mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	If a player tries to zone to a offline server they will see a standard error message. Also a reconnection attempt will be made on a disconnected server.
This commit is contained in:
		| @@ -256,6 +256,7 @@ | ||||
|     <Compile Include="packets\send\_0xE2Packet.cs" /> | ||||
|     <Compile Include="packets\receive\PingPacket.cs" /> | ||||
|     <Compile Include="packets\receive\UpdatePlayerPositionPacket.cs" /> | ||||
|     <Compile Include="packets\WorldPackets\Receive\ErrorPacket.cs" /> | ||||
|     <Compile Include="packets\WorldPackets\Receive\SessionEndPacket.cs" /> | ||||
|     <Compile Include="packets\WorldPackets\Receive\SessionBeginPacket.cs" /> | ||||
|     <Compile Include="packets\WorldPackets\Send\SessionBeginConfirmPacket.cs" /> | ||||
|   | ||||
| @@ -42,6 +42,16 @@ namespace FFXIVClassic_Map_Server | ||||
|                 //Normal Game Opcode | ||||
|                 switch (subpacket.gameMessage.opcode) | ||||
|                 { | ||||
|                     //World Server - Error | ||||
|                     case 0x100A: | ||||
|                         ErrorPacket worldError = new ErrorPacket(subpacket.data); | ||||
|                         switch (worldError.errorCode) | ||||
|                         { | ||||
|                             case 0x01: | ||||
|                                 session.GetActor().SendGameMessage(Server.GetWorldManager().GetActor(), 60005, 0x20); | ||||
|                                 break; | ||||
|                         } | ||||
|                         break; | ||||
|                     //World Server - Session Begin | ||||
|                     case 0x1000: | ||||
|                         subpacket.DebugPrintSubPacket(); | ||||
|   | ||||
| @@ -360,14 +360,7 @@ namespace FFXIVClassic_Map_Server | ||||
|  | ||||
|         //Moves actor to new zone, and sends packets to spawn at the given coords. | ||||
|         public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) | ||||
|         { | ||||
|             Area oldZone = player.zone; | ||||
|             //Remove player from currentZone if transfer else it's login | ||||
|             if (player.zone != null) | ||||
|             { | ||||
|                 oldZone.RemoveActorFromZone(player); | ||||
|             } | ||||
|  | ||||
|         {        | ||||
|             //Add player to new zone and update | ||||
|             Area newArea; | ||||
|  | ||||
| @@ -379,16 +372,18 @@ namespace FFXIVClassic_Map_Server | ||||
|             //This server does not contain that zoneId | ||||
|             if (newArea == null) | ||||
|             { | ||||
|                 if (oldZone != null) | ||||
|                 { | ||||
|                     oldZone.AddActorToZone(player); | ||||
|                 } | ||||
|  | ||||
|                 Program.Log.Debug("Request to change to zone not on this server by: {0}.", player.customDisplayName); | ||||
|                 RequestWorldServerZoneChange(player, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             Area oldZone = player.zone; | ||||
|             //Remove player from currentZone if transfer else it's login | ||||
|             if (player.zone != null) | ||||
|             { | ||||
|                 oldZone.RemoveActorFromZone(player); | ||||
|             } | ||||
|  | ||||
|             newArea.AddActorToZone(player); | ||||
|  | ||||
|             //Update player actor's properties | ||||
|   | ||||
| @@ -748,8 +748,8 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|         } | ||||
|  | ||||
|         public void SendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams) | ||||
|         { | ||||
|             if (msgParams.Length == 0) | ||||
|         { | ||||
|             if (msgParams == null || msgParams.Length == 0) | ||||
|             { | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log)); | ||||
|             } | ||||
| @@ -758,24 +758,24 @@ namespace FFXIVClassic_Map_Server.Actors | ||||
|         } | ||||
|  | ||||
|         public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams) | ||||
|         { | ||||
|             if (msgParams.Length == 0) | ||||
|         { | ||||
|             if (msgParams == null || msgParams.Length == 0) | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log)); | ||||
|             else | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams))); | ||||
|         } | ||||
|  | ||||
|         public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] msgParams) | ||||
|         { | ||||
|             if (msgParams.Length == 0) | ||||
|         { | ||||
|             if (msgParams == null || msgParams.Length == 0) | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log)); | ||||
|             else | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams))); | ||||
|         } | ||||
|  | ||||
|         public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] msgParams) | ||||
|         { | ||||
|             if (msgParams.Length == 0) | ||||
|         { | ||||
|             if (msgParams == null || msgParams.Length == 0) | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log)); | ||||
|             else | ||||
|                 QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams))); | ||||
|   | ||||
| @@ -0,0 +1,35 @@ | ||||
| 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.Receive | ||||
| { | ||||
|     class ErrorPacket | ||||
|     { | ||||
|         public uint errorCode; | ||||
|         | ||||
|         public bool invalidPacket = false; | ||||
|  | ||||
|         public ErrorPacket(byte[] data) | ||||
|         { | ||||
|             using (MemoryStream mem = new MemoryStream(data)) | ||||
|             { | ||||
|                 using (BinaryReader binReader = new BinaryReader(mem)) | ||||
|                 { | ||||
|                     try | ||||
|                     { | ||||
|                         errorCode = binReader.ReadUInt32();                         | ||||
|                     } | ||||
|                     catch (Exception) | ||||
|                     { | ||||
|                         invalidPacket = true; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user