mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	Relation group work.
This commit is contained in:
		| @@ -200,7 +200,7 @@ namespace FFXIVClassic_World_Server.DataObjects.Group | ||||
|  | ||||
|         public uint GetLeader() | ||||
|         { | ||||
|             return (uint)((partyGroupWork._globalTemp.owner >> 32) & 0xFFFFFFFF); | ||||
|             return (uint)(((ulong)partyGroupWork._globalTemp.owner >> 32) & 0xFFFFFFFF); | ||||
|         } | ||||
|          | ||||
|         public uint GetIdForName(string name) | ||||
|   | ||||
| @@ -21,6 +21,16 @@ namespace FFXIVClassic_World_Server.DataObjects.Group | ||||
|             work._globalTemp.variableCommand = command; | ||||
|         } | ||||
|  | ||||
|         public uint GetHost() | ||||
|         { | ||||
|             return (uint)(((ulong)work._globalTemp.host >> 32) & 0xFFFFFFFF); | ||||
|         } | ||||
|  | ||||
|         public uint GetOther() | ||||
|         { | ||||
|             return charaOther; | ||||
|         } | ||||
|  | ||||
|         public override int GetMemberCount() | ||||
|         { | ||||
|             return 2; | ||||
|   | ||||
| @@ -108,7 +108,9 @@ | ||||
|     <Compile Include="Packets\Send\_0x2Packet.cs" /> | ||||
|     <Compile Include="Packets\Send\_0x7Packet.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\PartyInvitePacket.cs" /> | ||||
|     <Compile Include="Packets\WorldPackets\Receive\Group\PartyModifyPacket.cs" /> | ||||
|     <Compile Include="Packets\WorldPackets\Receive\Group\SetActiveLinkshellPacket.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 Object mGroupLockReference; | ||||
|         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) | ||||
|         { | ||||
| @@ -18,23 +19,64 @@ namespace FFXIVClassic_World_Server | ||||
|             mCurrentWorldGroupsReference = worldGroupList; | ||||
|         } | ||||
|  | ||||
|         public Relation CreateRelationGroup(uint hostCharaId, uint otherCharaId, uint command) | ||||
|         public Relation CreatePartyRelationGroup(uint hostCharaId, uint otherCharaId) | ||||
|         { | ||||
|             lock (mGroupLockReference) | ||||
|             { | ||||
|                 ulong groupIndex = mWorldManager.GetGroupIndex(); | ||||
|                 Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, command); | ||||
|                 mRelationList.Add(groupIndex, relation); | ||||
|                 Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, 10001); | ||||
|                 mPartyRelationList.Add(groupIndex, relation); | ||||
|                 mCurrentWorldGroupsReference.Add(groupIndex, relation); | ||||
|                 mWorldManager.IncrementGroupIndex(); | ||||
|                 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) | ||||
|         { | ||||
|             if (mRelationList.ContainsKey(groupId)) | ||||
|                 mRelationList.Remove(groupId); | ||||
|             if (mPartyRelationList.ContainsKey(groupId)) | ||||
|                 mPartyRelationList.Remove(groupId); | ||||
|             if (mLinkshellRelationList.ContainsKey(groupId)) | ||||
|                 mLinkshellRelationList.Remove(groupId); | ||||
|             if (mCurrentWorldGroupsReference.ContainsKey(groupId)) | ||||
|                 mCurrentWorldGroupsReference.Remove(groupId); | ||||
|         } | ||||
|   | ||||
| @@ -229,6 +229,21 @@ namespace FFXIVClassic_World_Server | ||||
|                         else | ||||
|                             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; | ||||
|                     //Linkshell create request | ||||
|                     case 0x1025: | ||||
|   | ||||
| @@ -212,13 +212,6 @@ namespace FFXIVClassic_World_Server | ||||
|  | ||||
|             //Send party, retainer, ls groups | ||||
|             Party pt = mPartyManager.GetParty(session.sessionId); | ||||
|  | ||||
|              | ||||
|             if (session.sessionId == 156) | ||||
|             { | ||||
|                 mPartyManager.AddToParty(pt.groupIndex, 0x6c); | ||||
|                 mPartyManager.AddToParty(pt.groupIndex, 157); | ||||
|             } | ||||
|               | ||||
|             pt.SendGroupPackets(session); | ||||
|             SendPartySync(pt);    | ||||
| @@ -228,7 +221,8 @@ namespace FFXIVClassic_World_Server | ||||
|             foreach (Linkshell ls in linkshells) | ||||
|                 ls.SendGroupPackets(session); | ||||
|  | ||||
|             mRelationGroupManager.CreateRelationGroup(157, session.sessionId, 10001).SendGroupPackets(session); | ||||
|             mRelationGroupManager.CreatePartyRelationGroup(157, session.sessionId).SendGroupPackets(session); | ||||
|              | ||||
|         } | ||||
|  | ||||
|         private void SendMotD(Session session) | ||||
| @@ -296,7 +290,12 @@ namespace FFXIVClassic_World_Server | ||||
|                 foreach (GroupMember member in group.BuildMemberList(0)) | ||||
|                     group.SendGroupPackets(mServer.GetSession(member.actorId)); | ||||
|             } | ||||
|         }         | ||||
|         } | ||||
|  | ||||
|         public void ProcessPartyInvite(Session request, uint invitee) | ||||
|         { | ||||
|             throw new NotImplementedException(); | ||||
|         } | ||||
|  | ||||
|         public void IncrementGroupIndex() | ||||
|         { | ||||
| @@ -332,6 +331,7 @@ namespace FFXIVClassic_World_Server | ||||
|         { | ||||
|             return mLinkshellManager; | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user