fix: Updates encoded packet handler to use function pointers (#1066)
This commit is contained in:
parent
f24b98f8e2
commit
057cf87e60
6 changed files with 79 additions and 54 deletions
|
|
@ -35,7 +35,9 @@ public static class IncomingPackets
|
|||
|
||||
public static PacketHandler GetHandler(int packetID) => Handlers[packetID];
|
||||
|
||||
public static void RegisterEncoded(int packetID, bool ingame, OnEncodedPacketReceive onReceive)
|
||||
public static unsafe void RegisterEncoded(
|
||||
int packetID, bool ingame, delegate*<NetState, IEntity, EncodedReader, void> onReceive
|
||||
)
|
||||
{
|
||||
if (packetID is >= 0 and < 0x100)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ public static class IncomingPlayerPackets
|
|||
IncomingPackets.Register(0xD7, 0, true, &EncodedCommand);
|
||||
IncomingPackets.Register(0xF4, 0, false, &CrashReport);
|
||||
|
||||
IncomingPackets.RegisterEncoded(0x28, true, GuildGumpRequest);
|
||||
IncomingPackets.RegisterEncoded(0x32, true, QuestGumpRequest);
|
||||
IncomingPackets.RegisterEncoded(0x28, true, &GuildGumpRequest);
|
||||
IncomingPackets.RegisterEncoded(0x32, true, &QuestGumpRequest);
|
||||
}
|
||||
|
||||
public static void DeathStatusResponse(NetState state, CircularBufferReader reader, int packetLength)
|
||||
|
|
@ -593,7 +593,7 @@ public static class IncomingPlayerPackets
|
|||
EventSink.InvokeQuestGumpRequest(state.Mobile);
|
||||
}
|
||||
|
||||
public static void EncodedCommand(NetState state, CircularBufferReader reader, int packetLength)
|
||||
public static unsafe void EncodedCommand(NetState state, CircularBufferReader reader, int packetLength)
|
||||
{
|
||||
var e = World.FindEntity((Serial)reader.ReadUInt32());
|
||||
int packetId = reader.ReadUInt16();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue