Added party sync packet which will sync member info between world/zone servers.

This commit is contained in:
Filip Maj 2016-12-20 19:17:50 -05:00
parent a68866617f
commit 2bdc238bc2
6 changed files with 158 additions and 4 deletions

View file

@ -1,5 +1,6 @@

using FFXIVClassic.Common;
using FFXIVClassic_Map_Server.actors.group;
using FFXIVClassic_Map_Server.Actors.Chara;
using FFXIVClassic_Map_Server.packets.send.actor;
@ -50,7 +51,9 @@ namespace FFXIVClassic_Map_Server.Actors
public Work work = new Work();
public CharaWork charaWork = new CharaWork();
public Group currentParty = null;
public Character(uint actorID) : base(actorID)
{
//Init timer array to "notimer"

View file

@ -474,5 +474,14 @@ namespace FFXIVClassic_Map_Server.Actors
else
return;
}
//A party member list packet came, set the party
/* public void SetParty(MonsterPartyGroup group)
{
if (group is MonsterPartyGroup)
currentParty = group;
}
*/
}
}

View file

@ -16,6 +16,7 @@ using MoonSharp.Interpreter;
using FFXIVClassic_Map_Server.packets.receive.events;
using FFXIVClassic_Map_Server.packets.send.actor.inventory;
using FFXIVClassic_Map_Server.actors.group;
using FFXIVClassic_Map_Server.packets.send.group;
namespace FFXIVClassic_Map_Server.Actors
{
@ -646,6 +647,9 @@ namespace FFXIVClassic_Map_Server.Actors
this.destinationZone = 0;
this.destinationSpawnType = 0;
//Clean up parties
RemoveFromCurrentPartyAndCleanup();
//Save Player
Database.SavePlayerPlayTime(this);
Database.SavePlayerPosition(this);
@ -658,6 +662,9 @@ namespace FFXIVClassic_Map_Server.Actors
//Remove actor from zone and main server list
zone.RemoveActorFromZone(this);
//Clean up parties
RemoveFromCurrentPartyAndCleanup();
//Set destination
this.destinationZone = destinationZone;
this.destinationSpawnType = spawnType;
@ -1256,7 +1263,6 @@ namespace FFXIVClassic_Map_Server.Actors
public void SendInstanceUpdate()
{
Server.GetWorldManager().SeamlessCheck(this);
//Update Instance
@ -1266,7 +1272,37 @@ namespace FFXIVClassic_Map_Server.Actors
if (zone2 != null)
aroundMe.AddRange(zone2.GetActorsAroundActor(this, 50));
playerSession.UpdateInstance(aroundMe);
}
//A party member list packet came, set the party
public void SetParty(PartyGroup group)
{
if (group is PartyGroup)
{
RemoveFromCurrentPartyAndCleanup();
currentParty = group;
}
}
//Removes the player from the party and cleans it up if needed
public void RemoveFromCurrentPartyAndCleanup()
{
if (currentParty == null)
return;
for (int i = 0; i < currentParty.members.Count; i++)
{
if (currentParty.members[i].actorId == actorId)
{
currentParty.members.RemoveAt(i);
break;
}
}
//currentParty.members.Remove(this);
if (currentParty.members.Count == 0)
Server.GetWorldManager().NoMembersInParty((PartyGroup)currentParty);
currentParty = null;
}
}