mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-22 20:57:47 +00:00
Server list is now sent from db rather than hard coded.
This commit is contained in:
parent
091166b41a
commit
a65e81273b
3 changed files with 16 additions and 14 deletions
|
@ -206,8 +206,9 @@ namespace FFXIVClassic_Lobby_Server
|
|||
world.address = address;
|
||||
world.port = port;
|
||||
world.listPosition = listPosition;
|
||||
uint result = ((numChars / maxChars) *0xFF) & 0xFF;
|
||||
uint result = (uint)(((float)numChars / (float)maxChars) * (float)100);
|
||||
world.population = (ushort)result;
|
||||
|
||||
world.isActive = isActive;
|
||||
worldList.Add(world);
|
||||
}
|
||||
|
|
|
@ -259,11 +259,14 @@ namespace FFXIVClassic_Lobby_Server
|
|||
int serverCount = 0;
|
||||
int totalCount = 0;
|
||||
PacketStructs.WorldListPacket worldListPacket = new PacketStructs.WorldListPacket();
|
||||
worldListPacket.isEndList = serverList.Count <= 6 ? (byte)1 : (byte)0;
|
||||
worldListPacket.numWorlds = serverList.Count <= 6 ? (byte)serverList.Count : (byte)6;
|
||||
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.unknown2 = 0;
|
||||
worldListPacket.worlds = new PacketStructs.WorldListEntry[6];
|
||||
|
||||
foreach (World world in serverList)
|
||||
{
|
||||
|
@ -281,9 +284,8 @@ namespace FFXIVClassic_Lobby_Server
|
|||
{
|
||||
//Send this chunk of world list
|
||||
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.debugPrintPacket();
|
||||
BasePacket.encryptPacket(client.blowfish, basePacket);
|
||||
client.queuePacket(basePacket);
|
||||
|
||||
|
@ -291,11 +293,12 @@ namespace FFXIVClassic_Lobby_Server
|
|||
if (totalCount <= serverList.Count)
|
||||
{
|
||||
worldListPacket = new PacketStructs.WorldListPacket();
|
||||
worldListPacket.isEndList = serverList.Count - totalCount <= 6 ? (byte)1 : (byte)0;
|
||||
worldListPacket.numWorlds = serverList.Count - totalCount <= 6 ? (byte)(serverList.Count - totalCount) : (byte)6;
|
||||
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;
|
||||
worldListPacket.unknown2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,9 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct WorldListPacket
|
||||
{
|
||||
public UInt64 sequence;
|
||||
public byte isEndList;
|
||||
public uint numWorlds;
|
||||
public byte unknown1;
|
||||
public ushort unknown2;
|
||||
public UInt64 sequence;
|
||||
public uint isEndListANDNumWorlds;
|
||||
public uint unknown1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public WorldListEntry[] worlds;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue