1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-23 05:07:47 +00:00

Server list is now sent from db rather than hard coded.

This commit is contained in:
Filip Maj 2015-09-03 01:02:55 -04:00
parent 091166b41a
commit a65e81273b
3 changed files with 16 additions and 14 deletions

View file

@ -206,8 +206,9 @@ namespace FFXIVClassic_Lobby_Server
world.address = address; world.address = address;
world.port = port; world.port = port;
world.listPosition = listPosition; world.listPosition = listPosition;
uint result = ((numChars / maxChars) *0xFF) & 0xFF; uint result = (uint)(((float)numChars / (float)maxChars) * (float)100);
world.population = (ushort)result; world.population = (ushort)result;
world.isActive = isActive; world.isActive = isActive;
worldList.Add(world); worldList.Add(world);
} }

View file

@ -259,11 +259,14 @@ namespace FFXIVClassic_Lobby_Server
int serverCount = 0; int serverCount = 0;
int totalCount = 0; int totalCount = 0;
PacketStructs.WorldListPacket worldListPacket = new PacketStructs.WorldListPacket(); PacketStructs.WorldListPacket worldListPacket = new PacketStructs.WorldListPacket();
worldListPacket.isEndList = serverList.Count <= 6 ? (byte)1 : (byte)0; uint isEndList = serverList.Count <= 6 ? (byte)(serverList.Count+1) : (byte)0;
worldListPacket.numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6; uint numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6;
numWorlds <<= 8;
worldListPacket.isEndListANDNumWorlds = (uint)(isEndList | numWorlds);
worldListPacket.sequence = 0; worldListPacket.sequence = 0;
worldListPacket.unknown1 = 0; worldListPacket.unknown1 = 0;
worldListPacket.unknown2 = 0; worldListPacket.worlds = new PacketStructs.WorldListEntry[6];
foreach (World world in serverList) foreach (World world in serverList)
{ {
@ -281,9 +284,8 @@ namespace FFXIVClassic_Lobby_Server
{ {
//Send this chunk of world list //Send this chunk of world list
byte[] data = PacketStructs.StructureToByteArray(worldListPacket); byte[] data = PacketStructs.StructureToByteArray(worldListPacket);
SubPacket subpacket = new SubPacket(0x02, packet.header.sourceId, packet.header.targetId, data); SubPacket subpacket = new SubPacket(0x15, 0xe0006868, 0xe0006868, data);
BasePacket basePacket = BasePacket.createPacket(subpacket, true, false); BasePacket basePacket = BasePacket.createPacket(subpacket, true, false);
basePacket.debugPrintPacket();
BasePacket.encryptPacket(client.blowfish, basePacket); BasePacket.encryptPacket(client.blowfish, basePacket);
client.queuePacket(basePacket); client.queuePacket(basePacket);
@ -291,11 +293,12 @@ namespace FFXIVClassic_Lobby_Server
if (totalCount <= serverList.Count) if (totalCount <= serverList.Count)
{ {
worldListPacket = new PacketStructs.WorldListPacket(); worldListPacket = new PacketStructs.WorldListPacket();
worldListPacket.isEndList = serverList.Count - totalCount <= 6 ? (byte)1 : (byte)0; isEndList = serverList.Count <= 6 ? (byte)(serverList.Count + 1) : (byte)0;
worldListPacket.numWorlds = serverList.Count - totalCount <= 6 ? (byte)(serverList.Count - totalCount) : (byte)6; numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6;
numWorlds <<= 8;
worldListPacket.isEndListANDNumWorlds = (uint)(isEndList | numWorlds);
worldListPacket.sequence = 0; worldListPacket.sequence = 0;
worldListPacket.unknown1 = 0; worldListPacket.unknown1 = 0;
worldListPacket.unknown2 = 0;
} }
} }
} }

View file

@ -26,10 +26,8 @@ namespace FFXIVClassic_Lobby_Server.packets
public unsafe struct WorldListPacket public unsafe struct WorldListPacket
{ {
public UInt64 sequence; public UInt64 sequence;
public byte isEndList; public uint isEndListANDNumWorlds;
public uint numWorlds; public uint unknown1;
public byte unknown1;
public ushort unknown2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public WorldListEntry[] worlds; public WorldListEntry[] worlds;
} }