mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Added all Console writes to the log. Put in "Max chars" for character list.
This commit is contained in:
parent
e90a25d0ab
commit
d6ec5e7240
3 changed files with 71 additions and 21 deletions
|
@ -14,12 +14,14 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||
public const ushort MAXPERPACKET = 2;
|
||||
|
||||
private ulong sequence;
|
||||
private ushort maxChars;
|
||||
private List<Character> characterList;
|
||||
|
||||
public CharacterListPacket(ulong sequence, List<Character> characterList)
|
||||
public CharacterListPacket(ulong sequence, List<Character> characterList, ushort maxChars)
|
||||
{
|
||||
this.sequence = sequence;
|
||||
this.characterList = characterList;
|
||||
this.maxChars = maxChars;
|
||||
}
|
||||
|
||||
public List<SubPacket> buildPackets()
|
||||
|
@ -36,14 +38,14 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||
{
|
||||
if (totalCount == 0 || characterCount % MAXPERPACKET == 0)
|
||||
{
|
||||
memStream = new MemoryStream(0x3D0);
|
||||
memStream = new MemoryStream(0x3B0);
|
||||
binWriter = new BinaryWriter(memStream);
|
||||
|
||||
//Write List Info
|
||||
binWriter.Write((UInt64)sequence);
|
||||
binWriter.Write(characterList.Count - totalCount <= MAXPERPACKET ? (byte)(characterList.Count) : (byte)0);
|
||||
binWriter.Write(maxChars - totalCount <= MAXPERPACKET ? (byte)(maxChars + 1) : (byte)0);
|
||||
//binWriter.Write((byte)1);
|
||||
binWriter.Write(characterList.Count - totalCount <= MAXPERPACKET ? (UInt32)(characterList.Count - totalCount) : (UInt32)MAXPERPACKET);
|
||||
binWriter.Write(maxChars - totalCount <= MAXPERPACKET ? (UInt32)(maxChars - totalCount) : (UInt32)MAXPERPACKET);
|
||||
binWriter.Write((byte)0);
|
||||
binWriter.Write((UInt16)0);
|
||||
}
|
||||
|
@ -89,10 +91,53 @@ namespace FFXIVClassic_Lobby_Server.packets
|
|||
|
||||
}
|
||||
|
||||
//If there is anything left that was missed or the list is empty
|
||||
if (characterCount > 0 || characterList.Count == 0)
|
||||
//Keep creating empty slots until done max characters
|
||||
while (maxChars - totalCount > 0)
|
||||
{
|
||||
if (characterList.Count == 0)
|
||||
if (characterCount % MAXPERPACKET == 0)
|
||||
{
|
||||
memStream = new MemoryStream(0x3D0);
|
||||
binWriter = new BinaryWriter(memStream);
|
||||
|
||||
//Write List Info
|
||||
binWriter.Write((UInt64)sequence);
|
||||
binWriter.Write(maxChars - totalCount <= MAXPERPACKET ? (byte)(maxChars + 1) : (byte)0);
|
||||
//binWriter.Write((byte)1);
|
||||
binWriter.Write(maxChars - totalCount <= MAXPERPACKET ? (UInt32)(maxChars - totalCount) : (UInt32)MAXPERPACKET);
|
||||
binWriter.Write((byte)0);
|
||||
binWriter.Write((UInt16)0);
|
||||
}
|
||||
|
||||
binWriter.Seek(0x10 + (0x1D0 * characterCount), SeekOrigin.Begin);
|
||||
|
||||
//Write Entries
|
||||
binWriter.Write((uint)0); //???
|
||||
binWriter.Write((uint)0); //Character Id
|
||||
binWriter.Write((byte)(totalCount)); //Slot
|
||||
|
||||
binWriter.Write((byte)0); //Options (0x01: Service Account not active, 0x72: Change Chara Name)
|
||||
binWriter.Write((ushort)0);
|
||||
binWriter.Write((uint)0); //Logged out zone
|
||||
|
||||
characterCount++;
|
||||
totalCount++;
|
||||
|
||||
//Send this chunk of character list
|
||||
if (characterCount >= MAXPERPACKET)
|
||||
{
|
||||
byte[] data = memStream.GetBuffer();
|
||||
binWriter.Dispose();
|
||||
memStream.Dispose();
|
||||
SubPacket subpacket = new SubPacket(OPCODE, 0xe0006868, 0xe0006868, data);
|
||||
subPackets.Add(subpacket);
|
||||
characterCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//If there is anything left that was missed or the list is empty
|
||||
if (characterCount > 0 || maxChars == 0)
|
||||
{
|
||||
if (maxChars == 0)
|
||||
{
|
||||
memStream = new MemoryStream(0x3D0);
|
||||
binWriter = new BinaryWriter(memStream);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue