mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-24 19:38:26 +02:00
Can queue subpackets now (automatically creates basepacket). List packets implemented. Base packets fully figured out and implemented. Login has been stablized and no longer crashes. Implemented the following packets: List Packets, Set Job packet, chat message receive packet, SetActorIcon, SetActorIsZoning, SetActorSingleStatus, AchievementRate and some unknown packets.
This commit is contained in:
parent
3a8d7a43e5
commit
aeef4f5616
23 changed files with 581 additions and 223 deletions
|
@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
public const ushort OPCODE = 0x017D;
|
||||
public const uint PACKET_SIZE = 0x40;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong id, ulong listId, uint numEntries)
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, ulong listId, int numEntries)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
|
@ -23,7 +23,7 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
{
|
||||
//Write List Header
|
||||
binWriter.Write((UInt64)locationCode);
|
||||
binWriter.Write((UInt64)id);
|
||||
binWriter.Write((UInt64)sequenceId);
|
||||
//Write List Info
|
||||
binWriter.Write((UInt64)listId);
|
||||
binWriter.Write((UInt32)numEntries);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -10,11 +11,25 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
class ListEndPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x017E;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
public const uint PACKET_SIZE = 0x38;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, ulong listId)
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, ulong listId)
|
||||
{
|
||||
return new SubPacket(OPCODE, 0, playerActorID, BitConverter.GetBytes(listId));
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
//Write List Header
|
||||
binWriter.Write((UInt64)locationCode);
|
||||
binWriter.Write((UInt64)sequenceId);
|
||||
//Write List Info
|
||||
binWriter.Write((UInt64)listId);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
public const ushort OPCODE = 0x017F;
|
||||
public const uint PACKET_SIZE = 0x1B8;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, uint id, uint numInPacket)
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, List<ListEntry> entries, int offset)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
|
@ -23,17 +23,25 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
{
|
||||
//Write List Header
|
||||
binWriter.Write((UInt64)locationCode);
|
||||
binWriter.Write((UInt64)id);
|
||||
binWriter.Write((UInt64)sequenceId);
|
||||
//Write Entries
|
||||
uint max = 8;
|
||||
if (numInPacket < 8)
|
||||
max = numInPacket;
|
||||
int max = 8;
|
||||
if (entries.Count-offset < 8)
|
||||
max = entries.Count - offset;
|
||||
for (int i = 0; i < max; i++)
|
||||
{
|
||||
binWriter.Seek(0x10 + (0x30 * i), SeekOrigin.Begin);
|
||||
|
||||
ListEntry entry = entries[i];
|
||||
binWriter.Write((UInt32)entry.actorId);
|
||||
binWriter.Write((UInt32)entry.unknown1);
|
||||
binWriter.Write((UInt32)entry.unknown2);
|
||||
binWriter.Write((Byte)(entry.flag1? 1 : 0));
|
||||
binWriter.Write((Byte)(entry.isOnline? 1 : 0));
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(entry.name), 0, Encoding.ASCII.GetByteCount(entry.name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(entry.name));
|
||||
}
|
||||
//Write Count
|
||||
binWriter.Seek(0x30 * 8, SeekOrigin.Begin);
|
||||
binWriter.Seek(0x10 + (0x30 * 8), SeekOrigin.Begin);
|
||||
binWriter.Write(max);
|
||||
}
|
||||
}
|
||||
|
|
28
FFXIVClassic Map Server/packets/send/list/ListEntry.cs
Normal file
28
FFXIVClassic Map Server/packets/send/list/ListEntry.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.list
|
||||
{
|
||||
class ListEntry
|
||||
{
|
||||
public uint actorId;
|
||||
public uint unknown1;
|
||||
public uint unknown2;
|
||||
public bool flag1;
|
||||
public bool isOnline;
|
||||
public string name;
|
||||
|
||||
public ListEntry(uint actorId, uint unknown1, uint unknown2, bool flag1, bool isOnline, string name)
|
||||
{
|
||||
this.actorId = actorId;
|
||||
this.unknown1 = unknown1;
|
||||
this.unknown2 = unknown2;
|
||||
this.flag1 = flag1;
|
||||
this.isOnline = isOnline;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
public const ushort OPCODE = 0x017C;
|
||||
public const uint PACKET_SIZE = 0x98;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong id, ulong listId, uint numEntries)
|
||||
public static SubPacket buildPacket(uint playerActorID, uint locationCode, ulong sequenceId, ulong listId, uint listTypeId, int numEntries)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
|
@ -27,11 +27,10 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
{
|
||||
//Temp stuff
|
||||
string name = "";
|
||||
uint listTypeId = 0x4E22;
|
||||
|
||||
//Write list header
|
||||
binWriter.Write((UInt64)locationCode);
|
||||
binWriter.Write((UInt64)id);
|
||||
binWriter.Write((UInt64)sequenceId);
|
||||
|
||||
//Write list id
|
||||
binWriter.Write((UInt64)3);
|
||||
|
@ -47,6 +46,8 @@ namespace FFXIVClassic_Map_Server.packets.send.list
|
|||
binWriter.Write((UInt32)0xFFFFFFFF);
|
||||
binWriter.Write(Encoding.ASCII.GetBytes(name), 0, Encoding.ASCII.GetByteCount(name) >= 0x20 ? 0x20 : Encoding.ASCII.GetByteCount(name));
|
||||
|
||||
binWriter.Seek(0x64, SeekOrigin.Begin);
|
||||
|
||||
binWriter.Write((UInt32)0x6D);
|
||||
binWriter.Write((UInt32)0x6D);
|
||||
binWriter.Write((UInt32)0x6D);
|
||||
|
|
44
FFXIVClassic Map Server/packets/send/list/ListUtils.cs
Normal file
44
FFXIVClassic Map Server/packets/send/list/ListUtils.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.list
|
||||
{
|
||||
class ListUtils
|
||||
{
|
||||
|
||||
public static List<SubPacket> createList(uint actorId, uint locationCode, ulong sequenceId, ulong listId, uint listTypeId, List<ListEntry> listEntries)
|
||||
{
|
||||
List<SubPacket> subpacketList = new List<SubPacket>();
|
||||
subpacketList.Add(ListStartPacket.buildPacket(actorId, locationCode, sequenceId, listId, listTypeId, listEntries.Count));
|
||||
subpacketList.Add(ListBeginPacket.buildPacket(actorId, locationCode, sequenceId, listId, listEntries.Count));
|
||||
subpacketList.Add(ListEntriesEndPacket.buildPacket(actorId, locationCode, sequenceId, listEntries, 0));
|
||||
subpacketList.Add(ListEndPacket.buildPacket(actorId, locationCode, sequenceId, listId));
|
||||
return subpacketList;
|
||||
}
|
||||
|
||||
public static List<SubPacket> createRetainerList(uint actorId, uint locationCode, ulong sequenceId, ulong listId, List<ListEntry> listEntries)
|
||||
{
|
||||
List<SubPacket> subpacketList = new List<SubPacket>();
|
||||
subpacketList.Add(ListStartPacket.buildPacket(actorId, locationCode, sequenceId, listId, ListStartPacket.TYPEID_RETAINER, listEntries.Count));
|
||||
subpacketList.Add(ListBeginPacket.buildPacket(actorId, locationCode, sequenceId, listId, listEntries.Count));
|
||||
subpacketList.Add(ListEntriesEndPacket.buildPacket(actorId, locationCode, sequenceId, listEntries, 0));
|
||||
subpacketList.Add(ListEndPacket.buildPacket(actorId, locationCode, sequenceId, listId));
|
||||
return subpacketList;
|
||||
}
|
||||
|
||||
public static List<SubPacket> createPartyList(uint actorId, uint locationCode, ulong sequenceId, ulong listId, List<ListEntry> listEntries)
|
||||
{
|
||||
List<SubPacket> subpacketList = new List<SubPacket>();
|
||||
subpacketList.Add(ListStartPacket.buildPacket(actorId, locationCode, sequenceId, listId, ListStartPacket.TYPEID_PARTY, listEntries.Count));
|
||||
subpacketList.Add(ListBeginPacket.buildPacket(actorId, locationCode, sequenceId, listId, listEntries.Count));
|
||||
subpacketList.Add(ListEntriesEndPacket.buildPacket(actorId, locationCode, sequenceId, listEntries, 0));
|
||||
subpacketList.Add(ListEndPacket.buildPacket(actorId, locationCode, sequenceId, listId));
|
||||
return subpacketList;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue