From 0086d674e7701e80cafbd50f7e0f86c8387ca020 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:06:09 -0700 Subject: [PATCH] fix: Codegens special systems (#1537) --- .../Server.Items.AlchemyBag.v0.json | 4 + .../Server.Items.AlchemyStone.v0.json | 4 + .../Server.Items.BagOfingots.v0.json | 4 + .../Server.Items.GamblingStone.v0.json | 14 ++ .../Server.Items.IngotStone.v0.json | 4 + .../Migrations/Server.Items.RegStone.v0.json | 4 + .../Migrations/Server.Items.ResGate.v0.json | 4 + .../Migrations/Server.Items.ScribeBag.v0.json | 4 + .../Server.Items.ScribeStone.v0.json | 4 + .../Migrations/Server.Items.SmithBag.v0.json | 4 + .../Server.Items.SmithStone.v0.json | 4 + .../Migrations/Server.Items.TailorBag.v0.json | 4 + .../Server.Items.TailorStone.v0.json | 4 + .../Items/Resurrection/ResGate.cs | 71 +++---- .../Items/Stones/AlchemyStone.cs | 56 ++---- .../Items/Stones/GamblingStone.cs | 188 +++++++----------- .../Items/Stones/IngotStone.cs | 56 ++---- .../Special Systems/Items/Stones/RegStone.cs | 56 ++---- .../Items/Stones/ScribeStone.cs | 56 ++---- .../Items/Stones/SmithStone.cs | 56 ++---- .../Items/Stones/TailorStone.cs | 56 ++---- .../Items/Supply Bags/AlchemyBag.cs | 43 ++-- .../Items/Supply Bags/BagOfIngots.cs | 54 ++--- .../Items/Supply Bags/ScribeBag.cs | 42 ++-- .../Items/Supply Bags/SmithBag.cs | 54 ++--- .../Items/Supply Bags/TailorBag.cs | 53 ++--- 26 files changed, 366 insertions(+), 537 deletions(-) create mode 100644 Projects/UOContent/Migrations/Server.Items.AlchemyBag.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.AlchemyStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.BagOfingots.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.GamblingStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.IngotStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.RegStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ResGate.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ScribeBag.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ScribeStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SmithBag.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SmithStone.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.TailorBag.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.TailorStone.v0.json diff --git a/Projects/UOContent/Migrations/Server.Items.AlchemyBag.v0.json b/Projects/UOContent/Migrations/Server.Items.AlchemyBag.v0.json new file mode 100644 index 000000000..7200b3be4 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AlchemyBag.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.AlchemyBag" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.AlchemyStone.v0.json b/Projects/UOContent/Migrations/Server.Items.AlchemyStone.v0.json new file mode 100644 index 000000000..5735d8306 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AlchemyStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.AlchemyStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.BagOfingots.v0.json b/Projects/UOContent/Migrations/Server.Items.BagOfingots.v0.json new file mode 100644 index 000000000..7c13d651d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BagOfingots.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.BagOfingots" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.GamblingStone.v0.json b/Projects/UOContent/Migrations/Server.Items.GamblingStone.v0.json new file mode 100644 index 000000000..39659e278 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.GamblingStone.v0.json @@ -0,0 +1,14 @@ +{ + "version": 0, + "type": "Server.Items.GamblingStone", + "properties": [ + { + "name": "GamblePot", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.IngotStone.v0.json b/Projects/UOContent/Migrations/Server.Items.IngotStone.v0.json new file mode 100644 index 000000000..b1f2e7ff4 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.IngotStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.IngotStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.RegStone.v0.json b/Projects/UOContent/Migrations/Server.Items.RegStone.v0.json new file mode 100644 index 000000000..3b30ed31b --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.RegStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.RegStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ResGate.v0.json b/Projects/UOContent/Migrations/Server.Items.ResGate.v0.json new file mode 100644 index 000000000..5a5c9f59f --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ResGate.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ResGate" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ScribeBag.v0.json b/Projects/UOContent/Migrations/Server.Items.ScribeBag.v0.json new file mode 100644 index 000000000..8f9ca43e8 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ScribeBag.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ScribeBag" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ScribeStone.v0.json b/Projects/UOContent/Migrations/Server.Items.ScribeStone.v0.json new file mode 100644 index 000000000..1a0e2cb83 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ScribeStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ScribeStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SmithBag.v0.json b/Projects/UOContent/Migrations/Server.Items.SmithBag.v0.json new file mode 100644 index 000000000..ffcb41d19 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SmithBag.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SmithBag" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SmithStone.v0.json b/Projects/UOContent/Migrations/Server.Items.SmithStone.v0.json new file mode 100644 index 000000000..8ac926a0e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SmithStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SmithStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.TailorBag.v0.json b/Projects/UOContent/Migrations/Server.Items.TailorBag.v0.json new file mode 100644 index 000000000..b440f3864 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.TailorBag.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.TailorBag" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.TailorStone.v0.json b/Projects/UOContent/Migrations/Server.Items.TailorStone.v0.json new file mode 100644 index 000000000..e94426fcd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.TailorStone.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.TailorStone" +} \ No newline at end of file diff --git a/Projects/UOContent/Special Systems/Items/Resurrection/ResGate.cs b/Projects/UOContent/Special Systems/Items/Resurrection/ResGate.cs index 2eca59b51..e593912ad 100644 --- a/Projects/UOContent/Special Systems/Items/Resurrection/ResGate.cs +++ b/Projects/UOContent/Special Systems/Items/Resurrection/ResGate.cs @@ -1,53 +1,36 @@ +using ModernUO.Serialization; using Server.Gumps; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class ResGate : Item { - public class ResGate : Item + [Constructible] + public ResGate() : base(0xF6C) { - [Constructible] - public ResGate() : base(0xF6C) + Movable = false; + Hue = 0x2D1; + Light = LightType.Circle300; + } + + public override string DefaultName => "a resurrection gate"; + + public override bool OnMoveOver(Mobile m) + { + if (!m.Alive && m.Map?.CanFit(m.Location, 16, false, false) == true) { - Movable = false; - Hue = 0x2D1; - Light = LightType.Circle300; + m.PlaySound(0x214); + m.FixedEffect(0x376A, 10, 16); + + m.CloseGump(); + m.SendGump(new ResurrectGump(m)); + } + else + { + m.SendLocalizedMessage(502391); // Thou can not be resurrected there! } - public ResGate(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a resurrection gate"; - - public override bool OnMoveOver(Mobile m) - { - if (!m.Alive && m.Map?.CanFit(m.Location, 16, false, false) == true) - { - m.PlaySound(0x214); - m.FixedEffect(0x376A, 10, 16); - - m.CloseGump(); - m.SendGump(new ResurrectGump(m)); - } - else - { - m.SendLocalizedMessage(502391); // Thou can not be resurrected there! - } - - return false; - } - - 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 false; } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/AlchemyStone.cs b/Projects/UOContent/Special Systems/Items/Stones/AlchemyStone.cs index 5e6286613..505be3ae3 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/AlchemyStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/AlchemyStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class AlchemyStone : Item { - public class AlchemyStone : Item + [Constructible] + public AlchemyStone() : base(0xED4) { - [Constructible] - public AlchemyStone() : base(0xED4) + Movable = false; + Hue = 0x250; + } + + public override string DefaultName => "an Alchemist Supply Stone"; + + public override void OnDoubleClick(Mobile from) + { + var alcBag = new AlchemyBag(); + + if (!from.AddToBackpack(alcBag)) { - Movable = false; - Hue = 0x250; - } - - public AlchemyStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "an Alchemist Supply Stone"; - - public override void OnDoubleClick(Mobile from) - { - var alcBag = new AlchemyBag(); - - if (!from.AddToBackpack(alcBag)) - { - alcBag.Delete(); - } - } - - 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(); + alcBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/GamblingStone.cs b/Projects/UOContent/Special Systems/Items/Stones/GamblingStone.cs index 79c0d8dca..dc3898e39 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/GamblingStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/GamblingStone.cs @@ -1,126 +1,88 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class GamblingStone : Item { - public class GamblingStone : Item + [InvalidateProperties] + [SerializableField(0)] + [SerializedCommandProperty(AccessLevel.GameMaster)] + private int _gamblePot = 2500; + + [Constructible] + public GamblingStone() : base(0xED4) { - private int m_GamblePot = 2500; + Movable = false; + Hue = 0x56; + } - [Constructible] - public GamblingStone() - : base(0xED4) - { - Movable = false; - Hue = 0x56; - } + public override string DefaultName => "a gambling stone"; - public GamblingStone(Serial serial) - : base(serial) - { - } + public override void GetProperties(IPropertyList list) + { + base.GetProperties(list); - [CommandProperty(AccessLevel.GameMaster)] - public int GamblePot + list.Add($"Jackpot: {_gamblePot}gp"); + } + + public override void OnSingleClick(Mobile from) + { + base.OnSingleClick(from); + LabelTo(from, $"Jackpot: {_gamblePot}gp"); + } + + public override void OnDoubleClick(Mobile from) + { + var pack = from.Backpack; + + if (pack?.ConsumeTotal(typeof(Gold), 250) == true) { - get => m_GamblePot; - set + _gamblePot += 150; + InvalidateProperties(); + + var roll = Utility.Random(1200); + + if (roll == 0) // Jackpot { - m_GamblePot = value; - InvalidateProperties(); + const int maxCheck = 1000000; + + from.SendMessage(0x35, $"You win the {_gamblePot}gp jackpot!"); + + while (_gamblePot > maxCheck) + { + from.AddToBackpack(new BankCheck(maxCheck)); + + _gamblePot -= maxCheck; + } + + from.AddToBackpack(new BankCheck(_gamblePot)); + + _gamblePot = 2500; + } + else if (roll <= 20) // Chance for a regbag + { + from.SendMessage(0x35, "You win a bag of reagents!"); + from.AddToBackpack(new BagOfReagents()); + } + else if (roll <= 40) // Chance for gold + { + from.SendMessage(0x35, "You win 1500gp!"); + from.AddToBackpack(new BankCheck(1500)); + } + else if (roll <= 100) // Another chance for gold + { + from.SendMessage(0x35, "You win 1000gp!"); + from.AddToBackpack(new BankCheck(1000)); + } + else // Loser! + { + from.SendMessage(0x22, "You lose!"); } } - - public override string DefaultName => "a gambling stone"; - - public override void GetProperties(IPropertyList list) + else { - base.GetProperties(list); - - list.Add($"Jackpot: {m_GamblePot}gp"); - } - - public override void OnSingleClick(Mobile from) - { - base.OnSingleClick(from); - LabelTo(from, $"Jackpot: {m_GamblePot}gp"); - } - - public override void OnDoubleClick(Mobile from) - { - var pack = from.Backpack; - - if (pack?.ConsumeTotal(typeof(Gold), 250) == true) - { - m_GamblePot += 150; - InvalidateProperties(); - - var roll = Utility.Random(1200); - - if (roll == 0) // Jackpot - { - var maxCheck = 1000000; - - from.SendMessage(0x35, $"You win the {m_GamblePot}gp jackpot!"); - - while (m_GamblePot > maxCheck) - { - from.AddToBackpack(new BankCheck(maxCheck)); - - m_GamblePot -= maxCheck; - } - - from.AddToBackpack(new BankCheck(m_GamblePot)); - - m_GamblePot = 2500; - } - else if (roll <= 20) // Chance for a regbag - { - from.SendMessage(0x35, "You win a bag of reagents!"); - from.AddToBackpack(new BagOfReagents()); - } - else if (roll <= 40) // Chance for gold - { - from.SendMessage(0x35, "You win 1500gp!"); - from.AddToBackpack(new BankCheck(1500)); - } - else if (roll <= 100) // Another chance for gold - { - from.SendMessage(0x35, "You win 1000gp!"); - from.AddToBackpack(new BankCheck(1000)); - } - else // Loser! - { - from.SendMessage(0x22, "You lose!"); - } - } - else - { - from.SendMessage(0x22, "You need at least 250gp in your backpack to use this."); - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write(m_GamblePot); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 0: - { - m_GamblePot = reader.ReadInt(); - - break; - } - } + from.SendMessage(0x22, $"You need at least 250gp in your backpack to use this."); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/IngotStone.cs b/Projects/UOContent/Special Systems/Items/Stones/IngotStone.cs index 53c9a5813..fd8da8472 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/IngotStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/IngotStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class IngotStone : Item { - public class IngotStone : Item + [Constructible] + public IngotStone() : base(0xED4) { - [Constructible] - public IngotStone() : base(0xED4) + Movable = false; + Hue = 0x480; + } + + public override string DefaultName => "an Ingot stone"; + + public override void OnDoubleClick(Mobile from) + { + var ingotBag = new BagOfingots(); + + if (!from.AddToBackpack(ingotBag)) { - Movable = false; - Hue = 0x480; - } - - public IngotStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "an Ingot stone"; - - public override void OnDoubleClick(Mobile from) - { - var ingotBag = new BagOfingots(); - - if (!from.AddToBackpack(ingotBag)) - { - ingotBag.Delete(); - } - } - - 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(); + ingotBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/RegStone.cs b/Projects/UOContent/Special Systems/Items/Stones/RegStone.cs index 1c5b327b5..584832cd5 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/RegStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/RegStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class RegStone : Item { - public class RegStone : Item + [Constructible] + public RegStone() : base(0xED4) { - [Constructible] - public RegStone() : base(0xED4) + Movable = false; + Hue = 0x2D1; + } + + public override string DefaultName => "a reagent stone"; + + public override void OnDoubleClick(Mobile from) + { + var regBag = new BagOfReagents(); + + if (!from.AddToBackpack(regBag)) { - Movable = false; - Hue = 0x2D1; - } - - public RegStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a reagent stone"; - - public override void OnDoubleClick(Mobile from) - { - var regBag = new BagOfReagents(); - - if (!from.AddToBackpack(regBag)) - { - regBag.Delete(); - } - } - - 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(); + regBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/ScribeStone.cs b/Projects/UOContent/Special Systems/Items/Stones/ScribeStone.cs index a42b4ae9d..9158d6127 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/ScribeStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/ScribeStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class ScribeStone : Item { - public class ScribeStone : Item + [Constructible] + public ScribeStone() : base(0xED4) { - [Constructible] - public ScribeStone() : base(0xED4) + Movable = false; + Hue = 0x105; + } + + public override string DefaultName => "a Scribe Supply Stone"; + + public override void OnDoubleClick(Mobile from) + { + var scribeBag = new ScribeBag(); + + if (!from.AddToBackpack(scribeBag)) { - Movable = false; - Hue = 0x105; - } - - public ScribeStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a Scribe Supply Stone"; - - public override void OnDoubleClick(Mobile from) - { - var scribeBag = new ScribeBag(); - - if (!from.AddToBackpack(scribeBag)) - { - scribeBag.Delete(); - } - } - - 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(); + scribeBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/SmithStone.cs b/Projects/UOContent/Special Systems/Items/Stones/SmithStone.cs index c9f698001..58fde78e0 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/SmithStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/SmithStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class SmithStone : Item { - public class SmithStone : Item + [Constructible] + public SmithStone() : base(0xED4) { - [Constructible] - public SmithStone() : base(0xED4) + Movable = false; + Hue = 0x476; + } + + public override string DefaultName => "a Blacksmith Supply Stone"; + + public override void OnDoubleClick(Mobile from) + { + var SmithBag = new SmithBag(); + + if (!from.AddToBackpack(SmithBag)) { - Movable = false; - Hue = 0x476; - } - - public SmithStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a Blacksmith Supply Stone"; - - public override void OnDoubleClick(Mobile from) - { - var SmithBag = new SmithBag(); - - if (!from.AddToBackpack(SmithBag)) - { - SmithBag.Delete(); - } - } - - 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(); + SmithBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Stones/TailorStone.cs b/Projects/UOContent/Special Systems/Items/Stones/TailorStone.cs index 2094795c0..f0860b8f6 100644 --- a/Projects/UOContent/Special Systems/Items/Stones/TailorStone.cs +++ b/Projects/UOContent/Special Systems/Items/Stones/TailorStone.cs @@ -1,42 +1,26 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class TailorStone : Item { - public class TailorStone : Item + [Constructible] + public TailorStone() : base(0xED4) { - [Constructible] - public TailorStone() : base(0xED4) + Movable = false; + Hue = 0x315; + } + + public override string DefaultName => "a Tailor Supply Stone"; + + public override void OnDoubleClick(Mobile from) + { + var tailorBag = new TailorBag(); + + if (!from.AddToBackpack(tailorBag)) { - Movable = false; - Hue = 0x315; - } - - public TailorStone(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a Tailor Supply Stone"; - - public override void OnDoubleClick(Mobile from) - { - var tailorBag = new TailorBag(); - - if (!from.AddToBackpack(tailorBag)) - { - tailorBag.Delete(); - } - } - - 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(); + tailorBag.Delete(); } } } diff --git a/Projects/UOContent/Special Systems/Items/Supply Bags/AlchemyBag.cs b/Projects/UOContent/Special Systems/Items/Supply Bags/AlchemyBag.cs index 68c63d911..20ed28af9 100644 --- a/Projects/UOContent/Special Systems/Items/Supply Bags/AlchemyBag.cs +++ b/Projects/UOContent/Special Systems/Items/Supply Bags/AlchemyBag.cs @@ -1,36 +1,19 @@ using System; +using ModernUO.Serialization; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class AlchemyBag : Bag { - public class AlchemyBag : Bag + [Constructible] + public AlchemyBag(int amount = 5000) { - [Constructible] - public AlchemyBag(int amount = 5000) - { - Hue = 0x250; - DropItem(new MortarPestle(Math.Max(amount / 1000, 1))); - DropItem(new BagOfReagents(5000)); - DropItem(new Bottle(5000)); - } - - public AlchemyBag(Serial serial) : base(serial) - { - } - - public override string DefaultName => "an Alchemy 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(); - } + Hue = 0x250; + DropItem(new MortarPestle(Math.Max(amount / 1000, 1))); + DropItem(new BagOfReagents(5000)); + DropItem(new Bottle(5000)); } + + public override string DefaultName => "an Alchemy Kit"; } diff --git a/Projects/UOContent/Special Systems/Items/Supply Bags/BagOfIngots.cs b/Projects/UOContent/Special Systems/Items/Supply Bags/BagOfIngots.cs index 1ec7b80e5..5d477e805 100644 --- a/Projects/UOContent/Special Systems/Items/Supply Bags/BagOfIngots.cs +++ b/Projects/UOContent/Special Systems/Items/Supply Bags/BagOfIngots.cs @@ -1,39 +1,23 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class BagOfingots : Bag { - public class BagOfingots : Bag + [Constructible] + public BagOfingots(int amount = 5000) { - [Constructible] - public BagOfingots(int amount = 5000) - { - DropItem(new DullCopperIngot(amount)); - DropItem(new ShadowIronIngot(amount)); - DropItem(new CopperIngot(amount)); - DropItem(new BronzeIngot(amount)); - DropItem(new GoldIngot(amount)); - DropItem(new AgapiteIngot(amount)); - DropItem(new VeriteIngot(amount)); - DropItem(new ValoriteIngot(amount)); - DropItem(new IronIngot(amount)); - DropItem(new Tongs()); - DropItem(new TinkerTools()); - } - - public BagOfingots(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + DropItem(new DullCopperIngot(amount)); + DropItem(new ShadowIronIngot(amount)); + DropItem(new CopperIngot(amount)); + DropItem(new BronzeIngot(amount)); + DropItem(new GoldIngot(amount)); + DropItem(new AgapiteIngot(amount)); + DropItem(new VeriteIngot(amount)); + DropItem(new ValoriteIngot(amount)); + DropItem(new IronIngot(amount)); + DropItem(new Tongs()); + DropItem(new TinkerTools()); } } diff --git a/Projects/UOContent/Special Systems/Items/Supply Bags/ScribeBag.cs b/Projects/UOContent/Special Systems/Items/Supply Bags/ScribeBag.cs index 5c81d98f5..e568e196f 100644 --- a/Projects/UOContent/Special Systems/Items/Supply Bags/ScribeBag.cs +++ b/Projects/UOContent/Special Systems/Items/Supply Bags/ScribeBag.cs @@ -1,33 +1,17 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class ScribeBag : Bag { - public class ScribeBag : Bag + [Constructible] + public ScribeBag(int amount = 5000) { - [Constructible] - public ScribeBag(int amount = 5000) - { - Hue = 0x105; - DropItem(new BagOfReagents(amount)); - DropItem(new BlankScroll(amount)); - } - - public ScribeBag(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a Scribe 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(); - } + Hue = 0x105; + DropItem(new BagOfReagents(amount)); + DropItem(new BlankScroll(amount)); } + + public override string DefaultName => "a Scribe Kit"; } diff --git a/Projects/UOContent/Special Systems/Items/Supply Bags/SmithBag.cs b/Projects/UOContent/Special Systems/Items/Supply Bags/SmithBag.cs index fe2cc2b94..bafcb0537 100644 --- a/Projects/UOContent/Special Systems/Items/Supply Bags/SmithBag.cs +++ b/Projects/UOContent/Special Systems/Items/Supply Bags/SmithBag.cs @@ -1,39 +1,23 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class SmithBag : Bag { - public class SmithBag : Bag + [Constructible] + public SmithBag(int amount = 5000) { - [Constructible] - public SmithBag(int amount = 5000) - { - DropItem(new DullCopperIngot(amount)); - DropItem(new ShadowIronIngot(amount)); - DropItem(new CopperIngot(amount)); - DropItem(new BronzeIngot(amount)); - DropItem(new GoldIngot(amount)); - DropItem(new AgapiteIngot(amount)); - DropItem(new VeriteIngot(amount)); - DropItem(new ValoriteIngot(amount)); - DropItem(new IronIngot(amount)); - DropItem(new Tongs(amount)); - DropItem(new TinkerTools(amount)); - } - - public SmithBag(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + DropItem(new DullCopperIngot(amount)); + DropItem(new ShadowIronIngot(amount)); + DropItem(new CopperIngot(amount)); + DropItem(new BronzeIngot(amount)); + DropItem(new GoldIngot(amount)); + DropItem(new AgapiteIngot(amount)); + DropItem(new VeriteIngot(amount)); + DropItem(new ValoriteIngot(amount)); + DropItem(new IronIngot(amount)); + DropItem(new Tongs(amount)); + DropItem(new TinkerTools(amount)); } } diff --git a/Projects/UOContent/Special Systems/Items/Supply Bags/TailorBag.cs b/Projects/UOContent/Special Systems/Items/Supply Bags/TailorBag.cs index 0f8764feb..aca0514a4 100644 --- a/Projects/UOContent/Special Systems/Items/Supply Bags/TailorBag.cs +++ b/Projects/UOContent/Special Systems/Items/Supply Bags/TailorBag.cs @@ -1,41 +1,24 @@ using System; +using ModernUO.Serialization; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class TailorBag : Bag { - public class TailorBag : Bag + [Constructible] + public TailorBag(int amount = 500) { - [Constructible] - public TailorBag(int amount = 500) - { - Hue = 0x315; - DropItem(new SewingKit(Math.Max(amount / 100, 1))); - DropItem(new Scissors()); - DropItem(new Hides(amount)); - DropItem(new BoltOfCloth(Math.Max(amount / 25, 1))); - DropItem(new DyeTub()); - DropItem(new DyeTub()); - DropItem(new BlackDyeTub()); - DropItem(new Dyes()); - } - - public TailorBag(Serial serial) : base(serial) - { - } - - public override string DefaultName => "a Tailoring 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(); - } + Hue = 0x315; + DropItem(new SewingKit(Math.Max(amount / 100, 1))); + DropItem(new Scissors()); + DropItem(new Hides(amount)); + DropItem(new BoltOfCloth(Math.Max(amount / 25, 1))); + DropItem(new DyeTub()); + DropItem(new DyeTub()); + DropItem(new BlackDyeTub()); + DropItem(new Dyes()); } + + public override string DefaultName => "a Tailoring Kit"; }