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
|
|
@ -1,28 +1,12 @@
|
|||
namespace Server.Items
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class Cauldron : Item
|
||||
{
|
||||
public class Cauldron : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Cauldron() : base(0x9ED) => Weight = 1.0;
|
||||
[Constructible]
|
||||
public Cauldron() : base(0x9ED) => Weight = 1.0;
|
||||
|
||||
public Cauldron(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName => "a cauldron";
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override string DefaultName => "a cauldron";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,105 +1,75 @@
|
|||
using System.Collections.Generic;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Quests.Hag
|
||||
namespace Server.Engines.Quests.Hag;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class HagApprenticeCorpse : Corpse
|
||||
{
|
||||
public class HagApprenticeCorpse : Corpse
|
||||
[Constructible]
|
||||
public HagApprenticeCorpse() : base(GetOwner(), []) => Direction = Direction.South;
|
||||
|
||||
private static Mobile GetOwner()
|
||||
{
|
||||
[Constructible]
|
||||
public HagApprenticeCorpse() : base(GetOwner(), GetEquipment())
|
||||
var apprentice = new Mobile
|
||||
{
|
||||
Direction = Direction.South;
|
||||
Hue = Race.Human.RandomSkinHue(),
|
||||
Female = false,
|
||||
Body = 0x190
|
||||
};
|
||||
|
||||
foreach (var item in EquipItems)
|
||||
apprentice.Delete();
|
||||
|
||||
return apprentice;
|
||||
}
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
list.Add("a charred corpse");
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
|
||||
|
||||
from.NetState.SendMessage(Serial, ItemID, MessageType.Label, hue, 3, true, null, "", "a charred corpse");
|
||||
}
|
||||
|
||||
public override void Open(Mobile from, bool checkSelfLoot)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
var qs = player.Quest;
|
||||
|
||||
if (qs is WitchApprenticeQuest)
|
||||
{
|
||||
DropItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
public HagApprenticeCorpse(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: What is this? Why are we creating a mobile and deleting it?
|
||||
private static Mobile GetOwner()
|
||||
{
|
||||
var apprentice = new Mobile();
|
||||
|
||||
apprentice.Hue = Race.Human.RandomSkinHue();
|
||||
apprentice.Female = false;
|
||||
apprentice.Body = 0x190;
|
||||
|
||||
apprentice.Delete();
|
||||
|
||||
return apprentice;
|
||||
}
|
||||
|
||||
private static List<Item> GetEquipment() => new();
|
||||
|
||||
public override void AddNameProperty(IPropertyList list)
|
||||
{
|
||||
list.Add("a charred corpse");
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
|
||||
|
||||
from.NetState.SendMessage(Serial, ItemID, MessageType.Label, hue, 3, true, null, "", "a charred corpse");
|
||||
}
|
||||
|
||||
public override void Open(Mobile from, bool checkSelfLoot)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
var qs = player.Quest;
|
||||
|
||||
if (qs is WitchApprenticeQuest)
|
||||
var obj = qs.FindObjective<FindApprenticeObjective>();
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
var obj = qs.FindObjective<FindApprenticeObjective>();
|
||||
if (obj?.Completed == false)
|
||||
if (obj.Corpse == this)
|
||||
{
|
||||
if (obj.Corpse == this)
|
||||
{
|
||||
obj.Complete();
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo(
|
||||
from,
|
||||
1055047
|
||||
); // You examine the corpse, but it doesn't fit the description of the particular apprentice the Hag tasked you with finding.
|
||||
}
|
||||
|
||||
return;
|
||||
obj.Complete();
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
{
|
||||
// You examine the corpse, but it doesn't fit the description of the particular apprentice the Hag tasked you with finding.
|
||||
SendLocalizedMessageTo(from, 1055047);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SendLocalizedMessageTo(from, 1055048); // You examine the corpse, but find nothing of interest.
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
SendLocalizedMessageTo(from, 1055048); // You examine the corpse, but find nothing of interest.
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,20 @@
|
|||
namespace Server.Items
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class HagCauldron : BaseAddon
|
||||
{
|
||||
public class HagCauldron : BaseAddon
|
||||
[Constructible]
|
||||
public HagCauldron()
|
||||
{
|
||||
[Constructible]
|
||||
public HagCauldron()
|
||||
{
|
||||
AddonComponent pot;
|
||||
pot = new AddonComponent(2420);
|
||||
AddComponent(pot, 0, 0, 0); // pot w/ support
|
||||
AddonComponent pot;
|
||||
pot = new AddonComponent(2420);
|
||||
AddComponent(pot, 0, 0, 0); // pot w/ support
|
||||
|
||||
AddonComponent fire;
|
||||
fire = new AddonComponent(4012); // fire pit
|
||||
fire.Light = LightType.Circle150;
|
||||
AddComponent(fire, 0, 0, 0);
|
||||
}
|
||||
|
||||
public HagCauldron(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
AddonComponent fire;
|
||||
fire = new AddonComponent(4012); // fire pit
|
||||
fire.Light = LightType.Circle150;
|
||||
AddComponent(fire, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,71 +1,52 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Items
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class HagStew : BaseAddon
|
||||
{
|
||||
public class HagStew : BaseAddon
|
||||
[Constructible]
|
||||
public HagStew()
|
||||
{
|
||||
[Constructible]
|
||||
public HagStew()
|
||||
// stew
|
||||
AddComponent(new AddonComponent(2416)
|
||||
{
|
||||
AddonComponent stew;
|
||||
stew = new AddonComponent(2416);
|
||||
stew.Name = "stew";
|
||||
stew.Visible = true;
|
||||
AddComponent(stew, 0, 0, -7); // stew
|
||||
}
|
||||
Name = "stew",
|
||||
Visible = true
|
||||
}, 0, 0, -7);
|
||||
}
|
||||
|
||||
public HagStew(Serial serial) : base(serial)
|
||||
public override void OnComponentUsed(AddonComponent stew, Mobile from)
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.SendMessage("You are too far away.");
|
||||
}
|
||||
|
||||
public override void OnComponentUsed(AddonComponent stew, Mobile from)
|
||||
else
|
||||
{
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
stew.Visible = false;
|
||||
|
||||
var hagstew = new BreadLoaf(); // this decides your fillrate
|
||||
hagstew.Eat(from);
|
||||
|
||||
Timer timer = new ShowStew(stew);
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public class ShowStew : Timer
|
||||
{
|
||||
private readonly AddonComponent _stew;
|
||||
|
||||
public ShowStew(AddonComponent ac) : base(TimeSpan.FromSeconds(30)) => _stew = ac;
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (_stew.Visible == false)
|
||||
{
|
||||
from.SendMessage("You are too far away.");
|
||||
}
|
||||
else
|
||||
{
|
||||
stew.Visible = false;
|
||||
|
||||
var hagstew = new BreadLoaf(); // this decides your fillrate
|
||||
hagstew.Eat(from);
|
||||
|
||||
Timer m_timer = new ShowStew(stew);
|
||||
m_timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public class ShowStew : Timer
|
||||
{
|
||||
private readonly AddonComponent stew;
|
||||
|
||||
public ShowStew(AddonComponent ac) : base(TimeSpan.FromSeconds(30))
|
||||
{
|
||||
stew = ac;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (stew.Visible == false)
|
||||
{
|
||||
Stop();
|
||||
stew.Visible = true;
|
||||
}
|
||||
Stop();
|
||||
_stew.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,81 +1,51 @@
|
|||
namespace Server.Engines.Quests.Hag
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Engines.Quests.Hag;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class HangoverCure : Item
|
||||
{
|
||||
public class HangoverCure : Item
|
||||
[EncodedInt]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private int _uses;
|
||||
|
||||
[Constructible]
|
||||
public HangoverCure() : base(0xE2B)
|
||||
{
|
||||
[Constructible]
|
||||
public HangoverCure() : base(0xE2B)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 0x2D;
|
||||
Weight = 1.0;
|
||||
Hue = 0x2D;
|
||||
|
||||
Uses = 20;
|
||||
_uses = 20;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1055060; // Grizelda's Extra Strength Hangover Cure
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042038); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
public HangoverCure(Serial serial) : base(serial)
|
||||
if (Uses > 0)
|
||||
{
|
||||
from.PlaySound(0x2D6);
|
||||
from.SendLocalizedMessage(501206); // An awful taste fills your mouth.
|
||||
|
||||
if (from.BAC > 0)
|
||||
{
|
||||
from.BAC = 0;
|
||||
from.SendLocalizedMessage(501204); // You are now sober!
|
||||
}
|
||||
|
||||
Uses--;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1055060; // Grizelda's Extra Strength Hangover Cure
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Uses { get; set; }
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
else
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042038); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
if (Uses > 0)
|
||||
{
|
||||
from.PlaySound(0x2D6);
|
||||
from.SendLocalizedMessage(501206); // An awful taste fills your mouth.
|
||||
|
||||
if (from.BAC > 0)
|
||||
{
|
||||
from.BAC = 0;
|
||||
from.SendLocalizedMessage(501204); // You are now sober!
|
||||
}
|
||||
|
||||
Uses--;
|
||||
}
|
||||
else
|
||||
{
|
||||
Delete();
|
||||
from.SendLocalizedMessage(501201); // There wasn't enough left to have any effect.
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.WriteEncodedInt(Uses);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Uses = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Uses = 20;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Delete();
|
||||
from.SendLocalizedMessage(501201); // There wasn't enough left to have any effect.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,72 +1,59 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Hag
|
||||
namespace Server.Engines.Quests.Hag;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MagicFlute : Item
|
||||
{
|
||||
public class MagicFlute : Item
|
||||
[Constructible]
|
||||
public MagicFlute() : base(0x1421) => Hue = 0x8AB;
|
||||
|
||||
public override int LabelNumber => 1055051; // magic flute
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
[Constructible]
|
||||
public MagicFlute() : base(0x1421) => Hue = 0x8AB;
|
||||
|
||||
public MagicFlute(Serial serial) : base(serial)
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042292); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1055051; // magic flute
|
||||
from.PlaySound(0x3D);
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
if (from is not PlayerMobile player)
|
||||
{
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
SendLocalizedMessageTo(from, 1042292); // You must have the object in your backpack to use it.
|
||||
return;
|
||||
}
|
||||
|
||||
from.PlaySound(0x3D);
|
||||
|
||||
if (from is PlayerMobile player)
|
||||
{
|
||||
var qs = player.Quest;
|
||||
|
||||
if (qs is WitchApprenticeQuest)
|
||||
{
|
||||
var obj = qs.FindObjective<FindZeefzorpulObjective>();
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
if (player.Map != Map.Trammel && player.Map != Map.Felucca || !player.InRange(obj.ImpLocation, 8))
|
||||
{
|
||||
player.SendLocalizedMessage(
|
||||
1055053
|
||||
); // Nothing happens. Zeefzorpul must not be hiding in this area.
|
||||
}
|
||||
else if (player.InRange(obj.ImpLocation, 4))
|
||||
{
|
||||
Delete();
|
||||
|
||||
obj.Complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendLocalizedMessage(
|
||||
1055052
|
||||
); // The flute sparkles. Zeefzorpul must be in a good hiding place nearby.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
var qs = player.Quest;
|
||||
|
||||
writer.Write(0); // version
|
||||
if (qs is not WitchApprenticeQuest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
var obj = qs.FindObjective<FindZeefzorpulObjective>();
|
||||
if (obj?.Completed != false)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.Map != Map.Trammel && player.Map != Map.Felucca || !player.InRange(obj.ImpLocation, 8))
|
||||
{
|
||||
// Nothing happens. Zeefzorpul must not be hiding in this area.
|
||||
player.SendLocalizedMessage(1055053);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.InRange(obj.ImpLocation, 4))
|
||||
{
|
||||
Delete();
|
||||
obj.Complete();
|
||||
return;
|
||||
}
|
||||
|
||||
// The flute sparkles. Zeefzorpul must be in a good hiding place nearby.
|
||||
player.SendLocalizedMessage(1055052);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,28 +1,12 @@
|
|||
namespace Server.Engines.Quests.Hag
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Engines.Quests.Hag;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class MoonfireBrew : Item
|
||||
{
|
||||
public class MoonfireBrew : Item
|
||||
{
|
||||
[Constructible]
|
||||
public MoonfireBrew() : base(0xF04) => Weight = 1.0;
|
||||
[Constructible]
|
||||
public MoonfireBrew() : base(0xF04) => Weight = 1.0;
|
||||
|
||||
public MoonfireBrew(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1055065; // a bottle of magical moonfire brew
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
public override int LabelNumber => 1055065; // a bottle of magical moonfire brew
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,232 +1,205 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Virtues;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests.Hag
|
||||
namespace Server.Engines.Quests.Hag;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public partial class Grizelda : BaseQuester
|
||||
{
|
||||
public class Grizelda : BaseQuester
|
||||
[Constructible]
|
||||
public Grizelda() : base("the Hag")
|
||||
{
|
||||
[Constructible]
|
||||
public Grizelda() : base("the Hag")
|
||||
}
|
||||
|
||||
public override bool ClickTitle => true;
|
||||
public override string DefaultName => "Grizelda";
|
||||
|
||||
public override void InitBody()
|
||||
{
|
||||
InitStats(100, 100, 25);
|
||||
|
||||
Hue = 0x83EA;
|
||||
|
||||
Female = true;
|
||||
Body = 0x191;
|
||||
}
|
||||
|
||||
public override void InitOutfit()
|
||||
{
|
||||
AddItem(new Robe(0x1));
|
||||
AddItem(new Sandals());
|
||||
AddItem(new WizardsHat(0x1));
|
||||
AddItem(new GoldBracelet());
|
||||
|
||||
HairItemID = 0x203C;
|
||||
|
||||
Item staff = new GnarledStaff();
|
||||
staff.Movable = false;
|
||||
AddItem(staff);
|
||||
}
|
||||
|
||||
public override void OnTalk(PlayerMobile player, bool contextMenu)
|
||||
{
|
||||
Direction = GetDirectionTo(player);
|
||||
|
||||
var qs = player.Quest;
|
||||
|
||||
if (qs is not WitchApprenticeQuest)
|
||||
{
|
||||
}
|
||||
var newQuest = new WitchApprenticeQuest(player);
|
||||
|
||||
public Grizelda(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool ClickTitle => true;
|
||||
public override string DefaultName => "Grizelda";
|
||||
|
||||
public override void InitBody()
|
||||
{
|
||||
InitStats(100, 100, 25);
|
||||
|
||||
Hue = 0x83EA;
|
||||
|
||||
Female = true;
|
||||
Body = 0x191;
|
||||
}
|
||||
|
||||
public override void InitOutfit()
|
||||
{
|
||||
AddItem(new Robe(0x1));
|
||||
AddItem(new Sandals());
|
||||
AddItem(new WizardsHat(0x1));
|
||||
AddItem(new GoldBracelet());
|
||||
|
||||
HairItemID = 0x203C;
|
||||
|
||||
Item staff = new GnarledStaff();
|
||||
staff.Movable = false;
|
||||
AddItem(staff);
|
||||
}
|
||||
|
||||
public override void OnTalk(PlayerMobile player, bool contextMenu)
|
||||
{
|
||||
Direction = GetDirectionTo(player);
|
||||
|
||||
var qs = player.Quest;
|
||||
|
||||
if (qs is WitchApprenticeQuest)
|
||||
if (qs != null)
|
||||
{
|
||||
if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective)))
|
||||
newQuest.AddConversation(new DontOfferConversation());
|
||||
}
|
||||
else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out var inRestartPeriod))
|
||||
{
|
||||
PlaySound(0x20);
|
||||
PlaySound(0x206);
|
||||
newQuest.SendOffer();
|
||||
}
|
||||
else if (inRestartPeriod)
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
newQuest.AddConversation(new RecentlyFinishedConversation());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective)))
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringCorpseSearchConversation());
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.FindObjective<FindGrizeldaAboutMurderObjective>() is { Completed: false } obj1)
|
||||
{
|
||||
PlaySound(0x420);
|
||||
PlaySound(0x20);
|
||||
obj1.Complete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.IsObjectiveInProgress(typeof(KillImpsObjective))
|
||||
|| qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective)))
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringImpSearchConversation());
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.FindObjective<ReturnRecipeObjective>() is { Completed: false } obj2)
|
||||
{
|
||||
PlaySound(0x258);
|
||||
PlaySound(0x41B);
|
||||
obj2.Complete();
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective)))
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringIngredientsConversation());
|
||||
return;
|
||||
}
|
||||
|
||||
if (qs.FindObjective<ReturnIngredientsObjective>() is { Completed: false } obj3)
|
||||
{
|
||||
var cont = GetNewContainer();
|
||||
|
||||
cont.DropItem(new BlackPearl(30));
|
||||
cont.DropItem(new Bloodmoss(30));
|
||||
cont.DropItem(new Garlic(30));
|
||||
cont.DropItem(new Ginseng(30));
|
||||
cont.DropItem(new MandrakeRoot(30));
|
||||
cont.DropItem(new Nightshade(30));
|
||||
cont.DropItem(new SulfurousAsh(30));
|
||||
cont.DropItem(new SpidersSilk(30));
|
||||
|
||||
cont.DropItem(new Cauldron());
|
||||
cont.DropItem(new MoonfireBrew());
|
||||
cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), Map));
|
||||
cont.DropItem(new Gold(2000, 2200));
|
||||
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
var weapon = Loot.RandomWeapon();
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringCorpseSearchConversation());
|
||||
BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<FindGrizeldaAboutMurderObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
PlaySound(0x420);
|
||||
PlaySound(0x20);
|
||||
obj.Complete();
|
||||
}
|
||||
else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective))
|
||||
|| qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective)))
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringImpSearchConversation());
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = qs.FindObjective<ReturnRecipeObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
PlaySound(0x258);
|
||||
PlaySound(0x41B);
|
||||
obj.Complete();
|
||||
}
|
||||
else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective)))
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
qs.AddConversation(new HagDuringIngredientsConversation());
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = qs.FindObjective<ReturnIngredientsObjective>();
|
||||
|
||||
if (obj?.Completed == false)
|
||||
{
|
||||
var cont = GetNewContainer();
|
||||
|
||||
cont.DropItem(new BlackPearl(30));
|
||||
cont.DropItem(new Bloodmoss(30));
|
||||
cont.DropItem(new Garlic(30));
|
||||
cont.DropItem(new Ginseng(30));
|
||||
cont.DropItem(new MandrakeRoot(30));
|
||||
cont.DropItem(new Nightshade(30));
|
||||
cont.DropItem(new SulfurousAsh(30));
|
||||
cont.DropItem(new SpidersSilk(30));
|
||||
|
||||
cont.DropItem(new Cauldron());
|
||||
cont.DropItem(new MoonfireBrew());
|
||||
cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), Map));
|
||||
cont.DropItem(new Gold(2000, 2200));
|
||||
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
var weapon = Loot.RandomWeapon();
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
|
||||
}
|
||||
else
|
||||
{
|
||||
weapon.DamageLevel = (WeaponDamageLevel)RandomMinMaxScaled(2, 3);
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)RandomMinMaxScaled(2, 3);
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled(2, 3);
|
||||
}
|
||||
|
||||
cont.DropItem(weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
Item item;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
item = Loot.RandomArmorOrShieldOrJewelry();
|
||||
|
||||
if (item is BaseArmor armor)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(armor, 2, 20, 30);
|
||||
}
|
||||
else if (item is BaseJewel jewel)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(jewel, 2, 20, 30);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var armor = Loot.RandomArmorOrShield();
|
||||
item = armor;
|
||||
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled(2, 3);
|
||||
armor.Durability = (ArmorDurabilityLevel)RandomMinMaxScaled(2, 3);
|
||||
}
|
||||
|
||||
cont.DropItem(item);
|
||||
}
|
||||
|
||||
if (player.BAC > 0)
|
||||
{
|
||||
cont.DropItem(new HangoverCure());
|
||||
}
|
||||
|
||||
if (player.PlaceInBackpack(cont))
|
||||
{
|
||||
var gainedPath = false;
|
||||
|
||||
if (VirtueSystem.Award(
|
||||
player,
|
||||
VirtueName.Sacrifice,
|
||||
250,
|
||||
ref gainedPath
|
||||
)) // TODO: Check amount on OSI.
|
||||
{
|
||||
player.SendLocalizedMessage(1054160); // You have gained in sacrifice.
|
||||
}
|
||||
|
||||
PlaySound(0x253);
|
||||
PlaySound(0x20);
|
||||
obj.Complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
cont.Delete();
|
||||
player.SendLocalizedMessage(
|
||||
1046260
|
||||
); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
weapon.DamageLevel = (WeaponDamageLevel)RandomMinMaxScaled(2, 3);
|
||||
weapon.AccuracyLevel = (WeaponAccuracyLevel)RandomMinMaxScaled(2, 3);
|
||||
weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled(2, 3);
|
||||
}
|
||||
|
||||
cont.DropItem(weapon);
|
||||
}
|
||||
else
|
||||
{
|
||||
QuestSystem newQuest = new WitchApprenticeQuest(player);
|
||||
Item item;
|
||||
|
||||
if (qs != null)
|
||||
if (Core.AOS)
|
||||
{
|
||||
newQuest.AddConversation(new DontOfferConversation());
|
||||
item = Loot.RandomArmorOrShieldOrJewelry();
|
||||
|
||||
if (item is BaseArmor armor)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(armor, 2, 20, 30);
|
||||
}
|
||||
else if (item is BaseJewel jewel)
|
||||
{
|
||||
BaseRunicTool.ApplyAttributesTo(jewel, 2, 20, 30);
|
||||
}
|
||||
}
|
||||
else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out var inRestartPeriod))
|
||||
else
|
||||
{
|
||||
PlaySound(0x20);
|
||||
PlaySound(0x206);
|
||||
newQuest.SendOffer();
|
||||
}
|
||||
else if (inRestartPeriod)
|
||||
{
|
||||
PlaySound(0x259);
|
||||
PlaySound(0x206);
|
||||
newQuest.AddConversation(new RecentlyFinishedConversation());
|
||||
var armor = Loot.RandomArmorOrShield();
|
||||
item = armor;
|
||||
|
||||
armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled(2, 3);
|
||||
armor.Durability = (ArmorDurabilityLevel)RandomMinMaxScaled(2, 3);
|
||||
}
|
||||
|
||||
cont.DropItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
if (player.BAC > 0)
|
||||
{
|
||||
cont.DropItem(new HangoverCure());
|
||||
}
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
if (player.PlaceInBackpack(cont))
|
||||
{
|
||||
var gainedPath = false;
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
// TODO: Check amount on OSI.
|
||||
if (VirtueSystem.Award(player, VirtueName.Sacrifice, 250, ref gainedPath))
|
||||
{
|
||||
player.SendLocalizedMessage(1054160); // You have gained in sacrifice.
|
||||
}
|
||||
|
||||
var version = reader.ReadInt();
|
||||
PlaySound(0x253);
|
||||
PlaySound(0x20);
|
||||
obj3.Complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
cont.Delete();
|
||||
// You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
|
||||
player.SendLocalizedMessage(1046260);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Server.Engines.Quests.Hag
|
|||
Timer.StartTimer(TimeSpan.FromSeconds(3.0), () => DeleteImp(imp));
|
||||
}
|
||||
|
||||
private void DeleteImp(Mobile m)
|
||||
private static void DeleteImp(Mobile m)
|
||||
{
|
||||
if (m?.Deleted == false)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue