diff --git a/Projects/UOContent/Items/Wands/BaseWand.cs b/Projects/UOContent/Items/Wands/BaseWand.cs index 935eb7aec..92a39fcdd 100644 --- a/Projects/UOContent/Items/Wands/BaseWand.cs +++ b/Projects/UOContent/Items/Wands/BaseWand.cs @@ -21,11 +21,18 @@ namespace Server.Items ManaDraining } - public abstract class BaseWand : BaseBashing + [Serializable(0, false)] + public abstract partial class BaseWand : BaseBashing { - private int m_Charges; + [InvalidateProperties] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + [SerializableField(0)] + private WandEffect _wandEffect; - private WandEffect m_WandEffect; + [InvalidateProperties] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + [SerializableField(1)] + private int _charges; public BaseWand(WandEffect effect, int minCharges, int maxCharges) : base( Utility.RandomList( @@ -37,17 +44,13 @@ namespace Server.Items ) { Weight = 1.0; - Effect = effect; + WandEffect = effect; Charges = Utility.RandomMinMax(minCharges, maxCharges); Attributes.SpellChanneling = 1; Attributes.CastSpeed = -1; WeaponAttributes.MageWeapon = Utility.RandomMinMax(1, 10); } - public BaseWand(Serial serial) : base(serial) - { - } - public override WeaponAbility PrimaryAbility => WeaponAbility.Dismount; public override WeaponAbility SecondaryAbility => WeaponAbility.Disarm; @@ -67,28 +70,6 @@ namespace Server.Items public virtual TimeSpan GetUseDelay => TimeSpan.FromSeconds(4.0); - [CommandProperty(AccessLevel.GameMaster)] - public WandEffect Effect - { - get => m_WandEffect; - set - { - m_WandEffect = value; - InvalidateProperties(); - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public int Charges - { - get => m_Charges; - set - { - m_Charges = value; - InvalidateProperties(); - } - } - public void ConsumeCharge(Mobile from) { --Charges; @@ -142,72 +123,44 @@ namespace Server.Items } } - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write((int)m_WandEffect); - writer.Write(m_Charges); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 0: - { - m_WandEffect = (WandEffect)reader.ReadInt(); - m_Charges = reader.ReadInt(); - - break; - } - } - } - public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); - switch (m_WandEffect) + switch (_wandEffect) { case WandEffect.Clumsiness: - list.Add(1017326, m_Charges.ToString()); + list.Add(1017326, _charges.ToString()); break; // clumsiness charges: ~1_val~ case WandEffect.Identification: - list.Add(1017350, m_Charges.ToString()); + list.Add(1017350, _charges.ToString()); break; // identification charges: ~1_val~ case WandEffect.Healing: - list.Add(1017329, m_Charges.ToString()); + list.Add(1017329, _charges.ToString()); break; // healing charges: ~1_val~ case WandEffect.Feeblemindedness: - list.Add(1017327, m_Charges.ToString()); + list.Add(1017327, _charges.ToString()); break; // feeblemind charges: ~1_val~ case WandEffect.Weakness: - list.Add(1017328, m_Charges.ToString()); + list.Add(1017328, _charges.ToString()); break; // weakness charges: ~1_val~ case WandEffect.MagicArrow: - list.Add(1060492, m_Charges.ToString()); + list.Add(1060492, _charges.ToString()); break; // magic arrow charges: ~1_val~ case WandEffect.Harming: - list.Add(1017334, m_Charges.ToString()); + list.Add(1017334, _charges.ToString()); break; // harm charges: ~1_val~ case WandEffect.Fireball: - list.Add(1060487, m_Charges.ToString()); + list.Add(1060487, _charges.ToString()); break; // fireball charges: ~1_val~ case WandEffect.GreaterHealing: - list.Add(1017330, m_Charges.ToString()); + list.Add(1017330, _charges.ToString()); break; // greater healing charges: ~1_val~ case WandEffect.Lightning: - list.Add(1060491, m_Charges.ToString()); + list.Add(1060491, _charges.ToString()); break; // lightning charges: ~1_val~ case WandEffect.ManaDraining: - list.Add(1017339, m_Charges.ToString()); + list.Add(1017339, _charges.ToString()); break; // mana drain charges: ~1_val~ } } @@ -234,7 +187,7 @@ namespace Server.Items } else { - var num = m_WandEffect switch + var num = _wandEffect switch { WandEffect.Clumsiness => 3002011, WandEffect.Identification => 1044063, @@ -252,7 +205,7 @@ namespace Server.Items if (num > 0) { - attrs.Add(new EquipInfoAttribute(num, m_Charges)); + attrs.Add(new EquipInfoAttribute(num, _charges)); } } diff --git a/Projects/UOContent/Items/Wands/ClumsyWand.cs b/Projects/UOContent/Items/Wands/ClumsyWand.cs index c0415c614..2cb94a7af 100644 --- a/Projects/UOContent/Items/Wands/ClumsyWand.cs +++ b/Projects/UOContent/Items/Wands/ClumsyWand.cs @@ -2,31 +2,14 @@ using Server.Spells.First; namespace Server.Items { - public class ClumsyWand : BaseWand + [Serializable(0, false)] + public partial class ClumsyWand : BaseWand { [Constructible] public ClumsyWand() : base(WandEffect.Clumsiness, 5, 30) { } - public ClumsyWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new ClumsySpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/FeebleWand.cs b/Projects/UOContent/Items/Wands/FeebleWand.cs index 2afa2e205..1fa71810f 100644 --- a/Projects/UOContent/Items/Wands/FeebleWand.cs +++ b/Projects/UOContent/Items/Wands/FeebleWand.cs @@ -2,31 +2,14 @@ using Server.Spells.First; namespace Server.Items { - public class FeebleWand : BaseWand + [Serializable(0, false)] + public partial class FeebleWand : BaseWand { [Constructible] public FeebleWand() : base(WandEffect.Feeblemindedness, 5, 30) { } - public FeebleWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new FeeblemindSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/FireballWand.cs b/Projects/UOContent/Items/Wands/FireballWand.cs index ca59fff45..2c80cc160 100644 --- a/Projects/UOContent/Items/Wands/FireballWand.cs +++ b/Projects/UOContent/Items/Wands/FireballWand.cs @@ -2,31 +2,14 @@ using Server.Spells.Third; namespace Server.Items { - public class FireballWand : BaseWand + [Serializable(0, false)] + public partial class FireballWand : BaseWand { [Constructible] public FireballWand() : base(WandEffect.Fireball, 5, Core.ML ? 109 : 15) { } - public FireballWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new FireballSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/GreaterHealWand.cs b/Projects/UOContent/Items/Wands/GreaterHealWand.cs index 0728b54bc..2e9ee8291 100644 --- a/Projects/UOContent/Items/Wands/GreaterHealWand.cs +++ b/Projects/UOContent/Items/Wands/GreaterHealWand.cs @@ -2,31 +2,14 @@ using Server.Spells.Fourth; namespace Server.Items { - public class GreaterHealWand : BaseWand + [Serializable(0, false)] + public partial class GreaterHealWand : BaseWand { [Constructible] public GreaterHealWand() : base(WandEffect.GreaterHealing, 1, Core.ML ? 109 : 5) { } - public GreaterHealWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new GreaterHealSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/HarmWand.cs b/Projects/UOContent/Items/Wands/HarmWand.cs index 00dabd1b9..853957195 100644 --- a/Projects/UOContent/Items/Wands/HarmWand.cs +++ b/Projects/UOContent/Items/Wands/HarmWand.cs @@ -2,31 +2,14 @@ using Server.Spells.Second; namespace Server.Items { - public class HarmWand : BaseWand + [Serializable(0, false)] + public partial class HarmWand : BaseWand { [Constructible] public HarmWand() : base(WandEffect.Harming, 5, Core.ML ? 109 : 30) { } - public HarmWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new HarmSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/HealWand.cs b/Projects/UOContent/Items/Wands/HealWand.cs index d60ea6c24..ad40234fa 100644 --- a/Projects/UOContent/Items/Wands/HealWand.cs +++ b/Projects/UOContent/Items/Wands/HealWand.cs @@ -2,31 +2,14 @@ using Server.Spells.First; namespace Server.Items { - public class HealWand : BaseWand + [Serializable(0, false)] + public partial class HealWand : BaseWand { [Constructible] public HealWand() : base(WandEffect.Healing, 10, Core.ML ? 109 : 25) { } - public HealWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new HealSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/IDWand.cs b/Projects/UOContent/Items/Wands/IDWand.cs index 30670ef39..1c6328ff6 100644 --- a/Projects/UOContent/Items/Wands/IDWand.cs +++ b/Projects/UOContent/Items/Wands/IDWand.cs @@ -2,33 +2,16 @@ using System; namespace Server.Items { - public class IDWand : BaseWand + [Serializable(0, false)] + public partial class IDWand : BaseWand { [Constructible] public IDWand() : base(WandEffect.Identification, 25, 175) { } - public IDWand(Serial serial) : base(serial) - { - } - public override TimeSpan GetUseDelay => TimeSpan.Zero; - 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 bool OnWandTarget(Mobile from, object o) { if (o is Item item) diff --git a/Projects/UOContent/Items/Wands/LightningWand.cs b/Projects/UOContent/Items/Wands/LightningWand.cs index 40a4310f2..caf69aee5 100644 --- a/Projects/UOContent/Items/Wands/LightningWand.cs +++ b/Projects/UOContent/Items/Wands/LightningWand.cs @@ -2,31 +2,14 @@ using Server.Spells.Fourth; namespace Server.Items { - public class LightningWand : BaseWand + [Serializable(0, false)] + public partial class LightningWand : BaseWand { [Constructible] public LightningWand() : base(WandEffect.Lightning, 5, Core.ML ? 109 : 20) { } - public LightningWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new LightningSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/MagicArrowWand.cs b/Projects/UOContent/Items/Wands/MagicArrowWand.cs index 6be5aad47..036602ae2 100644 --- a/Projects/UOContent/Items/Wands/MagicArrowWand.cs +++ b/Projects/UOContent/Items/Wands/MagicArrowWand.cs @@ -2,31 +2,14 @@ using Server.Spells.First; namespace Server.Items { - public class MagicArrowWand : BaseWand + [Serializable(0, false)] + public partial class MagicArrowWand : BaseWand { [Constructible] public MagicArrowWand() : base(WandEffect.MagicArrow, 5, Core.ML ? 109 : 30) { } - public MagicArrowWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new MagicArrowSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/ManaDrainWand.cs b/Projects/UOContent/Items/Wands/ManaDrainWand.cs index c3ea2b0c3..61b49bcb9 100644 --- a/Projects/UOContent/Items/Wands/ManaDrainWand.cs +++ b/Projects/UOContent/Items/Wands/ManaDrainWand.cs @@ -2,31 +2,14 @@ using Server.Spells.Fourth; namespace Server.Items { - public class ManaDrainWand : BaseWand + [Serializable(0, false)] + public partial class ManaDrainWand : BaseWand { [Constructible] public ManaDrainWand() : base(WandEffect.ManaDraining, 5, 30) { } - public ManaDrainWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new ManaDrainSpell(from, this)); diff --git a/Projects/UOContent/Items/Wands/WeaknessWand.cs b/Projects/UOContent/Items/Wands/WeaknessWand.cs index 6ac6c4d17..5361d0bcb 100644 --- a/Projects/UOContent/Items/Wands/WeaknessWand.cs +++ b/Projects/UOContent/Items/Wands/WeaknessWand.cs @@ -2,31 +2,14 @@ using Server.Spells.First; namespace Server.Items { - public class WeaknessWand : BaseWand + [Serializable(0, false)] + public partial class WeaknessWand : BaseWand { [Constructible] public WeaknessWand() : base(WandEffect.Weakness, 5, 30) { } - public WeaknessWand(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(); - } - public override void OnWandUse(Mobile from) { Cast(new WeakenSpell(from, this)); diff --git a/Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json b/Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json new file mode 100644 index 000000000..6ba1c57fb --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json @@ -0,0 +1,19 @@ +{ + "version": 0, + "type": "Server.Items.BaseWand", + "properties": [ + { + "name": "WandEffect", + "type": "Server.Items.WandEffect", + "rule": "EnumMigrationRule" + }, + { + "name": "Charges", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ClumsyWand.v0.json b/Projects/UOContent/Migrations/Server.Items.ClumsyWand.v0.json new file mode 100644 index 000000000..cf890a69a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ClumsyWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ClumsyWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.FeebleWand.v0.json b/Projects/UOContent/Migrations/Server.Items.FeebleWand.v0.json new file mode 100644 index 000000000..2c1db31e2 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.FeebleWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.FeebleWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.FireballWand.v0.json b/Projects/UOContent/Migrations/Server.Items.FireballWand.v0.json new file mode 100644 index 000000000..649c9e69a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.FireballWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.FireballWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.GreaterHealWand.v0.json b/Projects/UOContent/Migrations/Server.Items.GreaterHealWand.v0.json new file mode 100644 index 000000000..5983e58c9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.GreaterHealWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.GreaterHealWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.HarmWand.v0.json b/Projects/UOContent/Migrations/Server.Items.HarmWand.v0.json new file mode 100644 index 000000000..72f8c4f61 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.HarmWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.HarmWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.HealWand.v0.json b/Projects/UOContent/Migrations/Server.Items.HealWand.v0.json new file mode 100644 index 000000000..92808f40e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.HealWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.HealWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.IDWand.v0.json b/Projects/UOContent/Migrations/Server.Items.IDWand.v0.json new file mode 100644 index 000000000..41a692f5a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.IDWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.IDWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.LightningWand.v0.json b/Projects/UOContent/Migrations/Server.Items.LightningWand.v0.json new file mode 100644 index 000000000..6090f04d4 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.LightningWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.LightningWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MagicArrowWand.v0.json b/Projects/UOContent/Migrations/Server.Items.MagicArrowWand.v0.json new file mode 100644 index 000000000..5cb42bbc7 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MagicArrowWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MagicArrowWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ManaDrainWand.v0.json b/Projects/UOContent/Migrations/Server.Items.ManaDrainWand.v0.json new file mode 100644 index 000000000..a3c91f990 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ManaDrainWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ManaDrainWand" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.WeaknessWand.v0.json b/Projects/UOContent/Migrations/Server.Items.WeaknessWand.v0.json new file mode 100644 index 000000000..1d660bf6a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.WeaknessWand.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.WeaknessWand" +} \ No newline at end of file