Fixes cast errors (#106)

This commit is contained in:
Kamron Batman 2020-04-13 00:11:35 -07:00 • committed by GitHub
parent 55fb749f17
commit bc50bea867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 140 additions and 143 deletions

View file

@ -11,9 +11,9 @@ namespace Server.Network
List<Item> list = beheld.EquipItems;
int count = list.Count;
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
count++;
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
if (beheld.FacialHair?.ItemID > 0)
count++;
EnsureCapacity(8 + count * 5);
@ -31,13 +31,13 @@ namespace Server.Network
}
}
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
{
m_Stream.Write((byte)(Layer.Hair + 1));
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
}
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
if (beheld.FacialHair?.ItemID > 0)
{
m_Stream.Write((byte)(Layer.FacialHair + 1));
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
@ -55,7 +55,7 @@ namespace Server.Network
List<Item> items = beheld.EquipItems;
int count = items.Count;
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
count++;
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
count++;
@ -87,7 +87,7 @@ namespace Server.Network
}
}
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
{
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
m_Stream.Write((ushort)beheld.Hair.ItemID);
@ -128,9 +128,9 @@ namespace Server.Network
List<Item> items = beheld.EquipItems;
int count = items.Count;
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
count++;
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
if (beheld.FacialHair?.ItemID > 0)
count++;
EnsureCapacity(5 + count * 20);
@ -161,7 +161,7 @@ namespace Server.Network
}
}
if (beheld.Hair != null && beheld.Hair.ItemID > 0)
if (beheld.Hair?.ItemID > 0)
{
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
m_Stream.Write((ushort)beheld.Hair.ItemID);
@ -176,7 +176,7 @@ namespace Server.Network
++written;
}
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
if (beheld.FacialHair?.ItemID > 0)
{
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
@ -195,4 +195,4 @@ namespace Server.Network
m_Stream.Write((ushort)written);
}
}
}
}