mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 22:14:39 +02:00
Reimplemented server list using BInaryWriter.
This commit is contained in:
parent
a65e81273b
commit
e7e267bd44
5 changed files with 165 additions and 86 deletions
|
@ -147,7 +147,7 @@ namespace FFXIVClassic_Lobby_Server
|
|||
{
|
||||
Console.WriteLine("{0} => Get characters", client.currentUserId == 0 ? client.getAddress() : "User " + client.currentUserId);
|
||||
|
||||
buildWorldLists(client, packet);
|
||||
sendWorldList(client, packet);
|
||||
|
||||
BasePacket outgoingPacket = new BasePacket("./packets/getCharsPacket.bin");
|
||||
BasePacket.encryptPacket(client.blowfish, outgoingPacket);
|
||||
|
@ -203,14 +203,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
|
||||
if (alreadyTaken)
|
||||
{
|
||||
PacketStructs.ErrorPacket errorPacket = new PacketStructs.ErrorPacket();
|
||||
errorPacket.sequence = charaReq.sequence;
|
||||
errorPacket.errorId = 13005;
|
||||
errorPacket.errorCode = 0;
|
||||
errorPacket.statusCode = 0;
|
||||
byte[] data = PacketStructs.StructureToByteArray(errorPacket);
|
||||
|
||||
SubPacket subpacket = new SubPacket(0x02, packet.header.sourceId, packet.header.targetId, data);
|
||||
ErrorPacket errorPacket = new ErrorPacket(charaReq.sequence, 13005, 0, 0, "");
|
||||
SubPacket subpacket = errorPacket.buildPacket();
|
||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
||||
basePacket.debugPrintPacket();
|
||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
||||
|
@ -250,58 +244,32 @@ namespace FFXIVClassic_Lobby_Server
|
|||
case 0x06://Rename Retainer
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendWorldList(ClientConnection client, SubPacket packet)
|
||||
{
|
||||
List<World> serverList = Database.getServers();
|
||||
WorldListPacket worldlistPacket = new WorldListPacket(serverList);
|
||||
List<SubPacket> subPackets = worldlistPacket.buildPackets();
|
||||
|
||||
BasePacket basePacket = BasePacket.createPacket(subPackets, true, false);
|
||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
||||
client.queuePacket(basePacket);
|
||||
}
|
||||
|
||||
private void buildWorldLists(ClientConnection client, SubPacket packet)
|
||||
private void sendUnknownList(ClientConnection client, SubPacket packet)
|
||||
{
|
||||
List<World> serverList = Database.getServers();
|
||||
|
||||
int serverCount = 0;
|
||||
int totalCount = 0;
|
||||
PacketStructs.WorldListPacket worldListPacket = new PacketStructs.WorldListPacket();
|
||||
uint isEndList = serverList.Count <= 6 ? (byte)(serverList.Count+1) : (byte)0;
|
||||
uint numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6;
|
||||
numWorlds <<= 8;
|
||||
}
|
||||
|
||||
worldListPacket.isEndListANDNumWorlds = (uint)(isEndList | numWorlds);
|
||||
worldListPacket.sequence = 0;
|
||||
worldListPacket.unknown1 = 0;
|
||||
worldListPacket.worlds = new PacketStructs.WorldListEntry[6];
|
||||
private void sendRetainerList(ClientConnection client, SubPacket packet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
foreach (World world in serverList)
|
||||
{
|
||||
//Insert world entry
|
||||
PacketStructs.WorldListEntry entry = new PacketStructs.WorldListEntry();
|
||||
entry.id = world.id;
|
||||
entry.listPosition = world.listPosition;
|
||||
entry.population = world.population;
|
||||
entry.name = world.name;
|
||||
worldListPacket.worlds[serverCount] = entry;
|
||||
private void sendCharacterList(ClientConnection client, SubPacket packet)
|
||||
{
|
||||
|
||||
serverCount++;
|
||||
totalCount++;
|
||||
if (serverCount % 6 == 0 || totalCount >= serverList.Count)
|
||||
{
|
||||
//Send this chunk of world list
|
||||
byte[] data = PacketStructs.StructureToByteArray(worldListPacket);
|
||||
SubPacket subpacket = new SubPacket(0x15, 0xe0006868, 0xe0006868, data);
|
||||
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
|
||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
||||
client.queuePacket(basePacket);
|
||||
|
||||
//Make new worldlist if still remaining
|
||||
if (totalCount <= serverList.Count)
|
||||
{
|
||||
worldListPacket = new PacketStructs.WorldListPacket();
|
||||
isEndList = serverList.Count <= 6 ? (byte)(serverList.Count + 1) : (byte)0;
|
||||
numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6;
|
||||
numWorlds <<= 8;
|
||||
worldListPacket.isEndListANDNumWorlds = (uint)(isEndList | numWorlds);
|
||||
worldListPacket.sequence = 0;
|
||||
worldListPacket.unknown1 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue