### Summary - Fixes various exploits that can crash the shard when the client misbehaves. - Clients will now be disconnected if they send packets that are marked as out of game only (new flag), while they are in-game. > [!Note] > **Developer Note** > Added an `OutOfGameOnly` which should be used to flag packets as only available out of the game. > This is the opposite of, yet not the converse to `InGameOnly`.
28 lines
972 B
C#
28 lines
972 B
C#
using System.Buffers;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace Server.Network;
|
|
|
|
public static class AssistantProtocol
|
|
{
|
|
private static PacketHandler[] _handlers;
|
|
|
|
[CallPriority(10)]
|
|
public static void Configure()
|
|
{
|
|
_handlers = ProtocolExtensions<AssistantsProtocolInfo>.Register(new AssistantsProtocolInfo());
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static unsafe void Register(int cmd, bool ingame, delegate*<NetState, SpanReader, void> onReceive) =>
|
|
Register(cmd, ingame, false, onReceive);
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static unsafe void Register(int cmd, bool ingame, bool outgame, delegate*<NetState, SpanReader, void> onReceive) =>
|
|
_handlers[cmd] = new PacketHandler(cmd, onReceive, inGameOnly: ingame, outGameOnly: outgame);
|
|
|
|
private struct AssistantsProtocolInfo : IProtocolExtensionsInfo
|
|
{
|
|
public int PacketId => 0xF0;
|
|
}
|
|
}
|