From 75c58e252670d38d2097b8264cf8c991dfbd93e0 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:53:51 -0700 Subject: [PATCH] fix: Codegens doom items and mobs (#1541) --- .../The Summoning/Items/BellOfTheDead.cs | 223 ++++--- .../The Summoning/Items/ChylothShroud.cs | 36 +- .../The Summoning/Items/ChylothStaff.cs | 33 +- .../Quests/The Summoning/Items/GoldenSkull.cs | 42 +- .../The Summoning/Items/GrandGrimoire.cs | 44 +- .../The Summoning/Items/SummoningAltar.cs | 85 ++- .../Quests/The Summoning/Mobiles/Chyloth.cs | 547 ++++++++---------- .../Quests/The Summoning/Mobiles/Victoria.cs | 233 ++++---- .../Quests/The Summoning/Objectives.cs | 34 +- .../Quests/The Summoning/TheSummoningQuest.cs | 5 +- ....Engines.Quests.Doom.BellOfTheDead.v0.json | 16 + ...Server.Engines.Quests.Doom.Chyloth.v0.json | 4 + ....Engines.Quests.Doom.ChylothShroud.v0.json | 4 + ...r.Engines.Quests.Doom.ChylothStaff.v0.json | 4 + ...er.Engines.Quests.Doom.GoldenSkull.v0.json | 4 + ....Engines.Quests.Doom.GrandGrimoire.v0.json | 4 + ...Engines.Quests.Doom.SummoningAltar.v0.json | 11 + ...erver.Engines.Quests.Doom.Victoria.v0.json | 4 + 18 files changed, 605 insertions(+), 728 deletions(-) create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.BellOfTheDead.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Chyloth.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothShroud.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothStaff.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GoldenSkull.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GrandGrimoire.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.SummoningAltar.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Victoria.v0.json diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/BellOfTheDead.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/BellOfTheDead.cs index 161f3a44f..01e9ae4f9 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/BellOfTheDead.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/BellOfTheDead.cs @@ -1,134 +1,113 @@ using System; +using ModernUO.Serialization; using Server.Items; using Server.Mobiles; -namespace Server.Engines.Quests.Doom +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class BellOfTheDead : Item { - public class BellOfTheDead : Item + [SerializableField(0)] + [SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] + private Chyloth _chyloth; + + [SerializableField(1)] + [SerializedCommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] + private SkeletalDragon _dragon; + + [Constructible] + public BellOfTheDead() : base(0x91A) { - [Constructible] - public BellOfTheDead() : base(0x91A) + Hue = 0x835; + Movable = false; + } + + public override int LabelNumber => 1050018; // bell of the dead + + [CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] + public bool Summoning { get; set; } + + public override void OnDoubleClick(Mobile from) + { + if (from.InRange(GetWorldLocation(), 2)) { - Hue = 0x835; - Movable = false; + BeginSummon(from); } - - public BellOfTheDead(Serial serial) : base(serial) + else { - } - - public override int LabelNumber => 1050018; // bell of the dead - - [CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] - public Chyloth Chyloth { get; set; } - - [CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] - public SkeletalDragon Dragon { get; set; } - - [CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)] - public bool Summoning { get; set; } - - public override void OnDoubleClick(Mobile from) - { - if (from.InRange(GetWorldLocation(), 2)) - { - BeginSummon(from); - } - else - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. - } - } - - public virtual void BeginSummon(Mobile from) - { - if (Chyloth?.Deleted == false) - { - from.SendLocalizedMessage( - 1050010 - ); // The ferry man has already been summoned. There is no need to ring for him again. - } - else if (Dragon?.Deleted == false) - { - from.SendLocalizedMessage( - 1050017 - ); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. - } - else if (!Summoning) - { - Summoning = true; - - Effects.PlaySound(GetWorldLocation(), Map, 0x100); - - Timer.StartTimer(TimeSpan.FromSeconds(8.0), () => EndSummon(from)); - } - } - - public virtual void EndSummon(Mobile from) - { - if (Chyloth?.Deleted == false) - { - from.SendLocalizedMessage( - 1050010 - ); // The ferry man has already been summoned. There is no need to ring for him again. - } - else if (Dragon?.Deleted == false) - { - from.SendLocalizedMessage( - 1050017 - ); // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. - } - else if (Summoning) - { - Summoning = false; - - var loc = GetWorldLocation(); - - loc.Z -= 16; - - Effects.SendLocationParticles( - EffectItem.Create(loc, Map, EffectItem.DefaultDuration), - 0x3728, - 10, - 10, - 0, - 0, - 2023, - 0 - ); - Effects.PlaySound(loc, Map, 0x1FE); - - Chyloth = new Chyloth { Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc))) }; - - Chyloth.MoveToWorld(loc, Map); - - Chyloth.Bell = this; - Chyloth.AngryAt = from; - Chyloth.BeginGiveWarning(); - Chyloth.BeginRemove(TimeSpan.FromSeconds(40.0)); - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(Chyloth); - writer.Write(Dragon); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - Chyloth = reader.ReadEntity(); - Dragon = reader.ReadEntity(); - - Chyloth?.Delete(); + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } } + + public virtual void BeginSummon(Mobile from) + { + if (_chyloth?.Deleted == false) + { + // The ferry man has already been summoned. There is no need to ring for him again. + from.SendLocalizedMessage(1050010); + } + else if (_dragon?.Deleted == false) + { + // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. + from.SendLocalizedMessage(1050017); + } + else if (!Summoning) + { + Summoning = true; + + Effects.PlaySound(GetWorldLocation(), Map, 0x100); + + Timer.StartTimer(TimeSpan.FromSeconds(8.0), () => EndSummon(from)); + } + } + + public virtual void EndSummon(Mobile from) + { + if (_chyloth?.Deleted == false) + { + // The ferry man has already been summoned. There is no need to ring for him again. + from.SendLocalizedMessage(1050010); + } + else if (_dragon?.Deleted == false) + { + // The ferryman has recently been summoned already. You decide against ringing the bell again so soon. + from.SendLocalizedMessage(1050017); + } + else if (Summoning) + { + Summoning = false; + + var loc = GetWorldLocation(); + + loc.Z -= 16; + + Effects.SendLocationParticles( + EffectItem.Create(loc, Map, EffectItem.DefaultDuration), + 0x3728, + 10, + 10, + 0, + 0, + 2023, + 0 + ); + Effects.PlaySound(loc, Map, 0x1FE); + + Chyloth = new Chyloth { Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc))) }; + + Chyloth.MoveToWorld(loc, Map); + + Chyloth.Bell = this; + Chyloth.AngryAt = from; + Chyloth.BeginGiveWarning(); + Chyloth.BeginRemove(TimeSpan.FromSeconds(40.0)); + } + } + + [AfterDeserialization(false)] + private void AfterDeserialization() + { + _chyloth?.Delete(); + } } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothShroud.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothShroud.cs index 2dfcd8a7b..99a022afc 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothShroud.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothShroud.cs @@ -1,30 +1,14 @@ -namespace Server.Engines.Quests.Doom +using ModernUO.Serialization; + +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class ChylothShroud : Item { - public class ChylothShroud : Item + [Constructible] + public ChylothShroud() : base(0x204E) { - [Constructible] - public ChylothShroud() : base(0x204E) - { - Hue = 0x846; - Layer = Layer.OuterTorso; - } - - public ChylothShroud(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(); - } + Hue = 0x846; + Layer = Layer.OuterTorso; } } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothStaff.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothStaff.cs index f42d3dce8..919444d91 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothStaff.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/ChylothStaff.cs @@ -1,30 +1,13 @@ +using ModernUO.Serialization; using Server.Items; -namespace Server.Engines.Quests.Doom +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class ChylothStaff : BlackStaff { - public class ChylothStaff : BlackStaff - { - [Constructible] - public ChylothStaff() => Hue = 0x482; + [Constructible] + public ChylothStaff() => Hue = 0x482; - public ChylothStaff(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1041111; // a magic staff - - 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 => 1041111; // a magic staff } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/GoldenSkull.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/GoldenSkull.cs index 17d9f0527..0fff2f1b1 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/GoldenSkull.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/GoldenSkull.cs @@ -1,33 +1,17 @@ -namespace Server.Engines.Quests.Doom +using ModernUO.Serialization; + +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class GoldenSkull : Item { - public class GoldenSkull : Item + [Constructible] + public GoldenSkull() : base(Utility.Random(0x1AE2, 3)) { - [Constructible] - public GoldenSkull() : base(Utility.Random(0x1AE2, 3)) - { - Weight = 1.0; - Hue = 0x8A5; - LootType = LootType.Blessed; - } - - public GoldenSkull(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1061619; // a golden skull - - 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(); - } + Weight = 1.0; + Hue = 0x8A5; + LootType = LootType.Blessed; } + + public override int LabelNumber => 1061619; // a golden skull } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/GrandGrimoire.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/GrandGrimoire.cs index a5e5c8836..b646070d5 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/GrandGrimoire.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/GrandGrimoire.cs @@ -1,34 +1,18 @@ -namespace Server.Engines.Quests.Doom +using ModernUO.Serialization; + +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class GrandGrimoire : Item { - public class GrandGrimoire : Item + [Constructible] + public GrandGrimoire() : base(0xEFA) { - [Constructible] - public GrandGrimoire() : base(0xEFA) - { - Weight = 1.0; - Hue = 0x835; - Layer = Layer.OneHanded; - LootType = LootType.Blessed; - } - - public GrandGrimoire(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1060801; // The Grand Grimoire - - 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(); - } + Weight = 1.0; + Hue = 0x835; + Layer = Layer.OneHanded; + LootType = LootType.Blessed; } + + public override int LabelNumber => 1060801; // The Grand Grimoire } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Items/SummoningAltar.cs b/Projects/UOContent/Engines/Quests/The Summoning/Items/SummoningAltar.cs index 6951e14a9..d5ec6f24a 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Items/SummoningAltar.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Items/SummoningAltar.cs @@ -1,62 +1,45 @@ +using ModernUO.Serialization; using Server.Items; using Server.Mobiles; -namespace Server.Engines.Quests.Doom +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class SummoningAltar : AbbatoirAddon { - public class SummoningAltar : AbbatoirAddon + [Constructible] + public SummoningAltar() { - private BoneDemon m_Daemon; + } - [Constructible] - public SummoningAltar() + [SerializableProperty(0)] + public BoneDemon Daemon + { + get => _daemon; + set { - } - - public SummoningAltar(Serial serial) : base(serial) - { - } - - public BoneDemon Daemon - { - get => m_Daemon; - set - { - m_Daemon = value; - CheckDaemon(); - } - } - - public void CheckDaemon() - { - if (m_Daemon?.Alive != true) - { - m_Daemon = null; - Hue = 0; - } - else - { - Hue = 0x66D; - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_Daemon); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - m_Daemon = reader.ReadEntity(); - + _daemon = value; CheckDaemon(); + this.MarkDirty(); } } + + public void CheckDaemon() + { + if (_daemon?.Alive != true) + { + _daemon = null; + Hue = 0; + } + else + { + Hue = 0x66D; + } + } + + [AfterDeserialization] + private void AfterDeserialization() + { + CheckDaemon(); + } } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Chyloth.cs b/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Chyloth.cs index de59ed9f0..6ce75937b 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Chyloth.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Chyloth.cs @@ -1,361 +1,326 @@ using System; +using ModernUO.Serialization; using Server.Gumps; using Server.Items; using Server.Mobiles; using Server.Network; -namespace Server.Engines.Quests.Doom +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class Chyloth : BaseQuester { - public class Chyloth : BaseQuester + private static readonly int[] _offsets = { - private static readonly int[] m_Offsets = - { - -1, -1, - -1, 0, - -1, 1, - 0, -1, - 0, 1, - 1, -1, - 1, 0, - 1, 1 - }; + -1, -1, + -1, 0, + -1, 1, + 0, -1, + 0, 1, + 1, -1, + 1, 0, + 1, 1 + }; - [Constructible] - public Chyloth() : base("the Ferryman") + [Constructible] + public Chyloth() : base("the Ferryman") + { + } + + public override string DefaultName => "Chyloth"; + + public BellOfTheDead Bell { get; set; } + + public Mobile AngryAt { get; set; } + + public override void InitBody() + { + InitStats(100, 100, 25); + + Hue = 0x8455; + Body = 0x190; + } + + public override void InitOutfit() + { + EquipItem(new ChylothShroud()); + EquipItem(new ChylothStaff()); + } + + public virtual void BeginGiveWarning() + { + if (Deleted || AngryAt == null) { + return; } - public Chyloth(Serial serial) : base(serial) + Timer.StartTimer(TimeSpan.FromSeconds(4.0), EndGiveWarning); + } + + public virtual void EndGiveWarning() + { + if (Deleted || AngryAt == null) { + return; } - public override string DefaultName => "Chyloth"; + // You have summoned me in vain ~1_NAME~! Only the dead may cross! + PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050013, AngryAt.Name); + PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050014); // Why have you disturbed me, mortal?!? - public BellOfTheDead Bell { get; set; } + BeginSummonDragon(); + } - public Mobile AngryAt { get; set; } - - public override void InitBody() + public virtual void BeginSummonDragon() + { + if (Deleted || AngryAt == null) { - InitStats(100, 100, 25); - - Hue = 0x8455; - Body = 0x190; + return; } - public override void InitOutfit() + Timer.StartTimer(TimeSpan.FromSeconds(30.0), EndSummonDragon); + } + + public virtual void BeginRemove(TimeSpan delay) + { + Timer.StartTimer(delay, EndRemove); + } + + public virtual void EndRemove() + { + if (Deleted) { - EquipItem(new ChylothShroud()); - EquipItem(new ChylothStaff()); + return; } - public virtual void BeginGiveWarning() - { - if (Deleted || AngryAt == null) - { - return; - } + var loc = Location; + var map = Map; - Timer.StartTimer(TimeSpan.FromSeconds(4.0), EndGiveWarning); + Effects.SendLocationParticles( + EffectItem.Create(loc, map, EffectItem.DefaultDuration), + 0x3728, + 10, + 10, + 0, + 0, + 2023, + 0 + ); + Effects.PlaySound(loc, map, 0x1FE); + + Delete(); + } + + public virtual void EndSummonDragon() + { + if (Deleted || AngryAt == null) + { + return; } - public virtual void EndGiveWarning() + var map = AngryAt.Map; + + if (map == null) { - if (Deleted || AngryAt == null) - { - return; - } - - PublicOverheadMessage( - MessageType.Regular, - 0x3B2, - 1050013, - AngryAt.Name - ); // You have summoned me in vain ~1_NAME~! Only the dead may cross! - PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050014); // Why have you disturbed me, mortal?!? - - BeginSummonDragon(); + return; } - public virtual void BeginSummonDragon() + if (!AngryAt.Region.IsPartOf("Doom")) { - if (Deleted || AngryAt == null) - { - return; - } - - Timer.StartTimer(TimeSpan.FromSeconds(30.0), EndSummonDragon); + return; } - public virtual void BeginRemove(TimeSpan delay) + PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050015); // Feel the wrath of my legions!!! + PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "MUHAHAHAHA HAHAH HAHA"); // A wee bit crazy, aren't we? + + var dragon = new SkeletalDragon(); + + var offset = Utility.Random(8) * 2; + + var foundLoc = false; + + for (var i = 0; i < _offsets.Length; i += 2) { - Timer.StartTimer(delay, EndRemove); - } + var x = AngryAt.X + _offsets[(offset + i) % _offsets.Length]; + var y = AngryAt.Y + _offsets[(offset + i + 1) % _offsets.Length]; - public virtual void EndRemove() - { - if (Deleted) + if (map.CanSpawnMobile(x, y, AngryAt.Z)) { - return; + dragon.MoveToWorld(new Point3D(x, y, AngryAt.Z), map); + foundLoc = true; + break; } - var loc = Location; - var map = Map; + var z = map.GetAverageZ(x, y); - Effects.SendLocationParticles( - EffectItem.Create(loc, map, EffectItem.DefaultDuration), - 0x3728, - 10, - 10, - 0, - 0, - 2023, - 0 - ); - Effects.PlaySound(loc, map, 0x1FE); - - Delete(); - } - - public virtual void EndSummonDragon() - { - if (Deleted || AngryAt == null) + if (map.CanSpawnMobile(x, y, z)) { - return; - } - - var map = AngryAt.Map; - - if (map == null) - { - return; - } - - if (!AngryAt.Region.IsPartOf("Doom")) - { - return; - } - - PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050015); // Feel the wrath of my legions!!! - PublicOverheadMessage(MessageType.Regular, 0x3B2, false, "MUHAHAHAHA HAHAH HAHA"); // A wee bit crazy, aren't we? - - var dragon = new SkeletalDragon(); - - var offset = Utility.Random(8) * 2; - - var foundLoc = false; - - for (var i = 0; i < m_Offsets.Length; i += 2) - { - var x = AngryAt.X + m_Offsets[(offset + i) % m_Offsets.Length]; - var y = AngryAt.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; - - if (map.CanSpawnMobile(x, y, AngryAt.Z)) - { - dragon.MoveToWorld(new Point3D(x, y, AngryAt.Z), map); - foundLoc = true; - break; - } - - var z = map.GetAverageZ(x, y); - - if (map.CanSpawnMobile(x, y, z)) - { - dragon.MoveToWorld(new Point3D(x, y, z), map); - foundLoc = true; - break; - } - } - - if (!foundLoc) - { - dragon.MoveToWorld(AngryAt.Location, map); - } - - dragon.Combatant = AngryAt; - - if (Bell != null) - { - Bell.Dragon = dragon; + dragon.MoveToWorld(new Point3D(x, y, z), map); + foundLoc = true; + break; } } - public static void TeleportToFerry(Mobile from) + if (!foundLoc) { - var loc = new Point3D(408, 251, 2); - var map = Map.Malas; - - Effects.SendLocationParticles( - EffectItem.Create(loc, map, EffectItem.DefaultDuration), - 0x3728, - 10, - 10, - 0, - 0, - 2023, - 0 - ); - Effects.PlaySound(loc, map, 0x1FE); - - TeleportPets(from, loc, map); - - from.MoveToWorld(loc, map); + dragon.MoveToWorld(AngryAt.Location, map); } - public override bool OnDragDrop(Mobile from, Item dropped) + dragon.Combatant = AngryAt; + + if (Bell != null) { - if (dropped is GoldenSkull) - { - dropped.Delete(); - - PublicOverheadMessage( - MessageType.Regular, - 0x3B2, - 1050046, - from.Name - ); // Very well, ~1_NAME~, I accept your token. You may cross. - BeginRemove(TimeSpan.FromSeconds(4.0)); - - var p = PartySystem.Party.Get(from); - - for (var i = 0; i < p?.Members.Count; ++i) - { - var pmi = p.Members[i]; - var member = pmi.Mobile; - - if (member != from && member.Map == Map.Malas && member.Region.IsPartOf("Doom")) - { - if (AngryAt == member) - { - AngryAt = null; - } - - member.CloseGump(); - member.SendGump(new ChylothPartyGump(from, member)); - } - } - - if (AngryAt == from) - { - AngryAt = null; - } - - TeleportToFerry(from); - - return false; - } - - return base.OnDragDrop(from, dropped); - } - - public override bool CanTalkTo(PlayerMobile to) => false; - - public override void OnTalk(PlayerMobile player, bool contextMenu) - { - } - - 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(); + Bell.Dragon = dragon; } } - public class ChylothPartyGump : Gump + public static void TeleportToFerry(Mobile from) { - private readonly Mobile m_Leader; - private readonly Mobile m_Member; + var loc = new Point3D(408, 251, 2); + var map = Map.Malas; - public ChylothPartyGump(Mobile leader, Mobile member) : base(150, 50) + Effects.SendLocationParticles( + EffectItem.Create(loc, map, EffectItem.DefaultDuration), + 0x3728, + 10, + 10, + 0, + 0, + 2023, + 0 + ); + Effects.PlaySound(loc, map, 0x1FE); + + TeleportPets(from, loc, map); + + from.MoveToWorld(loc, map); + } + + public override bool OnDragDrop(Mobile from, Item dropped) + { + if (dropped is GoldenSkull) { - m_Leader = leader; - m_Member = member; + dropped.Delete(); - Closable = false; + // Very well, ~1_NAME~, I accept your token. You may cross. + PublicOverheadMessage(MessageType.Regular, 0x3B2, 1050046, from.Name); + BeginRemove(TimeSpan.FromSeconds(4.0)); - AddPage(0); + var p = PartySystem.Party.Get(from); - AddImage(0, 0, 3600); + for (var i = 0; i < p?.Members.Count; ++i) + { + var pmi = p.Members[i]; + var member = pmi.Mobile; - AddImageTiled(0, 14, 15, 200, 3603); - AddImageTiled(380, 14, 14, 200, 3605); - AddImage(0, 201, 3606); - AddImageTiled(15, 201, 370, 16, 3607); - AddImageTiled(15, 0, 370, 16, 3601); - AddImage(380, 0, 3602); - AddImage(380, 201, 3608); - AddImageTiled(15, 15, 365, 190, 2624); + if (member != from && member.Map == Map.Malas && member.Region.IsPartOf("Doom")) + { + if (AngryAt == member) + { + AngryAt = null; + } - AddRadio(30, 140, 9727, 9730, true, 1); - AddHtmlLocalized(65, 145, 300, 25, 1050050, 0x7FFF); // Yes, let's go! + member.CloseGump(); + member.SendGump(new ChylothPartyGump(from, member)); + } + } - AddRadio(30, 175, 9727, 9730, false, 0); - AddHtmlLocalized(65, 178, 300, 25, 1050049, 0x7FFF); // No thanks, I'd rather stay here. + if (AngryAt == from) + { + AngryAt = null; + } - AddHtmlLocalized( - 30, - 20, - 360, - 35, - 1050047, - 0x7FFF - ); // Another player has paid Chyloth for your passage across lake Mortis: + TeleportToFerry(from); - AddHtmlLocalized(30, 105, 345, 40, 1050048, 0x5B2D); // Do you wish to accept their invitation at this time? - - AddImage(65, 72, 5605); - - AddImageTiled(80, 90, 200, 1, 9107); - AddImageTiled(95, 92, 200, 1, 9157); - - AddLabel(90, 70, 1645, leader.Name); - - AddButton(290, 175, 247, 248, 2); - - AddImageTiled(15, 14, 365, 1, 9107); - AddImageTiled(380, 14, 1, 190, 9105); - AddImageTiled(15, 205, 365, 1, 9107); - AddImageTiled(15, 14, 1, 190, 9105); - AddImageTiled(0, 0, 395, 1, 9157); - AddImageTiled(394, 0, 1, 217, 9155); - AddImageTiled(0, 216, 395, 1, 9157); - AddImageTiled(0, 0, 1, 217, 9155); + return false; } - public override void OnResponse(NetState sender, RelayInfo info) - { - if (info.ButtonID == 2 && info.IsSwitched(1)) - { - if (m_Member.Region.IsPartOf("Doom")) - { - m_Leader.SendLocalizedMessage( - 1050054, - m_Member.Name - ); // ~1_NAME~ has accepted your invitation to cross lake Mortis. + return base.OnDragDrop(from, dropped); + } - Chyloth.TeleportToFerry(m_Member); - } - else - { - m_Member.SendLocalizedMessage(1050051); // The invitation has been revoked. - } + public override bool CanTalkTo(PlayerMobile to) => false; + + public override void OnTalk(PlayerMobile player, bool contextMenu) + { + } +} + +public class ChylothPartyGump : Gump +{ + private readonly Mobile _leader; + private readonly Mobile _member; + + public ChylothPartyGump(Mobile leader, Mobile member) : base(150, 50) + { + _leader = leader; + _member = member; + + Closable = false; + + AddPage(0); + + AddImage(0, 0, 3600); + + AddImageTiled(0, 14, 15, 200, 3603); + AddImageTiled(380, 14, 14, 200, 3605); + AddImage(0, 201, 3606); + AddImageTiled(15, 201, 370, 16, 3607); + AddImageTiled(15, 0, 370, 16, 3601); + AddImage(380, 0, 3602); + AddImage(380, 201, 3608); + AddImageTiled(15, 15, 365, 190, 2624); + + AddRadio(30, 140, 9727, 9730, true, 1); + AddHtmlLocalized(65, 145, 300, 25, 1050050, 0x7FFF); // Yes, let's go! + + AddRadio(30, 175, 9727, 9730, false, 0); + AddHtmlLocalized(65, 178, 300, 25, 1050049, 0x7FFF); // No thanks, I'd rather stay here. + + // Another player has paid Chyloth for your passage across lake Mortis: + AddHtmlLocalized(30, 20, 360, 35, 1050047, 0x7FFF); + + AddHtmlLocalized(30, 105, 345, 40, 1050048, 0x5B2D); // Do you wish to accept their invitation at this time? + + AddImage(65, 72, 5605); + + AddImageTiled(80, 90, 200, 1, 9107); + AddImageTiled(95, 92, 200, 1, 9157); + + AddLabel(90, 70, 1645, leader.Name); + + AddButton(290, 175, 247, 248, 2); + + AddImageTiled(15, 14, 365, 1, 9107); + AddImageTiled(380, 14, 1, 190, 9105); + AddImageTiled(15, 205, 365, 1, 9107); + AddImageTiled(15, 14, 1, 190, 9105); + AddImageTiled(0, 0, 395, 1, 9157); + AddImageTiled(394, 0, 1, 217, 9155); + AddImageTiled(0, 216, 395, 1, 9157); + AddImageTiled(0, 0, 1, 217, 9155); + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + if (info.ButtonID == 2 && info.IsSwitched(1)) + { + if (_member.Region.IsPartOf("Doom")) + { + // ~1_NAME~ has accepted your invitation to cross lake Mortis. + _leader.SendLocalizedMessage(1050054, _member.Name); + + Chyloth.TeleportToFerry(_member); } else { - m_Member.SendLocalizedMessage(1050052); // You have declined their invitation. - m_Leader.SendLocalizedMessage( - 1050053, - m_Member.Name - ); // ~1_NAME~ has declined your invitation to cross lake Mortis. + _member.SendLocalizedMessage(1050051); // The invitation has been revoked. } } + else + { + _member.SendLocalizedMessage(1050052); // You have declined their invitation. + // ~1_NAME~ has declined your invitation to cross lake Mortis. + _leader.SendLocalizedMessage(1050053, _member.Name); + } } } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Victoria.cs b/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Victoria.cs index 61a208174..69df4fed4 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Victoria.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Mobiles/Victoria.cs @@ -1,156 +1,139 @@ +using ModernUO.Serialization; using Server.Items; using Server.Mobiles; -namespace Server.Engines.Quests.Doom +namespace Server.Engines.Quests.Doom; + +[SerializationGenerator(0, false)] +public partial class Victoria : BaseQuester { - public class Victoria : BaseQuester + private const int AltarRange = 24; + + private SummoningAltar _altar; + + [Constructible] + public Victoria() : base("the Sorceress") { - private const int AltarRange = 24; + } - private SummoningAltar m_Altar; + public override int TalkNumber => 6159; // Ask about Chyloth + public override string DefaultName => "Victoria"; + public override bool ClickTitle => true; + public override bool IsActiveVendor => true; + public override bool DisallowAllMoves => false; - [Constructible] - public Victoria() : base("the Sorceress") + public SummoningAltar Altar + { + get { - } - - public Victoria(Serial serial) : base(serial) - { - } - - public override int TalkNumber => 6159; // Ask about Chyloth - public override string DefaultName => "Victoria"; - public override bool ClickTitle => true; - public override bool IsActiveVendor => true; - public override bool DisallowAllMoves => false; - - public SummoningAltar Altar - { - get + if (_altar?.Deleted != false || _altar.Map != Map || + !Utility.InRange(_altar.Location, Location, AltarRange)) { - if (m_Altar?.Deleted != false || m_Altar.Map != Map || - !Utility.InRange(m_Altar.Location, Location, AltarRange)) + foreach (var item in GetItemsInRange(AltarRange)) { - foreach (var item in GetItemsInRange(AltarRange)) + if (item is SummoningAltar altar) { - if (item is SummoningAltar altar) - { - m_Altar = altar; - break; - } - } - } - - return m_Altar; - } - } - - public override void InitSBInfo() - { - _sbInfos.Add(new SBMage()); - } - - public override void InitBody() - { - InitStats(100, 100, 25); - - Female = true; - Hue = 0x8835; - Body = 0x191; - } - - public override void InitOutfit() - { - EquipItem(new GrandGrimoire()); - - EquipItem(SetHue(new Sandals(), 0x455)); - EquipItem(SetHue(new SkullCap(), 0x455)); - EquipItem(SetHue(new PlainDress(), 0x455)); - - HairItemID = 0x203C; - HairHue = 0x482; - } - - public override bool OnDragDrop(Mobile from, Item dropped) - { - if (from is PlayerMobile player) - { - var qs = player.Quest; - - if (qs is TheSummoningQuest) - { - if (dropped is DaemonBone bones) - { - QuestObjective obj = qs.FindObjective(); - - if (obj?.Completed == false) - { - var need = obj.MaxProgress - obj.CurProgress; - - if (bones.Amount < need) - { - obj.CurProgress += bones.Amount; - bones.Delete(); - - qs.ShowQuestLogUpdated(); - } - else - { - obj.Complete(); - bones.Consume(need); - - if (!bones.Deleted) - { - SayTo( - from, - 1050038 - ); // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. - } - } - } - else - { - // TODO: Accurate? - SayTo( - from, - 1050038 - ); // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. - } - - return false; + _altar = altar; + break; } } } + return _altar; + } + } + + public override void InitSBInfo() + { + _sbInfos.Add(new SBMage()); + } + + public override void InitBody() + { + InitStats(100, 100, 25); + + Female = true; + Hue = 0x8835; + Body = 0x191; + } + + public override void InitOutfit() + { + EquipItem(new GrandGrimoire()); + + EquipItem(SetHue(new Sandals(), 0x455)); + EquipItem(SetHue(new SkullCap(), 0x455)); + EquipItem(SetHue(new PlainDress(), 0x455)); + + HairItemID = 0x203C; + HairHue = 0x482; + } + + public override bool OnDragDrop(Mobile from, Item dropped) + { + if (from is not PlayerMobile player) + { return base.OnDragDrop(from, dropped); } - public override bool CanTalkTo(PlayerMobile to) => - to.Quest == null && QuestSystem.CanOfferQuest(to, typeof(TheSummoningQuest)); + var qs = player.Quest; - public override void OnTalk(PlayerMobile player, bool contextMenu) + if (qs is not TheSummoningQuest) { - var qs = player.Quest; + return base.OnDragDrop(from, dropped); + } - if (qs == null && QuestSystem.CanOfferQuest(player, typeof(TheSummoningQuest))) + if (dropped is not DaemonBone bones) + { + return base.OnDragDrop(from, dropped); + } + + QuestObjective obj = qs.FindObjective(); + + if (obj?.Completed == false) + { + var need = obj.MaxProgress - obj.CurProgress; + + if (bones.Amount < need) { - Direction = GetDirectionTo(player); - new TheSummoningQuest(this, player).SendOffer(); + obj.CurProgress += bones.Amount; + bones.Delete(); + + qs.ShowQuestLogUpdated(); + } + else + { + obj.Complete(); + bones.Consume(need); + + if (!bones.Deleted) + { + // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. + SayTo(from, 1050038); + } } } - - public override void Serialize(IGenericWriter writer) + else { - base.Serialize(writer); - - writer.Write(0); // version + // TODO: Accurate? + // You have already given me all the Daemon bones necessary to weave the spell. Keep these for a later time. + SayTo(from, 1050038); } - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); + return false; + } - var version = reader.ReadInt(); + public override bool CanTalkTo(PlayerMobile to) => + to.Quest == null && QuestSystem.CanOfferQuest(to, typeof(TheSummoningQuest)); + + public override void OnTalk(PlayerMobile player, bool contextMenu) + { + var qs = player.Quest; + + if (qs == null && QuestSystem.CanOfferQuest(player, typeof(TheSummoningQuest))) + { + Direction = GetDirectionTo(player); + new TheSummoningQuest(this, player).SendOffer(); } } } diff --git a/Projects/UOContent/Engines/Quests/The Summoning/Objectives.cs b/Projects/UOContent/Engines/Quests/The Summoning/Objectives.cs index 43f88f3e0..d4a2cfed7 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/Objectives.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/Objectives.cs @@ -46,16 +46,8 @@ namespace Server.Engines.Quests.Doom { if (CurProgress > 0 && CurProgress < MaxProgress) { - gump.AddHtmlObject( - 70, - 130, - 300, - 100, - 1050028, - BaseQuestGump.Blue, - false, - false - ); // Victoria has accepted the Daemon bones, but the requirement is not yet met. + // Victoria has accepted the Daemon bones, but the requirement is not yet met. + gump.AddHtmlObject(70, 130, 300, 100, 1050028, BaseQuestGump.Blue, false, false); } else { @@ -67,16 +59,8 @@ namespace Server.Engines.Quests.Doom { if (CurProgress > 0 && CurProgress < MaxProgress) { - gump.AddHtmlObject( - 70, - 260, - 270, - 100, - 1050019, - BaseQuestGump.Blue, - false, - false - ); // Number of bones collected: + // Number of bones collected: + gump.AddHtmlObject(70, 260, 270, 100, 1050019, BaseQuestGump.Blue, false, false); gump.AddLabel(70, 280, 100, CurProgress.ToString()); gump.AddLabel(100, 280, 100, "/"); @@ -124,9 +108,8 @@ namespace Server.Engines.Quests.Doom if (!from.Alive) { - from.SendLocalizedMessage( - 1050033 - ); // The devourer lies dead, unfortunately so do you. You cannot claim your reward while dead. You will need to face him again. + // The devourer lies dead, unfortunately so do you. You cannot claim your reward while dead. You will need to face him again. + from.SendLocalizedMessage(1050033); ((TheSummoningQuest)System).WaitForSummon = true; } else @@ -152,9 +135,8 @@ namespace Server.Engines.Quests.Doom if (!hasRights) { - from.SendLocalizedMessage( - 1050034 - ); // The devourer lies dead. Unfortunately you did not sufficiently prove your worth in combating the devourer. Victoria shall summon another incarnation of the devourer to the circle of stones. Try again noble adventurer. + // The devourer lies dead. Unfortunately you did not sufficiently prove your worth in combating the devourer. Victoria shall summon another incarnation of the devourer to the circle of stones. Try again noble adventurer. + from.SendLocalizedMessage(1050034); ((TheSummoningQuest)System).WaitForSummon = true; } else diff --git a/Projects/UOContent/Engines/Quests/The Summoning/TheSummoningQuest.cs b/Projects/UOContent/Engines/Quests/The Summoning/TheSummoningQuest.cs index 61e299481..450526b2b 100644 --- a/Projects/UOContent/Engines/Quests/The Summoning/TheSummoningQuest.cs +++ b/Projects/UOContent/Engines/Quests/The Summoning/TheSummoningQuest.cs @@ -88,9 +88,8 @@ namespace Server.Engines.Quests.Doom { From.BankBox.DropItem(new DaemonBone(obj.CurProgress)); - From.SendLocalizedMessage( - 1050030 - ); // The Daemon bones that you have thus far given to Victoria have been returned to you. + // The Daemon bones that you have thus far given to Victoria have been returned to you. + From.SendLocalizedMessage(1050030); } } diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.BellOfTheDead.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.BellOfTheDead.v0.json new file mode 100644 index 000000000..ab85f81fd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.BellOfTheDead.v0.json @@ -0,0 +1,16 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.BellOfTheDead", + "properties": [ + { + "name": "Chyloth", + "type": "Server.Engines.Quests.Doom.Chyloth", + "rule": "SerializableInterfaceMigrationRule" + }, + { + "name": "Dragon", + "type": "Server.Mobiles.SkeletalDragon", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Chyloth.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Chyloth.v0.json new file mode 100644 index 000000000..a5aed50cf --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Chyloth.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.Chyloth" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothShroud.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothShroud.v0.json new file mode 100644 index 000000000..72402da72 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothShroud.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.ChylothShroud" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothStaff.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothStaff.v0.json new file mode 100644 index 000000000..5f70edcb4 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.ChylothStaff.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.ChylothStaff" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GoldenSkull.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GoldenSkull.v0.json new file mode 100644 index 000000000..5c1d988fa --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GoldenSkull.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.GoldenSkull" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GrandGrimoire.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GrandGrimoire.v0.json new file mode 100644 index 000000000..bf3be9dbd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.GrandGrimoire.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.GrandGrimoire" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.SummoningAltar.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.SummoningAltar.v0.json new file mode 100644 index 000000000..c8af1c569 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.SummoningAltar.v0.json @@ -0,0 +1,11 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.SummoningAltar", + "properties": [ + { + "name": "Daemon", + "type": "Server.Mobiles.BoneDemon", + "rule": "SerializableInterfaceMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Victoria.v0.json b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Victoria.v0.json new file mode 100644 index 000000000..91556be85 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.Quests.Doom.Victoria.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.Quests.Doom.Victoria" +} \ No newline at end of file