fix(core): Removes implicit cast between Serial and uint (#728)

* Fixes spellbooks using serial ctor
* Fixes misc items where someone thought they had an amount and it didn't
* Fixes all `Food` types.
This commit is contained in:
Kamron Batman 2021-08-25 00:27:19 -07:00 • committed by GitHub
parent 17521c9cd7
commit 0dc4acc164
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 319 additions and 248 deletions

View file

@ -114,22 +114,7 @@ namespace Server
var loc = reader.ReadPoint3D();
var worldLoc = reader.ReadPoint3D();
IEntity parent;
Serial serial = reader.ReadUInt();
if (serial.IsItem)
{
parent = World.FindItem(serial);
}
else if (serial.IsMobile)
{
parent = World.FindMobile(serial);
}
else
{
parent = null;
}
IEntity parent = reader.ReadEntity<IEntity>();
return new BounceInfo(map, loc, worldLoc, parent);
}
@ -2651,7 +2636,7 @@ namespace Server
if (GetSaveFlag(flags, SaveFlag.Parent))
{
Serial parent = reader.ReadUInt();
Serial parent = reader.ReadSerial();
if (parent.IsMobile)
{
@ -2812,7 +2797,7 @@ namespace Server
if (GetSaveFlag(flags, SaveFlag.Parent))
{
Serial parent = reader.ReadUInt();
Serial parent = reader.ReadSerial();
if (parent.IsMobile)
{
@ -2930,7 +2915,7 @@ namespace Server
AcquireCompactInfo().m_Name = name;
}
Serial parent = reader.ReadUInt();
Serial parent = reader.ReadSerial();
if (parent.IsMobile)
{

View file

@ -10,7 +10,7 @@ namespace Server
public const int EquipUpdatePacketLength = 15;
public const int RemovePacketLength = 5;
public static void SendHairEquipUpdatePacket(this NetState ns, Mobile m, Serial hairSerial, int itemId, int hue, Layer layer)
public static void SendHairEquipUpdatePacket(this NetState ns, Mobile m, uint hairSerial, int itemId, int hue, Layer layer)
{
if (ns == null)
{
@ -22,7 +22,7 @@ namespace Server
ns.Send(buffer);
}
public static void CreateHairEquipUpdatePacket(Span<byte> buffer, Mobile m, Serial hairSerial, int itemId, int hue, Layer layer)
public static void CreateHairEquipUpdatePacket(Span<byte> buffer, Mobile m, uint hairSerial, int itemId, int hue, Layer layer)
{
if (buffer[0] != 0)
{
@ -40,7 +40,7 @@ namespace Server
writer.Write((short)(m.SolidHueOverride >= 0 ? m.SolidHueOverride : hue));
}
public static void SendRemoveHairPacket(this NetState ns, Serial hairSerial)
public static void SendRemoveHairPacket(this NetState ns, uint hairSerial)
{
if (ns == null)
{
@ -52,7 +52,7 @@ namespace Server
ns.Send(buffer);
}
public static void CreateRemoveHairPacket(Span<byte> buffer, Serial hairSerial)
public static void CreateRemoveHairPacket(Span<byte> buffer, uint hairSerial)
{
if (buffer[0] != 0)
{
@ -121,7 +121,7 @@ namespace Server
// TODO: Can we make this higher for newer clients?
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint FakeSerial(Serial m) => 0x7FFFFFFF - 0x400 - m * 4;
public static uint FakeSerial(Serial m) => 0x7FFFFFFF - 0x400 - m.Value * 4;
}
public class FacialHairInfo : BaseHairInfo
@ -143,6 +143,6 @@ namespace Server
// TODO: Can we make this higher for newer clients?
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static uint FakeSerial(Serial m) => 0x7FFFFFFF - 0x400 - 1 - m * 4;
public static uint FakeSerial(Serial m) => 0x7FFFFFFF - 0x400 - 1 - m.Value* 4;
}
}