fix: Fixes more packet initializations (#1507)

This commit is contained in:
Kamron Batman 2023-09-19 00:02:17 -07:00 committed by GitHub
parent 0bec97639f
commit 2a3e048b86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 23 deletions

View file

@ -379,7 +379,7 @@ public static class Effects
int speed, int duration, bool fixedDirection = false, bool explodes = false, int hue = 0, int renderMode = 0
)
{
Span<byte> effect = stackalloc byte[OutgoingEffectPackets.HuedEffectLength];
Span<byte> effect = stackalloc byte[OutgoingEffectPackets.HuedEffectLength].InitializePacket();
OutgoingEffectPackets.CreateMovingHuedEffect(
effect,
from, to, itemID, fromLocation, toLocation, speed, duration, fixedDirection,

View file

@ -17,7 +17,7 @@ public static class OutgoingVirtualHairPackets
return;
}
Span<byte> buffer = stackalloc byte[EquipUpdatePacketLength];
Span<byte> buffer = stackalloc byte[EquipUpdatePacketLength].InitializePacket();
CreateHairEquipUpdatePacket(buffer, m, hairSerial, itemId, hue, layer);
ns.Send(buffer);
}
@ -47,7 +47,7 @@ public static class OutgoingVirtualHairPackets
return;
}
Span<byte> buffer = stackalloc byte[RemovePacketLength];
Span<byte> buffer = stackalloc byte[RemovePacketLength].InitializePacket();
CreateRemoveHairPacket(buffer, hairSerial);
ns.Send(buffer);
}

View file

@ -8994,7 +8994,8 @@ public partial class Mobile : IHued, IComparable<Mobile>, ISpawnable, IObjectPro
return;
}
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(affix, args)].InitializePacket();
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(affix, args)]
.InitializePacket();
var eable = m_Map.GetClientsInRange(m_Location);

View file

@ -41,7 +41,7 @@ public static class OutgoingMessagePackets
return;
}
Span<byte> buffer = stackalloc byte[GetMaxMessageLocalizedLength(args)];
Span<byte> buffer = stackalloc byte[GetMaxMessageLocalizedLength(args)].InitializePacket();
var length = CreateMessageLocalized(
buffer, serial, graphic, type, hue, font, number, name, args
);

View file

@ -94,7 +94,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[DeathAnimationPacketLength];
Span<byte> span = stackalloc byte[DeathAnimationPacketLength].InitializePacket();
CreateDeathAnimation(span, killed, corpse);
ns.Send(span);
}
@ -200,7 +200,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileAttributePacketLength];
Span<byte> span = stackalloc byte[MobileAttributePacketLength].InitializePacket();
CreateMobileHits(span, m, normalize);
ns.Send(span);
}
@ -225,7 +225,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileAttributePacketLength];
Span<byte> span = stackalloc byte[MobileAttributePacketLength].InitializePacket();
CreateMobileMana(span, m, normalize);
ns.Send(span);
}
@ -250,7 +250,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileAttributePacketLength];
Span<byte> span = stackalloc byte[MobileAttributePacketLength].InitializePacket();
CreateMobileStam(span, m, normalize);
ns.Send(span);
}
@ -275,7 +275,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileAttributesPacketLength];
Span<byte> span = stackalloc byte[MobileAttributesPacketLength].InitializePacket();
CreateMobileAttributes(span, m, normalize);
ns.Send(span);
}
@ -344,7 +344,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileAnimationPacketLength];
Span<byte> span = stackalloc byte[MobileAnimationPacketLength].InitializePacket();
CreateMobileAnimation(span, mobile, action, frameCount, repeatCount, forward, repeat, delay);
ns.Send(span);
}
@ -369,7 +369,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[NewMobileAnimationPacketLength];
Span<byte> span = stackalloc byte[NewMobileAnimationPacketLength].InitializePacket();
CreateNewMobileAnimation(span, mobile, action, frameCount, delay);
ns.Send(span);
}
@ -381,7 +381,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> span = stackalloc byte[MobileHealthbarPacketLength];
Span<byte> span = stackalloc byte[MobileHealthbarPacketLength].InitializePacket();
CreateMobileHealthbar(span, m, healthbar);
ns.Send(span);
}
@ -436,7 +436,7 @@ public static class OutgoingMobilePackets
return;
}
Span<byte> buffer = stackalloc byte[MobileStatusCompactLength];
Span<byte> buffer = stackalloc byte[MobileStatusCompactLength].InitializePacket();
CreateMobileStatusCompact(buffer, m, canBeRenamed);
ns.Send(buffer);
@ -487,7 +487,7 @@ public static class OutgoingMobilePackets
}
}
Span<byte> buffer = stackalloc byte[length];
Span<byte> buffer = stackalloc byte[length].InitializePacket();
CreateMobileStatus(buffer, beheld, version, beheld.CanBeRenamedBy(beholder));
ns.Send(buffer);
}