mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-11 23:14:39 +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
|
@ -0,0 +1,35 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||
{
|
||||
class SetActorIconPacket
|
||||
{
|
||||
public const uint DISCONNECTING = 0x00010000;
|
||||
public const uint ISGM = 0x00020000;
|
||||
public const uint ISAFK = 0x00000100;
|
||||
|
||||
public const ushort OPCODE = 0x0145;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, uint iconCode)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((UInt32)iconCode);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
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.actor
|
||||
{
|
||||
class SetActorIsZoningPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x017B;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, bool isDimmed)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
data[0] = (byte)(isDimmed ? 1 : 0);
|
||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,7 +36,7 @@ namespace FFXIVClassic_Map_Server.packets.send.actor
|
|||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((Int32)0);
|
||||
binWriter.Write((Int32)sourceActorID);
|
||||
binWriter.Write((Int32)0);
|
||||
binWriter.Write((Single)x);
|
||||
binWriter.Write((Single)y);
|
||||
binWriter.Write((Single)z);
|
||||
|
|
|
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||
{
|
||||
class SetStatusPacket
|
||||
class SetActorStatusAllPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x0179;
|
||||
public const uint PACKET_SIZE = 0x48;
|
|
@ -0,0 +1,32 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||
{
|
||||
class SetActorStatusPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x0177;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID, ushort index, ushort statusCode)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((UInt16)index);
|
||||
binWriter.Write((UInt16)statusCode);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
31
FFXIVClassic Map Server/packets/send/Actor/_0xFPacket.cs
Normal file
31
FFXIVClassic Map Server/packets/send/Actor/_0xFPacket.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.actor
|
||||
{
|
||||
class _0xFPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x000F;
|
||||
public const uint PACKET_SIZE = 0x38;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.login
|
||||
{
|
||||
class Login0x7ResponsePacket
|
||||
{
|
||||
public static BasePacket buildPacket(uint actorID, uint time)
|
||||
{
|
||||
byte[] data = new byte[0x18];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
binWriter.Write((short)0x18);
|
||||
binWriter.Write((short)0x8);
|
||||
binWriter.Write((uint)0);
|
||||
binWriter.Write((uint)0);
|
||||
binWriter.Write((uint)0xFFFFFD7F);
|
||||
|
||||
binWriter.Write((uint)actorID);
|
||||
binWriter.Write((uint)time);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return BasePacket.createPacket(data, false, false);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.player
|
||||
{
|
||||
class SendAchievementRatePacket
|
||||
{
|
||||
public const ushort OPCODE = 0x019F;
|
||||
public const uint PACKET_SIZE = 0x30;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint achievementId, uint progressCount, uint progressFlags)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Write((UInt32)achievementId);
|
||||
binWriter.Write((UInt32)progressCount);
|
||||
binWriter.Write((UInt32)progressFlags);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, playerActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
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.player
|
||||
{
|
||||
class SetCurrentJobPacket
|
||||
{
|
||||
public const ushort OPCODE = 0x01A4;
|
||||
public const uint PACKET_SIZE = 0x28;
|
||||
|
||||
public static SubPacket buildPacket(uint sourceActorID, uint targetActorID, uint jobId)
|
||||
{
|
||||
return new SubPacket(OPCODE, sourceActorID, targetActorID, BitConverter.GetBytes((uint)jobId));
|
||||
}
|
||||
}
|
||||
}
|
32
FFXIVClassic Map Server/packets/send/player/_0x196Packet.cs
Normal file
32
FFXIVClassic Map Server/packets/send/player/_0x196Packet.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using FFXIVClassic_Lobby_Server.packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets.send.player
|
||||
{
|
||||
class _0x196Packet
|
||||
{
|
||||
public const ushort OPCODE = 0x0196;
|
||||
public const uint PACKET_SIZE = 0x38;
|
||||
|
||||
public static SubPacket buildPacket(uint playerActorID, uint targetActorID)
|
||||
{
|
||||
byte[] data = new byte[PACKET_SIZE - 0x20];
|
||||
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryWriter binWriter = new BinaryWriter(mem))
|
||||
{
|
||||
binWriter.Seek(0xE, SeekOrigin.Begin);
|
||||
binWriter.Write((Byte)0x01);
|
||||
}
|
||||
}
|
||||
|
||||
return new SubPacket(OPCODE, playerActorID, targetActorID, data);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue