mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-28 13:26:08 +02:00
Built subpackets to let the zone servers talk to the world server. Implemented cross-server zoning but the E2 packet or something isn't being sent.
This commit is contained in:
parent
58fda93b45
commit
e30831fdc5
27 changed files with 674 additions and 113 deletions
|
@ -3,6 +3,8 @@ using FFXIVClassic_World_Server.DataObjects;
|
|||
using FFXIVClassic_World_Server.Packets.Receive;
|
||||
using FFXIVClassic_World_Server.Packets.Send;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Login;
|
||||
using FFXIVClassic_World_Server.Packets.WorldPackets.Receive;
|
||||
using FFXIVClassic_World_Server.Packets.WorldPackets.Send;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -37,7 +39,7 @@ namespace FFXIVClassic_World_Server
|
|||
{
|
||||
if (packet.header.isCompressed == 0x01)
|
||||
BasePacket.DecompressPacket(ref packet);
|
||||
|
||||
|
||||
List<SubPacket> subPackets = packet.GetSubpackets();
|
||||
foreach (SubPacket subpacket in subPackets)
|
||||
{
|
||||
|
@ -47,7 +49,10 @@ namespace FFXIVClassic_World_Server
|
|||
HelloPacket hello = new HelloPacket(packet.data);
|
||||
|
||||
if (packet.header.connectionType == BasePacket.TYPE_ZONE)
|
||||
{
|
||||
mServer.AddSession(client, Session.Channel.ZONE, hello.sessionId);
|
||||
mServer.GetWorldManager().DoLogin(mServer.GetSession(hello.sessionId));
|
||||
}
|
||||
else if (packet.header.connectionType == BasePacket.TYPE_CHAT)
|
||||
mServer.AddSession(client, Session.Channel.CHAT, hello.sessionId);
|
||||
|
||||
|
@ -73,7 +78,6 @@ namespace FFXIVClassic_World_Server
|
|||
{
|
||||
//Send to the correct zone server
|
||||
uint targetSession = subpacket.header.targetId;
|
||||
mServer.GetSession(targetSession).routing1 = Server.GetServer().GetWorldManager().mZoneServerList["127.0.0.1:1989"];
|
||||
|
||||
if (mServer.GetSession(targetSession).routing1 != null)
|
||||
mServer.GetSession(targetSession).routing1.SendPacket(subpacket);
|
||||
|
@ -81,6 +85,57 @@ namespace FFXIVClassic_World_Server
|
|||
if (mServer.GetSession(targetSession).routing2 != null)
|
||||
mServer.GetSession(targetSession).routing2.SendPacket(subpacket);
|
||||
}
|
||||
//World Server Type
|
||||
else if (subpacket.header.type >= 0x1000)
|
||||
{
|
||||
uint targetSession = subpacket.header.targetId;
|
||||
Session session = mServer.GetSession(targetSession);
|
||||
|
||||
switch (subpacket.header.type)
|
||||
{
|
||||
//Session Begin Confirm
|
||||
case 0x1000:
|
||||
SessionBeginConfirmPacket beginConfirmPacket = new SessionBeginConfirmPacket(packet.data);
|
||||
|
||||
if (beginConfirmPacket.invalidPacket || beginConfirmPacket.errorCode == 0)
|
||||
Program.Log.Error("Session {0} had a error beginning session.", beginConfirmPacket.sessionId);
|
||||
|
||||
break;
|
||||
//Session End Confirm
|
||||
case 0x1001:
|
||||
SessionEndConfirmPacket endConfirmPacket = new SessionEndConfirmPacket(packet.data);
|
||||
|
||||
if (!endConfirmPacket.invalidPacket && endConfirmPacket.errorCode != 0)
|
||||
{
|
||||
//Check destination, if != 0, update route and start new session
|
||||
if (endConfirmPacket.destinationZone != 0)
|
||||
{
|
||||
session.routing1 = Server.GetServer().GetWorldManager().GetZoneServer(endConfirmPacket.destinationZone);
|
||||
session.routing1.SendSessionStart(session);
|
||||
}
|
||||
else
|
||||
{
|
||||
mServer.RemoveSession(Session.Channel.ZONE, endConfirmPacket.sessionId);
|
||||
mServer.RemoveSession(Session.Channel.CHAT, endConfirmPacket.sessionId);
|
||||
}
|
||||
}
|
||||
else
|
||||
Program.Log.Error("Session {0} had an error ending session.", endConfirmPacket.sessionId);
|
||||
|
||||
break;
|
||||
//Zone Change Request
|
||||
case 0x1002:
|
||||
WorldRequestZoneChangePacket zoneChangePacket = new WorldRequestZoneChangePacket(packet.data);
|
||||
|
||||
if (!zoneChangePacket.invalidPacket)
|
||||
{
|
||||
mServer.GetWorldManager().DoZoneServerChange(session, zoneChangePacket.destinationZoneId, "", zoneChangePacket.destinationSpawnType, zoneChangePacket.destinationX, zoneChangePacket.destinationY, zoneChangePacket.destinationZ, zoneChangePacket.destinationRot);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
packet.DebugPrintPacket();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue