fix(core): Fixes item mask in incoming mobile packet (#568)

- [X] FIxes the item mask in incoming mobile packet
- [X] Streamlines some of the send info stuff
- [X] Adds a few missing packet initializations
This commit is contained in:
Kamron Batman 2021-04-10 21:48:07 -07:00 • committed by GitHub
parent ee61c5a257
commit b51bab5f1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 32 deletions

View file

@ -32,13 +32,13 @@ namespace Server.Items
private void SendGMItem(NetState ns)
{
// GM Packet
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength];
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
int length;
if (ns.StygianAbyss)
{
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.StygianAbyss, ns.HighSeas);
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(8, 2), GMItemId);
}
else

View file

@ -38,13 +38,13 @@ namespace Server.Items
private void SendGMItem(NetState ns)
{
// GM Packet
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength];
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
int length;
if (ns.StygianAbyss)
{
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.StygianAbyss, ns.HighSeas);
length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas);
BinaryPrimitives.WriteUInt16BigEndian(buffer.Slice(8, 2), GMItemId);
}
else

View file

@ -76,9 +76,6 @@ namespace Server.Multis.Boats
return;
}
bool isSA = ns.StygianAbyss;
bool isHS = ns.HighSeas;
var minLength = PacketContainerBuilder.MinPacketLength
+ OutgoingEntityPackets.MaxWorldEntityPacketLength
* 5; // Minimum of boat, hold, planks, and the player
@ -95,7 +92,7 @@ namespace Server.Multis.Boats
}
buffer.InitializePacket();
var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, isSA, isHS);
var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, true);
builder.Advance(bytesWritten);
}

View file

@ -32,9 +32,6 @@ namespace Server.Network
return;
}
bool isSA = ns.StygianAbyss;
bool isHS = ns.HighSeas;
var minLength = PacketContainerBuilder.MinPacketLength
+ OutgoingEntityPackets.MaxWorldEntityPacketLength
* estimatedCount;
@ -46,7 +43,7 @@ namespace Server.Network
foreach (var entity in entities)
{
buffer.InitializePacket();
var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, isSA, isHS);
var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, true);
builder.Advance(bytesWritten);
}