From b4566fe154b8dddfbb314fe52f777b5914b624a7 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sun, 22 Aug 2021 14:30:38 -0700 Subject: [PATCH] fix(wands): Fixes codegenning BaseWand. (#718) --- Projects/UOContent/Items/Wands/BaseWand.cs | 18 ++++++++++++------ ...d.v0.json => Server.Items.BaseWand.v1.json} | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) rename Projects/UOContent/Migrations/{Server.Items.BaseWand.v0.json => Server.Items.BaseWand.v1.json} (95%) diff --git a/Projects/UOContent/Items/Wands/BaseWand.cs b/Projects/UOContent/Items/Wands/BaseWand.cs index 92a39fcdd..8bab32252 100644 --- a/Projects/UOContent/Items/Wands/BaseWand.cs +++ b/Projects/UOContent/Items/Wands/BaseWand.cs @@ -21,7 +21,7 @@ namespace Server.Items ManaDraining } - [Serializable(0, false)] + [Serializable(1, false)] public abstract partial class BaseWand : BaseBashing { [InvalidateProperties] @@ -44,8 +44,8 @@ namespace Server.Items ) { Weight = 1.0; - WandEffect = effect; - Charges = Utility.RandomMinMax(minCharges, maxCharges); + _wandEffect = effect; + _charges = Utility.RandomMinMax(minCharges, maxCharges); Attributes.SpellChanneling = 1; Attributes.CastSpeed = -1; WeaponAttributes.MageWeapon = Utility.RandomMinMax(1, 10); @@ -74,7 +74,7 @@ namespace Server.Items { --Charges; - if (Charges == 0) + if (_charges == 0) { from.SendLocalizedMessage(1019073); // This item is out of charges. } @@ -108,7 +108,7 @@ namespace Server.Items if (Parent == from) { - if (Charges > 0) + if (_charges > 0) { OnWandUse(from); } @@ -123,6 +123,12 @@ namespace Server.Items } } + private void Deserialize(IGenericReader reader, int version) + { + _wandEffect = (WandEffect)reader.ReadInt(); + _charges = reader.ReadInt(); + } + public override void GetProperties(ObjectPropertyList list) { base.GetProperties(list); @@ -245,7 +251,7 @@ namespace Server.Items public virtual void DoWandTarget(Mobile from, object o) { - if (Deleted || Charges <= 0 || Parent != from || o is StaticTarget || o is LandTarget) + if (Deleted || _charges <= 0 || Parent != from || o is StaticTarget || o is LandTarget) { return; } diff --git a/Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json b/Projects/UOContent/Migrations/Server.Items.BaseWand.v1.json similarity index 95% rename from Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json rename to Projects/UOContent/Migrations/Server.Items.BaseWand.v1.json index 6ba1c57fb..cf16318f8 100644 --- a/Projects/UOContent/Migrations/Server.Items.BaseWand.v0.json +++ b/Projects/UOContent/Migrations/Server.Items.BaseWand.v1.json @@ -1,5 +1,5 @@ { - "version": 0, + "version": 1, "type": "Server.Items.BaseWand", "properties": [ {