mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Relation group work.
This commit is contained in:
parent
6ba1f968c3
commit
5af1f6dba6
@ -286,6 +286,8 @@
|
|||||||
<Compile Include="packets\WorldPackets\Send\Group\CreateLinkshellPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\Group\CreateLinkshellPacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\Group\DeleteLinkshellPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\Group\DeleteLinkshellPacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\Group\ModifyLinkshellPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\Group\ModifyLinkshellPacket.cs" />
|
||||||
|
<Compile Include="packets\WorldPackets\Send\Group\PartyInviteResultPacket.cs" />
|
||||||
|
<Compile Include="packets\WorldPackets\Send\Group\PartyInvitePacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\Group\PartyLeavePacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\Group\PartyLeavePacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\Group\PartyModifyPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\Group\PartyModifyPacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\SessionBeginConfirmPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\SessionBeginConfirmPacket.cs" />
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
using FFXIVClassic.Common;
|
||||||
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group
|
||||||
|
{
|
||||||
|
class PartyInvitePacket
|
||||||
|
{
|
||||||
|
public const ushort OPCODE = 0x1022;
|
||||||
|
public const uint PACKET_SIZE = 0x48;
|
||||||
|
|
||||||
|
public static SubPacket BuildPacket(Session session, string name)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
binWriter.Write((UInt16)0);
|
||||||
|
binWriter.Write(Encoding.ASCII.GetBytes(name), 0, Encoding.ASCII.GetByteCount(name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new SubPacket(true, OPCODE, session.id, session.id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SubPacket BuildPacket(Session session, uint actorId)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
binWriter.Write((UInt16)1);
|
||||||
|
binWriter.Write((UInt32)actorId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new SubPacket(true, OPCODE, session.id, session.id, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using FFXIVClassic.Common;
|
||||||
|
using FFXIVClassic_Map_Server.dataobjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_Map_Server.packets.WorldPackets.Send.Group
|
||||||
|
{
|
||||||
|
class PartyInviteResultPacket
|
||||||
|
{
|
||||||
|
public const ushort OPCODE = 0x1023;
|
||||||
|
public const uint PACKET_SIZE = 0x28;
|
||||||
|
|
||||||
|
public static SubPacket BuildPacket(Session session, uint result)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
binWriter.Write((UInt32)result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new SubPacket(true, OPCODE, session.id, session.id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -200,7 +200,7 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||||||
|
|
||||||
public uint GetLeader()
|
public uint GetLeader()
|
||||||
{
|
{
|
||||||
return (uint)((partyGroupWork._globalTemp.owner >> 32) & 0xFFFFFFFF);
|
return (uint)(((ulong)partyGroupWork._globalTemp.owner >> 32) & 0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetIdForName(string name)
|
public uint GetIdForName(string name)
|
||||||
|
@ -21,6 +21,16 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||||||
work._globalTemp.variableCommand = command;
|
work._globalTemp.variableCommand = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint GetHost()
|
||||||
|
{
|
||||||
|
return (uint)(((ulong)work._globalTemp.host >> 32) & 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
public uint GetOther()
|
||||||
|
{
|
||||||
|
return charaOther;
|
||||||
|
}
|
||||||
|
|
||||||
public override int GetMemberCount()
|
public override int GetMemberCount()
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -108,7 +108,9 @@
|
|||||||
<Compile Include="Packets\Send\_0x2Packet.cs" />
|
<Compile Include="Packets\Send\_0x2Packet.cs" />
|
||||||
<Compile Include="Packets\Send\_0x7Packet.cs" />
|
<Compile Include="Packets\Send\_0x7Packet.cs" />
|
||||||
<Compile Include="Packets\Send\_0x8PingPacket.cs" />
|
<Compile Include="Packets\Send\_0x8PingPacket.cs" />
|
||||||
|
<Compile Include="Packets\WorldPackets\Receive\Group\PartyInviteResultPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\Group\PartyLeavePacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\Group\PartyLeavePacket.cs" />
|
||||||
|
<Compile Include="Packets\WorldPackets\Receive\Group\PartyInvitePacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\Group\PartyModifyPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\Group\PartyModifyPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\Group\SetActiveLinkshellPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\Group\SetActiveLinkshellPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\Group\ModifyLinkshellPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\Group\ModifyLinkshellPacket.cs" />
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||||
|
{
|
||||||
|
class PartyInvitePacket
|
||||||
|
{
|
||||||
|
public bool invalidPacket = false;
|
||||||
|
|
||||||
|
public ushort command;
|
||||||
|
public string name;
|
||||||
|
public uint actorId;
|
||||||
|
|
||||||
|
public PartyInvitePacket(byte[] data)
|
||||||
|
{
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryReader binReader = new BinaryReader(mem))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
command = binReader.ReadUInt16();
|
||||||
|
|
||||||
|
if (command == 0)
|
||||||
|
actorId = binReader.ReadUInt32();
|
||||||
|
else
|
||||||
|
name = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
invalidPacket = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||||
|
{
|
||||||
|
class PartyInviteResultPacket
|
||||||
|
{
|
||||||
|
public bool invalidPacket = false;
|
||||||
|
|
||||||
|
public uint result;
|
||||||
|
|
||||||
|
public PartyInviteResultPacket(byte[] data)
|
||||||
|
{
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryReader binReader = new BinaryReader(mem))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = binReader.ReadUInt32();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
invalidPacket = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,8 @@ namespace FFXIVClassic_World_Server
|
|||||||
private WorldManager mWorldManager;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||||
private Dictionary<ulong, Relation> mRelationList = new Dictionary<ulong, Relation>();
|
private Dictionary<ulong, Relation> mPartyRelationList = new Dictionary<ulong, Relation>();
|
||||||
|
private Dictionary<ulong, Relation> mLinkshellRelationList = new Dictionary<ulong, Relation>();
|
||||||
|
|
||||||
public RelationGroupManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
public RelationGroupManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||||
{
|
{
|
||||||
@ -18,23 +19,64 @@ namespace FFXIVClassic_World_Server
|
|||||||
mCurrentWorldGroupsReference = worldGroupList;
|
mCurrentWorldGroupsReference = worldGroupList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Relation CreateRelationGroup(uint hostCharaId, uint otherCharaId, uint command)
|
public Relation CreatePartyRelationGroup(uint hostCharaId, uint otherCharaId)
|
||||||
{
|
{
|
||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
ulong groupIndex = mWorldManager.GetGroupIndex();
|
ulong groupIndex = mWorldManager.GetGroupIndex();
|
||||||
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, command);
|
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, 10001);
|
||||||
mRelationList.Add(groupIndex, relation);
|
mPartyRelationList.Add(groupIndex, relation);
|
||||||
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
||||||
mWorldManager.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
return relation;
|
return relation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Relation CreateLinkshellRelationGroup(uint hostCharaId, uint otherCharaId)
|
||||||
|
{
|
||||||
|
lock (mGroupLockReference)
|
||||||
|
{
|
||||||
|
ulong groupIndex = mWorldManager.GetGroupIndex();
|
||||||
|
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, 10002);
|
||||||
|
mLinkshellRelationList.Add(groupIndex, relation);
|
||||||
|
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
||||||
|
mWorldManager.IncrementGroupIndex();
|
||||||
|
return relation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Relation GetPartyRelationGroup(uint charaId)
|
||||||
|
{
|
||||||
|
lock (mGroupLockReference)
|
||||||
|
{
|
||||||
|
foreach (Relation relation in mPartyRelationList.Values)
|
||||||
|
{
|
||||||
|
if (relation.GetHost() == charaId || relation.GetOther() == charaId)
|
||||||
|
return relation;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Relation GetLinkshellRelationGroup(uint charaId)
|
||||||
|
{
|
||||||
|
lock (mGroupLockReference)
|
||||||
|
{
|
||||||
|
foreach (Relation relation in mLinkshellRelationList.Values)
|
||||||
|
{
|
||||||
|
if (relation.GetHost() == charaId || relation.GetOther() == charaId)
|
||||||
|
return relation;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void DeleteRelationGroup(ulong groupId)
|
public void DeleteRelationGroup(ulong groupId)
|
||||||
{
|
{
|
||||||
if (mRelationList.ContainsKey(groupId))
|
if (mPartyRelationList.ContainsKey(groupId))
|
||||||
mRelationList.Remove(groupId);
|
mPartyRelationList.Remove(groupId);
|
||||||
|
if (mLinkshellRelationList.ContainsKey(groupId))
|
||||||
|
mLinkshellRelationList.Remove(groupId);
|
||||||
if (mCurrentWorldGroupsReference.ContainsKey(groupId))
|
if (mCurrentWorldGroupsReference.ContainsKey(groupId))
|
||||||
mCurrentWorldGroupsReference.Remove(groupId);
|
mCurrentWorldGroupsReference.Remove(groupId);
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,21 @@ namespace FFXIVClassic_World_Server
|
|||||||
else
|
else
|
||||||
leavePt.DisbandPlayerRequest(GetSession(subpacket.header.sourceId));
|
leavePt.DisbandPlayerRequest(GetSession(subpacket.header.sourceId));
|
||||||
|
|
||||||
|
break;
|
||||||
|
//Party Invite Request
|
||||||
|
case 0x1022:
|
||||||
|
PartyInvitePacket partyInvitePacket = new PartyInvitePacket(subpacket.data);
|
||||||
|
if (partyInvitePacket.command == 0)
|
||||||
|
mWorldManager.ProcessPartyInvite(GetSession(subpacket.header.sourceId), partyInvitePacket.actorId);
|
||||||
|
else if (partyInvitePacket.command == 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
//Party Invite Result
|
||||||
|
case 0x1023:
|
||||||
|
PartyInviteResultPacket partyInviteResultPacket = new PartyInviteResultPacket(subpacket.data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
//Linkshell create request
|
//Linkshell create request
|
||||||
case 0x1025:
|
case 0x1025:
|
||||||
|
@ -212,13 +212,6 @@ namespace FFXIVClassic_World_Server
|
|||||||
|
|
||||||
//Send party, retainer, ls groups
|
//Send party, retainer, ls groups
|
||||||
Party pt = mPartyManager.GetParty(session.sessionId);
|
Party pt = mPartyManager.GetParty(session.sessionId);
|
||||||
|
|
||||||
|
|
||||||
if (session.sessionId == 156)
|
|
||||||
{
|
|
||||||
mPartyManager.AddToParty(pt.groupIndex, 0x6c);
|
|
||||||
mPartyManager.AddToParty(pt.groupIndex, 157);
|
|
||||||
}
|
|
||||||
|
|
||||||
pt.SendGroupPackets(session);
|
pt.SendGroupPackets(session);
|
||||||
SendPartySync(pt);
|
SendPartySync(pt);
|
||||||
@ -228,7 +221,8 @@ namespace FFXIVClassic_World_Server
|
|||||||
foreach (Linkshell ls in linkshells)
|
foreach (Linkshell ls in linkshells)
|
||||||
ls.SendGroupPackets(session);
|
ls.SendGroupPackets(session);
|
||||||
|
|
||||||
mRelationGroupManager.CreateRelationGroup(157, session.sessionId, 10001).SendGroupPackets(session);
|
mRelationGroupManager.CreatePartyRelationGroup(157, session.sessionId).SendGroupPackets(session);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendMotD(Session session)
|
private void SendMotD(Session session)
|
||||||
@ -296,7 +290,12 @@ namespace FFXIVClassic_World_Server
|
|||||||
foreach (GroupMember member in group.BuildMemberList(0))
|
foreach (GroupMember member in group.BuildMemberList(0))
|
||||||
group.SendGroupPackets(mServer.GetSession(member.actorId));
|
group.SendGroupPackets(mServer.GetSession(member.actorId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ProcessPartyInvite(Session request, uint invitee)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public void IncrementGroupIndex()
|
public void IncrementGroupIndex()
|
||||||
{
|
{
|
||||||
@ -332,6 +331,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
return mLinkshellManager;
|
return mLinkshellManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user