fix(core): Converts more packets (#383)
- [X] Converts damage packets - [X] Converts effect packets - [X] Converts equipment packets - [X] Converts gump packets - [X] Converts light packets - [X] Converts map packets - [X] Converts menu packets
This commit is contained in:
parent
75c0527284
commit
353b46fbbd
7 changed files with 68 additions and 93 deletions
|
|
@ -21,12 +21,12 @@ namespace Server.Network
|
|||
{
|
||||
public static void SendMapPatches(this NetState ns)
|
||||
{
|
||||
if (ns == null || !ns.GetSendBuffer(out var buffer))
|
||||
if (ns == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new CircularBufferWriter(buffer);
|
||||
var writer = new SpanWriter(stackalloc byte[41]);
|
||||
writer.Write((byte)0xBF); // Packet ID
|
||||
writer.Write((ushort)41); // Length
|
||||
writer.Write((ushort)0x18); // Subpacket
|
||||
|
|
@ -44,35 +44,19 @@ namespace Server.Network
|
|||
writer.Write(Map.Malas.Tiles.Patch.StaticBlocks);
|
||||
writer.Write(Map.Malas.Tiles.Patch.LandBlocks);
|
||||
|
||||
ns.Send(ref buffer, writer.Position);
|
||||
ns.Send(writer.Span);
|
||||
}
|
||||
|
||||
public static void SendInvalidMap(this NetState ns)
|
||||
{
|
||||
if (ns == null || !ns.GetSendBuffer(out var buffer))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
buffer[0] = 0xC6; // Packet ID
|
||||
|
||||
ns.Send(ref buffer, 1);
|
||||
}
|
||||
public static void SendInvalidMap(this NetState ns) => ns?.Send(stackalloc byte[] { 0xC6 });
|
||||
|
||||
public static void SendMapChange(this NetState ns, Map map)
|
||||
{
|
||||
if (ns == null || map == null || !ns.GetSendBuffer(out var buffer))
|
||||
if (map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var writer = new CircularBufferWriter(buffer);
|
||||
writer.Write((byte)0xBF); // Packet ID
|
||||
writer.Write((ushort)6); // Length
|
||||
writer.Write((ushort)0x08); // Subpacket
|
||||
writer.Write((byte)map.MapID);
|
||||
|
||||
ns.Send(ref buffer, writer.Position);
|
||||
ns?.Send(stackalloc byte[] { 0xBF, 0x00, 0x06, 0x00, 0x08, (byte)map.MapID });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue