fix(core): Converts account packets to spanwriter (#381)

- [X] Converts account packets to spanwriter
This commit is contained in:
Kamron Batman 2021-01-04 18:47:20 -08:00 • committed by GitHub
parent 3b413371dc
commit ac76c57c39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 157 additions and 117 deletions

View file

@ -28,12 +28,12 @@ namespace Server.Network
public static void SendArrow(this NetState ns, byte command, int x, int y, Serial s)
{
if (ns == null || !ns.GetSendBuffer(out var buffer))
if (ns == null)
{
return;
}
var writer = new CircularBufferWriter(buffer);
var writer = new SpanWriter(stackalloc byte[10]);
writer.Write((byte)0xBA); // Packet ID
writer.Write(command);
@ -55,7 +55,7 @@ namespace Server.Network
writer.Write((short)-1);
}
ns.Send(ref buffer, writer.Position);
ns.Send(writer.Span);
}
}
}