From bf6da39176e9dbb60a9f13a2aa4f6e850b2a0302 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 25 Feb 2023 13:54:05 -0800 Subject: [PATCH] fix: Codegens tools (#1354) --- .../Items/Skill Items/Tools/BaseRunicTool.cs | 2210 ++++++++--------- .../Items/Skill Items/Tools/BaseTool.cs | 325 +-- .../Items/Skill Items/Tools/Blowpipe.cs | 64 +- .../Items/Skill Items/Tools/DovetailSaw.cs | 44 +- .../Items/Skill Items/Tools/DrawKnife.cs | 37 +- .../Items/Skill Items/Tools/FletcherTools.cs | 44 +- .../Items/Skill Items/Tools/FlourSifter.cs | 37 +- .../UOContent/Items/Skill Items/Tools/Froe.cs | 37 +- .../Items/Skill Items/Tools/Hammer.cs | 37 +- .../Items/Skill Items/Tools/Inshave.cs | 37 +- .../Items/Skill Items/Tools/JointingPlane.cs | 44 +- .../Skill Items/Tools/MalletAndChisel.cs | 37 +- .../Items/Skill Items/Tools/MapmakersPen.cs | 46 +- .../Items/Skill Items/Tools/MortarPestle.cs | 37 +- .../Items/Skill Items/Tools/MouldingPlane.cs | 39 +- .../Items/Skill Items/Tools/Nails.cs | 39 +- .../Items/Skill Items/Tools/RollingPin.cs | 37 +- .../Skill Items/Tools/RunicDovetailSaw.cs | 67 +- .../Skill Items/Tools/RunicFletcherTool.cs | 67 +- .../Items/Skill Items/Tools/RunicHammer.cs | 121 +- .../Items/Skill Items/Tools/RunicSewingKit.cs | 122 +- .../UOContent/Items/Skill Items/Tools/Saw.cs | 39 +- .../Items/Skill Items/Tools/Scorp.cs | 37 +- .../Items/Skill Items/Tools/ScribesPen.cs | 46 +- .../Items/Skill Items/Tools/SewingKit.cs | 37 +- .../Items/Skill Items/Tools/Skillet.cs | 39 +- .../Items/Skill Items/Tools/SledgeHammer.cs | 39 +- .../Items/Skill Items/Tools/SmithHammer.cs | 55 +- .../Items/Skill Items/Tools/SmoothingPlane.cs | 39 +- .../Items/Skill Items/Tools/TinkerTools.cs | 45 +- .../Items/Skill Items/Tools/Tongs.cs | 39 +- .../Server.Items.BaseRunicTool.v1.json | 11 + .../Migrations/Server.Items.BaseTool.v2.json | 27 + .../Migrations/Server.Items.Blowpipe.v0.json | 4 + .../Server.Items.DovetailSaw.v0.json | 4 + .../Migrations/Server.Items.DrawKnife.v0.json | 4 + .../Server.Items.FletcherTools.v0.json | 4 + .../Server.Items.FlourSifter.v0.json | 4 + .../Migrations/Server.Items.Froe.v0.json | 4 + .../Migrations/Server.Items.Hammer.v0.json | 4 + .../Migrations/Server.Items.Inshave.v0.json | 4 + .../Server.Items.JointingPlane.v0.json | 4 + .../Server.Items.MalletAndChisel.v0.json | 4 + .../Server.Items.MapmakersPen.v0.json | 4 + .../Server.Items.MortarPestle.v0.json | 4 + .../Server.Items.MouldingPlane.v0.json | 4 + .../Migrations/Server.Items.Nails.v0.json | 4 + .../Server.Items.RollingPin.v0.json | 4 + .../Server.Items.RunicDovetailSaw.v0.json | 4 + .../Server.Items.RunicFletcherTool.v0.json | 4 + .../Server.Items.RunicHammer.v0.json | 4 + .../Server.Items.RunicSewingKit.v0.json | 4 + .../Migrations/Server.Items.Saw.v0.json | 4 + .../Migrations/Server.Items.Scorp.v0.json | 4 + .../Server.Items.ScribesPen.v0.json | 4 + .../Migrations/Server.Items.SewingKit.v0.json | 4 + .../Migrations/Server.Items.Skillet.v0.json | 4 + .../Server.Items.SledgeHammer.v0.json | 4 + .../Server.Items.SmithHammer.v0.json | 4 + .../Server.Items.SmoothingPlane.v0.json | 4 + .../Migrations/Server.Items.Tongs.v0.json | 4 + 61 files changed, 1827 insertions(+), 2266 deletions(-) create mode 100644 Projects/UOContent/Migrations/Server.Items.BaseRunicTool.v1.json create mode 100644 Projects/UOContent/Migrations/Server.Items.BaseTool.v2.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Blowpipe.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DovetailSaw.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DrawKnife.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.FletcherTools.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.FlourSifter.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Froe.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Hammer.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Inshave.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.JointingPlane.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MalletAndChisel.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MapmakersPen.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MortarPestle.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MouldingPlane.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Nails.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RollingPin.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RunicDovetailSaw.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RunicFletcherTool.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RunicHammer.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RunicSewingKit.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Saw.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Scorp.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ScribesPen.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SewingKit.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Skillet.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SledgeHammer.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SmithHammer.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SmoothingPlane.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Tongs.v0.json diff --git a/Projects/UOContent/Items/Skill Items/Tools/BaseRunicTool.cs b/Projects/UOContent/Items/Skill Items/Tools/BaseRunicTool.cs index 60fbd4815..6010ec376 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/BaseRunicTool.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/BaseRunicTool.cs @@ -1,1214 +1,1192 @@ using System; using System.Collections; using System.Collections.Generic; +using ModernUO.Serialization; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(1, false)] +public abstract partial class BaseRunicTool : BaseTool { - public abstract class BaseRunicTool : BaseTool + private const int MaxProperties = 32; + + private static bool m_IsRunicTool; + private static int m_LuckChance; + + private static readonly SkillName[] m_PossibleBonusSkills = { - private const int MaxProperties = 32; + SkillName.Swords, + SkillName.Fencing, + SkillName.Macing, + SkillName.Archery, + SkillName.Wrestling, + SkillName.Parry, + SkillName.Tactics, + SkillName.Anatomy, + SkillName.Healing, + SkillName.Magery, + SkillName.Meditation, + SkillName.EvalInt, + SkillName.MagicResist, + SkillName.AnimalTaming, + SkillName.AnimalLore, + SkillName.Veterinary, + SkillName.Musicianship, + SkillName.Provocation, + SkillName.Discordance, + SkillName.Peacemaking, + SkillName.Chivalry, + SkillName.Focus, + SkillName.Necromancy, + SkillName.Stealing, + SkillName.Stealth, + SkillName.SpiritSpeak, + SkillName.Bushido, + SkillName.Ninjitsu + }; - private static bool m_IsRunicTool; - private static int m_LuckChance; + private static readonly SkillName[] m_PossibleSpellbookSkills = + { + SkillName.Magery, + SkillName.Meditation, + SkillName.EvalInt, + SkillName.MagicResist + }; - private static readonly SkillName[] m_PossibleBonusSkills = + private static readonly BitArray m_Props = new(MaxProperties); + private static readonly int[] m_Possible = new int[MaxProperties]; + + public BaseRunicTool(CraftResource resource, int itemID) : base(itemID) => _resource = resource; + + public BaseRunicTool(CraftResource resource, int uses, int itemID) : base(uses, itemID) => _resource = resource; + + [SerializableProperty(0)] + [CommandProperty(AccessLevel.GameMaster)] + public CraftResource Resource + { + get => _resource; + set { - SkillName.Swords, - SkillName.Fencing, - SkillName.Macing, - SkillName.Archery, - SkillName.Wrestling, - SkillName.Parry, - SkillName.Tactics, - SkillName.Anatomy, - SkillName.Healing, - SkillName.Magery, - SkillName.Meditation, - SkillName.EvalInt, - SkillName.MagicResist, - SkillName.AnimalTaming, - SkillName.AnimalLore, - SkillName.Veterinary, - SkillName.Musicianship, - SkillName.Provocation, - SkillName.Discordance, - SkillName.Peacemaking, - SkillName.Chivalry, - SkillName.Focus, - SkillName.Necromancy, - SkillName.Stealing, - SkillName.Stealth, - SkillName.SpiritSpeak, - SkillName.Bushido, - SkillName.Ninjitsu - }; + _resource = value; + Hue = CraftResources.GetHue(_resource); + InvalidateProperties(); + } + } - private static readonly SkillName[] m_PossibleSpellbookSkills = + private void Deserialize(IGenericReader reader, int version) + { + _resource = (CraftResource)reader.ReadInt(); + } + + private static int Scale(int min, int max, int low, int high) + { + int percent; + + if (m_IsRunicTool) { - SkillName.Magery, - SkillName.Meditation, - SkillName.EvalInt, - SkillName.MagicResist - }; - - private static readonly BitArray m_Props = new(MaxProperties); - private static readonly int[] m_Possible = new int[MaxProperties]; - private CraftResource m_Resource; - - public BaseRunicTool(CraftResource resource, int itemID) : base(itemID) => m_Resource = resource; - - public BaseRunicTool(CraftResource resource, int uses, int itemID) : base(uses, itemID) => m_Resource = resource; - - public BaseRunicTool(Serial serial) : base(serial) + percent = Utility.RandomMinMax(min, max); + } + else { + // Behold, the worst system ever! + var v = Utility.RandomMinMax(0, 10000); + + v = (int)Math.Sqrt(v); + v = 100 - v; + + if (LootPack.CheckLuck(m_LuckChance)) + { + v += 10; + } + + if (v < min) + { + v = min; + } + else if (v > max) + { + v = max; + } + + percent = v; } - [CommandProperty(AccessLevel.GameMaster)] - public CraftResource Resource + percent *= 10000 + 10000 / ((high - low).Abs() + 1); + + return low + (high - low) * percent / 1000001; + } + + private static void ApplyAttribute( + AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, + int scale = 1 + ) + { + if (attr == AosAttribute.CastSpeed) { - get => m_Resource; - set + attrs[attr] += Scale(min, max, low / scale, high / scale) * scale; + } + else + { + attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; + } + + if (attr == AosAttribute.SpellChanneling) + { + attrs[AosAttribute.CastSpeed] -= 1; + } + } + + private static void ApplyAttribute( + AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, + int high + ) + { + attrs[attr] = Scale(min, max, low, high); + } + + private static void ApplyAttribute( + AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, + int high, int scale + ) + { + attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; + } + + private static void ApplyAttribute( + AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, + int high + ) + { + attrs[attr] = Scale(min, max, low, high); + } + + private static void ApplyAttribute( + AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, + int high, int scale + ) + { + attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; + } + + private static void ApplyAttribute( + AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, + int high + ) + { + attrs[attr] = Scale(min, max, low, high); + } + + private static void ApplyAttribute( + AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, + int high, int scale + ) + { + attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; + } + + private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) + { + var isSpellBook = attrs.Owner is Spellbook; + var possibleSkills = + new List(isSpellBook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills); + var count = Core.SE || isSpellBook ? possibleSkills.Count : possibleSkills.Count - 2; + + SkillName sk; + bool found; + + do + { + found = false; + sk = possibleSkills[Utility.Random(count--)]; + possibleSkills.Remove(sk); + + for (var i = 0; !found && i < 5; ++i) { - m_Resource = value; - Hue = CraftResources.GetHue(m_Resource); - InvalidateProperties(); + found = attrs.GetValues(i, out var check, out _) && check == sk; + } + } while (found && count > 0); + + attrs.SetValues(index, sk, Scale(min, max, low, high)); + } + + private static void ApplyResistance(BaseArmor ar, int min, int max, ResistanceType res, int low, int high) + { + switch (res) + { + case ResistanceType.Physical: + { + ar.PhysicalBonus += Scale(min, max, low, high); + break; + } + case ResistanceType.Fire: + { + ar.FireBonus += Scale(min, max, low, high); + break; + } + case ResistanceType.Cold: + { + ar.ColdBonus += Scale(min, max, low, high); + break; + } + case ResistanceType.Poison: + { + ar.PoisonBonus += Scale(min, max, low, high); + break; + } + case ResistanceType.Energy: + { + ar.EnergyBonus += Scale(min, max, low, high); + break; + } + } + } + + public static int GetUniqueRandom(int count) + { + var avail = 0; + + for (var i = 0; i < count; ++i) + { + if (!m_Props[i]) + { + m_Possible[avail++] = i; } } - public override void Serialize(IGenericWriter writer) + if (avail == 0) { - base.Serialize(writer); - - writer.Write(0); // version - writer.Write((int)m_Resource); + return -1; } - public override void Deserialize(IGenericReader reader) + var v = m_Possible[Utility.Random(avail)]; + + m_Props.Set(v, true); + + return v; + } + + public void ApplyAttributesTo(BaseWeapon weapon) + { + var resInfo = CraftResources.GetInfo(_resource); + + var attrs = resInfo?.AttributeInfo; + + if (attrs == null) { - base.Deserialize(reader); + return; + } - var version = reader.ReadInt(); + var attributeCount = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes); + var min = attrs.RunicMinIntensity; + var max = attrs.RunicMaxIntensity; - switch (version) + ApplyAttributesTo(weapon, true, 0, attributeCount, min, max); + } + + public static void ApplyAttributesTo(BaseWeapon weapon, int attributeCount, int min, int max) + { + ApplyAttributesTo(weapon, false, 0, attributeCount, min, max); + } + + public static void ApplyAttributesTo( + BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, + int min, int max + ) + { + m_IsRunicTool = isRunicTool; + m_LuckChance = luckChance; + + var primary = weapon.Attributes; + var secondary = weapon.WeaponAttributes; + + m_Props.SetAll(false); + + if (weapon is BaseRanged) + { + m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon + } + + for (var i = 0; i < attributeCount; ++i) + { + var random = GetUniqueRandom(25); + + if (random == -1) + { + break; + } + + switch (random) { case 0: { - m_Resource = (CraftResource)reader.ReadInt(); + switch (Utility.Random(5)) + { + case 0: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); + break; + } + case 1: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); + break; + } + case 2: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); + break; + } + case 3: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); + break; + } + case 4: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); + break; + } + } + break; } - } - } - - private static int Scale(int min, int max, int low, int high) - { - int percent; - - if (m_IsRunicTool) - { - percent = Utility.RandomMinMax(min, max); - } - else - { - // Behold, the worst system ever! - var v = Utility.RandomMinMax(0, 10000); - - v = (int)Math.Sqrt(v); - v = 100 - v; - - if (LootPack.CheckLuck(m_LuckChance)) - { - v += 10; - } - - if (v < min) - { - v = min; - } - else if (v > max) - { - v = max; - } - - percent = v; - } - - percent *= 10000 + 10000 / ((high - low).Abs() + 1); - - return low + (high - low) * percent / 1000001; - } - - private static void ApplyAttribute( - AosAttributes attrs, int min, int max, AosAttribute attr, int low, int high, - int scale = 1 - ) - { - if (attr == AosAttribute.CastSpeed) - { - attrs[attr] += Scale(min, max, low / scale, high / scale) * scale; - } - else - { - attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; - } - - if (attr == AosAttribute.SpellChanneling) - { - attrs[AosAttribute.CastSpeed] -= 1; - } - } - - private static void ApplyAttribute( - AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, - int high - ) - { - attrs[attr] = Scale(min, max, low, high); - } - - private static void ApplyAttribute( - AosArmorAttributes attrs, int min, int max, AosArmorAttribute attr, int low, - int high, int scale - ) - { - attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; - } - - private static void ApplyAttribute( - AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, - int high - ) - { - attrs[attr] = Scale(min, max, low, high); - } - - private static void ApplyAttribute( - AosWeaponAttributes attrs, int min, int max, AosWeaponAttribute attr, int low, - int high, int scale - ) - { - attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; - } - - private static void ApplyAttribute( - AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, - int high - ) - { - attrs[attr] = Scale(min, max, low, high); - } - - private static void ApplyAttribute( - AosElementAttributes attrs, int min, int max, AosElementAttribute attr, int low, - int high, int scale - ) - { - attrs[attr] = Scale(min, max, low / scale, high / scale) * scale; - } - - private static void ApplySkillBonus(AosSkillBonuses attrs, int min, int max, int index, int low, int high) - { - var isSpellBook = attrs.Owner is Spellbook; - var possibleSkills = - new List(isSpellBook ? m_PossibleSpellbookSkills : m_PossibleBonusSkills); - var count = Core.SE || isSpellBook ? possibleSkills.Count : possibleSkills.Count - 2; - - SkillName sk; - bool found; - - do - { - found = false; - sk = possibleSkills[Utility.Random(count--)]; - possibleSkills.Remove(sk); - - for (var i = 0; !found && i < 5; ++i) - { - found = attrs.GetValues(i, out var check, out _) && check == sk; - } - } while (found && count > 0); - - attrs.SetValues(index, sk, Scale(min, max, low, high)); - } - - private static void ApplyResistance(BaseArmor ar, int min, int max, ResistanceType res, int low, int high) - { - switch (res) - { - case ResistanceType.Physical: + case 1: { - ar.PhysicalBonus += Scale(min, max, low, high); + switch (Utility.Random(4)) + { + case 0: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); + break; + } + case 1: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); + break; + } + case 2: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); + break; + } + case 3: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); + break; + } + } + break; } - case ResistanceType.Fire: + case 2: { - ar.FireBonus += Scale(min, max, low, high); + switch (Utility.Random(2)) + { + case 0: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); + break; + } + case 1: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); + break; + } + } + break; } - case ResistanceType.Cold: + case 3: { - ar.ColdBonus += Scale(min, max, low, high); + ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); break; } - case ResistanceType.Poison: + case 4: { - ar.PoisonBonus += Scale(min, max, low, high); + ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); break; } - case ResistanceType.Energy: + case 5: { - ar.EnergyBonus += Scale(min, max, low, high); + ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); + break; + } + case 6: + { + ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); + break; + } + case 7: + { + ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); + break; + } + case 8: + { + ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); + break; + } + case 9: + { + ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); + break; + } + case 10: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); + break; + } + case 11: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); + break; + } + case 12: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); + break; + } + case 13: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); + break; + } + case 14: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); + break; + } + case 15: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); + break; + } + case 16: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); + break; + } + case 17: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); + break; + } + case 18: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); + break; + } + case 19: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); + break; + } + case 20: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); + break; + } + case 21: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); + break; + } + case 22: + { + ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); + break; + } + case 23: + { + weapon.Slayer = GetRandomSlayer(); + break; + } + case 24: + { + GetElementalDamages(weapon); break; } } } + } - public static int GetUniqueRandom(int count) + public static void GetElementalDamages(BaseWeapon weapon) + { + GetElementalDamages(weapon, true); + } + + public static void GetElementalDamages(BaseWeapon weapon, bool randomizeOrder) + { + weapon.GetDamageTypes(null, out var phys, out _, out _, out _, out _, out _, out _); + + var totalDamage = phys; + + AosElementAttribute[] attrs = { - var avail = 0; + AosElementAttribute.Cold, + AosElementAttribute.Energy, + AosElementAttribute.Fire, + AosElementAttribute.Poison + }; - for (var i = 0; i < count; ++i) - { - if (!m_Props[i]) - { - m_Possible[avail++] = i; - } - } - - if (avail == 0) - { - return -1; - } - - var v = m_Possible[Utility.Random(avail)]; - - m_Props.Set(v, true); - - return v; - } - - public void ApplyAttributesTo(BaseWeapon weapon) + if (randomizeOrder) { - var resInfo = CraftResources.GetInfo(m_Resource); - - var attrs = resInfo?.AttributeInfo; - - if (attrs == null) - { - return; - } - - var attributeCount = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes); - var min = attrs.RunicMinIntensity; - var max = attrs.RunicMaxIntensity; - - ApplyAttributesTo(weapon, true, 0, attributeCount, min, max); - } - - public static void ApplyAttributesTo(BaseWeapon weapon, int attributeCount, int min, int max) - { - ApplyAttributesTo(weapon, false, 0, attributeCount, min, max); - } - - public static void ApplyAttributesTo( - BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, - int min, int max - ) - { - m_IsRunicTool = isRunicTool; - m_LuckChance = luckChance; - - var primary = weapon.Attributes; - var secondary = weapon.WeaponAttributes; - - m_Props.SetAll(false); - - if (weapon is BaseRanged) - { - m_Props.Set(2, true); // ranged weapons cannot be ubws or mageweapon - } - - for (var i = 0; i < attributeCount; ++i) - { - var random = GetUniqueRandom(25); - - if (random == -1) - { - break; - } - - switch (random) - { - case 0: - { - switch (Utility.Random(5)) - { - case 0: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2); - break; - } - case 1: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2); - break; - } - case 2: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2); - break; - } - case 3: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2); - break; - } - case 4: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2); - break; - } - } - - break; - } - case 1: - { - switch (Utility.Random(4)) - { - case 0: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2); - break; - } - case 1: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2); - break; - } - case 2: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2); - break; - } - case 3: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2); - break; - } - } - - break; - } - case 2: - { - switch (Utility.Random(2)) - { - case 0: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1); - break; - } - case 1: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10); - break; - } - } - - break; - } - case 3: - { - ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50); - break; - } - case 4: - { - ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); - break; - } - case 5: - { - ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); - break; - } - case 6: - { - ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); - break; - } - case 7: - { - ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); - break; - } - case 8: - { - ApplyAttribute(primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5); - break; - } - case 9: - { - ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); - break; - } - case 10: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2); - break; - } - case 11: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2); - break; - } - case 12: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2); - break; - } - case 13: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2); - break; - } - case 14: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2); - break; - } - case 15: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2); - break; - } - case 16: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10); - break; - } - case 17: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15); - break; - } - case 18: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15); - break; - } - case 19: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15); - break; - } - case 20: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15); - break; - } - case 21: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15); - break; - } - case 22: - { - ApplyAttribute(secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10); - break; - } - case 23: - { - weapon.Slayer = GetRandomSlayer(); - break; - } - case 24: - { - GetElementalDamages(weapon); - break; - } - } - } - } - - public static void GetElementalDamages(BaseWeapon weapon) - { - GetElementalDamages(weapon, true); - } - - public static void GetElementalDamages(BaseWeapon weapon, bool randomizeOrder) - { - weapon.GetDamageTypes(null, out var phys, out _, out _, out _, out _, out _, out _); - - var totalDamage = phys; - - AosElementAttribute[] attrs = - { - AosElementAttribute.Cold, - AosElementAttribute.Energy, - AosElementAttribute.Fire, - AosElementAttribute.Poison - }; - - if (randomizeOrder) - { - for (var i = 0; i < attrs.Length; i++) - { - var temp = attrs[i]; - var rand = Utility.Random(attrs.Length); - - attrs[i] = attrs[rand]; - attrs[rand] = temp; - } - } - - /* - totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Cold, totalDamage ); - totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy, totalDamage ); - totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire, totalDamage ); - totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison, totalDamage ); - - weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage; - * */ - for (var i = 0; i < attrs.Length; i++) { - totalDamage = AssignElementalDamage(weapon, attrs[i], totalDamage); + var temp = attrs[i]; + var rand = Utility.Random(attrs.Length); + + attrs[i] = attrs[rand]; + attrs[rand] = temp; } - - // Order is Cold, Energy, Fire, Poison -> Physical left - // Cannot be looped, AoselementAttribute is 'out of order' - - weapon.Hue = weapon.GetElementalDamageHue(); } - private static int AssignElementalDamage(BaseWeapon weapon, AosElementAttribute attr, int totalDamage) + /* + totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Cold, totalDamage ); + totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy, totalDamage ); + totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire, totalDamage ); + totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison, totalDamage ); + + weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage; + * */ + + for (var i = 0; i < attrs.Length; i++) { - if (totalDamage <= 0) - { - return 0; - } - - var random = Utility.Random(totalDamage / 10 + 1) * 10; - weapon.AosElementDamages[attr] = random; - - return totalDamage - random; + totalDamage = AssignElementalDamage(weapon, attrs[i], totalDamage); } - public static SlayerName GetRandomSlayer() + // Order is Cold, Energy, Fire, Poison -> Physical left + // Cannot be looped, AoselementAttribute is 'out of order' + + weapon.Hue = weapon.GetElementalDamageHue(); + } + + private static int AssignElementalDamage(BaseWeapon weapon, AosElementAttribute attr, int totalDamage) + { + if (totalDamage <= 0) { - // TODO: Check random algorithm on OSI - - var groups = SlayerGroup.Groups; - - if (groups.Length == 0) - { - return SlayerName.None; - } - - // 10% chance of a super - skip fey - if (Utility.RandomDouble() < 0.10) - { - return groups[Utility.Random(groups.Length - 1)].Super.Name; - } - - // Minor slayer - skip fey and undead - return groups[Utility.Random(groups.Length - 2)].Entries.RandomElement().Name; + return 0; } - public void ApplyAttributesTo(BaseArmor armor) + var random = Utility.Random(totalDamage / 10 + 1) * 10; + weapon.AosElementDamages[attr] = random; + + return totalDamage - random; + } + + public static SlayerName GetRandomSlayer() + { + // TODO: Check random algorithm on OSI + + var groups = SlayerGroup.Groups; + + if (groups.Length == 0) { - var resInfo = CraftResources.GetInfo(m_Resource); - - var attrs = resInfo?.AttributeInfo; - - if (attrs == null) - { - return; - } - - var attributeCount = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes); - var min = attrs.RunicMinIntensity; - var max = attrs.RunicMaxIntensity; - - ApplyAttributesTo(armor, true, 0, attributeCount, min, max); + return SlayerName.None; } - public static void ApplyAttributesTo(BaseArmor armor, int attributeCount, int min, int max) + // 10% chance of a super - skip fey + if (Utility.RandomDouble() < 0.10) { - ApplyAttributesTo(armor, false, 0, attributeCount, min, max); + return groups[Utility.Random(groups.Length - 1)].Super.Name; } - public static void ApplyAttributesTo( - BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, - int max - ) + // Minor slayer - skip fey and undead + return groups[Utility.Random(groups.Length - 2)].Entries.RandomElement().Name; + } + + public void ApplyAttributesTo(BaseArmor armor) + { + var resInfo = CraftResources.GetInfo(_resource); + + var attrs = resInfo?.AttributeInfo; + + if (attrs == null) { - m_IsRunicTool = isRunicTool; - m_LuckChance = luckChance; + return; + } - var primary = armor.Attributes; - var secondary = armor.ArmorAttributes; + var attributeCount = Utility.RandomMinMax(attrs.RunicMinAttributes, attrs.RunicMaxAttributes); + var min = attrs.RunicMinIntensity; + var max = attrs.RunicMaxIntensity; - m_Props.SetAll(false); + ApplyAttributesTo(armor, true, 0, attributeCount, min, max); + } - var isShield = armor is BaseShield; - var baseCount = isShield ? 7 : 20; - var baseOffset = isShield ? 0 : 4; + public static void ApplyAttributesTo(BaseArmor armor, int attributeCount, int min, int max) + { + ApplyAttributesTo(armor, false, 0, attributeCount, min, max); + } - if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All) + public static void ApplyAttributesTo( + BaseArmor armor, bool isRunicTool, int luckChance, int attributeCount, int min, + int max + ) + { + m_IsRunicTool = isRunicTool; + m_LuckChance = luckChance; + + var primary = armor.Attributes; + var secondary = armor.ArmorAttributes; + + m_Props.SetAll(false); + + var isShield = armor is BaseShield; + var baseCount = isShield ? 7 : 20; + var baseOffset = isShield ? 0 : 4; + + if (!isShield && armor.MeditationAllowance == ArmorMeditationAllowance.All) + { + m_Props.Set(3, true); // remove mage armor from possible properties + } + + if (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather) + { + m_Props.Set(0, true); // remove lower requirements from possible properties for leather armor + m_Props.Set(2, true); // remove durability bonus from possible properties + } + + if (armor.RequiredRaces == Race.AllowElvesOnly) + { + // elves inherently have night sight and elf only armor doesn't get night sight as a mod + m_Props.Set(7, true); + } + + for (var i = 0; i < attributeCount; ++i) + { + var random = GetUniqueRandom(baseCount); + + if (random == -1) { - m_Props.Set(3, true); // remove mage armor from possible properties + break; } - if (armor.Resource >= CraftResource.RegularLeather && armor.Resource <= CraftResource.BarbedLeather) + random += baseOffset; + + switch (random) { - m_Props.Set(0, true); // remove lower requirements from possible properties for leather armor - m_Props.Set(2, true); // remove durability bonus from possible properties - } - - if (armor.RequiredRaces == Race.AllowElvesOnly) - { - // elves inherently have night sight and elf only armor doesn't get night sight as a mod - m_Props.Set(7, true); - } - - for (var i = 0; i < attributeCount; ++i) - { - var random = GetUniqueRandom(baseCount); - - if (random == -1) - { - break; - } - - random += baseOffset; - - switch (random) - { - /* Begin Shields */ - case 0: - { - ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); - break; - } - case 1: - { - ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); - break; - } - case 2: - { - if (Core.ML) - { - ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); - } - else - { - ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); - } - - break; - } - case 3: - { - ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); - break; - } - /* Begin Armor */ - case 4: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); - break; - } - case 5: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); - break; - } - case 6: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); - break; - } - /* End Shields */ - case 7: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); - break; - } - case 8: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); - break; - } - case 9: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); - break; - } - case 10: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); - break; - } - case 11: - { - ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); - break; - } - case 12: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); - break; - } - case 13: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); - break; - } - case 14: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); - break; - } - case 15: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); - break; - } - case 16: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); - break; - } - case 17: - { - ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); - break; - } - case 18: + /* Begin Shields */ + case 0: + { + ApplyAttribute(primary, min, max, AosAttribute.SpellChanneling, 1, 1); + break; + } + case 1: + { + ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); + break; + } + case 2: + { + if (Core.ML) { ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); - break; } - case 19: - { - ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); - break; - } - case 20: - { - ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); - break; - } - case 21: - { - ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); - break; - } - case 22: - { - ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); - break; - } - case 23: - { - ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); - break; - } - /* End Armor */ - } - } - } - - public static void ApplyAttributesTo(BaseHat hat, int attributeCount, int min, int max) - { - ApplyAttributesTo(hat, false, 0, attributeCount, min, max); - } - - public static void ApplyAttributesTo( - BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, - int max - ) - { - m_IsRunicTool = isRunicTool; - m_LuckChance = luckChance; - - var primary = hat.Attributes; - var secondary = hat.ClothingAttributes; - var resists = hat.Resistances; - - m_Props.SetAll(false); - - for (var i = 0; i < attributeCount; ++i) - { - var random = GetUniqueRandom(19); - - if (random == -1) - { - break; - } - - switch (random) - { - case 0: - { - ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); - break; - } - case 1: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); - break; - } - case 2: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); - break; - } - case 3: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); - break; - } - case 4: - { - ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); - break; - } - case 5: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); - break; - } - case 6: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); - break; - } - case 7: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); - break; - } - case 8: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); - break; - } - case 9: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); - break; - } - case 10: - { - ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); - break; - } - case 11: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); - break; - } - case 12: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); - break; - } - case 13: - { - ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); - break; - } - case 14: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); - break; - } - case 15: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); - break; - } - case 16: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); - break; - } - case 17: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); - break; - } - case 18: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); - break; - } - } - } - } - - public static void ApplyAttributesTo(BaseJewel jewelry, int attributeCount, int min, int max) - { - ApplyAttributesTo(jewelry, false, 0, attributeCount, min, max); - } - - public static void ApplyAttributesTo( - BaseJewel jewelry, bool isRunicTool, int luckChance, int attributeCount, - int min, int max - ) - { - m_IsRunicTool = isRunicTool; - m_LuckChance = luckChance; - - var primary = jewelry.Attributes; - var resists = jewelry.Resistances; - var skills = jewelry.SkillBonuses; - - m_Props.SetAll(false); - - for (var i = 0; i < attributeCount; ++i) - { - var random = GetUniqueRandom(24); - - if (random == -1) - { - break; - } - - switch (random) - { - case 0: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); - break; - } - case 1: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); - break; - } - case 2: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); - break; - } - case 3: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); - break; - } - case 4: - { - ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); - break; - } - case 5: - { - ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 25); - break; - } - case 6: - { - ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); - break; - } - case 7: + else { ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); - break; } - case 8: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); - break; - } - case 9: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); - break; - } - case 10: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); - break; - } - case 11: - { - ApplyAttribute(primary, min, max, AosAttribute.EnhancePotions, 5, 25, 5); - break; - } - case 12: - { - ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); - break; - } - case 13: - { - ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); - break; - } - case 14: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); - break; - } - case 15: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); - break; - } - case 16: - { - ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); - break; - } - case 17: - { - ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); - break; - } - case 18: - { - ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); - break; - } - case 19: - { - ApplySkillBonus(skills, min, max, 0, 1, 15); - break; - } - case 20: - { - ApplySkillBonus(skills, min, max, 1, 1, 15); - break; - } - case 21: - { - ApplySkillBonus(skills, min, max, 2, 1, 15); - break; - } - case 22: - { - ApplySkillBonus(skills, min, max, 3, 1, 15); - break; - } - case 23: - { - ApplySkillBonus(skills, min, max, 4, 1, 15); - break; - } - } + + break; + } + case 3: + { + ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); + break; + } + /* Begin Armor */ + case 4: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); + break; + } + case 5: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); + break; + } + case 6: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); + break; + } + /* End Shields */ + case 7: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.MageArmor, 1, 1); + break; + } + case 8: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); + break; + } + case 9: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); + break; + } + case 10: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); + break; + } + case 11: + { + ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); + break; + } + case 12: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); + break; + } + case 13: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); + break; + } + case 14: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); + break; + } + case 15: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); + break; + } + case 16: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); + break; + } + case 17: + { + ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); + break; + } + case 18: + { + ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); + break; + } + case 19: + { + ApplyResistance(armor, min, max, ResistanceType.Physical, 1, 15); + break; + } + case 20: + { + ApplyResistance(armor, min, max, ResistanceType.Fire, 1, 15); + break; + } + case 21: + { + ApplyResistance(armor, min, max, ResistanceType.Cold, 1, 15); + break; + } + case 22: + { + ApplyResistance(armor, min, max, ResistanceType.Poison, 1, 15); + break; + } + case 23: + { + ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15); + break; + } + /* End Armor */ } } + } - public static void ApplyAttributesTo(Spellbook spellbook, int attributeCount, int min, int max) + public static void ApplyAttributesTo(BaseHat hat, int attributeCount, int min, int max) + { + ApplyAttributesTo(hat, false, 0, attributeCount, min, max); + } + + public static void ApplyAttributesTo( + BaseHat hat, bool isRunicTool, int luckChance, int attributeCount, int min, + int max + ) + { + m_IsRunicTool = isRunicTool; + m_LuckChance = luckChance; + + var primary = hat.Attributes; + var secondary = hat.ClothingAttributes; + var resists = hat.Resistances; + + m_Props.SetAll(false); + + for (var i = 0; i < attributeCount; ++i) { - ApplyAttributesTo(spellbook, false, 0, attributeCount, min, max); - } + var random = GetUniqueRandom(19); - public static void ApplyAttributesTo( - Spellbook spellbook, bool isRunicTool, int luckChance, int attributeCount, - int min, int max - ) - { - m_IsRunicTool = isRunicTool; - m_LuckChance = luckChance; - - var primary = spellbook.Attributes; - var skills = spellbook.SkillBonuses; - - m_Props.SetAll(false); - - for (var i = 0; i < attributeCount; ++i) + if (random == -1) { - var random = GetUniqueRandom(16); + break; + } - if (random == -1) - { - break; - } + switch (random) + { + case 0: + { + ApplyAttribute(primary, min, max, AosAttribute.ReflectPhysical, 1, 15); + break; + } + case 1: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenHits, 1, 2); + break; + } + case 2: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenStam, 1, 3); + break; + } + case 3: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); + break; + } + case 4: + { + ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); + break; + } + case 5: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusHits, 1, 5); + break; + } + case 6: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusStam, 1, 8); + break; + } + case 7: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); + break; + } + case 8: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); + break; + } + case 9: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); + break; + } + case 10: + { + ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); + break; + } + case 11: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.LowerStatReq, 10, 100, 10); + break; + } + case 12: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.SelfRepair, 1, 5); + break; + } + case 13: + { + ApplyAttribute(secondary, min, max, AosArmorAttribute.DurabilityBonus, 10, 100, 10); + break; + } + case 14: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); + break; + } + case 15: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); + break; + } + case 16: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); + break; + } + case 17: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); + break; + } + case 18: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); + break; + } + } + } + } - switch (random) - { - case 0: - case 1: - case 2: - case 3: - { - ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); + public static void ApplyAttributesTo(BaseJewel jewelry, int attributeCount, int min, int max) + { + ApplyAttributesTo(jewelry, false, 0, attributeCount, min, max); + } - for (var j = 0; j < 4; ++j) - { - m_Props.Set(j, true); - } + public static void ApplyAttributesTo( + BaseJewel jewelry, bool isRunicTool, int luckChance, int attributeCount, + int min, int max + ) + { + m_IsRunicTool = isRunicTool; + m_LuckChance = luckChance; - break; - } - case 4: + var primary = jewelry.Attributes; + var resists = jewelry.Resistances; + var skills = jewelry.SkillBonuses; + + m_Props.SetAll(false); + + for (var i = 0; i < attributeCount; ++i) + { + var random = GetUniqueRandom(24); + + if (random == -1) + { + break; + } + + switch (random) + { + case 0: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Physical, 1, 15); + break; + } + case 1: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Fire, 1, 15); + break; + } + case 2: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Cold, 1, 15); + break; + } + case 3: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Poison, 1, 15); + break; + } + case 4: + { + ApplyAttribute(resists, min, max, AosElementAttribute.Energy, 1, 15); + break; + } + case 5: + { + ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 25); + break; + } + case 6: + { + ApplyAttribute(primary, min, max, AosAttribute.DefendChance, 1, 15); + break; + } + case 7: + { + ApplyAttribute(primary, min, max, AosAttribute.AttackChance, 1, 15); + break; + } + case 8: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusStr, 1, 8); + break; + } + case 9: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusDex, 1, 8); + break; + } + case 10: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); + break; + } + case 11: + { + ApplyAttribute(primary, min, max, AosAttribute.EnhancePotions, 5, 25, 5); + break; + } + case 12: + { + ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); + break; + } + case 13: + { + ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); + break; + } + case 14: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); + break; + } + case 15: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); + break; + } + case 16: + { + ApplyAttribute(primary, min, max, AosAttribute.Luck, 1, 100); + break; + } + case 17: + { + ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); + break; + } + case 18: + { + ApplyAttribute(primary, min, max, AosAttribute.NightSight, 1, 1); + break; + } + case 19: + { + ApplySkillBonus(skills, min, max, 0, 1, 15); + break; + } + case 20: + { + ApplySkillBonus(skills, min, max, 1, 1, 15); + break; + } + case 21: + { + ApplySkillBonus(skills, min, max, 2, 1, 15); + break; + } + case 22: + { + ApplySkillBonus(skills, min, max, 3, 1, 15); + break; + } + case 23: + { + ApplySkillBonus(skills, min, max, 4, 1, 15); + break; + } + } + } + } + + public static void ApplyAttributesTo(Spellbook spellbook, int attributeCount, int min, int max) + { + ApplyAttributesTo(spellbook, false, 0, attributeCount, min, max); + } + + public static void ApplyAttributesTo( + Spellbook spellbook, bool isRunicTool, int luckChance, int attributeCount, + int min, int max + ) + { + m_IsRunicTool = isRunicTool; + m_LuckChance = luckChance; + + var primary = spellbook.Attributes; + var skills = spellbook.SkillBonuses; + + m_Props.SetAll(false); + + for (var i = 0; i < attributeCount; ++i) + { + var random = GetUniqueRandom(16); + + if (random == -1) + { + break; + } + + switch (random) + { + case 0: + case 1: + case 2: + case 3: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8); + + for (var j = 0; j < 4; ++j) { - ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); - break; + m_Props.Set(j, true); } - case 5: - { - ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); - break; - } - case 6: - { - ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); - break; - } - case 7: - { - ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); - break; - } - case 8: - { - ApplySkillBonus(skills, min, max, 0, 1, 15); - break; - } - case 9: - { - ApplySkillBonus(skills, min, max, 1, 1, 15); - break; - } - case 10: - { - ApplySkillBonus(skills, min, max, 2, 1, 15); - break; - } - case 11: - { - ApplySkillBonus(skills, min, max, 3, 1, 15); - break; - } - case 12: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); - break; - } - case 13: - { - ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); - break; - } - case 14: - { - ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); - break; - } - case 15: - { - spellbook.Slayer = GetRandomSlayer(); - break; - } - } + + break; + } + case 4: + { + ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8); + break; + } + case 5: + { + ApplyAttribute(primary, min, max, AosAttribute.CastSpeed, 1, 1); + break; + } + case 6: + { + ApplyAttribute(primary, min, max, AosAttribute.CastRecovery, 1, 3); + break; + } + case 7: + { + ApplyAttribute(primary, min, max, AosAttribute.SpellDamage, 1, 12); + break; + } + case 8: + { + ApplySkillBonus(skills, min, max, 0, 1, 15); + break; + } + case 9: + { + ApplySkillBonus(skills, min, max, 1, 1, 15); + break; + } + case 10: + { + ApplySkillBonus(skills, min, max, 2, 1, 15); + break; + } + case 11: + { + ApplySkillBonus(skills, min, max, 3, 1, 15); + break; + } + case 12: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerRegCost, 1, 20); + break; + } + case 13: + { + ApplyAttribute(primary, min, max, AosAttribute.LowerManaCost, 1, 8); + break; + } + case 14: + { + ApplyAttribute(primary, min, max, AosAttribute.RegenMana, 1, 2); + break; + } + case 15: + { + spellbook.Slayer = GetRandomSlayer(); + break; + } } } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs b/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs index 5ef23c441..66340c7c2 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs @@ -1,219 +1,166 @@ using System; +using ModernUO.Serialization; using Server.Engines.Craft; using Server.Network; -namespace Server.Items +namespace Server.Items; + +public enum ToolQuality { - public enum ToolQuality + Low, + Regular, + Exceptional +} + +[SerializationGenerator(2, false)] +public abstract partial class BaseTool : Item, IUsesRemaining, ICraftable +{ + [InvalidateProperties] + [SerializableField(0)] + [SerializedCommandProperty(AccessLevel.GameMaster)] + private string _crafter; + + [InvalidateProperties] + [SerializableField(2)] + [SerializedCommandProperty(AccessLevel.GameMaster)] + private int _usesRemaining; + + public BaseTool(int itemID) : this(Utility.RandomMinMax(25, 75), itemID) { - Low, - Regular, - Exceptional } - public abstract class BaseTool : Item, IUsesRemaining, ICraftable + public BaseTool(int uses, int itemID) : base(itemID) { - private Mobile m_Crafter; - private ToolQuality m_Quality; - private int m_UsesRemaining; + _usesRemaining = uses; + _quality = ToolQuality.Regular; + } - public BaseTool(int itemID) : this(Utility.RandomMinMax(25, 75), itemID) + [CommandProperty(AccessLevel.GameMaster)] + [SerializableProperty(1)] + public ToolQuality Quality + { + get => _quality; + set { + UnscaleUses(); + _quality = value; + ScaleUses(); + this.MarkDirty(); + } + } + + public virtual bool BreakOnDepletion => true; + + public abstract CraftSystem CraftSystem { get; } + + private bool ShowUsesRemaining { get; set; } = true; + + public int OnCraft( + int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, + CraftItem craftItem, int resHue + ) + { + Quality = (ToolQuality)quality; + + if (makersMark) + { + Crafter = from?.RawName; } - public BaseTool(int uses, int itemID) : base(itemID) + return quality; + } + + bool IUsesRemaining.ShowUsesRemaining + { + get => ShowUsesRemaining; + set => ShowUsesRemaining = value; + } + + public void ScaleUses() + { + UsesRemaining = _usesRemaining * GetUsesScalar() / 100; + InvalidateProperties(); + } + + public void UnscaleUses() + { + UsesRemaining = _usesRemaining * 100 / GetUsesScalar(); + } + + public int GetUsesScalar() => _quality == ToolQuality.Exceptional ? 200 : 100; + + public override void GetProperties(IPropertyList list) + { + base.GetProperties(list); + + // Makers mark not displayed on OSI + // if (m_Crafter != null) + // list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ + + if (_quality == ToolQuality.Exceptional) { - m_UsesRemaining = uses; - m_Quality = ToolQuality.Regular; + list.Add(1060636); // exceptional } - public BaseTool(Serial serial) : base(serial) + list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~ + } + + public virtual void DisplayDurabilityTo(Mobile m) + { + LabelToAffix(m, 1017323, AffixType.Append, $": {_usesRemaining}"); // Durability + } + + public static bool CheckAccessible(Item tool, Mobile m) => tool.IsChildOf(m) || tool.Parent == m; + + public static bool CheckTool(Item tool, Mobile m) + { + var check = m.FindItemOnLayer(Layer.OneHanded); + + if (check is BaseTool && check != tool && check is not AncientSmithyHammer) { + return false; } - [CommandProperty(AccessLevel.GameMaster)] - public Mobile Crafter + check = m.FindItemOnLayer(Layer.TwoHanded); + + return check is not BaseTool || check == tool || check is AncientSmithyHammer; + } + + public override void OnSingleClick(Mobile from) + { + DisplayDurabilityTo(from); + + base.OnSingleClick(from); + } + + public override void OnDoubleClick(Mobile from) + { + if (IsChildOf(from.Backpack) || Parent == from) { - get => m_Crafter; - set + var system = CraftSystem; + + var num = system.CanCraft(from, this, null); + + // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE + if (num > 0 && (num != 1044267 || !Core.SE)) { - m_Crafter = value; - InvalidateProperties(); - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public ToolQuality Quality - { - get => m_Quality; - set - { - UnscaleUses(); - m_Quality = value; - InvalidateProperties(); - ScaleUses(); - } - } - - public virtual bool BreakOnDepletion => true; - - public abstract CraftSystem CraftSystem { get; } - - private bool ShowUsesRemaining { get; set; } = true; - - public int OnCraft( - int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, - CraftItem craftItem, int resHue - ) - { - Quality = (ToolQuality)quality; - - if (makersMark) - { - Crafter = from; - } - - return quality; - } - - [CommandProperty(AccessLevel.GameMaster)] - public int UsesRemaining - { - get => m_UsesRemaining; - set - { - m_UsesRemaining = value; - InvalidateProperties(); - } - } - - bool IUsesRemaining.ShowUsesRemaining - { - get => ShowUsesRemaining; - set => ShowUsesRemaining = value; - } - - public void ScaleUses() - { - m_UsesRemaining = m_UsesRemaining * GetUsesScalar() / 100; - InvalidateProperties(); - } - - public void UnscaleUses() - { - m_UsesRemaining = m_UsesRemaining * 100 / GetUsesScalar(); - } - - public int GetUsesScalar() - { - if (m_Quality == ToolQuality.Exceptional) - { - return 200; - } - - return 100; - } - - public override void GetProperties(IPropertyList list) - { - base.GetProperties(list); - - // Makers mark not displayed on OSI - // if (m_Crafter != null) - // list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~ - - if (m_Quality == ToolQuality.Exceptional) - { - list.Add(1060636); // exceptional - } - - list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~ - } - - public virtual void DisplayDurabilityTo(Mobile m) - { - LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability - } - - public static bool CheckAccessible(Item tool, Mobile m) => tool.IsChildOf(m) || tool.Parent == m; - - public static bool CheckTool(Item tool, Mobile m) - { - var check = m.FindItemOnLayer(Layer.OneHanded); - - if (check is BaseTool && check != tool && check is not AncientSmithyHammer) - { - return false; - } - - check = m.FindItemOnLayer(Layer.TwoHanded); - - return check is not BaseTool || check == tool || check is AncientSmithyHammer; - } - - public override void OnSingleClick(Mobile from) - { - DisplayDurabilityTo(from); - - base.OnSingleClick(from); - } - - public override void OnDoubleClick(Mobile from) - { - if (IsChildOf(from.Backpack) || Parent == from) - { - var system = CraftSystem; - - var num = system.CanCraft(from, this, null); - - // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE - if (num > 0 && (num != 1044267 || !Core.SE)) - { - from.SendLocalizedMessage(num); - } - else - { - from.SendGump(new CraftGump(from, system, this, null)); - } + from.SendLocalizedMessage(num); } else { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + from.SendGump(new CraftGump(from, system, this, null)); } } - - public override void Serialize(IGenericWriter writer) + else { - base.Serialize(writer); - - writer.Write(1); // version - - writer.Write(m_Crafter); - writer.Write((int)m_Quality); - - writer.Write(m_UsesRemaining); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 1: - { - m_Crafter = reader.ReadEntity(); - m_Quality = (ToolQuality)reader.ReadInt(); - goto case 0; - } - case 0: - { - m_UsesRemaining = reader.ReadInt(); - break; - } - } + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } } + + private void Deserialize(IGenericReader reader, int version) + { + Timer.DelayCall((item, crafter) => item._crafter = crafter?.RawName, this, reader.ReadEntity()); + _quality = (ToolQuality)reader.ReadInt(); + _usesRemaining = reader.ReadInt(); + } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Blowpipe.cs b/Projects/UOContent/Items/Skill Items/Tools/Blowpipe.cs index a0cbbb4c2..7107ffbaf 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Blowpipe.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Blowpipe.cs @@ -1,49 +1,27 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0xE8A, 0xE89)] +[SerializationGenerator(0, false)] +public partial class Blowpipe : BaseTool { - [Flippable(0xE8A, 0xE89)] - public class Blowpipe : BaseTool + [Constructible] + public Blowpipe() : base(0xE8A) { - [Constructible] - public Blowpipe() : base(0xE8A) - { - Weight = 4.0; - Hue = 0x3B9; - } - - [Constructible] - public Blowpipe(int uses) : base(uses, 0xE8A) - { - Weight = 4.0; - Hue = 0x3B9; - } - - public Blowpipe(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefGlassblowing.CraftSystem; - - public override int LabelNumber => 1044608; // blow pipe - - 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 (Weight == 2.0) - { - Weight = 4.0; - } - } + Weight = 4.0; + Hue = 0x3B9; } + + [Constructible] + public Blowpipe(int uses) : base(uses, 0xE8A) + { + Weight = 4.0; + Hue = 0x3B9; + } + + public override CraftSystem CraftSystem => DefGlassblowing.CraftSystem; + + public override int LabelNumber => 1044608; // blow pipe } diff --git a/Projects/UOContent/Items/Skill Items/Tools/DovetailSaw.cs b/Projects/UOContent/Items/Skill Items/Tools/DovetailSaw.cs index 8210096aa..c95302be5 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/DovetailSaw.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/DovetailSaw.cs @@ -1,39 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1028, 0x1029)] +[SerializationGenerator(0, false)] +public partial class DovetailSaw : BaseTool { - [Flippable(0x1028, 0x1029)] - public class DovetailSaw : BaseTool - { - [Constructible] - public DovetailSaw() : base(0x1028) => Weight = 2.0; + [Constructible] + public DovetailSaw() : base(0x1028) => Weight = 2.0; - [Constructible] - public DovetailSaw(int uses) : base(uses, 0x1028) => Weight = 2.0; + [Constructible] + public DovetailSaw(int uses) : base(uses, 0x1028) => Weight = 2.0; - public DovetailSaw(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 (Weight == 1.0) - { - Weight = 2.0; - } - } - } + public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/DrawKnife.cs b/Projects/UOContent/Items/Skill Items/Tools/DrawKnife.cs index ad1fc9530..397d92975 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/DrawKnife.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/DrawKnife.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class DrawKnife : BaseTool { - public class DrawKnife : BaseTool - { - [Constructible] - public DrawKnife() : base(0x10E4) => Weight = 1.0; + [Constructible] + public DrawKnife() : base(0x10E4) => Weight = 1.0; - [Constructible] - public DrawKnife(int uses) : base(uses, 0x10E4) => Weight = 1.0; + [Constructible] + public DrawKnife(int uses) : base(uses, 0x10E4) => Weight = 1.0; - public DrawKnife(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/FletcherTools.cs b/Projects/UOContent/Items/Skill Items/Tools/FletcherTools.cs index 0cffc8e37..775a0bb38 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/FletcherTools.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/FletcherTools.cs @@ -1,39 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1022, 0x1023)] +[SerializationGenerator(0, false)] +public partial class FletcherTools : BaseTool { - [Flippable(0x1022, 0x1023)] - public class FletcherTools : BaseTool - { - [Constructible] - public FletcherTools() : base(0x1022) => Weight = 2.0; + [Constructible] + public FletcherTools() : base(0x1022) => Weight = 2.0; - [Constructible] - public FletcherTools(int uses) : base(uses, 0x1022) => Weight = 2.0; + [Constructible] + public FletcherTools(int uses) : base(uses, 0x1022) => Weight = 2.0; - public FletcherTools(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefBowFletching.CraftSystem; - - 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 (Weight == 1.0) - { - Weight = 2.0; - } - } - } + public override CraftSystem CraftSystem => DefBowFletching.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/FlourSifter.cs b/Projects/UOContent/Items/Skill Items/Tools/FlourSifter.cs index a90eb6666..0794a4aef 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/FlourSifter.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/FlourSifter.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class FlourSifter : BaseTool { - public class FlourSifter : BaseTool - { - [Constructible] - public FlourSifter() : base(0x103E) => Weight = 1.0; + [Constructible] + public FlourSifter() : base(0x103E) => Weight = 1.0; - [Constructible] - public FlourSifter(int uses) : base(uses, 0x103E) => Weight = 1.0; + [Constructible] + public FlourSifter(int uses) : base(uses, 0x103E) => Weight = 1.0; - public FlourSifter(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCooking.CraftSystem; - - 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 CraftSystem CraftSystem => DefCooking.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Froe.cs b/Projects/UOContent/Items/Skill Items/Tools/Froe.cs index a5712d873..3658db1f2 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Froe.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Froe.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Froe : BaseTool { - public class Froe : BaseTool - { - [Constructible] - public Froe() : base(0x10E5) => Weight = 1.0; + [Constructible] + public Froe() : base(0x10E5) => Weight = 1.0; - [Constructible] - public Froe(int uses) : base(uses, 0x10E5) => Weight = 1.0; + [Constructible] + public Froe(int uses) : base(uses, 0x10E5) => Weight = 1.0; - public Froe(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Hammer.cs b/Projects/UOContent/Items/Skill Items/Tools/Hammer.cs index 07677e822..732648691 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Hammer.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Hammer.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Hammer : BaseTool { - public class Hammer : BaseTool - { - [Constructible] - public Hammer() : base(0x102A) => Weight = 2.0; + [Constructible] + public Hammer() : base(0x102A) => Weight = 2.0; - [Constructible] - public Hammer(int uses) : base(uses, 0x102A) => Weight = 2.0; + [Constructible] + public Hammer(int uses) : base(uses, 0x102A) => Weight = 2.0; - public Hammer(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Inshave.cs b/Projects/UOContent/Items/Skill Items/Tools/Inshave.cs index 7f57af098..48631a9d3 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Inshave.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Inshave.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Inshave : BaseTool { - public class Inshave : BaseTool - { - [Constructible] - public Inshave() : base(0x10E6) => Weight = 1.0; + [Constructible] + public Inshave() : base(0x10E6) => Weight = 1.0; - [Constructible] - public Inshave(int uses) : base(uses, 0x10E6) => Weight = 1.0; + [Constructible] + public Inshave(int uses) : base(uses, 0x10E6) => Weight = 1.0; - public Inshave(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/JointingPlane.cs b/Projects/UOContent/Items/Skill Items/Tools/JointingPlane.cs index 393450803..741840f1a 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/JointingPlane.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/JointingPlane.cs @@ -1,39 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1030, 0x1031)] +[SerializationGenerator(0, false)] +public partial class JointingPlane : BaseTool { - [Flippable(0x1030, 0x1031)] - public class JointingPlane : BaseTool - { - [Constructible] - public JointingPlane() : base(0x1030) => Weight = 2.0; + [Constructible] + public JointingPlane() : base(0x1030) => Weight = 2.0; - [Constructible] - public JointingPlane(int uses) : base(uses, 0x1030) => Weight = 2.0; + [Constructible] + public JointingPlane(int uses) : base(uses, 0x1030) => Weight = 2.0; - public JointingPlane(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 (Weight == 1.0) - { - Weight = 2.0; - } - } - } + public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/MalletAndChisel.cs b/Projects/UOContent/Items/Skill Items/Tools/MalletAndChisel.cs index d0e7d7721..5a890e07b 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/MalletAndChisel.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/MalletAndChisel.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class MalletAndChisel : BaseTool { - public class MalletAndChisel : BaseTool - { - [Constructible] - public MalletAndChisel() : base(0x12B3) => Weight = 1.0; + [Constructible] + public MalletAndChisel() : base(0x12B3) => Weight = 1.0; - [Constructible] - public MalletAndChisel(int uses) : base(uses, 0x12B3) => Weight = 1.0; + [Constructible] + public MalletAndChisel(int uses) : base(uses, 0x12B3) => Weight = 1.0; - public MalletAndChisel(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefMasonry.CraftSystem; - - 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 CraftSystem CraftSystem => DefMasonry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/MapmakersPen.cs b/Projects/UOContent/Items/Skill Items/Tools/MapmakersPen.cs index f760be821..edf1e2b6c 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/MapmakersPen.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/MapmakersPen.cs @@ -1,41 +1,19 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x0FBF, 0x0FC0)] +[SerializationGenerator(0, false)] +public partial class MapmakersPen : BaseTool { - [Flippable(0x0FBF, 0x0FC0)] - public class MapmakersPen : BaseTool - { - [Constructible] - public MapmakersPen() : base(0x0FBF) => Weight = 1.0; + [Constructible] + public MapmakersPen() : base(0x0FBF) => Weight = 1.0; - [Constructible] - public MapmakersPen(int uses) : base(uses, 0x0FBF) => Weight = 1.0; + [Constructible] + public MapmakersPen(int uses) : base(uses, 0x0FBF) => Weight = 1.0; - public MapmakersPen(Serial serial) : base(serial) - { - } + public override CraftSystem CraftSystem => DefCartography.CraftSystem; - public override CraftSystem CraftSystem => DefCartography.CraftSystem; - - public override int LabelNumber => 1044167; // mapmaker's pen - - 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 (Weight == 2.0) - { - Weight = 1.0; - } - } - } + public override int LabelNumber => 1044167; // mapmaker's pen } diff --git a/Projects/UOContent/Items/Skill Items/Tools/MortarPestle.cs b/Projects/UOContent/Items/Skill Items/Tools/MortarPestle.cs index 646bd2e89..9ed61e088 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/MortarPestle.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/MortarPestle.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class MortarPestle : BaseTool { - public class MortarPestle : BaseTool - { - [Constructible] - public MortarPestle() : base(0xE9B) => Weight = 1.0; + [Constructible] + public MortarPestle() : base(0xE9B) => Weight = 1.0; - [Constructible] - public MortarPestle(int uses) : base(uses, 0xE9B) => Weight = 1.0; + [Constructible] + public MortarPestle(int uses) : base(uses, 0xE9B) => Weight = 1.0; - public MortarPestle(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefAlchemy.CraftSystem; - - 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 CraftSystem CraftSystem => DefAlchemy.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/MouldingPlane.cs b/Projects/UOContent/Items/Skill Items/Tools/MouldingPlane.cs index cf3415bb0..c04c8d3c0 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/MouldingPlane.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/MouldingPlane.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x102C, 0x102D)] +[SerializationGenerator(0, false)] +public partial class MouldingPlane : BaseTool { - [Flippable(0x102C, 0x102D)] - public class MouldingPlane : BaseTool - { - [Constructible] - public MouldingPlane() : base(0x102C) => Weight = 2.0; + [Constructible] + public MouldingPlane() : base(0x102C) => Weight = 2.0; - [Constructible] - public MouldingPlane(int uses) : base(uses, 0x102C) => Weight = 2.0; + [Constructible] + public MouldingPlane(int uses) : base(uses, 0x102C) => Weight = 2.0; - public MouldingPlane(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Nails.cs b/Projects/UOContent/Items/Skill Items/Tools/Nails.cs index 667514953..151d5fa6c 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Nails.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Nails.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x102E, 0x102F)] +[SerializationGenerator(0, false)] +public partial class Nails : BaseTool { - [Flippable(0x102E, 0x102F)] - public class Nails : BaseTool - { - [Constructible] - public Nails() : base(0x102E) => Weight = 2.0; + [Constructible] + public Nails() : base(0x102E) => Weight = 2.0; - [Constructible] - public Nails(int uses) : base(uses, 0x102C) => Weight = 2.0; + [Constructible] + public Nails(int uses) : base(uses, 0x102C) => Weight = 2.0; - public Nails(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/RollingPin.cs b/Projects/UOContent/Items/Skill Items/Tools/RollingPin.cs index 4d75f15a8..794e85522 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RollingPin.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RollingPin.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class RollingPin : BaseTool { - public class RollingPin : BaseTool - { - [Constructible] - public RollingPin() : base(0x1043) => Weight = 1.0; + [Constructible] + public RollingPin() : base(0x1043) => Weight = 1.0; - [Constructible] - public RollingPin(int uses) : base(uses, 0x1043) => Weight = 1.0; + [Constructible] + public RollingPin(int uses) : base(uses, 0x1043) => Weight = 1.0; - public RollingPin(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCooking.CraftSystem; - - 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 CraftSystem CraftSystem => DefCooking.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/RunicDovetailSaw.cs b/Projects/UOContent/Items/Skill Items/Tools/RunicDovetailSaw.cs index 7bc951ed0..6cdb49049 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RunicDovetailSaw.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RunicDovetailSaw.cs @@ -1,56 +1,39 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class RunicDovetailSaw : BaseRunicTool { - public class RunicDovetailSaw : BaseRunicTool + [Constructible] + public RunicDovetailSaw(CraftResource resource) : base(resource, 0x1028) { - [Constructible] - public RunicDovetailSaw(CraftResource resource) : base(resource, 0x1028) - { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); - } + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } - [Constructible] - public RunicDovetailSaw(CraftResource resource, int uses) : base(resource, uses, 0x1028) - { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); - } + [Constructible] + public RunicDovetailSaw(CraftResource resource, int uses) : base(resource, uses, 0x1028) + { + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } - public RunicDovetailSaw(Serial serial) : base(serial) - { - } + public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - public override int LabelNumber + public override int LabelNumber + { + get { - get + var index = CraftResources.GetIndex(Resource); + + if (index >= 1 && index <= 6) { - var index = CraftResources.GetIndex(Resource); - - if (index >= 1 && index <= 6) - { - return 1072633 + index; - } - - return 1024137; // dovetail saw + return 1072633 + index; } - } - 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 1024137; // dovetail saw } } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/RunicFletcherTool.cs b/Projects/UOContent/Items/Skill Items/Tools/RunicFletcherTool.cs index 489090620..595d4e10d 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RunicFletcherTool.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RunicFletcherTool.cs @@ -1,56 +1,39 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class RunicFletcherTool : BaseRunicTool { - public class RunicFletcherTool : BaseRunicTool + [Constructible] + public RunicFletcherTool(CraftResource resource) : base(resource, 0x1022) { - [Constructible] - public RunicFletcherTool(CraftResource resource) : base(resource, 0x1022) - { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); - } + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } - [Constructible] - public RunicFletcherTool(CraftResource resource, int uses) : base(resource, uses, 0x1022) - { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); - } + [Constructible] + public RunicFletcherTool(CraftResource resource, int uses) : base(resource, uses, 0x1022) + { + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } - public RunicFletcherTool(Serial serial) : base(serial) - { - } + public override CraftSystem CraftSystem => DefBowFletching.CraftSystem; - public override CraftSystem CraftSystem => DefBowFletching.CraftSystem; - - public override int LabelNumber + public override int LabelNumber + { + get { - get + var index = CraftResources.GetIndex(Resource); + + if (index >= 1 && index <= 6) { - var index = CraftResources.GetIndex(Resource); - - if (index >= 1 && index <= 6) - { - return 1072627 + index; - } - - return 1044559; // Fletcher's Tools + return 1072627 + index; } - } - 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 1044559; // Fletcher's Tools } } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/RunicHammer.cs b/Projects/UOContent/Items/Skill Items/Tools/RunicHammer.cs index 5a1604b83..bb2581258 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RunicHammer.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RunicHammer.cs @@ -1,85 +1,68 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x13E4, 0x13E3)] +[SerializationGenerator(0, false)] +public partial class RunicHammer : BaseRunicTool { - [Flippable(0x13E4, 0x13E3)] - public class RunicHammer : BaseRunicTool + [Constructible] + public RunicHammer(CraftResource resource) : base(resource, 0x13E3) { - [Constructible] - public RunicHammer(CraftResource resource) : base(resource, 0x13E3) + Weight = 8.0; + Layer = Layer.OneHanded; + Hue = CraftResources.GetHue(resource); + } + + [Constructible] + public RunicHammer(CraftResource resource, int uses) : base(resource, uses, 0x13E3) + { + Weight = 8.0; + Layer = Layer.OneHanded; + Hue = CraftResources.GetHue(resource); + } + + public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; + + public override int LabelNumber + { + get { - Weight = 8.0; - Layer = Layer.OneHanded; - Hue = CraftResources.GetHue(resource); - } - - [Constructible] - public RunicHammer(CraftResource resource, int uses) : base(resource, uses, 0x13E3) - { - Weight = 8.0; - Layer = Layer.OneHanded; - Hue = CraftResources.GetHue(resource); - } - - public RunicHammer(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; - - public override int LabelNumber - { - get - { - var index = CraftResources.GetIndex(Resource); - - if (index >= 1 && index <= 8) - { - return 1049019 + index; - } - - return 1045128; // runic smithy hammer - } - } - - public override void AddNameProperties(IPropertyList list) - { - base.AddNameProperties(list); - var index = CraftResources.GetIndex(Resource); if (index >= 1 && index <= 8) { - return; + return 1049019 + index; } - if (!CraftResources.IsStandard(Resource)) + return 1045128; // runic smithy hammer + } + } + + public override void AddNameProperties(IPropertyList list) + { + base.AddNameProperties(list); + + var index = CraftResources.GetIndex(Resource); + + if (index >= 1 && index <= 8) + { + return; + } + + if (!CraftResources.IsStandard(Resource)) + { + var num = CraftResources.GetLocalizationNumber(Resource); + + if (num > 0) { - var num = CraftResources.GetLocalizationNumber(Resource); - - if (num > 0) - { - list.Add(num); - } - else - { - list.Add(CraftResources.GetName(Resource)); - } + list.Add(num); + } + else + { + list.Add(CraftResources.GetName(Resource)); } - } - - 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(); } } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs b/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs index edf868a4d..42c9cbf0b 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs @@ -1,89 +1,65 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class RunicSewingKit : BaseRunicTool { - public class RunicSewingKit : BaseRunicTool + [Constructible] + public RunicSewingKit(CraftResource resource) : base(resource, 0xF9D) { - [Constructible] - public RunicSewingKit(CraftResource resource) : base(resource, 0xF9D) + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } + + [Constructible] + public RunicSewingKit(CraftResource resource, int uses) : base(resource, uses, 0xF9D) + { + Weight = 2.0; + Hue = CraftResources.GetHue(resource); + } + + public override CraftSystem CraftSystem => DefTailoring.CraftSystem; + + public override void AddNameProperty(IPropertyList list) + { + if (CraftResources.IsStandard(Resource)) { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); + list.Add(1061119, " "); // ~1_LEATHER_TYPE~ runic sewing kit + return; } - [Constructible] - public RunicSewingKit(CraftResource resource, int uses) : base(resource, uses, 0xF9D) + var num = CraftResources.GetLocalizationNumber(Resource); + + if (num > 0) { - Weight = 2.0; - Hue = CraftResources.GetHue(resource); + // ~1_LEATHER_TYPE~ runic sewing kit + list.AddLocalized(1061119, num); + } + else + { + // ~1_LEATHER_TYPE~ runic sewing kit + list.Add(1061119, CraftResources.GetName(Resource)); + } + } + + public override void OnSingleClick(Mobile from) + { + if (CraftResources.IsStandard(Resource)) + { + LabelTo(from, 1061119, " "); // ~1_LEATHER_TYPE~ runic sewing kit + return; } - public RunicSewingKit(Serial serial) : base(serial) + var num = CraftResources.GetLocalizationNumber(Resource); + if (num > 0) { + LabelTo(from, 1061119, $"#{num}"); // ~1_LEATHER_TYPE~ runic sewing kit } - - public override CraftSystem CraftSystem => DefTailoring.CraftSystem; - - public override void AddNameProperty(IPropertyList list) + else { - if (CraftResources.IsStandard(Resource)) - { - list.Add(1061119, " "); // ~1_LEATHER_TYPE~ runic sewing kit - return; - } - - var num = CraftResources.GetLocalizationNumber(Resource); - - if (num > 0) - { - // ~1_LEATHER_TYPE~ runic sewing kit - list.Add(1061119, $"#{num}"); - } - else - { - // ~1_LEATHER_TYPE~ runic sewing kit - list.Add(1061119, CraftResources.GetName(Resource)); - } - } - - public override void OnSingleClick(Mobile from) - { - var v = " "; - - if (!CraftResources.IsStandard(Resource)) - { - var num = CraftResources.GetLocalizationNumber(Resource); - - if (num > 0) - { - v = $"#{num}"; - } - else - { - v = CraftResources.GetName(Resource); - } - } - - LabelTo(from, 1061119, v); // ~1_LEATHER_TYPE~ runic sewing kit - } - - 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 (ItemID is 0x13E4 or 0x13E3) - { - ItemID = 0xF9D; - } + LabelTo(from, 1061119, CraftResources.GetName(Resource)); // ~1_LEATHER_TYPE~ runic sewing kit } } } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Saw.cs b/Projects/UOContent/Items/Skill Items/Tools/Saw.cs index 959361537..ba44b25f7 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Saw.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Saw.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1034, 0x1035)] +[SerializationGenerator(0, false)] +public partial class Saw : BaseTool { - [Flippable(0x1034, 0x1035)] - public class Saw : BaseTool - { - [Constructible] - public Saw() : base(0x1034) => Weight = 2.0; + [Constructible] + public Saw() : base(0x1034) => Weight = 2.0; - [Constructible] - public Saw(int uses) : base(uses, 0x1034) => Weight = 2.0; + [Constructible] + public Saw(int uses) : base(uses, 0x1034) => Weight = 2.0; - public Saw(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Scorp.cs b/Projects/UOContent/Items/Skill Items/Tools/Scorp.cs index 30b0ba37f..d6678a2c9 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Scorp.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Scorp.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Scorp : BaseTool { - public class Scorp : BaseTool - { - [Constructible] - public Scorp() : base(0x10E7) => Weight = 1.0; + [Constructible] + public Scorp() : base(0x10E7) => Weight = 1.0; - [Constructible] - public Scorp(int uses) : base(uses, 0x10E7) => Weight = 1.0; + [Constructible] + public Scorp(int uses) : base(uses, 0x10E7) => Weight = 1.0; - public Scorp(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/ScribesPen.cs b/Projects/UOContent/Items/Skill Items/Tools/ScribesPen.cs index 6f3071d6f..2eb9c2ae4 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/ScribesPen.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/ScribesPen.cs @@ -1,41 +1,19 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x0FBF, 0x0FC0)] +[SerializationGenerator(0, false)] +public partial class ScribesPen : BaseTool { - [Flippable(0x0FBF, 0x0FC0)] - public class ScribesPen : BaseTool - { - [Constructible] - public ScribesPen() : base(0x0FBF) => Weight = 1.0; + [Constructible] + public ScribesPen() : base(0x0FBF) => Weight = 1.0; - [Constructible] - public ScribesPen(int uses) : base(uses, 0x0FBF) => Weight = 1.0; + [Constructible] + public ScribesPen(int uses) : base(uses, 0x0FBF) => Weight = 1.0; - public ScribesPen(Serial serial) : base(serial) - { - } + public override CraftSystem CraftSystem => DefInscription.CraftSystem; - public override CraftSystem CraftSystem => DefInscription.CraftSystem; - - public override int LabelNumber => 1044168; // scribe's pen - - 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 (Weight == 2.0) - { - Weight = 1.0; - } - } - } + public override int LabelNumber => 1044168; // scribe's pen } diff --git a/Projects/UOContent/Items/Skill Items/Tools/SewingKit.cs b/Projects/UOContent/Items/Skill Items/Tools/SewingKit.cs index 2925c422a..97a1d2912 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/SewingKit.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/SewingKit.cs @@ -1,33 +1,16 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class SewingKit : BaseTool { - public class SewingKit : BaseTool - { - [Constructible] - public SewingKit() : base(0xF9D) => Weight = 2.0; + [Constructible] + public SewingKit() : base(0xF9D) => Weight = 2.0; - [Constructible] - public SewingKit(int uses) : base(uses, 0xF9D) => Weight = 2.0; + [Constructible] + public SewingKit(int uses) : base(uses, 0xF9D) => Weight = 2.0; - public SewingKit(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefTailoring.CraftSystem; - - 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 CraftSystem CraftSystem => DefTailoring.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/Skillet.cs b/Projects/UOContent/Items/Skill Items/Tools/Skillet.cs index 042d5b2c9..f9278ce38 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Skillet.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Skillet.cs @@ -1,35 +1,18 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Skillet : BaseTool { - public class Skillet : BaseTool - { - [Constructible] - public Skillet() : base(0x97F) => Weight = 1.0; + [Constructible] + public Skillet() : base(0x97F) => Weight = 1.0; - [Constructible] - public Skillet(int uses) : base(uses, 0x97F) => Weight = 1.0; + [Constructible] + public Skillet(int uses) : base(uses, 0x97F) => Weight = 1.0; - public Skillet(Serial serial) : base(serial) - { - } + public override int LabelNumber => 1044567; // skillet - public override int LabelNumber => 1044567; // skillet - - public override CraftSystem CraftSystem => DefCooking.CraftSystem; - - 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 CraftSystem CraftSystem => DefCooking.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/SledgeHammer.cs b/Projects/UOContent/Items/Skill Items/Tools/SledgeHammer.cs index e068aec0b..9c6ddc53e 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/SledgeHammer.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/SledgeHammer.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0xFB5, 0xFB4)] +[SerializationGenerator(0, false)] +public partial class SledgeHammer : BaseTool { - [Flippable(0xFB5, 0xFB4)] - public class SledgeHammer : BaseTool - { - [Constructible] - public SledgeHammer() : base(0xFB5) => Layer = Layer.OneHanded; + [Constructible] + public SledgeHammer() : base(0xFB5) => Layer = Layer.OneHanded; - [Constructible] - public SledgeHammer(int uses) : base(uses, 0xFB5) => Layer = Layer.OneHanded; + [Constructible] + public SledgeHammer(int uses) : base(uses, 0xFB5) => Layer = Layer.OneHanded; - public SledgeHammer(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; - - 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 CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/SmithHammer.cs b/Projects/UOContent/Items/Skill Items/Tools/SmithHammer.cs index e796d167e..d068457c9 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/SmithHammer.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/SmithHammer.cs @@ -1,42 +1,25 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x13E3, 0x13E4)] +[SerializationGenerator(0, false)] +public partial class SmithHammer : BaseTool { - [Flippable(0x13E3, 0x13E4)] - public class SmithHammer : BaseTool + [Constructible] + public SmithHammer() : base(0x13E3) { - [Constructible] - public SmithHammer() : base(0x13E3) - { - Weight = 8.0; - Layer = Layer.OneHanded; - } - - [Constructible] - public SmithHammer(int uses) : base(uses, 0x13E3) - { - Weight = 8.0; - Layer = Layer.OneHanded; - } - - public SmithHammer(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; - - 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 = 8.0; + Layer = Layer.OneHanded; } + + [Constructible] + public SmithHammer(int uses) : base(uses, 0x13E3) + { + Weight = 8.0; + Layer = Layer.OneHanded; + } + + public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/SmoothingPlane.cs b/Projects/UOContent/Items/Skill Items/Tools/SmoothingPlane.cs index 49d29de42..13487dffe 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/SmoothingPlane.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/SmoothingPlane.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1032, 0x1033)] +[SerializationGenerator(0, false)] +public partial class SmoothingPlane : BaseTool { - [Flippable(0x1032, 0x1033)] - public class SmoothingPlane : BaseTool - { - [Constructible] - public SmoothingPlane() : base(0x1032) => Weight = 1.0; + [Constructible] + public SmoothingPlane() : base(0x1032) => Weight = 1.0; - [Constructible] - public SmoothingPlane(int uses) : base(uses, 0x1032) => Weight = 1.0; + [Constructible] + public SmoothingPlane(int uses) : base(uses, 0x1032) => Weight = 1.0; - public SmoothingPlane(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefCarpentry.CraftSystem; - - 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 CraftSystem CraftSystem => DefCarpentry.CraftSystem; } diff --git a/Projects/UOContent/Items/Skill Items/Tools/TinkerTools.cs b/Projects/UOContent/Items/Skill Items/Tools/TinkerTools.cs index cf5503a50..d6f9fc4b8 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/TinkerTools.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/TinkerTools.cs @@ -1,30 +1,29 @@ using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x1EB8, 0x1EB9)] +[SerializationGenerator(0, false)] +public partial class TinkerTools : BaseTool { - [Flippable(0x1EB8, 0x1EB9)] - [SerializationGenerator(0, false)] - public partial class TinkerTools : BaseTool - { - [Constructible] - public TinkerTools() : base(0x1EB8) => Weight = 1.0; + [Constructible] + public TinkerTools() : base(0x1EB8) => Weight = 1.0; - [Constructible] - public TinkerTools(int uses) : base(uses, 0x1EB8) => Weight = 1.0; + [Constructible] + public TinkerTools(int uses) : base(uses, 0x1EB8) => Weight = 1.0; - public override CraftSystem CraftSystem => DefTinkering.CraftSystem; - } - - [SerializationGenerator(0, false)] - public partial class TinkersTools : BaseTool - { - [Constructible] - public TinkersTools() : base(0x1EBC) => Weight = 1.0; - - [Constructible] - public TinkersTools(int uses) : base(uses, 0x1EBC) => Weight = 1.0; - - public override CraftSystem CraftSystem => DefTinkering.CraftSystem; - } + public override CraftSystem CraftSystem => DefTinkering.CraftSystem; } + +[SerializationGenerator(0, false)] +public partial class TinkersTools : BaseTool +{ + [Constructible] + public TinkersTools() : base(0x1EBC) => Weight = 1.0; + + [Constructible] + public TinkersTools(int uses) : base(uses, 0x1EBC) => Weight = 1.0; + + public override CraftSystem CraftSystem => DefTinkering.CraftSystem; +} \ No newline at end of file diff --git a/Projects/UOContent/Items/Skill Items/Tools/Tongs.cs b/Projects/UOContent/Items/Skill Items/Tools/Tongs.cs index 7724cf599..4c76847f1 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/Tongs.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/Tongs.cs @@ -1,34 +1,17 @@ +using ModernUO.Serialization; using Server.Engines.Craft; -namespace Server.Items +namespace Server.Items; + +[Flippable(0xfbb, 0xfbc)] +[SerializationGenerator(0, false)] +public partial class Tongs : BaseTool { - [Flippable(0xfbb, 0xfbc)] - public class Tongs : BaseTool - { - [Constructible] - public Tongs() : base(0xFBB) => Weight = 2.0; + [Constructible] + public Tongs() : base(0xFBB) => Weight = 2.0; - [Constructible] - public Tongs(int uses) : base(uses, 0xFBB) => Weight = 2.0; + [Constructible] + public Tongs(int uses) : base(uses, 0xFBB) => Weight = 2.0; - public Tongs(Serial serial) : base(serial) - { - } - - public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; - - 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 CraftSystem CraftSystem => DefBlacksmithy.CraftSystem; } diff --git a/Projects/UOContent/Migrations/Server.Items.BaseRunicTool.v1.json b/Projects/UOContent/Migrations/Server.Items.BaseRunicTool.v1.json new file mode 100644 index 000000000..87b7f9f9d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BaseRunicTool.v1.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "type": "Server.Items.BaseRunicTool", + "properties": [ + { + "name": "Resource", + "type": "Server.Items.CraftResource", + "rule": "EnumMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.BaseTool.v2.json b/Projects/UOContent/Migrations/Server.Items.BaseTool.v2.json new file mode 100644 index 000000000..ae84764fe --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BaseTool.v2.json @@ -0,0 +1,27 @@ +{ + "version": 2, + "type": "Server.Items.BaseTool", + "properties": [ + { + "name": "Crafter", + "type": "string", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "Quality", + "type": "Server.Items.ToolQuality", + "rule": "EnumMigrationRule" + }, + { + "name": "UsesRemaining", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Blowpipe.v0.json b/Projects/UOContent/Migrations/Server.Items.Blowpipe.v0.json new file mode 100644 index 000000000..84645bfa7 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Blowpipe.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Blowpipe" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DovetailSaw.v0.json b/Projects/UOContent/Migrations/Server.Items.DovetailSaw.v0.json new file mode 100644 index 000000000..8e452b036 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DovetailSaw.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DovetailSaw" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DrawKnife.v0.json b/Projects/UOContent/Migrations/Server.Items.DrawKnife.v0.json new file mode 100644 index 000000000..568333417 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DrawKnife.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DrawKnife" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.FletcherTools.v0.json b/Projects/UOContent/Migrations/Server.Items.FletcherTools.v0.json new file mode 100644 index 000000000..f4078e214 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.FletcherTools.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.FletcherTools" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.FlourSifter.v0.json b/Projects/UOContent/Migrations/Server.Items.FlourSifter.v0.json new file mode 100644 index 000000000..8c546477e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.FlourSifter.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.FlourSifter" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Froe.v0.json b/Projects/UOContent/Migrations/Server.Items.Froe.v0.json new file mode 100644 index 000000000..c1bd89908 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Froe.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Froe" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Hammer.v0.json b/Projects/UOContent/Migrations/Server.Items.Hammer.v0.json new file mode 100644 index 000000000..e365a3fa1 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Hammer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Hammer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Inshave.v0.json b/Projects/UOContent/Migrations/Server.Items.Inshave.v0.json new file mode 100644 index 000000000..0bb187dce --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Inshave.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Inshave" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.JointingPlane.v0.json b/Projects/UOContent/Migrations/Server.Items.JointingPlane.v0.json new file mode 100644 index 000000000..c76efd7a6 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.JointingPlane.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.JointingPlane" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MalletAndChisel.v0.json b/Projects/UOContent/Migrations/Server.Items.MalletAndChisel.v0.json new file mode 100644 index 000000000..d71eb2c3e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MalletAndChisel.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MalletAndChisel" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MapmakersPen.v0.json b/Projects/UOContent/Migrations/Server.Items.MapmakersPen.v0.json new file mode 100644 index 000000000..9c1f064bd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MapmakersPen.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MapmakersPen" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MortarPestle.v0.json b/Projects/UOContent/Migrations/Server.Items.MortarPestle.v0.json new file mode 100644 index 000000000..1a7099d5c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MortarPestle.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MortarPestle" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MouldingPlane.v0.json b/Projects/UOContent/Migrations/Server.Items.MouldingPlane.v0.json new file mode 100644 index 000000000..0ee9dc909 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MouldingPlane.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MouldingPlane" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Nails.v0.json b/Projects/UOContent/Migrations/Server.Items.Nails.v0.json new file mode 100644 index 000000000..d20963212 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Nails.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Nails" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RollingPin.v0.json b/Projects/UOContent/Migrations/Server.Items.RollingPin.v0.json new file mode 100644 index 000000000..0081830ea --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RollingPin.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RollingPin" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RunicDovetailSaw.v0.json b/Projects/UOContent/Migrations/Server.Items.RunicDovetailSaw.v0.json new file mode 100644 index 000000000..5874b17fc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RunicDovetailSaw.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RunicDovetailSaw" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RunicFletcherTool.v0.json b/Projects/UOContent/Migrations/Server.Items.RunicFletcherTool.v0.json new file mode 100644 index 000000000..d273f580e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RunicFletcherTool.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RunicFletcherTool" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RunicHammer.v0.json b/Projects/UOContent/Migrations/Server.Items.RunicHammer.v0.json new file mode 100644 index 000000000..9afd944bd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RunicHammer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RunicHammer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RunicSewingKit.v0.json b/Projects/UOContent/Migrations/Server.Items.RunicSewingKit.v0.json new file mode 100644 index 000000000..fb27bdc3f --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RunicSewingKit.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RunicSewingKit" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Saw.v0.json b/Projects/UOContent/Migrations/Server.Items.Saw.v0.json new file mode 100644 index 000000000..b48111cdc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Saw.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Saw" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Scorp.v0.json b/Projects/UOContent/Migrations/Server.Items.Scorp.v0.json new file mode 100644 index 000000000..6f3f82ccc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Scorp.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Scorp" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ScribesPen.v0.json b/Projects/UOContent/Migrations/Server.Items.ScribesPen.v0.json new file mode 100644 index 000000000..16f7d6635 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ScribesPen.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ScribesPen" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SewingKit.v0.json b/Projects/UOContent/Migrations/Server.Items.SewingKit.v0.json new file mode 100644 index 000000000..4ff21fb27 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SewingKit.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SewingKit" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Skillet.v0.json b/Projects/UOContent/Migrations/Server.Items.Skillet.v0.json new file mode 100644 index 000000000..503a003e5 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Skillet.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Skillet" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SledgeHammer.v0.json b/Projects/UOContent/Migrations/Server.Items.SledgeHammer.v0.json new file mode 100644 index 000000000..a28c6ac58 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SledgeHammer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SledgeHammer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SmithHammer.v0.json b/Projects/UOContent/Migrations/Server.Items.SmithHammer.v0.json new file mode 100644 index 000000000..c4fc2395f --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SmithHammer.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SmithHammer" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SmoothingPlane.v0.json b/Projects/UOContent/Migrations/Server.Items.SmoothingPlane.v0.json new file mode 100644 index 000000000..55caac88e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SmoothingPlane.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SmoothingPlane" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Tongs.v0.json b/Projects/UOContent/Migrations/Server.Items.Tongs.v0.json new file mode 100644 index 000000000..2dcae21ed --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Tongs.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Tongs" +} \ No newline at end of file