mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -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:
parent
260878df38
commit
4ce4647a75
@ -256,6 +256,7 @@
|
|||||||
<Compile Include="packets\send\_0xE2Packet.cs" />
|
<Compile Include="packets\send\_0xE2Packet.cs" />
|
||||||
<Compile Include="packets\receive\PingPacket.cs" />
|
<Compile Include="packets\receive\PingPacket.cs" />
|
||||||
<Compile Include="packets\receive\UpdatePlayerPositionPacket.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\SessionEndPacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Receive\SessionBeginPacket.cs" />
|
<Compile Include="packets\WorldPackets\Receive\SessionBeginPacket.cs" />
|
||||||
<Compile Include="packets\WorldPackets\Send\SessionBeginConfirmPacket.cs" />
|
<Compile Include="packets\WorldPackets\Send\SessionBeginConfirmPacket.cs" />
|
||||||
|
@ -42,6 +42,16 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Normal Game Opcode
|
//Normal Game Opcode
|
||||||
switch (subpacket.gameMessage.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
|
//World Server - Session Begin
|
||||||
case 0x1000:
|
case 0x1000:
|
||||||
subpacket.DebugPrintSubPacket();
|
subpacket.DebugPrintSubPacket();
|
||||||
|
@ -361,13 +361,6 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
//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)
|
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
|
//Add player to new zone and update
|
||||||
Area newArea;
|
Area newArea;
|
||||||
|
|
||||||
@ -379,16 +372,18 @@ namespace FFXIVClassic_Map_Server
|
|||||||
//This server does not contain that zoneId
|
//This server does not contain that zoneId
|
||||||
if (newArea == null)
|
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);
|
Program.Log.Debug("Request to change to zone not on this server by: {0}.", player.customDisplayName);
|
||||||
RequestWorldServerZoneChange(player, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
RequestWorldServerZoneChange(player, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
||||||
return;
|
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);
|
newArea.AddActorToZone(player);
|
||||||
|
|
||||||
//Update player actor's properties
|
//Update player actor's properties
|
||||||
|
@ -749,7 +749,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SendGameMessage(Actor sourceActor, Actor textIdOwner, ushort textId, byte log, params object[] msgParams)
|
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));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, sourceActor.actorId, textIdOwner.actorId, textId, log));
|
||||||
}
|
}
|
||||||
@ -759,7 +759,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, params object[] msgParams)
|
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));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log));
|
||||||
else
|
else
|
||||||
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
||||||
@ -767,7 +767,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, string customSender, params object[] 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));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log));
|
||||||
else
|
else
|
||||||
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams)));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, customSender, log, LuaUtils.CreateLuaParamList(msgParams)));
|
||||||
@ -775,7 +775,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
|
|
||||||
public void SendGameMessage(Actor textIdOwner, ushort textId, byte log, uint displayId, params object[] 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));
|
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log));
|
||||||
else
|
else
|
||||||
QueuePacket(GameMessagePacket.BuildPacket(Server.GetWorldManager().GetActor().actorId, actorId, textIdOwner.actorId, textId, displayId, log, LuaUtils.CreateLuaParamList(msgParams)));
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,7 +35,7 @@ namespace FFXIVClassic_World_Server.DataObjects
|
|||||||
ownedZoneIds.Add(id);
|
ownedZoneIds.Add(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect()
|
public bool Connect()
|
||||||
{
|
{
|
||||||
Program.Log.Info("Connecting to zone server @ {0}:{1}", zoneServerIp, zoneServerPort);
|
Program.Log.Info("Connecting to zone server @ {0}:{1}", zoneServerIp, zoneServerPort);
|
||||||
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(zoneServerIp), zoneServerPort);
|
IPEndPoint remoteEP = new IPEndPoint(IPAddress.Parse(zoneServerIp), zoneServerPort);
|
||||||
@ -60,7 +60,9 @@ namespace FFXIVClassic_World_Server.DataObjects
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{ Program.Log.Error("Failed to connect"); return; }
|
{ Program.Log.Error("Failed to connect"); return false; }
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendPacket(SubPacket subpacket)
|
public void SendPacket(SubPacket subpacket)
|
||||||
|
@ -77,6 +77,7 @@
|
|||||||
<Compile Include="Packets\WorldPackets\Receive\SessionBeginConfirmPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\SessionBeginConfirmPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\WorldRequestZoneChangePacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\WorldRequestZoneChangePacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Receive\SessionEndConfirmPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Receive\SessionEndConfirmPacket.cs" />
|
||||||
|
<Compile Include="Packets\WorldPackets\Send\ErrorPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Send\SessionBeginPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Send\SessionBeginPacket.cs" />
|
||||||
<Compile Include="Packets\WorldPackets\Send\SessionEndPacket.cs" />
|
<Compile Include="Packets\WorldPackets\Send\SessionEndPacket.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
using FFXIVClassic.Common;
|
||||||
|
using FFXIVClassic_World_Server.DataObjects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Send
|
||||||
|
{
|
||||||
|
class ErrorPacket
|
||||||
|
{
|
||||||
|
public const ushort OPCODE = 0x100A;
|
||||||
|
public const uint PACKET_SIZE = 0x24;
|
||||||
|
|
||||||
|
public static SubPacket BuildPacket(Session session, uint errorCode)
|
||||||
|
{
|
||||||
|
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||||
|
|
||||||
|
using (MemoryStream mem = new MemoryStream(data))
|
||||||
|
{
|
||||||
|
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
binWriter.Write((UInt32)errorCode);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SubPacket(true, OPCODE, 0, session.sessionId, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_World_Server.DataObjects;
|
using FFXIVClassic_World_Server.DataObjects;
|
||||||
|
using FFXIVClassic_World_Server.Packets.WorldPackets.Send;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -167,7 +168,13 @@ namespace FFXIVClassic_World_Server
|
|||||||
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
//Moves actor to new zone, and sends packets to spawn at the given coords.
|
||||||
public void DoZoneServerChange(Session session, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
public void DoZoneServerChange(Session session, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation)
|
||||||
{
|
{
|
||||||
|
ZoneServer zs = GetZoneServer(destinationZoneId);
|
||||||
|
if (zs.isConnected)
|
||||||
session.routing1.SendSessionEnd(session, destinationZoneId, destinationPrivateArea, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
session.routing1.SendSessionEnd(session, destinationZoneId, destinationPrivateArea, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
||||||
|
else if (zs.Connect())
|
||||||
|
session.routing1.SendSessionEnd(session, destinationZoneId, destinationPrivateArea, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
||||||
|
else
|
||||||
|
session.routing1.SendPacket(ErrorPacket.BuildPacket(session, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Login Zone In
|
//Login Zone In
|
||||||
|
Loading…
Reference in New Issue
Block a user