Fixed random crashes when zoning. Was due to improper write of the SessionEndPacket. For extra safety db is locked until zone in happens. Added some logs. Seems to be all working!

This commit is contained in:
Filip Maj 2016-12-03 13:23:32 -05:00
parent e30831fdc5
commit ebd8ab0580
5 changed files with 17 additions and 18 deletions

View File

@ -50,6 +50,8 @@ namespace FFXIVClassic_Map_Server
if (session.GetActor().destinationZone != 0) if (session.GetActor().destinationZone != 0)
Server.GetWorldManager().DoZoneIn(session.GetActor(), false, session.GetActor().destinationSpawnType); Server.GetWorldManager().DoZoneIn(session.GetActor(), false, session.GetActor().destinationSpawnType);
Program.Log.Info("{0} has been added to the session list.", session.GetActor().customDisplayName);
client.FlushQueuedSendPackets(); client.FlushQueuedSendPackets();
break; break;
//World Server - Session End //World Server - Session End
@ -61,6 +63,9 @@ namespace FFXIVClassic_Map_Server
else else
session.GetActor().CleanupAndSave(endSessionPacket.destinationZoneId, endSessionPacket.destinationSpawnType, endSessionPacket.destinationX, endSessionPacket.destinationY, endSessionPacket.destinationZ, endSessionPacket.destinationRot); session.GetActor().CleanupAndSave(endSessionPacket.destinationZoneId, endSessionPacket.destinationSpawnType, endSessionPacket.destinationX, endSessionPacket.destinationY, endSessionPacket.destinationZ, endSessionPacket.destinationRot);
Server.GetServer().RemoveSession(session.id);
Program.Log.Info("{0} has been removed from the session list.", session.GetActor().customDisplayName);
client.QueuePacket(SessionEndConfirmPacket.BuildPacket(session, endSessionPacket.destinationZoneId), true, false); client.QueuePacket(SessionEndConfirmPacket.BuildPacket(session, endSessionPacket.destinationZoneId), true, false);
client.FlushQueuedSendPackets(); client.FlushQueuedSendPackets();
break; break;

View File

@ -468,12 +468,14 @@ namespace FFXIVClassic_Map_Server
if (!isLogin) if (!isLogin)
{ {
player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId), true, false); player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId), true, false);
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x0), true, false); player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x2), true, false);
player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x0), true, false); player.SendZoneInPackets(this, spawnType);
} }
player.SendZoneInPackets(this, spawnType); player.SendZoneInPackets(this, spawnType);
player.playerSession.LockUpdates(false);
LuaEngine.OnZoneIn(player); LuaEngine.OnZoneIn(player);
} }

View File

@ -476,7 +476,7 @@ namespace FFXIVClassic_Map_Server.Actors
QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId)); QueuePacket(SetMapPacket.BuildPacket(actorId, zone.regionId, zone.actorId));
QueuePacket(GetSpawnPackets(actorId, spawnType)); QueuePacket(GetSpawnPackets(actorId, spawnType));
GetSpawnPackets(actorId, spawnType).DebugPrintPacket(); //GetSpawnPackets(actorId, spawnType).DebugPrintPacket();
#region grouptest #region grouptest
//Retainers //Retainers
@ -661,10 +661,6 @@ namespace FFXIVClassic_Map_Server.Actors
//Save Player //Save Player
Database.SavePlayerPlayTime(this); Database.SavePlayerPlayTime(this);
Database.SavePlayerPosition(this); Database.SavePlayerPosition(this);
Server.GetServer().RemoveSession(playerSession.id);
Program.Log.Info("{0} has been removed from the session list.", this.customDisplayName);
} }
public void CleanupAndSave(uint destinationZone, ushort spawnType, float destinationX, float destinationY, float destinationZ, float destinationRot) public void CleanupAndSave(uint destinationZone, ushort spawnType, float destinationX, float destinationY, float destinationZ, float destinationRot)
@ -685,10 +681,6 @@ namespace FFXIVClassic_Map_Server.Actors
//Save Player //Save Player
Database.SavePlayerPlayTime(this); Database.SavePlayerPlayTime(this);
Database.SavePlayerPosition(this); Database.SavePlayerPosition(this);
Server.GetServer().RemoveSession(playerSession.id);
Program.Log.Info("{0} has been removed from the session list.", this.customDisplayName);
} }
public Area GetZone() public Area GetZone()

View File

@ -20,7 +20,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
public uint languageCode = 1; public uint languageCode = 1;
private uint lastPingPacket = Utils.UnixTimeStampUTC(); private uint lastPingPacket = Utils.UnixTimeStampUTC();
public bool isUpdatesLocked = false; public bool isUpdatesLocked = true;
public string errorMessage = ""; public string errorMessage = "";

View File

@ -45,7 +45,7 @@ namespace FFXIVClassic_World_Server.Packets.WorldPackets.Send
try try
{ {
binWriter.Write((UInt32)destinationZoneId); binWriter.Write((UInt32)destinationZoneId);
binWriter.Write((UInt32)spawnType); binWriter.Write((UInt16)spawnType);
binWriter.Write((Single)spawnX); binWriter.Write((Single)spawnX);
binWriter.Write((Single)spawnY); binWriter.Write((Single)spawnY);
binWriter.Write((Single)spawnZ); binWriter.Write((Single)spawnZ);