diff --git a/Projects/UOContent/Items/Traps/FlameSpurtTrap.cs b/Projects/UOContent/Items/Traps/FlameSpurtTrap.cs index dd62f9c02..5769db6a8 100644 --- a/Projects/UOContent/Items/Traps/FlameSpurtTrap.cs +++ b/Projects/UOContent/Items/Traps/FlameSpurtTrap.cs @@ -7,6 +7,7 @@ namespace Server.Items; [SerializationGenerator(0, false)] public partial class FlameSpurtTrap : BaseTrap { + [SerializableField(0)] private Item _spurt; private TimerExecutionToken _timerToken; diff --git a/Projects/UOContent/Migrations/Server.Items.FlameSpurtTrap.v0.json b/Projects/UOContent/Migrations/Server.Items.FlameSpurtTrap.v0.json index 27e1b2076..1e92a8ec5 100644 --- a/Projects/UOContent/Migrations/Server.Items.FlameSpurtTrap.v0.json +++ b/Projects/UOContent/Migrations/Server.Items.FlameSpurtTrap.v0.json @@ -1,4 +1,11 @@ { "version": 0, - "type": "Server.Items.FlameSpurtTrap" + "type": "Server.Items.FlameSpurtTrap", + "properties": [ + { + "name": "Spurt", + "type": "Server.Item", + "rule": "SerializableInterfaceMigrationRule" + } + ] } \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.BaseHealer.v2.json b/Projects/UOContent/Migrations/Server.Mobiles.BaseHealer.v2.json new file mode 100644 index 000000000..6105381bb --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.BaseHealer.v2.json @@ -0,0 +1,4 @@ +{ + "version": 2, + "type": "Server.Mobiles.BaseHealer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.EvilHealer.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.EvilHealer.v0.json new file mode 100644 index 000000000..52fbfda79 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.EvilHealer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Mobiles.EvilHealer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.EvilWanderingHealer.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.EvilWanderingHealer.v0.json new file mode 100644 index 000000000..cd7ea602a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.EvilWanderingHealer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Mobiles.EvilWanderingHealer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.FortuneTeller.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.FortuneTeller.v0.json new file mode 100644 index 000000000..9e50a11fa --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.FortuneTeller.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Mobiles.FortuneTeller" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.Healer.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.Healer.v0.json new file mode 100644 index 000000000..aa5478f53 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.Healer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Mobiles.Healer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.PricedHealer.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.PricedHealer.v0.json new file mode 100644 index 000000000..158232346 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.PricedHealer.v0.json @@ -0,0 +1,14 @@ +{ + "version": 0, + "type": "Server.Mobiles.PricedHealer", + "properties": [ + { + "name": "Price", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Mobiles.WanderingHealer.v0.json b/Projects/UOContent/Migrations/Server.Mobiles.WanderingHealer.v0.json new file mode 100644 index 000000000..d40b585b3 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Mobiles.WanderingHealer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Mobiles.WanderingHealer" +} \ No newline at end of file diff --git a/Projects/UOContent/Mobiles/Healers/BaseHealer.cs b/Projects/UOContent/Mobiles/Healers/BaseHealer.cs index 8697a153f..5a6697875 100644 --- a/Projects/UOContent/Mobiles/Healers/BaseHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/BaseHealer.cs @@ -1,158 +1,157 @@ using System; using System.Collections.Generic; +using System.IO; +using ModernUO.Serialization; using Server.Gumps; using Server.Items; -namespace Server.Mobiles +namespace Server.Mobiles; + +[SerializationGenerator(2, false)] +public abstract partial class BaseHealer : BaseVendor { - public abstract class BaseHealer : BaseVendor + private static readonly TimeSpan ResurrectDelay = TimeSpan.FromSeconds(2.0); + + private DateTime _nextResurrect; + + public BaseHealer() { - private static readonly TimeSpan ResurrectDelay = TimeSpan.FromSeconds(2.0); - - private DateTime m_NextResurrect; - - public BaseHealer() + if (!IsInvulnerable) { - if (!IsInvulnerable) - { - AI = AIType.AI_Mage; - ActiveSpeed = 0.2; - PassiveSpeed = 0.8; - RangePerception = DefaultRangePerception; - FightMode = FightMode.Aggressor; - } - - SpeechHue = 0; - - SetStr(304, 400); - SetDex(102, 150); - SetInt(204, 300); - - SetDamage(10, 23); - - SetDamageType(ResistanceType.Physical, 100); - - SetResistance(ResistanceType.Physical, 40, 50); - SetResistance(ResistanceType.Fire, 40, 50); - SetResistance(ResistanceType.Cold, 40, 50); - SetResistance(ResistanceType.Poison, 40, 50); - SetResistance(ResistanceType.Energy, 40, 50); - - SetSkill(SkillName.Anatomy, 75.0, 97.5); - SetSkill(SkillName.EvalInt, 82.0, 100.0); - SetSkill(SkillName.Healing, 75.0, 97.5); - SetSkill(SkillName.Magery, 82.0, 100.0); - SetSkill(SkillName.MagicResist, 82.0, 100.0); - SetSkill(SkillName.Tactics, 82.0, 100.0); - - Fame = 1000; - Karma = 10000; - - PackItem(new Bandage(Utility.RandomMinMax(5, 10))); - PackItem(new HealPotion()); - PackItem(new CurePotion()); + AI = AIType.AI_Mage; + ActiveSpeed = 0.2; + PassiveSpeed = 0.8; + RangePerception = DefaultRangePerception; + FightMode = FightMode.Aggressor; } - public BaseHealer(Serial serial) : base(serial) + SpeechHue = 0; + + SetStr(304, 400); + SetDex(102, 150); + SetInt(204, 300); + + SetDamage(10, 23); + + SetDamageType(ResistanceType.Physical, 100); + + SetResistance(ResistanceType.Physical, 40, 50); + SetResistance(ResistanceType.Fire, 40, 50); + SetResistance(ResistanceType.Cold, 40, 50); + SetResistance(ResistanceType.Poison, 40, 50); + SetResistance(ResistanceType.Energy, 40, 50); + + SetSkill(SkillName.Anatomy, 75.0, 97.5); + SetSkill(SkillName.EvalInt, 82.0, 100.0); + SetSkill(SkillName.Healing, 75.0, 97.5); + SetSkill(SkillName.Magery, 82.0, 100.0); + SetSkill(SkillName.MagicResist, 82.0, 100.0); + SetSkill(SkillName.Tactics, 82.0, 100.0); + + Fame = 1000; + Karma = 10000; + + PackItem(new Bandage(Utility.RandomMinMax(5, 10))); + PackItem(new HealPotion()); + PackItem(new CurePotion()); + } + + protected override List SBInfos { get; } = new(); + + public override bool IsActiveVendor => false; + public override bool IsInvulnerable => false; + + public override VendorShoeType ShoeType => VendorShoeType.Sandals; + + public virtual bool HealsYoungPlayers => true; + + public override void InitSBInfo() + { + } + + public virtual int GetRobeColor() => Utility.RandomYellowHue(); + + public override void InitOutfit() + { + base.InitOutfit(); + + AddItem(new Robe(GetRobeColor())); + } + + public virtual bool CheckResurrect(Mobile m) => true; + + public virtual void OfferResurrection(Mobile m) + { + Direction = GetDirectionTo(m); + + m.PlaySound(0x1F2); + m.FixedEffect(0x376A, 10, 16); + + m.CloseGump(); + m.SendGump(new ResurrectGump(m, ResurrectMessage.Healer)); + } + + public virtual void OfferHeal(PlayerMobile m) + { + Direction = GetDirectionTo(m); + + if (m.CheckYoungHealTime()) { - } - - protected override List SBInfos { get; } = new(); - - public override bool IsActiveVendor => false; - public override bool IsInvulnerable => false; - - public override VendorShoeType ShoeType => VendorShoeType.Sandals; - - public virtual bool HealsYoungPlayers => true; - - public override void InitSBInfo() - { - } - - public virtual int GetRobeColor() => Utility.RandomYellowHue(); - - public override void InitOutfit() - { - base.InitOutfit(); - - AddItem(new Robe(GetRobeColor())); - } - - public virtual bool CheckResurrect(Mobile m) => true; - - public virtual void OfferResurrection(Mobile m) - { - Direction = GetDirectionTo(m); + Say(501229); // You look like you need some healing my child. m.PlaySound(0x1F2); - m.FixedEffect(0x376A, 10, 16); + m.FixedEffect(0x376A, 9, 32); - m.CloseGump(); - m.SendGump(new ResurrectGump(m, ResurrectMessage.Healer)); + m.Hits = m.HitsMax; } - - public virtual void OfferHeal(PlayerMobile m) + else { - Direction = GetDirectionTo(m); - - if (m.CheckYoungHealTime()) - { - Say(501229); // You look like you need some healing my child. - - m.PlaySound(0x1F2); - m.FixedEffect(0x376A, 9, 32); - - m.Hits = m.HitsMax; - } - else - { - Say(501228); // I can do no more for you at this time. - } + Say(501228); // I can do no more for you at this time. } + } - public override void OnMovement(Mobile m, Point3D oldLocation) + public override void OnMovement(Mobile m, Point3D oldLocation) + { + if (!m.Frozen && Core.Now >= _nextResurrect && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m)) { - if (!m.Frozen && Core.Now >= m_NextResurrect && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m)) + if (!m.Alive) { - if (!m.Alive) + _nextResurrect = Core.Now + ResurrectDelay; + + if (m.Map?.CanFit(m.Location, 16, false, false) != true) { - m_NextResurrect = Core.Now + ResurrectDelay; - - if (m.Map?.CanFit(m.Location, 16, false, false) != true) - { - m.SendLocalizedMessage(502391); // Thou can not be resurrected there! - } - else if (CheckResurrect(m)) - { - OfferResurrection(m); - } + m.SendLocalizedMessage(502391); // Thou can not be resurrected there! } - else if (HealsYoungPlayers && m.Hits < m.HitsMax && m is PlayerMobile mobile && mobile.Young) + else if (CheckResurrect(m)) { - OfferHeal(mobile); + OfferResurrection(m); } } - } - - // ReSharper disable once RedundantOverriddenMember - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - if (!IsInvulnerable) + else if (HealsYoungPlayers && m.Hits < m.HitsMax && m is PlayerMobile mobile && mobile.Young) { - AI = AIType.AI_Mage; - ActiveSpeed = 0.2; - PassiveSpeed = 0.8; - RangePerception = DefaultRangePerception; - FightMode = FightMode.Aggressor; + OfferHeal(mobile); } } } + + private void Deserialize(IGenericReader reader, int version) + { + // NOTE: This is to fix a previous RunUO serialiation issue with this class: + // This would be a breaking change if there is a derived class that is version 2 or higher + // If that is the case, change the SerializationGenerator to a version higher than that before merging this change + reader.Seek(-4, SeekOrigin.Current); + } + + [AfterDeserialization] + private void AfterDeserialization() + { + if (!IsInvulnerable) + { + AI = AIType.AI_Mage; + ActiveSpeed = 0.2; + PassiveSpeed = 0.8; + RangePerception = DefaultRangePerception; + FightMode = FightMode.Aggressor; + } + } } diff --git a/Projects/UOContent/Mobiles/Healers/EvilHealer.cs b/Projects/UOContent/Mobiles/Healers/EvilHealer.cs index 02fcbeb7d..61aae34a5 100644 --- a/Projects/UOContent/Mobiles/Healers/EvilHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/EvilHealer.cs @@ -1,66 +1,50 @@ -namespace Server.Mobiles +using ModernUO.Serialization; + +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class EvilHealer : BaseHealer { - public class EvilHealer : BaseHealer + [Constructible] + public EvilHealer() { - [Constructible] - public EvilHealer() + Title = "the healer"; + + Karma = -10000; + + SetSkill(SkillName.Forensics, 80.0, 100.0); + SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + SetSkill(SkillName.Swords, 80.0, 100.0); + } + + public override bool CanTeach => true; + + public override bool AlwaysMurderer => true; + public override bool IsActiveVendor => true; + + public override bool CheckTeach(SkillName skill, Mobile from) + { + if (!base.CheckTeach(skill, from)) { - Title = "the healer"; - - Karma = -10000; - - SetSkill(SkillName.Forensics, 80.0, 100.0); - SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); - SetSkill(SkillName.Swords, 80.0, 100.0); + return false; } - public EvilHealer(Serial serial) : base(serial) + return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; + } + + public override void InitSBInfo() + { + SBInfos.Add(new SBHealer()); + } + + public override bool CheckResurrect(Mobile m) + { + if (Core.AOS && m.Criminal) { + Say(501222); // Thou art a criminal. I shall not resurrect thee. + return false; } - public override bool CanTeach => true; - - public override bool AlwaysMurderer => true; - public override bool IsActiveVendor => true; - - public override bool CheckTeach(SkillName skill, Mobile from) - { - if (!base.CheckTeach(skill, from)) - { - return false; - } - - return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; - } - - public override void InitSBInfo() - { - SBInfos.Add(new SBHealer()); - } - - public override bool CheckResurrect(Mobile m) - { - if (Core.AOS && m.Criminal) - { - Say(501222); // Thou art a criminal. I shall not resurrect thee. - return false; - } - - return true; - } - - 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(); - } + return true; } } diff --git a/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs b/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs index 10ea0634f..0058ffd3c 100644 --- a/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs @@ -1,79 +1,57 @@ +using ModernUO.Serialization; using Server.Items; -namespace Server.Mobiles +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class EvilWanderingHealer : BaseHealer { - public class EvilWanderingHealer : BaseHealer + [Constructible] + public EvilWanderingHealer() { - [Constructible] - public EvilWanderingHealer() + Title = Core.AOS ? "the priest Of Mondain" : "the evil wandering healer"; + Karma = -10000; + + AddItem(new GnarledStaff()); + + SetSkill(SkillName.Camping, 80.0, 100.0); + SetSkill(SkillName.Forensics, 80.0, 100.0); + SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + } + + public override bool CanTeach => true; + + public override bool AlwaysMurderer => true; + public override bool ClickTitle => false; // Do not display title in OnSingleClick + + public override bool CheckTeach(SkillName skill, Mobile from) + { + if (!base.CheckTeach(skill, from)) { - Title = Core.AOS ? "the Priest Of Mondain" : "the evil wandering healer"; - Karma = -10000; - - AddItem(new GnarledStaff()); - - SetSkill(SkillName.Camping, 80.0, 100.0); - SetSkill(SkillName.Forensics, 80.0, 100.0); - SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + return false; } - public EvilWanderingHealer(Serial serial) : base(serial) + return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; + } + + public override bool CheckResurrect(Mobile m) + { + if (Core.AOS && m.Criminal) { + Say(501222); // Thou art a criminal. I shall not resurrect thee. + return false; } - public override bool CanTeach => true; + return true; + } - public override bool AlwaysMurderer => true; - public override bool ClickTitle => false; // Do not display title in OnSingleClick + public override void OnDeath(Container c) + { + base.OnDeath(c); - public override bool CheckTeach(SkillName skill, Mobile from) + if (Utility.RandomBool()) { - if (!base.CheckTeach(skill, from)) - { - return false; - } - - return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; - } - - public override bool CheckResurrect(Mobile m) - { - if (Core.AOS && m.Criminal) - { - Say(501222); // Thou art a criminal. I shall not resurrect thee. - return false; - } - - return true; - } - - public override void OnDeath(Container c) - { - base.OnDeath(c); - - if (Utility.RandomBool()) - { - c.DropItem(new FragmentOfAMap()); - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && Title == "the wandering healer" && Core.AOS) - { - Title = "the priest of Mondain"; - } + c.DropItem(new FragmentOfAMap()); } } } diff --git a/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs b/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs index fbd3a3fed..135b4b0d5 100644 --- a/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs +++ b/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs @@ -1,79 +1,62 @@ +using ModernUO.Serialization; using Server.Items; -namespace Server.Mobiles +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class FortuneTeller : BaseHealer { - public class FortuneTeller : BaseHealer + [Constructible] + public FortuneTeller() { - [Constructible] - public FortuneTeller() - { - Title = "the fortune teller"; + Title = "the fortune teller"; - SetSkill(SkillName.Anatomy, 85.0, 100.0); - SetSkill(SkillName.Healing, 90.0, 100.0); - SetSkill(SkillName.Forensics, 75.0, 98.0); - SetSkill(SkillName.SpiritSpeak, 65.0, 88.0); + SetSkill(SkillName.Anatomy, 85.0, 100.0); + SetSkill(SkillName.Healing, 90.0, 100.0); + SetSkill(SkillName.Forensics, 75.0, 98.0); + SetSkill(SkillName.SpiritSpeak, 65.0, 88.0); + } + + public override bool CanTeach => true; + + public override bool IsActiveVendor => true; + public override bool IsInvulnerable => true; + + public override bool CheckTeach(SkillName skill, Mobile from) + { + if (!base.CheckTeach(skill, from)) + { + return false; } - public FortuneTeller(Serial serial) : base(serial) + return skill is SkillName.Anatomy or SkillName.Healing or SkillName.Forensics or SkillName.SpiritSpeak; + } + + public override void InitSBInfo() + { + SBInfos.Add(new SBMage()); + SBInfos.Add(new SBFortuneTeller()); + } + + public override int GetRobeColor() => Utility.RandomBrightHue(); + + public override void InitOutfit() + { + base.InitOutfit(); + + switch (Utility.Random(3)) { + case 0: + AddItem(new SkullCap(Utility.RandomBrightHue())); + break; + case 1: + AddItem(new WizardsHat(Utility.RandomBrightHue())); + break; + case 2: + AddItem(new Bandana(Utility.RandomBrightHue())); + break; } - public override bool CanTeach => true; - - public override bool IsActiveVendor => true; - public override bool IsInvulnerable => true; - - public override bool CheckTeach(SkillName skill, Mobile from) - { - if (!base.CheckTeach(skill, from)) - { - return false; - } - - return skill is SkillName.Anatomy or SkillName.Healing or SkillName.Forensics or SkillName.SpiritSpeak; - } - - public override void InitSBInfo() - { - SBInfos.Add(new SBMage()); - SBInfos.Add(new SBFortuneTeller()); - } - - public override int GetRobeColor() => Utility.RandomBrightHue(); - - public override void InitOutfit() - { - base.InitOutfit(); - - switch (Utility.Random(3)) - { - case 0: - AddItem(new SkullCap(Utility.RandomBrightHue())); - break; - case 1: - AddItem(new WizardsHat(Utility.RandomBrightHue())); - break; - case 2: - AddItem(new Bandana(Utility.RandomBrightHue())); - break; - } - - AddItem(new Spellbook()); - } - - 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(); - } + AddItem(new Spellbook()); } } diff --git a/Projects/UOContent/Mobiles/Healers/Healer.cs b/Projects/UOContent/Mobiles/Healers/Healer.cs index 47eecff5c..3d01a66a3 100644 --- a/Projects/UOContent/Mobiles/Healers/Healer.cs +++ b/Projects/UOContent/Mobiles/Healers/Healer.cs @@ -1,85 +1,64 @@ -namespace Server.Mobiles +using ModernUO.Serialization; + +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class Healer : BaseHealer { - public class Healer : BaseHealer + [Constructible] + public Healer() { - [Constructible] - public Healer() + Title = "the healer"; + + if (!Core.AOS) { - Title = "the healer"; - - if (!Core.AOS) - { - NameHue = 0x35; - } - - SetSkill(SkillName.Forensics, 80.0, 100.0); - SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); - SetSkill(SkillName.Swords, 80.0, 100.0); + NameHue = 0x35; } - public Healer(Serial serial) : base(serial) + SetSkill(SkillName.Forensics, 80.0, 100.0); + SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + SetSkill(SkillName.Swords, 80.0, 100.0); + } + + public override bool CanTeach => true; + + public override bool IsActiveVendor => true; + public override bool IsInvulnerable => true; + + public override bool CheckTeach(SkillName skill, Mobile from) + { + if (!base.CheckTeach(skill, from)) { + return false; } - public override bool CanTeach => true; + return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; + } - public override bool IsActiveVendor => true; - public override bool IsInvulnerable => true; + public override void InitSBInfo() + { + SBInfos.Add(new SBHealer()); + } - public override bool CheckTeach(SkillName skill, Mobile from) + public override bool CheckResurrect(Mobile m) + { + if (m.Criminal) { - if (!base.CheckTeach(skill, from)) - { - return false; - } - - return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; + Say(501222); // Thou art a criminal. I shall not resurrect thee. + return false; } - public override void InitSBInfo() + if (m.Kills >= 5) { - SBInfos.Add(new SBHealer()); + Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee. + return false; } - public override bool CheckResurrect(Mobile m) + if (m.Karma < 0) { - if (m.Criminal) - { - Say(501222); // Thou art a criminal. I shall not resurrect thee. - return false; - } - - if (m.Kills >= 5) - { - Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee. - return false; - } - - if (m.Karma < 0) - { - Say(501224); // Thou hast strayed from the path of virtue, but thou still deservest a second chance. - } - - return true; + Say(501224); // Thou hast strayed from the path of virtue, but thou still deservest a second chance. } - 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(); - - if (Core.AOS && NameHue == 0x35) - { - NameHue = -1; - } - } + return true; } } diff --git a/Projects/UOContent/Mobiles/Healers/PricedHealer.cs b/Projects/UOContent/Mobiles/Healers/PricedHealer.cs index 030c9e3e1..e6ce63efa 100644 --- a/Projects/UOContent/Mobiles/Healers/PricedHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/PricedHealer.cs @@ -1,71 +1,44 @@ +using ModernUO.Serialization; using Server.Gumps; -namespace Server.Mobiles +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class PricedHealer : BaseHealer { - public class PricedHealer : BaseHealer + [SerializableField(0)] + [SerializedCommandProperty(AccessLevel.GameMaster)] + private int _price; + + [Constructible] + public PricedHealer(int price = 5000) { - [Constructible] - public PricedHealer(int price = 5000) + Price = price; + + if (!Core.AOS) { - Price = price; - - if (!Core.AOS) - { - NameHue = 0x35; - } - } - - public PricedHealer(Serial serial) : base(serial) - { - } - - [CommandProperty(AccessLevel.GameMaster)] - public int Price { get; set; } - - public override bool IsInvulnerable => true; - - public override bool HealsYoungPlayers => false; - - public override void InitSBInfo() - { - } - - public override void OfferResurrection(Mobile m) - { - Direction = GetDirectionTo(m); - - m.PlaySound(0x214); - m.FixedEffect(0x376A, 10, 16); - - m.CloseGump(); - m.SendGump(new ResurrectGump(m, this, Price)); - } - - public override bool CheckResurrect(Mobile m) => true; - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(Price); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 0: - { - Price = reader.ReadInt(); - break; - } - } + NameHue = 0x35; } } + + public override bool IsInvulnerable => true; + + public override bool HealsYoungPlayers => false; + + public override void InitSBInfo() + { + } + + public override void OfferResurrection(Mobile m) + { + Direction = GetDirectionTo(m); + + m.PlaySound(0x214); + m.FixedEffect(0x376A, 10, 16); + + m.CloseGump(); + m.SendGump(new ResurrectGump(m, this, Price)); + } + + public override bool CheckResurrect(Mobile m) => true; } diff --git a/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs b/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs index 036b8741c..75ccb74be 100644 --- a/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs @@ -1,73 +1,56 @@ +using ModernUO.Serialization; using Server.Items; -namespace Server.Mobiles +namespace Server.Mobiles; + +[SerializationGenerator(0, false)] +public partial class WanderingHealer : BaseHealer { - public class WanderingHealer : BaseHealer + [Constructible] + public WanderingHealer() { - [Constructible] - public WanderingHealer() + Title = "the wandering healer"; + + AddItem(new GnarledStaff()); + + SetSkill(SkillName.Camping, 80.0, 100.0); + SetSkill(SkillName.Forensics, 80.0, 100.0); + SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + } + + public override bool CanTeach => true; + + public override bool ClickTitle => false; // Do not display title in OnSingleClick + + public override bool CheckTeach(SkillName skill, Mobile from) + { + if (!base.CheckTeach(skill, from)) { - Title = "the wandering healer"; - - AddItem(new GnarledStaff()); - - SetSkill(SkillName.Camping, 80.0, 100.0); - SetSkill(SkillName.Forensics, 80.0, 100.0); - SetSkill(SkillName.SpiritSpeak, 80.0, 100.0); + return false; } - public WanderingHealer(Serial serial) : base(serial) + return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; + } + + public override bool CheckResurrect(Mobile m) + { + if (m.Criminal) { + Say(501222); // Thou art a criminal. I shall not resurrect thee. + return false; } - public override bool CanTeach => true; - - public override bool ClickTitle => false; // Do not display title in OnSingleClick - - public override bool CheckTeach(SkillName skill, Mobile from) + if (m.Kills >= 5) { - if (!base.CheckTeach(skill, from)) - { - return false; - } - - return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; + Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee. + return false; } - public override bool CheckResurrect(Mobile m) + if (m.Karma < 0) { - if (m.Criminal) - { - Say(501222); // Thou art a criminal. I shall not resurrect thee. - return false; - } - - if (m.Kills >= 5) - { - Say(501223); // Thou'rt not a decent and good person. I shall not resurrect thee. - return false; - } - - if (m.Karma < 0) - { - Say(501224); // Thou hast strayed from the path of virtue, but thou still deservest a second chance. - } - - return true; + Say(501224); // Thou hast strayed from the path of virtue, but thou still deservest a second chance. } - 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(); - } + return true; } }