fix: Adds safety to corpses and cleans up quests (#1685)
### Summary - Adds some more checks in case a corpse's owner is somehow null. Would like to eventually allow null owner corpses, but more work is needed. - Cleans up variable unboxing and reassignment in quests. Also flattens quest logic. Still more work needs to be done. - Codegens more quest items/mobiles.
This commit is contained in:
parent
0d5aa1d022
commit
e994505ad0
90 changed files with 2623 additions and 3168 deletions
|
|
@ -608,7 +608,7 @@ public abstract partial class BaseBeverage : Item, IHasQuantity
|
|||
{
|
||||
if (from is PlayerMobile { Quest: SolenMatriarchQuest qs })
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<GatherWaterObjective>();
|
||||
var obj = qs.FindObjective<GatherWaterObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ public partial class BankCheck : Item
|
|||
|
||||
if (qs is DarkTidesQuest)
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<CashBankCheckObjective>();
|
||||
var obj = qs.FindObjective<CashBankCheckObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,16 +47,19 @@ public static class CorpsePackets
|
|||
}
|
||||
}
|
||||
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
if (beheld.Owner != null)
|
||||
{
|
||||
writer.Write((byte)(Layer.Hair + 1));
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
if (beheld.Hair?.ItemID > 0)
|
||||
{
|
||||
writer.Write((byte)(Layer.Hair + 1));
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
{
|
||||
writer.Write((byte)(Layer.FacialHair + 1));
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
if (beheld.FacialHair?.ItemID > 0)
|
||||
{
|
||||
writer.Write((byte)(Layer.FacialHair + 1));
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write((byte)Layer.Invalid);
|
||||
|
|
@ -115,38 +118,41 @@ public static class CorpsePackets
|
|||
}
|
||||
}
|
||||
|
||||
if (hairItemID > 0)
|
||||
if (beheld.Owner != null)
|
||||
{
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
writer.Write((ushort)hairItemID);
|
||||
writer.Write((byte)0); // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Write(0); // X/Y
|
||||
if (ns.ContainerGridLines)
|
||||
if (hairItemID > 0)
|
||||
{
|
||||
writer.Write((byte)0); // Grid Location?
|
||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
writer.Write((ushort)hairItemID);
|
||||
writer.Write((byte)0); // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Write(0); // X/Y
|
||||
if (ns.ContainerGridLines)
|
||||
{
|
||||
writer.Write((byte)0); // Grid Location?
|
||||
}
|
||||
writer.Write(beheld.Serial);
|
||||
writer.Write((ushort)beheld.Hair!.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
writer.Write(beheld.Serial);
|
||||
writer.Write((ushort)beheld.Hair!.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
|
||||
if (facialHairItemID > 0)
|
||||
{
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
writer.Write((ushort)facialHairItemID);
|
||||
writer.Write((byte)0); // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Write(0); // X/Y
|
||||
if (ns.ContainerGridLines)
|
||||
if (facialHairItemID > 0)
|
||||
{
|
||||
writer.Write((byte)0); // Grid Location?
|
||||
}
|
||||
writer.Write(beheld.Serial);
|
||||
writer.Write((ushort)beheld.FacialHair!.Hue);
|
||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||
writer.Write((ushort)facialHairItemID);
|
||||
writer.Write((byte)0); // signed, itemID offset
|
||||
writer.Write((ushort)1);
|
||||
writer.Write(0); // X/Y
|
||||
if (ns.ContainerGridLines)
|
||||
{
|
||||
writer.Write((byte)0); // Grid Location?
|
||||
}
|
||||
writer.Write(beheld.Serial);
|
||||
writer.Write((ushort)beheld.FacialHair!.Hue);
|
||||
|
||||
++written;
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
writer.Seek(1, SeekOrigin.Begin);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue