ModernUO/Projects/UOContent/Assistants/AssistantProtocol.cs
Kamron Batman 7d9bc9ff0a
fix: Fixes thread guard and cleans up incoming packet reader (#1641)
### Summary
* Fixes syntax compile error when THREADGUARD is enabled.
* Removes `int packetLength` from incoming packet handles since they aren't needed.

### Developer Notes
Incoming packet handler `SpanReader` is now properly scoped to that packet by length.
2023-12-19 17:04:09 -08:00

22 lines
615 B
C#

using System.Buffers;
namespace Server.Network;
public static class AssistantProtocol
{
private static PacketHandler[] _handlers;
[CallPriority(10)]
public static void Configure()
{
_handlers = ProtocolExtensions<AssistantsProtocolInfo>.Register(new AssistantsProtocolInfo());
}
public static unsafe void Register(int cmd, bool ingame, delegate*<NetState, SpanReader, void> onReceive) =>
_handlers[cmd] = new PacketHandler(cmd, 0, ingame, onReceive);
private struct AssistantsProtocolInfo : IProtocolExtensionsInfo
{
public int PacketId => 0xF0;
}
}