From 39e6f62ec907e4c06e2dce390923ce3b653082d7 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Sat, 29 Oct 2022 16:08:23 -0700 Subject: [PATCH] fix: Codegens more misc items (#1216) --- .../UOContent/Engines/Khaldun/KhaldunGen.cs | 2 +- Projects/UOContent/Items/Misc/Gold.cs | 202 ++-- Projects/UOContent/Items/Misc/Guillotine.cs | 175 ++- Projects/UOContent/Items/Misc/HairDye.cs | 296 +++-- Projects/UOContent/Items/Misc/HoveringWisp.cs | 36 +- Projects/UOContent/Items/Misc/IDurability.cs | 31 +- .../UOContent/Items/Misc/InteriorDecorator.cs | 600 +++++----- Projects/UOContent/Items/Misc/Key.cs | 264 ++--- Projects/UOContent/Items/Misc/KeyRing.cs | 346 +++--- Projects/UOContent/Items/Misc/LOSBlocker.cs | 104 +- Projects/UOContent/Items/Misc/Moonstone.cs | 321 +++-- .../UOContent/Items/Misc/MoonstoneGate.cs | 131 +- Projects/UOContent/Items/Misc/MorphItem.cs | 232 ++-- Projects/UOContent/Items/Misc/OilCloth.cs | 217 ++-- Projects/UOContent/Items/Misc/Origami.cs | 283 ++--- .../Items/Misc/PlayerBulletinBoards.cs | 1051 ++++++++--------- .../UOContent/Items/Misc/PlayerVendorDeed.cs | 123 +- Projects/UOContent/Items/Misc/PowerCrystal.cs | 47 +- .../UOContent/Items/Misc/PowerGenerator.cs | 36 +- .../UOContent/Items/Misc/PromotionalToken.cs | 275 ++--- .../UOContent/Items/Misc/PublicMoongate.cs | 877 +++++++------- Projects/UOContent/Items/Misc/Rares.cs | 820 ++++--------- .../Server.Accounting.Account.v4.json | 2 - .../Migrations/Server.Items.Aquarium.v4.json | 1 - .../Migrations/Server.Items.BaseAddon.v3.json | 1 - .../Server.Items.BaseAddonContainer.v2.json | 1 - .../Server.Items.BasePlayerBB.v0.json | 38 + .../Server.Items.BroadcastCrystal.v1.json | 1 - .../Server.Items.ChiselsNorth.v0.json | 4 + .../Server.Items.ChiselsWest.v0.json | 4 + .../Server.Items.ContractOfEmployment.v0.json | 4 + .../Server.Items.CopperWire.v0.json | 4 + .../Server.Items.DirtyFrypan.v0.json | 4 + .../Server.Items.DirtyKettle.v0.json | 4 + .../Migrations/Server.Items.DirtyPan.v0.json | 4 + .../Migrations/Server.Items.DirtyPot.v0.json | 4 + .../Server.Items.DirtyRoundPot.v0.json | 4 + .../Server.Items.DirtySmallPot.v0.json | 4 + .../Server.Items.DirtySmallRoundPot.v0.json | 4 + .../Server.Items.DriedHerbs.v0.json | 4 + .../Server.Items.DriedOnions.v0.json | 4 + .../Server.Items.ForgedMetal.v0.json | 4 + .../Migrations/Server.Items.Gold.v0.json | 4 + .../Migrations/Server.Items.GoldWire.v0.json | 4 + .../Server.Items.GreenDriedFlowers.v0.json | 4 + .../Server.Items.Guillotine.v0.json | 4 + .../Migrations/Server.Items.HairDye.v0.json | 4 + .../Server.Items.HorseShoes.v0.json | 4 + .../Server.Items.HoveringWisp.v0.json | 4 + .../Server.Items.InteriorDecorator.v0.json | 4 + .../Migrations/Server.Items.IronWire.v0.json | 4 + .../Migrations/Server.Items.Key.v0.json | 35 + .../Migrations/Server.Items.KeyRing.v1.json | 15 + .../Server.Items.LOSBlocker.v0.json | 4 + .../Migrations/Server.Items.MapItem.v1.json | 1 - .../Migrations/Server.Items.Moonstone.v1.json | 11 + .../Server.Items.MoonstoneGate.v0.json | 4 + .../Migrations/Server.Items.MorphItem.v0.json | 38 + .../Migrations/Server.Items.OilCloth.v0.json | 4 + .../Server.Items.OrigamiButterfly.v0.json | 4 + .../Server.Items.OrigamiFish.v0.json | 4 + .../Server.Items.OrigamiFrog.v0.json | 4 + .../Server.Items.OrigamiPaper.v0.json | 4 + .../Server.Items.OrigamiShape.v0.json | 4 + .../Server.Items.OrigamiSongbird.v0.json | 4 + .../Server.Items.OrigamiSwan.v0.json | 4 + .../Server.Items.PaintsAndBrush.v0.json | 4 + .../Migrations/Server.Items.PenAndInk.v0.json | 4 + .../Server.Items.PlayerBBEast.v0.json | 4 + .../Server.Items.PlayerBBMessage.v0.json | 27 + .../Server.Items.PlayerBBSouth.v0.json | 4 + .../Server.Items.PowerCrystal.v0.json | 4 + .../Server.Items.PromotionalToken.v0.json | 4 + .../Server.Items.PublicMoongate.v0.json | 4 + .../Migrations/Server.Items.Rope.v0.json | 4 + .../Server.Items.SilverWire.v0.json | 4 + .../Server.Items.SolenAntHole.v1.json | 1 - ...erver.Items.SoulstoneFragmentToken.v0.json | 4 + .../Server.Items.TreasureMapChest.v2.json | 1 - .../Migrations/Server.Items.Whip.v0.json | 4 + .../Server.Items.WhiteDriedFlowers.v0.json | 4 + 81 files changed, 3042 insertions(+), 3780 deletions(-) create mode 100644 Projects/UOContent/Migrations/Server.Items.BasePlayerBB.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ChiselsNorth.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ChiselsWest.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ContractOfEmployment.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.CopperWire.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtyFrypan.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtyKettle.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtyPan.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtyPot.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtyRoundPot.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtySmallPot.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DirtySmallRoundPot.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DriedHerbs.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.DriedOnions.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.ForgedMetal.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Gold.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.GoldWire.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.GreenDriedFlowers.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Guillotine.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.HairDye.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.HorseShoes.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.HoveringWisp.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.InteriorDecorator.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.IronWire.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Key.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.KeyRing.v1.json create mode 100644 Projects/UOContent/Migrations/Server.Items.LOSBlocker.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Moonstone.v1.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MoonstoneGate.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.MorphItem.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OilCloth.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiButterfly.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiFish.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiFrog.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiPaper.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiShape.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiSongbird.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.OrigamiSwan.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PaintsAndBrush.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PenAndInk.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PlayerBBEast.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PlayerBBMessage.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PlayerBBSouth.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PowerCrystal.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PromotionalToken.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.PublicMoongate.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Rope.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SilverWire.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.SoulstoneFragmentToken.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.Whip.v0.json create mode 100644 Projects/UOContent/Migrations/Server.Items.WhiteDriedFlowers.v0.json diff --git a/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs b/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs index 2f4b6234f..c0048af7d 100644 --- a/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs +++ b/Projects/UOContent/Engines/Khaldun/KhaldunGen.cs @@ -20,7 +20,7 @@ namespace Server.Commands var found = false; foreach (var item in eable) { - if (item is MorphItem morphItem && morphItem.Z == z && morphItem.InactiveItemID == inactiveItemID && morphItem.ActiveItemID == activeItemID) + if (item is MorphItem morphItem && morphItem.Z == z && morphItem.InactiveItemId == inactiveItemID && morphItem.ActiveItemId == activeItemID) { found = true; break; diff --git a/Projects/UOContent/Items/Misc/Gold.cs b/Projects/UOContent/Items/Misc/Gold.cs index 51e507260..af606187f 100644 --- a/Projects/UOContent/Items/Misc/Gold.cs +++ b/Projects/UOContent/Items/Misc/Gold.cs @@ -1,138 +1,116 @@ using System; +using ModernUO.Serialization; using Server.Accounting; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Gold : Item { - public class Gold : Item + [Constructible] + public Gold(int amountFrom, int amountTo) : this(Utility.RandomMinMax(amountFrom, amountTo)) { - [Constructible] - public Gold(int amountFrom, int amountTo) : this(Utility.RandomMinMax(amountFrom, amountTo)) + } + + [Constructible] + public Gold(int amount = 1) : base(0xEED) + { + Stackable = true; + Amount = amount; + } + + public override double DefaultWeight => Core.ML ? 0.02 / 3 : 0.02; + + public override int GetDropSound() + { + return Amount switch { + <= 1 => 0x2E4, + <= 5 => 0x2E5, + _ => 0x2E6 + }; + } + + protected override void OnAmountChange(int oldValue) + { + var newValue = Amount; + + UpdateTotal(this, TotalType.Gold, newValue - oldValue); + } + + public override void OnAdded(IEntity parent) + { + base.OnAdded(parent); + + if (!AccountGold.Enabled) + { + return; } - [Constructible] - public Gold(int amount = 1) : base(0xEED) + Mobile owner = null; + SecureTradeInfo tradeInfo = null; + + var root = parent as Container; + + while (root?.Parent is Container container) { - Stackable = true; - Amount = amount; + root = container; } - public Gold(Serial serial) : base(serial) + parent = root ?? parent; + + if (parent is SecureTradeContainer trade && AccountGold.ConvertOnTrade) { + if (trade.Trade.From.Container == trade) + { + tradeInfo = trade.Trade.From; + owner = tradeInfo.Mobile; + } + else if (trade.Trade.To.Container == trade) + { + tradeInfo = trade.Trade.To; + owner = tradeInfo.Mobile; + } + } + else if (parent is BankBox box && AccountGold.ConvertOnBank) + { + owner = box.Owner; } - public override double DefaultWeight => Core.ML ? 0.02 / 3 : 0.02; - - public override int GetDropSound() + if (owner?.Account?.DepositGold(Amount) != true) { - if (Amount <= 1) - { - return 0x2E4; - } - - if (Amount <= 5) - { - return 0x2E5; - } - - return 0x2E6; + return; } - protected override void OnAmountChange(int oldValue) + if (tradeInfo != null) { - var newValue = Amount; + if (owner.NetState?.NewSecureTrading == false) + { + var plat = Math.DivRem(Amount, AccountGold.CurrencyThreshold, out var gold); - UpdateTotal(this, TotalType.Gold, newValue - oldValue); + tradeInfo.Plat += plat; + tradeInfo.Gold += gold; + } + + tradeInfo.VirtualCheck?.UpdateTrade(tradeInfo.Mobile); } - public override void OnAdded(IEntity parent) + owner.SendLocalizedMessage(1042763, $"{Amount:N0}"); + + Delete(); + + ((Container)parent).UpdateTotals(); + } + + public override int GetTotal(TotalType type) + { + var baseTotal = base.GetTotal(type); + + if (type == TotalType.Gold) { - base.OnAdded(parent); - - if (!AccountGold.Enabled) - { - return; - } - - Mobile owner = null; - SecureTradeInfo tradeInfo = null; - - var root = parent as Container; - - while (root?.Parent is Container container) - { - root = container; - } - - parent = root ?? parent; - - if (parent is SecureTradeContainer trade && AccountGold.ConvertOnTrade) - { - if (trade.Trade.From.Container == trade) - { - tradeInfo = trade.Trade.From; - owner = tradeInfo.Mobile; - } - else if (trade.Trade.To.Container == trade) - { - tradeInfo = trade.Trade.To; - owner = tradeInfo.Mobile; - } - } - else if (parent is BankBox box && AccountGold.ConvertOnBank) - { - owner = box.Owner; - } - - if (owner?.Account?.DepositGold(Amount) != true) - { - return; - } - - if (tradeInfo != null) - { - if (owner.NetState?.NewSecureTrading == false) - { - var plat = Math.DivRem(Amount, AccountGold.CurrencyThreshold, out var gold); - - tradeInfo.Plat += plat; - tradeInfo.Gold += gold; - } - - tradeInfo.VirtualCheck?.UpdateTrade(tradeInfo.Mobile); - } - - owner.SendLocalizedMessage(1042763, $"{Amount:N0}"); - - Delete(); - - ((Container)parent).UpdateTotals(); + baseTotal += Amount; } - public override int GetTotal(TotalType type) - { - var baseTotal = base.GetTotal(type); - - if (type == TotalType.Gold) - { - baseTotal += Amount; - } - - return baseTotal; - } - - 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 baseTotal; } } diff --git a/Projects/UOContent/Items/Misc/Guillotine.cs b/Projects/UOContent/Items/Misc/Guillotine.cs index 3b65f5a63..2e87f9e52 100644 --- a/Projects/UOContent/Items/Misc/Guillotine.cs +++ b/Projects/UOContent/Items/Misc/Guillotine.cs @@ -1,125 +1,102 @@ using System; +using ModernUO.Serialization; using Server.Network; using Server.Spells; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0)] +public partial class Guillotine : Item { - public class Guillotine : Item + private DateTime m_NextUse; + + [Constructible] + public Guillotine() : base(4656) => Movable = false; + + public override void OnDoubleClick(Mobile from) { - private DateTime m_NextUse; - - [Constructible] - public Guillotine() - : base(4656) => - Movable = false; - - public Guillotine(Serial serial) - : base(serial) + if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) { + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that } - - public override void OnDoubleClick(Mobile from) + else if (Visible && ItemID is 4656 or 4702 && Core.Now >= m_NextUse) { - if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that - } - else if (Visible && ItemID is 4656 or 4702 && Core.Now >= m_NextUse) - { - var p = GetWorldLocation(); - - if (Utility.Random(Math.Max((from.X - p.X).Abs(), (from.Y - p.Y).Abs())) < 1) - { - Effects.PlaySound(from.Location, from.Map, from.GetHurtSound()); - from.PublicOverheadMessage(MessageType.Regular, from.SpeechHue, true, "Ouch!"); - SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, Utility.Dice(2, 10, 5)); - } - - Effects.PlaySound(GetWorldLocation(), Map, 0x387); - - Timer.StartTimer(TimeSpan.FromSeconds(0.25), Down1); - Timer.StartTimer(TimeSpan.FromSeconds(0.50), Down2); - - Timer.StartTimer(TimeSpan.FromSeconds(5.00), BackUp); - - m_NextUse = Core.Now + TimeSpan.FromSeconds(10.0); - } - } - - private void Down1() - { - ItemID = ItemID == 4656 ? 4678 : 4712; - } - - private void Down2() - { - ItemID = ItemID == 4678 ? 4679 : 4713; - var p = GetWorldLocation(); - var f = Map; - if (f == null) + if (Utility.Random(Math.Max((from.X - p.X).Abs(), (from.Y - p.Y).Abs())) < 1) { - return; + Effects.PlaySound(from.Location, from.Map, from.GetHurtSound()); + from.PublicOverheadMessage(MessageType.Regular, from.SpeechHue, true, "Ouch!"); + SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, Utility.Dice(2, 10, 5)); } - new Blood(4650).MoveToWorld(p, f); + Effects.PlaySound(GetWorldLocation(), Map, 0x387); - for (var i = 0; i < 4; ++i) + Timer.StartTimer(TimeSpan.FromSeconds(0.25), Down1); + Timer.StartTimer(TimeSpan.FromSeconds(0.50), Down2); + + Timer.StartTimer(TimeSpan.FromSeconds(5.00), BackUp); + + m_NextUse = Core.Now + TimeSpan.FromSeconds(10.0); + } + } + + private void Down1() + { + ItemID = ItemID == 4656 ? 4678 : 4712; + } + + private void Down2() + { + ItemID = ItemID == 4678 ? 4679 : 4713; + + var p = GetWorldLocation(); + var f = Map; + + if (f == null) + { + return; + } + + new Blood(4650).MoveToWorld(p, f); + + for (var i = 0; i < 4; ++i) + { + var x = p.X - 2 + Utility.Random(5); + var y = p.Y - 2 + Utility.Random(5); + var z = p.Z; + + if (!f.CanFit(x, y, z, 1, false, false)) { - var x = p.X - 2 + Utility.Random(5); - var y = p.Y - 2 + Utility.Random(5); - var z = p.Z; + z = f.GetAverageZ(x, y); if (!f.CanFit(x, y, z, 1, false, false)) { - z = f.GetAverageZ(x, y); - - if (!f.CanFit(x, y, z, 1, false, false)) - { - continue; - } + continue; } - - var loc = f.GetRandomNearbyLocation(p, 2, -2, 4, 1); - - new Blood().MoveToWorld(loc, f); } - } - private void BackUp() - { - if (ItemID is 4678 or 4679) - { - ItemID = 4656; - } - else if (ItemID is 4712 or 4713) - { - ItemID = 4702; - } - } + var loc = f.GetRandomNearbyLocation(p, 2, -2, 4, 1); - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write((byte)0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - int version = reader.ReadByte(); - - if (ItemID is 4678 or 4679) - { - ItemID = 4656; - } - else if (ItemID is 4712 or 4713) - { - ItemID = 4702; - } + new Blood().MoveToWorld(loc, f); } } + + private void BackUp() + { + if (ItemID is 4678 or 4679) + { + ItemID = 4656; + } + else if (ItemID is 4712 or 4713) + { + ItemID = 4702; + } + } + + [AfterDeserialization] + private void AfterDeserialization() + { + BackUp(); + } } diff --git a/Projects/UOContent/Items/Misc/HairDye.cs b/Projects/UOContent/Items/Misc/HairDye.cs index 2ab248676..bc5e12351 100644 --- a/Projects/UOContent/Items/Misc/HairDye.cs +++ b/Projects/UOContent/Items/Misc/HairDye.cs @@ -1,168 +1,150 @@ +using System; +using ModernUO.Serialization; using Server.Gumps; using Server.Network; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class HairDye : Item { - public class HairDye : Item + [Constructible] + public HairDye() : base(0xEFF) => Weight = 1.0; + + public override int LabelNumber => 1041060; // Hair Dye + + public override void OnDoubleClick(Mobile from) { - [Constructible] - public HairDye() : base(0xEFF) => Weight = 1.0; - - public HairDye(Serial serial) : base(serial) + if (from.InRange(GetWorldLocation(), 1)) { + from.CloseGump(); + from.SendGump(new HairDyeGump(this)); } - - public override int LabelNumber => 1041060; // Hair Dye - - public override void Serialize(IGenericWriter writer) + else { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - public override void OnDoubleClick(Mobile from) - { - if (from.InRange(GetWorldLocation(), 1)) - { - from.CloseGump(); - from.SendGump(new HairDyeGump(this)); - } - else - { - from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that. - } - } - } - - public class HairDyeGump : Gump - { - private static readonly HairDyeEntry[] m_Entries = - { - new("*****", 1602, 26), - new("*****", 1628, 27), - new("*****", 1502, 32), - new("*****", 1302, 32), - new("*****", 1402, 32), - new("*****", 1202, 24), - new("*****", 2402, 29), - new("*****", 2213, 6), - new("*****", 1102, 8), - new("*****", 1110, 8), - new("*****", 1118, 16), - new("*****", 1134, 16) - }; - - private readonly HairDye m_HairDye; - - public HairDyeGump(HairDye dye) : base(50, 50) - { - m_HairDye = dye; - - AddPage(0); - - AddBackground(100, 10, 350, 355, 2600); - AddBackground(120, 54, 110, 270, 5100); - - AddHtmlLocalized(70, 25, 400, 35, 1011013); //
Hair Color Selection Menu
- - AddButton(149, 328, 4005, 4007, 1); - AddHtmlLocalized(185, 329, 250, 35, 1011014); // Dye my hair this color! - - for (var i = 0; i < m_Entries.Length; ++i) - { - AddLabel(130, 59 + i * 22, m_Entries[i].HueStart - 1, m_Entries[i].Name); - AddButton(207, 60 + i * 22, 5224, 5224, 0, GumpButtonType.Page, i + 1); - } - - for (var i = 0; i < m_Entries.Length; ++i) - { - var e = m_Entries[i]; - - AddPage(i + 1); - - for (var j = 0; j < e.HueCount; ++j) - { - AddLabel(278 + j / 16 * 80, 52 + j % 16 * 17, e.HueStart + j - 1, "*****"); - AddRadio(260 + j / 16 * 80, 52 + j % 16 * 17, 210, 211, false, i * 100 + j); - } - } - } - - public override void OnResponse(NetState from, RelayInfo info) - { - if (m_HairDye.Deleted) - { - return; - } - - var m = from.Mobile; - var switches = info.Switches; - - if (!m_HairDye.IsChildOf(m.Backpack)) - { - m.SendLocalizedMessage(1042010); // You must have the objectin your backpack to use it. - return; - } - - if (info.ButtonID != 0 && switches.Length > 0) - { - if (m.HairItemID == 0 && m.FacialHairItemID == 0) - { - m.SendLocalizedMessage(502623); // You have no hair to dye and cannot use this - } - else - { - // To prevent this from being exploited, the hue is abstracted into an internal list - - var entryIndex = switches[0] / 100; - var hueOffset = switches[0] % 100; - - if (entryIndex >= 0 && entryIndex < m_Entries.Length) - { - var e = m_Entries[entryIndex]; - - if (hueOffset >= 0 && hueOffset < e.HueCount) - { - var hue = e.HueStart + hueOffset; - - m.HairHue = hue; - m.FacialHairHue = hue; - - m.SendLocalizedMessage(501199); // You dye your hair - m_HairDye.Delete(); - m.PlaySound(0x4E); - } - } - } - } - else - { - m.SendLocalizedMessage(501200); // You decide not to dye your hair - } - } - - private class HairDyeEntry - { - public HairDyeEntry(string name, int hueStart, int hueCount) - { - Name = name; - HueStart = hueStart; - HueCount = hueCount; - } - - public string Name { get; } - - public int HueStart { get; } - - public int HueCount { get; } + from.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that. } } } + +public class HairDyeGump : Gump +{ + private static HairDyeEntry[] _entries = + { + new("*****", 1602, 26), + new("*****", 1628, 27), + new("*****", 1502, 32), + new("*****", 1302, 32), + new("*****", 1402, 32), + new("*****", 1202, 24), + new("*****", 2402, 29), + new("*****", 2213, 6), + new("*****", 1102, 8), + new("*****", 1110, 8), + new("*****", 1118, 16), + new("*****", 1134, 16) + }; + + private HairDye _hairDye; + + public HairDyeGump(HairDye dye) : base(50, 50) + { + _hairDye = dye; + + AddPage(0); + + AddBackground(100, 10, 350, 355, 2600); + AddBackground(120, 54, 110, 270, 5100); + + AddHtmlLocalized(70, 25, 400, 35, 1011013); //
Hair Color Selection Menu
+ + AddButton(149, 328, 4005, 4007, 1); + AddHtmlLocalized(185, 329, 250, 35, 1011014); // Dye my hair this color! + + for (var i = 0; i < _entries.Length; ++i) + { + AddLabel(130, 59 + i * 22, _entries[i].HueStart - 1, _entries[i].Name); + AddButton(207, 60 + i * 22, 5224, 5224, 0, GumpButtonType.Page, i + 1); + } + + for (var i = 0; i < _entries.Length; ++i) + { + var e = _entries[i]; + + AddPage(i + 1); + + for (var j = 0; j < e.HueCount; ++j) + { + AddLabel(278 + j / 16 * 80, 52 + j % 16 * 17, e.HueStart + j - 1, "*****"); + AddRadio(260 + j / 16 * 80, 52 + j % 16 * 17, 210, 211, false, i * 100 + j); + } + } + } + + public override void OnResponse(NetState from, RelayInfo info) + { + if (_hairDye.Deleted) + { + return; + } + + var m = from.Mobile; + var switches = info.Switches; + + if (!_hairDye.IsChildOf(m.Backpack)) + { + m.SendLocalizedMessage(1042010); // You must have the object in your backpack to use it. + return; + } + + if (info.ButtonID != 0 && switches.Length > 0) + { + if (m.HairItemID == 0 && m.FacialHairItemID == 0) + { + m.SendLocalizedMessage(502623); // You have no hair to dye and cannot use this + } + else + { + // To prevent this from being exploited, the hue is abstracted into an internal list + var entryIndex = Math.DivRem(switches[0], 100, out var hueOffset); + + if (entryIndex >= 0 && entryIndex < _entries.Length) + { + var e = _entries[entryIndex]; + + if (hueOffset >= 0 && hueOffset < e.HueCount) + { + var hue = e.HueStart + hueOffset; + + m.HairHue = hue; + m.FacialHairHue = hue; + + m.SendLocalizedMessage(501199); // You dye your hair + _hairDye.Delete(); + m.PlaySound(0x4E); + } + } + } + } + else + { + m.SendLocalizedMessage(501200); // You decide not to dye your hair + } + } + + private class HairDyeEntry + { + public HairDyeEntry(string name, int hueStart, int hueCount) + { + Name = name; + HueStart = hueStart; + HueCount = hueCount; + } + + public string Name { get; } + + public int HueStart { get; } + + public int HueCount { get; } + } +} diff --git a/Projects/UOContent/Items/Misc/HoveringWisp.cs b/Projects/UOContent/Items/Misc/HoveringWisp.cs index aacabb593..15b60bb93 100644 --- a/Projects/UOContent/Items/Misc/HoveringWisp.cs +++ b/Projects/UOContent/Items/Misc/HoveringWisp.cs @@ -1,30 +1,14 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class HoveringWisp : Item { - public class HoveringWisp : Item + [Constructible] + public HoveringWisp() : base(0x2100) { - [Constructible] - public HoveringWisp() : base(0x2100) - { - } - - public HoveringWisp(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1072881; // hovering wisp - - 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 int LabelNumber => 1072881; // hovering wisp } diff --git a/Projects/UOContent/Items/Misc/IDurability.cs b/Projects/UOContent/Items/Misc/IDurability.cs index a3f49be21..dc874e926 100644 --- a/Projects/UOContent/Items/Misc/IDurability.cs +++ b/Projects/UOContent/Items/Misc/IDurability.cs @@ -1,21 +1,20 @@ -namespace Server.Items +namespace Server.Items; + +internal interface IDurability { - internal interface IDurability - { - bool CanFortify { get; } + bool CanFortify { get; } - int InitMinHits { get; } - int InitMaxHits { get; } + int InitMinHits { get; } + int InitMaxHits { get; } - int HitPoints { get; set; } - int MaxHitPoints { get; set; } + int HitPoints { get; set; } + int MaxHitPoints { get; set; } - void ScaleDurability(); - void UnscaleDurability(); - } - - internal interface IWearableDurability : IDurability - { - int OnHit(BaseWeapon weapon, int damageTaken); - } + void ScaleDurability(); + void UnscaleDurability(); +} + +internal interface IWearableDurability : IDurability +{ + int OnHit(BaseWeapon weapon, int damageTaken); } diff --git a/Projects/UOContent/Items/Misc/InteriorDecorator.cs b/Projects/UOContent/Items/Misc/InteriorDecorator.cs index 953b19c21..af0f172ea 100644 --- a/Projects/UOContent/Items/Misc/InteriorDecorator.cs +++ b/Projects/UOContent/Items/Misc/InteriorDecorator.cs @@ -1,375 +1,351 @@ +using ModernUO.Serialization; using Server.Gumps; using Server.Multis; using Server.Network; using Server.Targeting; -namespace Server.Items +namespace Server.Items; + +public enum DecorateCommand { - public enum DecorateCommand + None, + Turn, + Up, + Down +} + +[SerializationGenerator(0, false)] +public partial class InteriorDecorator : Item +{ + private DecorateCommand m_Command; + + [Constructible] + public InteriorDecorator() : base(0xFC1) { - None, - Turn, - Up, - Down + Weight = 1.0; + LootType = LootType.Blessed; } - public class InteriorDecorator : Item + [CommandProperty(AccessLevel.GameMaster)] + public DecorateCommand Command { - private DecorateCommand m_Command; - - [Constructible] - public InteriorDecorator() : base(0xFC1) + get => m_Command; + set { - Weight = 1.0; - LootType = LootType.Blessed; + m_Command = value; + InvalidateProperties(); + } + } + + public override int LabelNumber => 1041280; // an interior decorator + + public override void GetProperties(IPropertyList list) + { + base.GetProperties(list); + + if (m_Command != DecorateCommand.None) + { + list.Add(1018322 + (int)m_Command); // Turn/Up/Down + } + } + + public override void OnDoubleClick(Mobile from) + { + if (!CheckUse(from)) + { + return; } - public InteriorDecorator(Serial serial) : base(serial) + if (!from.HasGump()) { + from.SendGump(new InternalGump(this)); } - [CommandProperty(AccessLevel.GameMaster)] - public DecorateCommand Command + if (m_Command != DecorateCommand.None) { - get => m_Command; - set + from.Target = new InternalTarget(this); + } + } + + public static bool CheckUse(Mobile from) + { + if (BaseHouse.FindHouseAt(from)?.IsCoOwner(from) == true) + { + return true; + } + + from.SendLocalizedMessage(502092); // You must be in your house to do this. + return false; + } + + private class InternalGump : Gump + { + private readonly InteriorDecorator m_Decorator; + + public InternalGump(InteriorDecorator decorator) : base(150, 50) + { + m_Decorator = decorator; + + AddBackground(0, 0, 200, 200, 2600); + + AddButton(50, 45, decorator.Command == DecorateCommand.Turn ? 2154 : 2152, 2154, 1); + AddHtmlLocalized(90, 50, 70, 40, 1018323); // Turn + + AddButton(50, 95, decorator.Command == DecorateCommand.Up ? 2154 : 2152, 2154, 2); + AddHtmlLocalized(90, 100, 70, 40, 1018324); // Up + + AddButton(50, 145, decorator.Command == DecorateCommand.Down ? 2154 : 2152, 2154, 3); + AddHtmlLocalized(90, 150, 70, 40, 1018325); // Down + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + var command = info.ButtonID switch { - m_Command = value; - InvalidateProperties(); - } - } + 1 => DecorateCommand.Turn, + 2 => DecorateCommand.Up, + 3 => DecorateCommand.Down, + _ => DecorateCommand.None + }; - public override int LabelNumber => 1041280; // an interior decorator - - public override void GetProperties(IPropertyList list) - { - base.GetProperties(list); - - if (m_Command != DecorateCommand.None) + if (command != DecorateCommand.None) { - list.Add(1018322 + (int)m_Command); // Turn/Up/Down - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - public override void OnDoubleClick(Mobile from) - { - if (!CheckUse(this, from)) - { - return; - } - - if (!from.HasGump()) - { - from.SendGump(new InternalGump(this)); - } - - if (m_Command != DecorateCommand.None) - { - from.Target = new InternalTarget(this); - } - } - - public static bool InHouse(Mobile from) - { - var house = BaseHouse.FindHouseAt(from); - - return house?.IsCoOwner(from) == true; - } - - public static bool CheckUse(InteriorDecorator tool, Mobile from) - { - /*if (tool.Deleted || !tool.IsChildOf( from.Backpack )) - from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. - else*/ - if (!InHouse(from)) - { - from.SendLocalizedMessage(502092); // You must be in your house to do this. + m_Decorator.Command = command; + sender.Mobile.SendGump(new InternalGump(m_Decorator)); + sender.Mobile.Target = new InternalTarget(m_Decorator); } else { - return true; - } - - return false; - } - - private class InternalGump : Gump - { - private readonly InteriorDecorator m_Decorator; - - public InternalGump(InteriorDecorator decorator) : base(150, 50) - { - m_Decorator = decorator; - - AddBackground(0, 0, 200, 200, 2600); - - AddButton(50, 45, decorator.Command == DecorateCommand.Turn ? 2154 : 2152, 2154, 1); - AddHtmlLocalized(90, 50, 70, 40, 1018323); // Turn - - AddButton(50, 95, decorator.Command == DecorateCommand.Up ? 2154 : 2152, 2154, 2); - AddHtmlLocalized(90, 100, 70, 40, 1018324); // Up - - AddButton(50, 145, decorator.Command == DecorateCommand.Down ? 2154 : 2152, 2154, 3); - AddHtmlLocalized(90, 150, 70, 40, 1018325); // Down - } - - public override void OnResponse(NetState sender, RelayInfo info) - { - var command = info.ButtonID switch - { - 1 => DecorateCommand.Turn, - 2 => DecorateCommand.Up, - 3 => DecorateCommand.Down, - _ => DecorateCommand.None - }; - - if (command != DecorateCommand.None) - { - m_Decorator.Command = command; - sender.Mobile.SendGump(new InternalGump(m_Decorator)); - sender.Mobile.Target = new InternalTarget(m_Decorator); - } - else - { - Target.Cancel(sender.Mobile); - } + Target.Cancel(sender.Mobile); } } + } - private class InternalTarget : Target + private class InternalTarget : Target + { + private readonly InteriorDecorator m_Decorator; + + public InternalTarget(InteriorDecorator decorator) : base(-1, false, TargetFlags.None) { - private readonly InteriorDecorator m_Decorator; + CheckLOS = false; - public InternalTarget(InteriorDecorator decorator) : base(-1, false, TargetFlags.None) + m_Decorator = decorator; + } + + protected override void OnTargetNotAccessible(Mobile from, object targeted) + { + OnTarget(from, targeted); + } + + protected override void OnTarget(Mobile from, object targeted) + { + if (targeted is Item item && CheckUse(from)) { - CheckLOS = false; + var house = BaseHouse.FindHouseAt(from); - m_Decorator = decorator; - } - - protected override void OnTargetNotAccessible(Mobile from, object targeted) - { - OnTarget(from, targeted); - } - - protected override void OnTarget(Mobile from, object targeted) - { - if (targeted is Item item && CheckUse(m_Decorator, from)) - { - var house = BaseHouse.FindHouseAt(from); - - var isDecorableComponent = false; - object addon = null; - var count = 0; - - if (item is AddonComponent component) - { - count = component.Addon.Components.Count; - addon = component.Addon; - } - else if (item is AddonContainerComponent containerComponent) - { - count = containerComponent.Addon.Components.Count; - addon = containerComponent.Addon; - } - else if (item is BaseAddonContainer container) - { - count = container.Components.Count; - addon = container; - } - - if (addon != null) - { - if (count == 1 && Core.SE) - { - isDecorableComponent = true; - } - - if (m_Decorator.Command == DecorateCommand.Turn) - { - var attributes = - (FlippableAddonAttribute[])addon.GetType() - .GetCustomAttributes(typeof(FlippableAddonAttribute), false); - - if (attributes.Length > 0) - { - isDecorableComponent = true; - } - } - } - - if (house?.IsCoOwner(from) != true) - { - from.SendLocalizedMessage(502092); // You must be in your house to do this. - } - else if (item.Parent != null || !house.IsInside(item)) - { - from.SendLocalizedMessage(1042270); // That is not in your house. - } - else if (!house.HasLockedDownItem(item) && !house.HasSecureItem(item) && !isDecorableComponent) - { - if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Up) - { - from.SendLocalizedMessage(1042274); // You cannot raise it up any higher. - } - else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Down) - { - from.SendLocalizedMessage(1042275); // You cannot lower it down any further. - } - else - { - from.SendLocalizedMessage(1042271); // That is not locked down. - } - } - else if (item is VendorRentalContract) - { - from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object. - } - else if (item.TotalWeight + item.PileWeight > 100) - { - from.SendLocalizedMessage(1042272); // That is too heavy. - } - else - { - switch (m_Decorator.Command) - { - case DecorateCommand.Up: - Up(item, from); - break; - case DecorateCommand.Down: - Down(item, from); - break; - case DecorateCommand.Turn: - Turn(item, from); - break; - } - } - } - - from.Target = new InternalTarget(m_Decorator); - } - - protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType) - { - if (cancelType == TargetCancelType.Canceled) - { - from.CloseGump(); - } - } - - private static void Turn(Item item, Mobile from) - { + var isDecorableComponent = false; object addon = null; + var count = 0; if (item is AddonComponent component) { + count = component.Addon.Components.Count; addon = component.Addon; } else if (item is AddonContainerComponent containerComponent) { + count = containerComponent.Addon.Components.Count; addon = containerComponent.Addon; } else if (item is BaseAddonContainer container) { + count = container.Components.Count; addon = container; } if (addon != null) { - var aAttributes = - (FlippableAddonAttribute[])addon.GetType() - .GetCustomAttributes(typeof(FlippableAddonAttribute), false); - - if (aAttributes.Length > 0) + if (count == 1 && Core.SE) { - aAttributes[0].Flip(from, (Item)addon); - return; + isDecorableComponent = true; + } + + if (m_Decorator.Command == DecorateCommand.Turn) + { + var attributes = + (FlippableAddonAttribute[])addon.GetType() + .GetCustomAttributes(typeof(FlippableAddonAttribute), false); + + if (attributes.Length > 0) + { + isDecorableComponent = true; + } } } - var attributes = - (FlippableAttribute[])item.GetType().GetCustomAttributes(typeof(FlippableAttribute), false); - - if (attributes.Length > 0) + if (house?.IsCoOwner(from) != true) { - attributes[0].Flip(item); + from.SendLocalizedMessage(502092); // You must be in your house to do this. } - else + else if (item.Parent != null || !house.IsInside(item)) { - from.SendLocalizedMessage(1042273); // You cannot turn that. + from.SendLocalizedMessage(1042270); // That is not in your house. } - } - - private static void Up(Item item, Mobile from) - { - var floorZ = GetFloorZ(item); - - if (floorZ > int.MinValue && item.Z < floorZ + 15) // Confirmed : no height checks here + else if (!house.HasLockedDownItem(item) && !house.HasSecureItem(item) && !isDecorableComponent) { - item.Location = new Point3D(item.Location.X, item.Location.Y, item.Z + 1); - } - else - { - from.SendLocalizedMessage(1042274); // You cannot raise it up any higher. - } - } - - private static void Down(Item item, Mobile from) - { - var floorZ = GetFloorZ(item); - - if (floorZ > int.MinValue && item.Z > GetFloorZ(item)) - { - item.Location = new Point3D(item.Location.X, item.Location.Y, item.Z - 1); - } - else - { - from.SendLocalizedMessage(1042275); // You cannot lower it down any further. - } - } - - private static int GetFloorZ(Item item) - { - var map = item.Map; - - if (map == null) - { - return int.MinValue; - } - - var tiles = map.Tiles.GetStaticTiles(item.X, item.Y, true); - - var z = int.MinValue; - - for (var i = 0; i < tiles.Length; ++i) - { - var tile = tiles[i]; - var id = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; - - var top = tile.Z; // Confirmed : no height checks here - - if (id.Surface && !id.Impassable && top > z && top <= item.Z) + if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Up) { - z = top; + from.SendLocalizedMessage(1042274); // You cannot raise it up any higher. + } + else if (item is AddonComponent && m_Decorator.Command == DecorateCommand.Down) + { + from.SendLocalizedMessage(1042275); // You cannot lower it down any further. + } + else + { + from.SendLocalizedMessage(1042271); // That is not locked down. + } + } + else if (item is VendorRentalContract) + { + from.SendLocalizedMessage(1062491); // You cannot use the house decorator on that object. + } + else if (item.TotalWeight + item.PileWeight > 100) + { + from.SendLocalizedMessage(1042272); // That is too heavy. + } + else + { + switch (m_Decorator.Command) + { + case DecorateCommand.Up: + { + Up(item, from); + break; + } + case DecorateCommand.Down: + { + Down(item, from); + break; + } + case DecorateCommand.Turn: + { + Turn(item, from); + break; + } } } - - return z; } + + from.Target = new InternalTarget(m_Decorator); + } + + protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType) + { + if (cancelType == TargetCancelType.Canceled) + { + from.CloseGump(); + } + } + + private static void Turn(Item item, Mobile from) + { + object addon = null; + + if (item is AddonComponent component) + { + addon = component.Addon; + } + else if (item is AddonContainerComponent containerComponent) + { + addon = containerComponent.Addon; + } + else if (item is BaseAddonContainer container) + { + addon = container; + } + + if (addon != null) + { + var aAttributes = + (FlippableAddonAttribute[])addon.GetType() + .GetCustomAttributes(typeof(FlippableAddonAttribute), false); + + if (aAttributes.Length > 0) + { + aAttributes[0].Flip(from, (Item)addon); + return; + } + } + + var attributes = + (FlippableAttribute[])item.GetType().GetCustomAttributes(typeof(FlippableAttribute), false); + + if (attributes.Length > 0) + { + attributes[0].Flip(item); + } + else + { + from.SendLocalizedMessage(1042273); // You cannot turn that. + } + } + + private static void Up(Item item, Mobile from) + { + var floorZ = GetFloorZ(item); + + if (floorZ > int.MinValue && item.Z < floorZ + 15) // Confirmed : no height checks here + { + item.Location = new Point3D(item.Location.X, item.Location.Y, item.Z + 1); + } + else + { + from.SendLocalizedMessage(1042274); // You cannot raise it up any higher. + } + } + + private static void Down(Item item, Mobile from) + { + var floorZ = GetFloorZ(item); + + if (floorZ > int.MinValue && item.Z > GetFloorZ(item)) + { + item.Location = new Point3D(item.Location.X, item.Location.Y, item.Z - 1); + } + else + { + from.SendLocalizedMessage(1042275); // You cannot lower it down any further. + } + } + + private static int GetFloorZ(Item item) + { + var map = item.Map; + + if (map == null) + { + return int.MinValue; + } + + var tiles = map.Tiles.GetStaticTiles(item.X, item.Y, true); + + var z = int.MinValue; + + for (var i = 0; i < tiles.Length; ++i) + { + var tile = tiles[i]; + var id = TileData.ItemTable[tile.ID & TileData.MaxItemValue]; + + var top = tile.Z; // Confirmed : no height checks here + + if (id.Surface && !id.Impassable && top > z && top <= item.Z) + { + z = top; + } + } + + return z; } } } diff --git a/Projects/UOContent/Items/Misc/Key.cs b/Projects/UOContent/Items/Misc/Key.cs index 0f362d47b..2713678ad 100644 --- a/Projects/UOContent/Items/Misc/Key.cs +++ b/Projects/UOContent/Items/Misc/Key.cs @@ -1,3 +1,4 @@ +using ModernUO.Serialization; using Server.Network; using Server.Prompts; using Server.Targeting; @@ -18,10 +19,26 @@ public interface ILockable uint KeyValue { get; set; } } -public class Key : Item +[SerializationGenerator(0, false)] +public partial class Key : Item { - private string m_Description; - private uint m_KeyVal; + [SerializableField(0)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private int _maxRange; + + [SerializableField(1)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private Item _link; + + [SerializableField(2)] + [InvalidateProperties] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private string _description; + + [SerializableField(3)] + [InvalidateProperties] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private uint _keyValue; [Constructible] public Key(uint val = 0) : this(KeyType.Iron, val) @@ -32,44 +49,11 @@ public class Key : Item { Weight = 1.0; - MaxRange = 3; - m_KeyVal = val; - Link = link; + _maxRange = 3; + _keyValue = val; + _link = link; } - public Key(Serial serial) : base(serial) - { - } - - [CommandProperty(AccessLevel.GameMaster)] - public string Description - { - get => m_Description; - set - { - m_Description = value; - InvalidateProperties(); - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public int MaxRange { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public uint KeyValue - { - get => m_KeyVal; - - set - { - m_KeyVal = value; - InvalidateProperties(); - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public Item Link { get; set; } - public static uint RandomValue() => (uint)(0xFFFFFFFE * Utility.RandomDouble()) + 1; public static void RemoveKeys(Mobile m, uint keyValue) @@ -105,7 +89,7 @@ public class Key : Item { var keyRing = (KeyRing)item; - keyRing.RemoveKeys(keyValue); + keyRing.RemoveKey(keyValue); } } } @@ -142,56 +126,6 @@ public class Key : Item return false; } - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(2); // version - - writer.Write(MaxRange); - - writer.Write(Link); - - writer.Write(m_Description); - writer.Write(m_KeyVal); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 2: - { - MaxRange = reader.ReadInt(); - - goto case 1; - } - case 1: - { - Link = reader.ReadEntity(); - - goto case 0; - } - case 0: - { - if (version < 2 || MaxRange == 0) - { - MaxRange = 3; - } - - m_Description = reader.ReadString(); - - m_KeyVal = reader.ReadUInt(); - - break; - } - } - } - public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) @@ -203,7 +137,7 @@ public class Key : Item Target t; int number; - if (m_KeyVal != 0) + if (_keyValue != 0) { number = 501662; // What shall I use this key on? t = new UnlockTarget(this); @@ -224,14 +158,7 @@ public class Key : Item string desc; - if (m_KeyVal == 0) - { - desc = "(blank)"; - } - else if ((desc = m_Description) == null || (desc = desc.Trim()).Length <= 0) - { - desc = null; - } + desc = _keyValue == 0 ? "(blank)" : _description.DefaultIfNullOrEmpty(null)?.Trim(); if (desc != null) { @@ -243,18 +170,9 @@ public class Key : Item { base.OnSingleClick(from); - string desc; + var desc = _keyValue == 0 ? "(blank)" : _description.DefaultIfNullOrEmpty(null)?.Trim(); - if (m_KeyVal == 0) - { - desc = "(blank)"; - } - else - { - desc = m_Description?.Trim() ?? ""; - } - - if (desc.Length > 0) + if (desc != null) { from.NetState.SendMessage(Serial, ItemID, MessageType.Regular, 0x3B2, 3, false, "ENU", "", desc); } @@ -262,85 +180,85 @@ public class Key : Item public bool UseOn(Mobile from, ILockable o) { - if (o.KeyValue == KeyValue) + if (o.KeyValue != KeyValue) { - if (o is BaseDoor door && !door.UseLocks()) - { - return false; - } - - o.Locked = !o.Locked; - - if (o is Item item) - { - if (o.Locked) - { - item.SendLocalizedMessageTo(from, 1048000); // You lock it. - } - else - { - item.SendLocalizedMessageTo(from, 1048001); // You unlock it. - } - - if (item is LockableContainer cont) - { - if (cont.LockLevel == ILockpickable.MagicLock) - { - cont.LockLevel = cont.RequiredSkill - 10; - } - - if (cont.TrapType != TrapType.None && cont.TrapOnLockpick) - { - if (o.Locked) - { - cont.SendLocalizedMessageTo(from, 501673); // You re-enable the trap. - } - else - { - // You disable the trap temporarily. Lock it again to re-enable it. - cont.SendLocalizedMessageTo(from, 501672); - } - } - } - } - - return true; + return false; } - return false; + if (o is BaseDoor door && !door.UseLocks()) + { + return false; + } + + o.Locked = !o.Locked; + + if (o is Item item) + { + if (o.Locked) + { + item.SendLocalizedMessageTo(from, 1048000); // You lock it. + } + else + { + item.SendLocalizedMessageTo(from, 1048001); // You unlock it. + } + + if (item is LockableContainer cont) + { + if (cont.LockLevel == ILockpickable.MagicLock) + { + cont.LockLevel = cont.RequiredSkill - 10; + } + + if (cont.TrapType != TrapType.None && cont.TrapOnLockpick) + { + if (o.Locked) + { + cont.SendLocalizedMessageTo(from, 501673); // You re-enable the trap. + } + else + { + // You disable the trap temporarily. Lock it again to re-enable it. + cont.SendLocalizedMessageTo(from, 501672); + } + } + } + } + + return true; } private class RenamePrompt : Prompt { - private readonly Key m_Key; + private Key _key; - public RenamePrompt(Key key) => m_Key = key; + public RenamePrompt(Key key) => _key = key; public override void OnResponse(Mobile from, string text) { - if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) + if (_key.Deleted || !_key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; } - m_Key.Description = Utility.FixHtml(text); + _key.Description = Utility.FixHtml(text); } } private class UnlockTarget : Target { - private readonly Key m_Key; + private Key _key; public UnlockTarget(Key key) : base(key.MaxRange, false, TargetFlags.None) { - m_Key = key; + _key = key; CheckLOS = false; } protected override void OnTarget(Mobile from, object targeted) { - if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) + if (_key.Deleted || !_key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; @@ -348,15 +266,15 @@ public class Key : Item int number; - if (targeted == m_Key) + if (targeted == _key) { number = 501665; // Enter a description for this key. - from.Prompt = new RenamePrompt(m_Key); + from.Prompt = new RenamePrompt(_key); } else if (targeted is ILockable lockable) { - if (m_Key.UseOn(from, lockable)) + if (_key.UseOn(from, lockable)) { number = -1; } @@ -379,13 +297,13 @@ public class Key : Item private class CopyTarget : Target { - private readonly Key m_Key; + private Key _key; - public CopyTarget(Key key) : base(3, false, TargetFlags.None) => m_Key = key; + public CopyTarget(Key key) : base(3, false, TargetFlags.None) => _key = key; protected override void OnTarget(Mobile from, object targeted) { - if (m_Key.Deleted || !m_Key.IsChildOf(from.Backpack)) + if (_key.Deleted || !_key.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(501661); // That key is unreachable. return; @@ -395,7 +313,7 @@ public class Key : Item if (targeted is Key k) { - if (k.m_KeyVal == 0) + if (k._keyValue == 0) { number = 501675; // This key is also blank. } @@ -403,18 +321,18 @@ public class Key : Item { number = 501676; // You make a copy of the key. - m_Key.Description = k.Description; - m_Key.KeyValue = k.KeyValue; - m_Key.Link = k.Link; - m_Key.MaxRange = k.MaxRange; + _key.Description = k.Description; + _key.KeyValue = k.KeyValue; + _key.Link = k.Link; + _key.MaxRange = k.MaxRange; } - else if (Utility.RandomDouble() <= 0.1) // 10% chance to destroy the key + else if (Utility.RandomDouble() < 0.1) // 10% chance to destroy the key { from.SendLocalizedMessage(501677); // You fail to make a copy of the key. number = 501678; // The key was destroyed in the attempt. - m_Key.Delete(); + _key.Delete(); } else { diff --git a/Projects/UOContent/Items/Misc/KeyRing.cs b/Projects/UOContent/Items/Misc/KeyRing.cs index 9260e7f26..dd2745b68 100644 --- a/Projects/UOContent/Items/Misc/KeyRing.cs +++ b/Projects/UOContent/Items/Misc/KeyRing.cs @@ -1,207 +1,183 @@ using System.Collections.Generic; +using ModernUO.Serialization; using Server.Targeting; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(1)] +public partial class KeyRing : Item { - public class KeyRing : Item + private const int MaxKeys = 20; // List capacity will be 32 + + [SerializableField(0)] + private List _keys; + + [Constructible] + public KeyRing() : base(0x1011) { - public static readonly int MaxKeys = 20; + Weight = 1.0; // They seem to have no weight on OSI ?! + _keys = new List(); + } - [Constructible] - public KeyRing() : base(0x1011) + public override bool OnDragDrop(Mobile from, Item dropped) + { + if (!IsChildOf(from.Backpack)) { - Weight = 1.0; // They seem to have no weight on OSI ?! - - Keys = new List(); - } - - public KeyRing(Serial serial) : base(serial) - { - } - - public List Keys { get; private set; } - - public override bool OnDragDrop(Mobile from, Item dropped) - { - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. - return false; - } - - if (dropped is not Key key || key.KeyValue == 0) - { - from.SendLocalizedMessage(501689); // Only non-blank keys can be put on a keyring. - return false; - } - - if (Keys.Count >= MaxKeys) - { - from.SendLocalizedMessage(1008138); // This keyring is full. - return false; - } - - Add(key); - from.SendLocalizedMessage(501691); // You put the key on the keyring. - return true; - } - - public override void OnDoubleClick(Mobile from) - { - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. - return; - } - - from.SendLocalizedMessage(501680); // What do you want to unlock? - from.Target = new InternalTarget(this); - } - - public override void OnDelete() - { - base.OnDelete(); - - foreach (var key in Keys) - { - key.Delete(); - } - - Keys.Clear(); - } - - public void Add(Key key) - { - key.Internalize(); - Keys.Add(key); - - UpdateItemID(); - } - - public void Open(Mobile from) - { - if (Parent is not Container cont) - { - return; - } - - for (var i = Keys.Count - 1; i >= 0; i--) - { - var key = Keys[i]; - - if (!key.Deleted && !cont.TryDropItem(from, key, true)) - { - break; - } - - Keys.RemoveAt(i); - } - - UpdateItemID(); - } - - public void RemoveKeys(uint keyValue) - { - for (var i = Keys.Count - 1; i >= 0; i--) - { - var key = Keys[i]; - - if (key.KeyValue == keyValue) - { - key.Delete(); - Keys.RemoveAt(i); - } - } - - UpdateItemID(); - } - - public bool ContainsKey(uint keyValue) - { - foreach (var key in Keys) - { - if (key.KeyValue == keyValue) - { - return true; - } - } - + from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. return false; } - private void UpdateItemID() + if (dropped is not Key key || key.KeyValue == 0) { - if (Keys.Count < 1) + from.SendLocalizedMessage(501689); // Only non-blank keys can be put on a keyring. + return false; + } + + if (Keys.Count >= MaxKeys) + { + from.SendLocalizedMessage(1008138); // This keyring is full. + return false; + } + + Add(key); + from.SendLocalizedMessage(501691); // You put the key on the keyring. + + return true; + } + + public override void OnDoubleClick(Mobile from) + { + if (!IsChildOf(from.Backpack)) + { + from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. + return; + } + + from.SendLocalizedMessage(501680); // What do you want to unlock? + from.Target = new InternalTarget(this); + } + + public override void OnDelete() + { + base.OnDelete(); + + foreach (var key in Keys) + { + key.Delete(); + } + + this.Clear(_keys); + } + + public void Add(Key key) + { + key.Internalize(); + this.Add(_keys, key); + + UpdateItemID(); + } + + public void Open(Mobile from) + { + if (Parent is not Container cont) + { + return; + } + + for (var i = _keys.Count - 1; i >= 0; i--) + { + var key = _keys[i]; + + if (!key.Deleted && !cont.TryDropItem(from, key, true)) { - ItemID = 0x1011; + break; } - else if (Keys.Count < 3) + + this.RemoveAt(_keys, i); + } + + UpdateItemID(); + } + + public void RemoveKey(uint keyValue) + { + for (var i = _keys.Count - 1; i >= 0; i--) + { + var key = _keys[i]; + + if (key.KeyValue == keyValue) { - ItemID = 0x1769; + key.Delete(); + this.RemoveAt(_keys, i); } - else if (Keys.Count < 5) + } + + UpdateItemID(); + } + + public bool ContainsKey(uint keyValue) + { + foreach (var key in _keys) + { + if (key.KeyValue == keyValue) { - ItemID = 0x176A; + return true; + } + } + + return false; + } + + private void UpdateItemID() + { + ItemID = _keys.Count switch + { + < 1 => 0x1011, + < 3 => 0x1769, + < 5 => 0x176A, + _ => 0x176B + }; + } + + private void Deserialize(IGenericReader reader, int version) + { + _keys = reader.ReadEntityList(); + } + + private class InternalTarget : Target + { + private KeyRing _keyRing; + + public InternalTarget(KeyRing keyRing) : base(-1, false, TargetFlags.None) => _keyRing = keyRing; + + protected override void OnTarget(Mobile from, object targeted) + { + if (_keyRing.Deleted || !_keyRing.IsChildOf(from.Backpack)) + { + from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. + return; + } + + if (_keyRing == targeted) + { + _keyRing.Open(from); + from.SendLocalizedMessage(501685); // You open the keyring. + } + else if (targeted is ILockable o) + { + foreach (var key in _keyRing.Keys) + { + if (key.UseOn(from, o)) + { + return; + } + } + + from.SendLocalizedMessage(1008140); // You do not have a key for that. } else { - ItemID = 0x176B; - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - - writer.Write(Keys); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - - Keys = reader.ReadEntityList(); - } - - private class InternalTarget : Target - { - private readonly KeyRing m_KeyRing; - - public InternalTarget(KeyRing keyRing) : base(-1, false, TargetFlags.None) => m_KeyRing = keyRing; - - protected override void OnTarget(Mobile from, object targeted) - { - if (m_KeyRing.Deleted || !m_KeyRing.IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. - return; - } - - if (m_KeyRing == targeted) - { - m_KeyRing.Open(from); - from.SendLocalizedMessage(501685); // You open the keyring. - } - else if (targeted is ILockable o) - { - foreach (var key in m_KeyRing.Keys) - { - if (key.UseOn(from, o)) - { - return; - } - } - - from.SendLocalizedMessage(1008140); // You do not have a key for that. - } - else - { - from.SendLocalizedMessage(501666); // You can't unlock that! - } + from.SendLocalizedMessage(501666); // You can't unlock that! } } } diff --git a/Projects/UOContent/Items/Misc/LOSBlocker.cs b/Projects/UOContent/Items/Misc/LOSBlocker.cs index 8a4afd4ae..d79fc5afa 100644 --- a/Projects/UOContent/Items/Misc/LOSBlocker.cs +++ b/Projects/UOContent/Items/Misc/LOSBlocker.cs @@ -1,78 +1,60 @@ using System; using System.Buffers.Binary; +using ModernUO.Serialization; using Server.Network; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class LOSBlocker : Item { - public class LOSBlocker : Item + private const ushort GMItemId = 0x36FF; + + [Constructible] + public LOSBlocker() : base(0x21A2) => Movable = false; + + public LOSBlocker(Serial serial) : base(serial) { - private const ushort GMItemId = 0x36FF; + } - [Constructible] - public LOSBlocker() : base(0x21A2) => Movable = false; + public override string DefaultName => "no line of sight"; - public LOSBlocker(Serial serial) : base(serial) + public static void Initialize() + { + TileData.ItemTable[0x21A2].Flags = TileFlag.Wall | TileFlag.NoShoot; + TileData.ItemTable[0x21A2].Height = 20; + } + + public override void SendWorldPacketTo(NetState ns, ReadOnlySpan world = default) + { + var mob = ns.Mobile; + if (AccessLevel.GameMaster >= mob?.AccessLevel) { + base.SendWorldPacketTo(ns, world); + return; } - public override string DefaultName => "no line of sight"; + SendGMItem(ns); + } - public static void Initialize() + private void SendGMItem(NetState ns) + { + // GM Packet + Span buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket(); + + int length; + + if (ns.StygianAbyss) { - TileData.ItemTable[0x21A2].Flags = TileFlag.Wall | TileFlag.NoShoot; - TileData.ItemTable[0x21A2].Height = 20; + length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas); + BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId); + } + else + { + length = OutgoingItemPackets.CreateWorldItem(buffer, this); + BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId); } - public override void SendWorldPacketTo(NetState ns, ReadOnlySpan world = default) - { - var mob = ns.Mobile; - if (AccessLevel.GameMaster >= mob?.AccessLevel) - { - base.SendWorldPacketTo(ns, world); - return; - } - - SendGMItem(ns); - } - - private void SendGMItem(NetState ns) - { - // GM Packet - Span buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket(); - - int length; - - if (ns.StygianAbyss) - { - length = OutgoingEntityPackets.CreateWorldEntity(buffer, this, ns.HighSeas); - BinaryPrimitives.WriteUInt16BigEndian(buffer[8..10], GMItemId); - } - else - { - length = OutgoingItemPackets.CreateWorldItem(buffer, this); - BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId); - } - - ns.Send(buffer[..length]); - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && ItemID == 0x2199) - { - ItemID = 0x21A2; - } - } + ns.Send(buffer[..length]); } } diff --git a/Projects/UOContent/Items/Misc/Moonstone.cs b/Projects/UOContent/Items/Misc/Moonstone.cs index b4adcecc8..55090df75 100644 --- a/Projects/UOContent/Items/Misc/Moonstone.cs +++ b/Projects/UOContent/Items/Misc/Moonstone.cs @@ -1,206 +1,171 @@ using System; +using ModernUO.Serialization; using Server.Factions; using Server.Mobiles; using Server.Network; -namespace Server.Items +namespace Server.Items; + +public enum MoonstoneType { - public enum MoonstoneType + Felucca, + Trammel +} + +[SerializationGenerator(1, false)] +public partial class Moonstone : Item +{ + [InvalidateProperties] + [SerializableField(0)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private MoonstoneType _type; + + [Constructible] + public Moonstone(MoonstoneType type) : base(0xF8B) { - Felucca, - Trammel + Weight = 1.0; + _type = type; } - public class Moonstone : Item + public override int LabelNumber => 1041490 + (int)_type; + + public override void OnSingleClick(Mobile from) { - private MoonstoneType m_Type; - - [Constructible] - public Moonstone(MoonstoneType type) : base(0xF8B) + if (IsChildOf(from.Backpack)) { - Weight = 1.0; - m_Type = type; + Hue = Utility.RandomBirdHue(); + ProcessDelta(); + from.SendLocalizedMessage(1005398); // The stone's substance shifts as you examine it. } - public Moonstone(Serial serial) : base(serial) + base.OnSingleClick(from); + } + + public override void OnDoubleClick(Mobile from) + { + if (!IsChildOf(from.Backpack)) { + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + } + else if (from.Mounted) + { + from.SendLocalizedMessage(1005399); // You can not bury a stone while you sit on a mount. + } + else if (!from.Body.IsHuman) + { + from.SendLocalizedMessage(1005400); // You can not bury a stone in this form. + } + else if (Sigil.ExistsOn(from)) + { + from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. + } + else if (from.Map == GetTargetMap() || from.Map != Map.Trammel && from.Map != Map.Felucca) + { + from.SendLocalizedMessage(1005401); // You cannot bury the stone here. + } + else if (from is PlayerMobile mobile && mobile.Young) + { + mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. + } + else if (from.Kills >= 5) + { + // The magic of the stone cannot be evoked by someone with blood on their hands. + from.SendLocalizedMessage(1005402); + } + else if (from.Criminal) + { + from.SendLocalizedMessage(1005403); // The magic of the stone cannot be evoked by the lawless. + } + else if (!Region.Find(from.Location, from.Map).IsDefault || + !Region.Find(from.Location, GetTargetMap()).IsDefault) + { + from.SendLocalizedMessage(1005401); // You cannot bury the stone here. + } + else if (!GetTargetMap().CanFit(from.Location, 16)) + { + from.SendLocalizedMessage(1005408); // Something is blocking the facet gate exit. + } + else + { + Movable = false; + MoveToWorld(from.Location, from.Map); + + from.Animate(32, 5, 1, true, false, 0); + + new SettleTimer(this, from.Location, from.Map, GetTargetMap(), from).Start(); + } + } + + public Map GetTargetMap() => _type == MoonstoneType.Felucca ? Map.Felucca : Map.Trammel; + + private void Deserialize(IGenericReader reader, int version) + { + _type = (MoonstoneType)reader.ReadInt(); + } + + private class SettleTimer : Timer + { + private Mobile _caster; + private Point3D _location; + private Map _map; + private Item _stone; + private Map _targetMap; + private int _count; + + public SettleTimer(Item stone, Point3D loc, Map map, Map targetMap, Mobile caster) : base( + TimeSpan.FromSeconds(2.5), + TimeSpan.FromSeconds(1.0) + ) + { + _stone = stone; + _location = loc; + _map = map; + _targetMap = targetMap; + _caster = caster; } - [CommandProperty(AccessLevel.GameMaster)] - public MoonstoneType Type + protected override void OnTick() { - get => m_Type; - set + ++_count; + + if (_count == 1) { - m_Type = value; - InvalidateProperties(); + _stone.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1005414); // The stone settles into the ground. } - } - - public override int LabelNumber => 1041490 + (int)m_Type; - - public override void OnSingleClick(Mobile from) - { - if (IsChildOf(from.Backpack)) + else if (_count >= 10) { - Hue = Utility.RandomBirdHue(); - ProcessDelta(); - from.SendLocalizedMessage(1005398); // The stone's substance shifts as you examine it. - } + _stone.Location = new Point3D(_stone.X, _stone.Y, _stone.Z - 1); - base.OnSingleClick(from); - } - - public override void OnDoubleClick(Mobile from) - { - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. - } - else if (from.Mounted) - { - from.SendLocalizedMessage(1005399); // You can not bury a stone while you sit on a mount. - } - else if (!from.Body.IsHuman) - { - from.SendLocalizedMessage(1005400); // You can not bury a stone in this form. - } - else if (Sigil.ExistsOn(from)) - { - from.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil. - } - else if (from.Map == GetTargetMap() || from.Map != Map.Trammel && from.Map != Map.Felucca) - { - from.SendLocalizedMessage(1005401); // You cannot bury the stone here. - } - else if (from is PlayerMobile mobile && mobile.Young) - { - mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young. - } - else if (from.Kills >= 5) - { - from.SendLocalizedMessage( - 1005402 - ); // The magic of the stone cannot be evoked by someone with blood on their hands. - } - else if (from.Criminal) - { - from.SendLocalizedMessage(1005403); // The magic of the stone cannot be evoked by the lawless. - } - else if (!Region.Find(from.Location, from.Map).IsDefault || - !Region.Find(from.Location, GetTargetMap()).IsDefault) - { - from.SendLocalizedMessage(1005401); // You cannot bury the stone here. - } - else if (!GetTargetMap().CanFit(from.Location, 16)) - { - from.SendLocalizedMessage(1005408); // Something is blocking the facet gate exit. - } - else - { - Movable = false; - MoveToWorld(from.Location, from.Map); - - from.Animate(32, 5, 1, true, false, 0); - - new SettleTimer(this, from.Location, from.Map, GetTargetMap(), from).Start(); - } - } - - public Map GetTargetMap() => m_Type == MoonstoneType.Felucca ? Map.Felucca : Map.Trammel; - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - writer.Write((int)m_Type); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 0: - { - m_Type = (MoonstoneType)reader.ReadInt(); - - break; - } - } - } - - private class SettleTimer : Timer - { - private readonly Mobile m_Caster; - private readonly Point3D m_Location; - private readonly Map m_Map; - private readonly Item m_Stone; - private readonly Map m_TargetMap; - private int m_Count; - - public SettleTimer(Item stone, Point3D loc, Map map, Map targetMap, Mobile caster) : base( - TimeSpan.FromSeconds(2.5), - TimeSpan.FromSeconds(1.0) - ) - { - m_Stone = stone; - - m_Location = loc; - m_Map = map; - m_TargetMap = targetMap; - - m_Caster = caster; - } - - protected override void OnTick() - { - ++m_Count; - - if (m_Count == 1) + if (_count == 16) { - m_Stone.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1005414); // The stone settles into the ground. - } - else if (m_Count >= 10) - { - m_Stone.Location = new Point3D(m_Stone.X, m_Stone.Y, m_Stone.Z - 1); - - if (m_Count == 16) + if (!Region.Find(_location, _map).IsDefault || !Region.Find(_location, _targetMap).IsDefault) { - if (!Region.Find(m_Location, m_Map).IsDefault || !Region.Find(m_Location, m_TargetMap).IsDefault) - { - m_Stone.Movable = true; - m_Caster.AddToBackpack(m_Stone); - Stop(); - return; - } - - if (!m_TargetMap.CanFit(m_Location, 16)) - { - m_Stone.Movable = true; - m_Caster.AddToBackpack(m_Stone); - Stop(); - return; - } - - var hue = m_Stone.Hue; - - if (hue == 0) - { - hue = Utility.RandomBirdHue(); - } - - new MoonstoneGate(m_Location, m_TargetMap, m_Map, m_Caster, hue); - new MoonstoneGate(m_Location, m_Map, m_TargetMap, m_Caster, hue); - - m_Stone.Delete(); + _stone.Movable = true; + _caster.AddToBackpack(_stone); Stop(); + return; } + + if (!_targetMap.CanFit(_location, 16)) + { + _stone.Movable = true; + _caster.AddToBackpack(_stone); + Stop(); + return; + } + + var hue = _stone.Hue; + + if (hue == 0) + { + hue = Utility.RandomBirdHue(); + } + + new MoonstoneGate(_location, _targetMap, _map, _caster, hue); + new MoonstoneGate(_location, _map, _targetMap, _caster, hue); + + _stone.Delete(); + Stop(); } } } diff --git a/Projects/UOContent/Items/Misc/MoonstoneGate.cs b/Projects/UOContent/Items/Misc/MoonstoneGate.cs index 2b678e6bc..b0eb1d407 100644 --- a/Projects/UOContent/Items/Misc/MoonstoneGate.cs +++ b/Projects/UOContent/Items/Misc/MoonstoneGate.cs @@ -1,87 +1,70 @@ using System; +using ModernUO.Serialization; using Server.Engines.PartySystem; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class MoonstoneGate : Moongate { - public class MoonstoneGate : Moongate + private Mobile _caster; + + public MoonstoneGate(Point3D loc, Map map, Map targetMap, Mobile caster, int hue) : base(loc, targetMap) { - private readonly Mobile m_Caster; + MoveToWorld(loc, map); + Dispellable = false; + Hue = hue; - public MoonstoneGate(Point3D loc, Map map, Map targetMap, Mobile caster, int hue) : base(loc, targetMap) + _caster = caster; + + new InternalTimer(this).Start(); + Effects.PlaySound(loc, map, 0x20E); + } + + public override void CheckGate(Mobile m, int range) + { + if (m.Kills >= 5) { - MoveToWorld(loc, map); - Dispellable = false; - Hue = hue; - - m_Caster = caster; - - new InternalTimer(this).Start(); - - Effects.PlaySound(loc, map, 0x20E); + return; } - public MoonstoneGate(Serial serial) : base(serial) + var casterParty = Party.Get(_caster); + var userParty = Party.Get(m); + + if (m == _caster || casterParty != null && userParty == casterParty) { - } - - public override void CheckGate(Mobile m, int range) - { - if (m.Kills >= 5) - { - return; - } - - var casterParty = Party.Get(m_Caster); - var userParty = Party.Get(m); - - if (m == m_Caster || casterParty != null && userParty == casterParty) - { - base.CheckGate(m, range); - } - } - - public override void UseGate(Mobile m) - { - if (m.Kills >= 5) - { - return; - } - - var casterParty = Party.Get(m_Caster); - var userParty = Party.Get(m); - - if (m == m_Caster || casterParty != null && userParty == casterParty) - { - base.UseGate(m); - } - } - - 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(); - - Delete(); - } - - private class InternalTimer : Timer - { - private readonly Item m_Item; - - public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0)) => m_Item = item; - - protected override void OnTick() - { - m_Item.Delete(); - } + base.CheckGate(m, range); } } + + public override void UseGate(Mobile m) + { + if (m.Kills >= 5) + { + return; + } + + var casterParty = Party.Get(_caster); + var userParty = Party.Get(m); + + if (m == _caster || casterParty != null && userParty == casterParty) + { + base.UseGate(m); + } + } + + [AfterDeserialization(false)] + private void AfterDeserialization() + { + Delete(); + } + + private class InternalTimer : Timer + { + private Item _item; + + public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0)) => _item = item; + + protected override void OnTick() => _item.Delete(); + } } diff --git a/Projects/UOContent/Items/Misc/MorphItem.cs b/Projects/UOContent/Items/Misc/MorphItem.cs index f695d04d9..84587e658 100644 --- a/Projects/UOContent/Items/Misc/MorphItem.cs +++ b/Projects/UOContent/Items/Misc/MorphItem.cs @@ -1,143 +1,103 @@ -namespace Server.Items +using System; +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class MorphItem : Item { - public class MorphItem : Item + [SerializableField(1)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private int _inactiveItemId; + + [SerializableField(2)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private int _activeItemId; + + [Constructible] + public MorphItem(int inactiveItemID, int activeItemID, int range) : this(inactiveItemID, activeItemID, range, range) { - private int m_InsideRange; - private int m_OutsideRange; + } - [Constructible] - public MorphItem(int inactiveItemID, int activeItemID, int range) : this(inactiveItemID, activeItemID, range, range) + [Constructible] + public MorphItem(int inactiveItemID, int activeItemID, int inRange, int outRange) : base(inactiveItemID) + { + Movable = false; + + _inactiveItemId = inactiveItemID; + _activeItemId = activeItemID; + _insideRange = inRange; + _outsideRange = outRange; + } + + [SerializableProperty(0)] + [CommandProperty(AccessLevel.GameMaster)] + public int OutsideRange + { + get => _outsideRange; + set => _outsideRange = Math.Clamp(value, 0, 18); + } + + [SerializableProperty(3)] + [CommandProperty(AccessLevel.GameMaster)] + public int InsideRange + { + get => _insideRange; + set => _insideRange = Math.Clamp(value, 0, 18); + } + + [CommandProperty(AccessLevel.GameMaster)] + public int CurrentRange => ItemID == _inactiveItemId ? _insideRange : _outsideRange; + + public override bool HandlesOnMovement => true; + + public override void OnMovement(Mobile m, Point3D oldLocation) + { + if (Utility.InRange(m.Location, Location, CurrentRange) || Utility.InRange(oldLocation, Location, CurrentRange)) { - } - - [Constructible] - public MorphItem(int inactiveItemID, int activeItemID, int inRange, int outRange) : base(inactiveItemID) - { - Movable = false; - - InactiveItemID = inactiveItemID; - ActiveItemID = activeItemID; - InsideRange = inRange; - OutsideRange = outRange; - } - - public MorphItem(Serial serial) : base(serial) - { - } - - [CommandProperty(AccessLevel.GameMaster)] - public int InactiveItemID { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public int ActiveItemID { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public int InsideRange - { - get => m_InsideRange; - set => m_InsideRange = value > 18 ? 18 : - value < 0 ? 0 : value; - } - - [CommandProperty(AccessLevel.GameMaster)] - public int OutsideRange - { - get => m_OutsideRange; - set => m_OutsideRange = value > 18 ? 18 : - value < 0 ? 0 : value; - } - - [CommandProperty(AccessLevel.GameMaster)] - public int CurrentRange => ItemID == InactiveItemID ? InsideRange : OutsideRange; - - public override bool HandlesOnMovement => true; - - public override void OnMovement(Mobile m, Point3D oldLocation) - { - if (Utility.InRange(m.Location, Location, CurrentRange) || Utility.InRange(oldLocation, Location, CurrentRange)) - { - Refresh(); - } - } - - public override void OnMapChange() - { - if (!Deleted) - { - Refresh(); - } - } - - public override void OnLocationChange(Point3D oldLoc) - { - if (!Deleted) - { - Refresh(); - } - } - - public void Refresh() - { - var found = false; - var eable = GetMobilesInRange(CurrentRange); - foreach (var mob in eable) - { - if (!mob.Hidden || mob.AccessLevel <= AccessLevel.Player) - { - found = true; - break; - } - } - - eable.Free(); - - ItemID = found ? ActiveItemID : InactiveItemID; - - Visible = ItemID != 0x1; - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); // version - - writer.Write(m_OutsideRange); - - writer.Write(InactiveItemID); - writer.Write(ActiveItemID); - writer.Write(m_InsideRange); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 1: - { - m_OutsideRange = reader.ReadInt(); - goto case 0; - } - case 0: - { - InactiveItemID = reader.ReadInt(); - ActiveItemID = reader.ReadInt(); - m_InsideRange = reader.ReadInt(); - - if (version < 1) - { - m_OutsideRange = m_InsideRange; - } - - break; - } - } - - Timer.StartTimer(Refresh); + Refresh(); } } + + public override void OnMapChange() + { + if (!Deleted) + { + Refresh(); + } + } + + public override void OnLocationChange(Point3D oldLoc) + { + if (!Deleted) + { + Refresh(); + } + } + + public void Refresh() + { + var found = false; + var eable = GetMobilesInRange(CurrentRange); + foreach (var mob in eable) + { + if (!mob.Hidden || mob.AccessLevel <= AccessLevel.Player) + { + found = true; + break; + } + } + + eable.Free(); + + ItemID = found ? _activeItemId : _inactiveItemId; + + Visible = ItemID != 0x1; + } + + [AfterDeserialization] + private void AfterDeserialization() + { + Refresh(); + } } diff --git a/Projects/UOContent/Items/Misc/OilCloth.cs b/Projects/UOContent/Items/Misc/OilCloth.cs index a75e06c5b..9d2ebba31 100644 --- a/Projects/UOContent/Items/Misc/OilCloth.cs +++ b/Projects/UOContent/Items/Misc/OilCloth.cs @@ -1,160 +1,139 @@ using System; +using ModernUO.Serialization; using Server.Mobiles; using Server.Network; using Server.Targeting; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class OilCloth : Item, IScissorable, IDyable { - public class OilCloth : Item, IScissorable, IDyable + [Constructible] + public OilCloth() : base(0x175D) => Hue = 2001; + + public override int LabelNumber => 1041498; // oil cloth + + public override double DefaultWeight => 1.0; + + public bool Dye(Mobile from, DyeTub sender) { - [Constructible] - public OilCloth() : base(0x175D) => Hue = 2001; - - public OilCloth(Serial serial) : base(serial) + if (Deleted) { + return false; } - public override int LabelNumber => 1041498; // oil cloth + Hue = sender.DyedHue; - public override double DefaultWeight => 1.0; + return true; + } - public bool Dye(Mobile from, DyeTub sender) + public bool Scissor(Mobile from, Scissors scissors) + { + if (Deleted || !from.CanSee(this)) { - if (Deleted) - { - return false; - } - - Hue = sender.DyedHue; - - return true; + return false; } - public bool Scissor(Mobile from, Scissors scissors) + ScissorHelper(from, new Bandage(), 1); + + return true; + } + + public override void OnDoubleClick(Mobile from) + { + if (IsChildOf(from.Backpack)) { - if (Deleted || !from.CanSee(this)) - { - return false; - } - - ScissorHelper(from, new Bandage(), 1); - - return true; + from.BeginTarget(-1, false, TargetFlags.None, OnTarget); + from.SendLocalizedMessage(1005424); // Select the weapon or armor you wish to use the cloth on. } - - public override void OnDoubleClick(Mobile from) + else { - if (IsChildOf(from.Backpack)) + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + } + } + + public void OnTarget(Mobile from, object obj) + { + // TODO: Need details on how oil cloths should get consumed here + + if (!IsChildOf(from.Backpack)) + { + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + } + else if (obj is Item item && item.RootParent != from) + { + from.SendLocalizedMessage(1005425); // You may only wipe down items you are holding or carrying. + } + else if (obj is BaseWeapon weapon) + { + if (weapon.Poison == null || weapon.PoisonCharges <= 0) { - from.BeginTarget(-1, false, TargetFlags.None, OnTarget); - from.SendLocalizedMessage(1005424); // Select the weapon or armor you wish to use the cloth on. + // Hmmmm... this does not need to be cleaned. + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1005422); } else { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + if (weapon.PoisonCharges < 2) + { + weapon.PoisonCharges = 0; + } + else + { + weapon.PoisonCharges -= 2; + } + + if (weapon.PoisonCharges > 0) + { + from.SendLocalizedMessage(1005423); // You have removed some of the caustic substance, but not all. + } + else + { + from.SendLocalizedMessage(1010497); // You have cleaned the item. + } } } - - public void OnTarget(Mobile from, object obj) + else if (obj == from && obj is PlayerMobile pm) { - // TODO: Need details on how oil cloths should get consumed here - - if (!IsChildOf(from.Backpack)) + if (pm.BodyMod == 183 || pm.BodyMod == 184) { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. - } - else if (obj is Item item && item.RootParent != from) - { - from.SendLocalizedMessage(1005425); // You may only wipe down items you are holding or carrying. - } - else if (obj is BaseWeapon weapon) - { - if (weapon.Poison == null || weapon.PoisonCharges <= 0) - { - from.LocalOverheadMessage( - MessageType.Regular, - 0x3B2, - 1005422 - ); // Hmmmm... this does not need to be cleaned. - } - else - { - if (weapon.PoisonCharges < 2) - { - weapon.PoisonCharges = 0; - } - else - { - weapon.PoisonCharges -= 2; - } + pm.SavagePaintExpiration = TimeSpan.Zero; - if (weapon.PoisonCharges > 0) - { - from.SendLocalizedMessage(1005423); // You have removed some of the caustic substance, but not all. - } - else - { - from.SendLocalizedMessage(1010497); // You have cleaned the item. - } - } - } - else if (obj == from && obj is PlayerMobile pm) - { - if (pm.BodyMod == 183 || pm.BodyMod == 184) - { - pm.SavagePaintExpiration = TimeSpan.Zero; + pm.BodyMod = 0; + pm.HueMod = -1; - pm.BodyMod = 0; - pm.HueMod = -1; + from.SendLocalizedMessage(1040006); // You wipe away all of your body paint. - from.SendLocalizedMessage(1040006); // You wipe away all of your body paint. - - Consume(); - } - else - { - from.LocalOverheadMessage( - MessageType.Regular, - 0x3B2, - 1005422 - ); // Hmmmm... this does not need to be cleaned. - } - } - else if (obj is BaseBeverage beverage) - { - if (beverage.Content == BeverageType.Liquor) - { - var bomb = new Firebomb(beverage.ItemID); - bomb.Name = beverage.Name; - - beverage.ReplaceWith(bomb); - - from.SendLocalizedMessage(1060580); // You prepare a firebomb. - Consume(); - } - } - else if (obj is Firebomb) - { - from.SendLocalizedMessage(1060579); // That is already a firebomb! + Consume(); } else { - from.SendLocalizedMessage(1005426); // The cloth will not work on that. + // Hmmmm... this does not need to be cleaned. + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1005422); } } - - public override void Serialize(IGenericWriter writer) + else if (obj is BaseBeverage beverage) { - base.Serialize(writer); + if (beverage.Content == BeverageType.Liquor) + { + var bomb = new Firebomb(beverage.ItemID) + { + Name = beverage.Name + }; - writer.Write(0); + beverage.ReplaceWith(bomb); + + from.SendLocalizedMessage(1060580); // You prepare a firebomb. + Consume(); + } } - - public override void Deserialize(IGenericReader reader) + else if (obj is Firebomb) { - base.Deserialize(reader); - - var version = reader.ReadInt(); + from.SendLocalizedMessage(1060579); // That is already a firebomb! + } + else + { + from.SendLocalizedMessage(1005426); // The cloth will not work on that. } } } diff --git a/Projects/UOContent/Items/Misc/Origami.cs b/Projects/UOContent/Items/Misc/Origami.cs index 74f934e81..9cc01f157 100644 --- a/Projects/UOContent/Items/Misc/Origami.cs +++ b/Projects/UOContent/Items/Misc/Origami.cs @@ -1,216 +1,97 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0)] +public partial class OrigamiPaper : Item { - public class OrigamiPaper : Item + [Constructible] + public OrigamiPaper() : base(0x2830) { - [Constructible] - public OrigamiPaper() : base(0x2830) - { - } - - public OrigamiPaper(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030288; // origami paper - - public override void OnDoubleClick(Mobile from) - { - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. - } - else - { - Delete(); - - Item i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch - { - 0 => new OrigamiButterfly(), - 1 => new OrigamiSwan(), - 2 => new OrigamiFrog(), - 3 => new OrigamiShape(), - 4 => new OrigamiSongbird(), - 5 => new OrigamiFish(), - _ => null - }; - - if (i != null) - { - from.AddToBackpack(i); - } - - from.SendLocalizedMessage(1070822); // You fold the paper into an interesting shape. - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } } - public class OrigamiButterfly : Item + public override int LabelNumber => 1030288; // origami paper + + public override void OnDoubleClick(Mobile from) { - [Constructible] - public OrigamiButterfly() : base(0x2838) => LootType = LootType.Blessed; - - public OrigamiButterfly(Serial serial) : base(serial) + if (!IsChildOf(from.Backpack)) { + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + return; } - public override int LabelNumber => 1030296; // a delicate origami butterfly + Delete(); - public override void Serialize(IGenericWriter writer) + Item i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch { - base.Serialize(writer); + 0 => new OrigamiButterfly(), + 1 => new OrigamiSwan(), + 2 => new OrigamiFrog(), + 3 => new OrigamiShape(), + 4 => new OrigamiSongbird(), + 5 => new OrigamiFish(), + _ => null + }; - writer.WriteEncodedInt(0); + if (i != null) + { + from.AddToBackpack(i); } - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class OrigamiSwan : Item - { - [Constructible] - public OrigamiSwan() : base(0x2839) => LootType = LootType.Blessed; - - public OrigamiSwan(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030297; // a delicate origami swan - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class OrigamiFrog : Item - { - [Constructible] - public OrigamiFrog() : base(0x283A) => LootType = LootType.Blessed; - - public OrigamiFrog(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030298; // a delicate origami frog - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class OrigamiShape : Item - { - [Constructible] - public OrigamiShape() : base(0x283B) => LootType = LootType.Blessed; - - public OrigamiShape(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030299; // an intricate geometric origami shape - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class OrigamiSongbird : Item - { - [Constructible] - public OrigamiSongbird() : base(0x283C) => LootType = LootType.Blessed; - - public OrigamiSongbird(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030300; // a delicate origami songbird - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class OrigamiFish : Item - { - [Constructible] - public OrigamiFish() : base(0x283D) => LootType = LootType.Blessed; - - public OrigamiFish(Serial serial) : base(serial) - { - } - - public override int LabelNumber => 1030301; // a delicate origami fish - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } + from.SendLocalizedMessage(1070822); // You fold the paper into an interesting shape. } } + +[SerializationGenerator(0)] +public partial class OrigamiButterfly : Item +{ + [Constructible] + public OrigamiButterfly() : base(0x2838) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030296; // a delicate origami butterfly +} + +[SerializationGenerator(0)] +public partial class OrigamiSwan : Item +{ + [Constructible] + public OrigamiSwan() : base(0x2839) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030297; // a delicate origami swan +} + +[SerializationGenerator(0)] +public partial class OrigamiFrog : Item +{ + [Constructible] + public OrigamiFrog() : base(0x283A) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030298; // a delicate origami frog +} + +[SerializationGenerator(0)] +public partial class OrigamiShape : Item +{ + [Constructible] + public OrigamiShape() : base(0x283B) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030299; // an intricate geometric origami shape +} + +[SerializationGenerator(0)] +public partial class OrigamiSongbird : Item +{ + [Constructible] + public OrigamiSongbird() : base(0x283C) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030300; // a delicate origami songbird +} + +[SerializationGenerator(0)] +public partial class OrigamiFish : Item +{ + [Constructible] + public OrigamiFish() : base(0x283D) => LootType = LootType.Blessed; + + public override int LabelNumber => 1030301; // a delicate origami fish +} diff --git a/Projects/UOContent/Items/Misc/PlayerBulletinBoards.cs b/Projects/UOContent/Items/Misc/PlayerBulletinBoards.cs index d1499aabd..d1548a790 100644 --- a/Projects/UOContent/Items/Misc/PlayerBulletinBoards.cs +++ b/Projects/UOContent/Items/Misc/PlayerBulletinBoards.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using ModernUO.Serialization; using Server.ContextMenus; using Server.Gumps; using Server.Mobiles; @@ -7,466 +8,110 @@ using Server.Multis; using Server.Network; using Server.Prompts; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class PlayerBBSouth : BasePlayerBB { - public class PlayerBBSouth : BasePlayerBB + [Constructible] + public PlayerBBSouth() : base(0x2311) => Weight = 15.0; + + public override int LabelNumber => 1062421; // bulletin board (south) +} + +[SerializationGenerator(0, false)] +public partial class PlayerBBEast : BasePlayerBB +{ + [Constructible] + public PlayerBBEast() : base(0x2312) => Weight = 15.0; + + public override int LabelNumber => 1062420; // bulletin board (east) +} + +[SerializationGenerator(0, false)] +public abstract partial class BasePlayerBB : Item, ISecurable +{ + [SerializableField(0)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private SecureLevel _level; + + [SerializableField(1)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private string _title; + + [CanBeNull] + [SerializableField(2)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private PlayerBBMessage _greeting; + + [SerializableField(3)] + private List _messages; + + public BasePlayerBB(int itemID) : base(itemID) { - [Constructible] - public PlayerBBSouth() : base(0x2311) => Weight = 15.0; + _messages = new List(); + _level = SecureLevel.Anyone; + } - public PlayerBBSouth(Serial serial) : base(serial) + public override void GetContextMenuEntries(Mobile from, List list) + { + base.GetContextMenuEntries(from, list); + SetSecureLevelEntry.AddTo(from, this, list); + } + + public static bool CheckAccess(BaseHouse house, Mobile from) + { + if (house.Public || !house.IsAosRules) { + return !house.IsBanned(from); } - public override int LabelNumber => 1062421; // bulletin board (south) + return house.HasAccess(from); + } - public override void Serialize(IGenericWriter writer) + public override void OnDoubleClick(Mobile from) + { + var house = BaseHouse.FindHouseAt(this); + + if (house?.HasLockedDownItem(this) != true) { - base.Serialize(writer); - - writer.Write(0); // version + from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. } - - public override void Deserialize(IGenericReader reader) + else if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) { - base.Deserialize(reader); - - var version = reader.ReadInt(); + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. + } + else if (CheckAccess(house, from)) + { + from.SendGump(new PlayerBBGump(from, house, this, 0)); } } - public class PlayerBBEast : BasePlayerBB + public class PostPrompt : Prompt { - [Constructible] - public PlayerBBEast() : base(0x2312) => Weight = 15.0; + private BasePlayerBB _board; + private bool _greeting; + private BaseHouse _house; + private int _page; - public PlayerBBEast(Serial serial) : base(serial) + public PostPrompt(int page, BaseHouse house, BasePlayerBB board, bool greeting) { + _page = page; + _house = house; + _board = board; + _greeting = greeting; } - public override int LabelNumber => 1062420; // bulletin board (east) - - public override void Serialize(IGenericWriter writer) + public override void OnCancel(Mobile from) { - base.Serialize(writer); - - writer.Write(0); // version + OnResponse(from, ""); } - public override void Deserialize(IGenericReader reader) + public override void OnResponse(Mobile from, string text) { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public abstract class BasePlayerBB : Item, ISecurable - { - public BasePlayerBB(int itemID) : base(itemID) - { - Messages = new List(); - Level = SecureLevel.Anyone; - } - - public BasePlayerBB(Serial serial) : base(serial) - { - } - - public List Messages { get; private set; } - - public PlayerBBMessage Greeting { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public string Title { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public SecureLevel Level { get; set; } - - public override void GetContextMenuEntries(Mobile from, List list) - { - base.GetContextMenuEntries(from, list); - SetSecureLevelEntry.AddTo(from, this, list); - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); - - writer.Write((int)Level); - - writer.Write(Title); - - if (Greeting != null) - { - writer.Write(true); - Greeting.Serialize(writer); - } - else - { - writer.Write(false); - } - - writer.WriteEncodedInt(Messages.Count); - - for (var i = 0; i < Messages.Count; ++i) - { - Messages[i].Serialize(writer); - } - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 1: - { - Level = (SecureLevel)reader.ReadInt(); - goto case 0; - } - case 0: - { - if (version < 1) - { - Level = SecureLevel.Anyone; - } - - Title = reader.ReadString(); - - if (reader.ReadBool()) - { - Greeting = new PlayerBBMessage(reader); - } - - var count = reader.ReadEncodedInt(); - - Messages = new List(count); - - for (var i = 0; i < count; ++i) - { - Messages.Add(new PlayerBBMessage(reader)); - } - - break; - } - } - } - - public static bool CheckAccess(BaseHouse house, Mobile from) - { - if (house.Public || !house.IsAosRules) - { - return !house.IsBanned(from); - } - - return house.HasAccess(from); - } - - public override void OnDoubleClick(Mobile from) - { - var house = BaseHouse.FindHouseAt(this); - - if (house?.HasLockedDownItem(this) != true) - { - from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. - } - else if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this)) - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. - } - else if (CheckAccess(house, from)) - { - from.SendGump(new PlayerBBGump(from, house, this, 0)); - } - } - - public class PostPrompt : Prompt - { - private readonly BasePlayerBB m_Board; - private readonly bool m_Greeting; - private readonly BaseHouse m_House; - private readonly int m_Page; - - public PostPrompt(int page, BaseHouse house, BasePlayerBB board, bool greeting) - { - m_Page = page; - m_House = house; - m_Board = board; - m_Greeting = greeting; - } - - public override void OnCancel(Mobile from) - { - OnResponse(from, ""); - } - - public override void OnResponse(Mobile from, string text) - { - var page = m_Page; - var house = m_House; - var board = m_Board; - - if (house?.HasLockedDownItem(board) != true) - { - from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. - return; - } - - if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board)) - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. - return; - } - - if (!CheckAccess(house, from)) - { - from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board. - return; - } - - if (m_Greeting && !house.IsOwner(from)) - { - return; - } - - text = text.Trim(); - - if (text.Length > 255) - { - text = text[..255]; - } - - if (text.Length > 0) - { - var message = new PlayerBBMessage(Core.Now, from, text); - - if (m_Greeting) - { - board.Greeting = message; - } - else - { - board.Messages.Add(message); - - if (board.Messages.Count > 50) - { - board.Messages.RemoveAt(0); - - if (page > 0) - { - --page; - } - } - } - } - - from.SendGump(new PlayerBBGump(from, house, board, page)); - } - } - - public class SetTitlePrompt : Prompt - { - private readonly BasePlayerBB m_Board; - private readonly BaseHouse m_House; - private readonly int m_Page; - - public SetTitlePrompt(int page, BaseHouse house, BasePlayerBB board) - { - m_Page = page; - m_House = house; - m_Board = board; - } - - public override void OnCancel(Mobile from) - { - OnResponse(from, ""); - } - - public override void OnResponse(Mobile from, string text) - { - var page = m_Page; - var house = m_House; - var board = m_Board; - - if (house?.HasLockedDownItem(board) != true) - { - from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. - return; - } - - if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board)) - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. - return; - } - - if (!CheckAccess(house, from)) - { - from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board. - return; - } - - text = text.Trim(); - - if (text.Length > 255) - { - text = text[..255]; - } - - if (text.Length > 0) - { - board.Title = text; - } - - from.SendGump(new PlayerBBGump(from, house, board, page)); - } - } - } - - public class PlayerBBMessage - { - public PlayerBBMessage(DateTime time, Mobile poster, string message) - { - Time = time; - Poster = poster; - Message = message; - } - - public PlayerBBMessage(IGenericReader reader) - { - var version = reader.ReadEncodedInt(); - - switch (version) - { - case 0: - { - Time = reader.ReadDateTime(); - Poster = reader.ReadEntity(); - Message = reader.ReadString(); - break; - } - } - } - - [CommandProperty(AccessLevel.GameMaster)] - public DateTime Time { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public Mobile Poster { get; set; } - - [CommandProperty(AccessLevel.GameMaster)] - public string Message { get; set; } - - public void Serialize(IGenericWriter writer) - { - writer.WriteEncodedInt(0); // version - - writer.Write(Time); - writer.Write(Poster); - writer.Write(Message); - } - } - - public class PlayerBBGump : Gump - { - private const int LabelColor = 0x7FFF; - private const int LabelHue = 1153; - private readonly BasePlayerBB m_Board; - private readonly Mobile m_From; - private readonly BaseHouse m_House; - private readonly int m_Page; - - public PlayerBBGump(Mobile from, BaseHouse house, BasePlayerBB board, int page) : base(50, 10) - { - from.CloseGump(); - - m_Page = page; - m_From = from; - m_House = house; - m_Board = board; - - AddPage(0); - - AddImage(30, 30, 5400); - - AddButton(393, 145, 2084, 2084, 4); // Scroll up - AddButton(390, 371, 2085, 2085, 5); // Scroll down - - AddButton(32, 183, 5412, 5413, 1); // Post message - - if (house.IsOwner(from)) - { - AddButton(63, 90, 5601, 5605, 2); - AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor); // Set title - - AddButton(63, 109, 5601, 5605, 3); - AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor); // Post greeting - } - - var title = board.Title; - - if (title != null) - { - AddHtml(183, 68, 180, 23, title); - } - - AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor); // Post - - AddLabel(440, 89, LabelHue, page.ToString()); - AddLabel(455, 89, LabelHue, "/"); - AddLabel(470, 89, LabelHue, board.Messages.Count.ToString()); - - var message = board.Greeting; - - if (page >= 1 && page <= board.Messages.Count) - { - message = board.Messages[page - 1]; - } - - AddImageTiled(150, 220, 240, 1, 2700); // Separator - - AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715); // Posted On: - AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715); // Posted By: - - if (message != null) - { - AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss")); - - var poster = message.Poster; - var name = (poster?.Name?.Trim()).DefaultIfNullOrEmpty("Someone"); - - AddHtml(255, 200, 150, 20, name); - - AddHtml(150, 240, 250, 100, message.Message ?? ""); - - if (message != board.Greeting && house.IsOwner(from)) - { - AddButton(130, 395, 1209, 1210, 6); - AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor); // Banish Poster - - AddButton(310, 395, 1209, 1210, 7); - AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor); // Delete Message - } - - if (from.AccessLevel >= AccessLevel.GameMaster) - { - AddButton(135, 242, 1209, 1210, 8); // Post props - } - } - } - - public override void OnResponse(NetState sender, RelayInfo info) - { - var page = m_Page; - var from = m_From; - var house = m_House; - var board = m_Board; + var page = _page; + var house = _house; + var board = _board; if (house?.HasLockedDownItem(board) != true) { @@ -480,159 +125,397 @@ namespace Server.Items return; } - if (!BasePlayerBB.CheckAccess(house, from)) + if (!CheckAccess(house, from)) { from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board. return; } - switch (info.ButtonID) + if (_greeting && !house.IsOwner(from)) { - case 1: // Post message - { - from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, false); - from.SendLocalizedMessage(1062397); // Please enter your message: - - break; - } - case 2: // Set title - { - if (house.IsOwner(from)) - { - from.Prompt = new BasePlayerBB.SetTitlePrompt(page, house, board); - from.SendLocalizedMessage(1062402); // Enter new title: - } - - break; - } - case 3: // Post greeting - { - if (house.IsOwner(from)) - { - from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, true); - from.SendLocalizedMessage(1062404); // Enter new greeting (this will always be the first post): - } - - break; - } - case 4: // Scroll up - { - if (page == 0) - { - page = board.Messages.Count; - } - else - { - page -= 1; - } - - from.SendGump(new PlayerBBGump(from, house, board, page)); - - break; - } - case 5: // Scroll down - { - page += 1; - page %= board.Messages.Count + 1; - - from.SendGump(new PlayerBBGump(from, house, board, page)); - - break; - } - case 6: // Banish poster - { - if (house.IsOwner(from)) - { - if (page >= 1 && page <= board.Messages.Count) - { - var message = board.Messages[page - 1]; - var poster = message.Poster; - - if (poster == null) - { - from.SendGump(new PlayerBBGump(from, house, board, page)); - return; - } - - if (poster.AccessLevel > AccessLevel.Player && from.AccessLevel <= poster.AccessLevel) - { - from.SendLocalizedMessage(501354); // Uh oh...a bigger boot may be required. - } - else if (house.IsFriend(poster)) - { - from.SendLocalizedMessage( - 1060750 - ); // That person is a friend, co-owner, or owner of this house, and therefore cannot be banished! - } - else if (poster is PlayerVendor) - { - from.SendLocalizedMessage(501351); // You cannot eject a vendor. - } - else if (house.Bans.Count >= BaseHouse.MaxBans) - { - from.SendLocalizedMessage(501355); // The ban limit for this house has been reached! - } - else if (house.IsBanned(poster)) - { - from.SendLocalizedMessage(501356); // This person is already banned! - } - else if (poster is BaseCreature creature && creature.NoHouseRestrictions) - { - from.SendLocalizedMessage(1062040); // You cannot ban that. - } - else - { - if (!house.Bans.Contains(poster)) - { - house.Bans.Add(poster); - } - - from.SendLocalizedMessage(1062417); // That person has been banned from this house. - - if (house.IsInside(poster) && !BasePlayerBB.CheckAccess(house, poster)) - { - poster.MoveToWorld(house.BanLocation, house.Map); - } - } - } - - from.SendGump(new PlayerBBGump(from, house, board, page)); - } - - break; - } - case 7: // Delete message - { - if (house.IsOwner(from)) - { - if (page >= 1 && page <= board.Messages.Count) - { - board.Messages.RemoveAt(page - 1); - } - - from.SendGump(new PlayerBBGump(from, house, board, 0)); - } - - break; - } - case 8: // Post props - { - if (from.AccessLevel >= AccessLevel.GameMaster) - { - var message = board.Greeting; - - if (page >= 1 && page <= board.Messages.Count) - { - message = board.Messages[page - 1]; - } - - from.SendGump(new PlayerBBGump(from, house, board, page)); - from.SendGump(new PropertiesGump(from, message)); - } - - break; - } + return; } + + text = text.Trim(); + + if (text.Length > 255) + { + text = text[..255]; + } + + if (text.Length > 0) + { + var message = new PlayerBBMessage(Core.Now, from, text); + + if (_greeting) + { + board.Greeting = message; + } + else + { + board.Add(board.Messages, message); + + if (board.Messages.Count > 50) + { + board.RemoveAt(board.Messages, 0); + + if (page > 0) + { + --page; + } + } + } + } + + from.SendGump(new PlayerBBGump(from, house, board, page)); + } + } + + public class SetTitlePrompt : Prompt + { + private BasePlayerBB _board; + private BaseHouse _house; + private int _page; + + public SetTitlePrompt(int page, BaseHouse house, BasePlayerBB board) + { + _page = page; + _house = house; + _board = board; + } + + public override void OnCancel(Mobile from) + { + OnResponse(from, ""); + } + + public override void OnResponse(Mobile from, string text) + { + var page = _page; + var house = _house; + var board = _board; + + if (house?.HasLockedDownItem(board) != true) + { + from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. + return; + } + + if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board)) + { + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. + return; + } + + if (!CheckAccess(house, from)) + { + from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board. + return; + } + + text = text.Trim(); + + if (text.Length > 255) + { + text = text[..255]; + } + + if (text.Length > 0) + { + board.Title = text; + } + + from.SendGump(new PlayerBBGump(from, house, board, page)); + } + } +} + +[PropertyObject] +[SerializationGenerator(0)] +public partial class PlayerBBMessage +{ + [SerializableField(0)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private DateTime _time; + + [SerializableField(1)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private Mobile _poster; + + [SerializableField(2)] + [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] + private string _message; + + public PlayerBBMessage() + { + } + + public PlayerBBMessage(DateTime time, Mobile poster, string message) + { + _time = time; + _poster = poster; + _message = message; + } +} + +public class PlayerBBGump : Gump +{ + private const int LabelColor = 0x7FFF; + private const int LabelHue = 1153; + private BasePlayerBB _board; + private Mobile _from; + private BaseHouse _house; + private int _page; + + public PlayerBBGump(Mobile from, BaseHouse house, BasePlayerBB board, int page) : base(50, 10) + { + from.CloseGump(); + + _page = page; + _from = from; + _house = house; + _board = board; + + AddPage(0); + + AddImage(30, 30, 5400); + + AddButton(393, 145, 2084, 2084, 4); // Scroll up + AddButton(390, 371, 2085, 2085, 5); // Scroll down + + AddButton(32, 183, 5412, 5413, 1); // Post message + + if (house.IsOwner(from)) + { + AddButton(63, 90, 5601, 5605, 2); + AddHtmlLocalized(81, 89, 230, 20, 1062400, LabelColor); // Set title + + AddButton(63, 109, 5601, 5605, 3); + AddHtmlLocalized(81, 108, 230, 20, 1062401, LabelColor); // Post greeting + } + + var title = board.Title; + + if (title != null) + { + AddHtml(183, 68, 180, 23, title); + } + + AddHtmlLocalized(385, 89, 60, 20, 1062409, LabelColor); // Post + + AddLabel(440, 89, LabelHue, page.ToString()); + AddLabel(455, 89, LabelHue, "/"); + AddLabel(470, 89, LabelHue, board.Messages.Count.ToString()); + + var message = board.Greeting; + + if (page >= 1 && page <= board.Messages.Count) + { + message = board.Messages[page - 1]; + } + + AddImageTiled(150, 220, 240, 1, 2700); // Separator + + AddHtmlLocalized(150, 180, 100, 20, 1062405, 16715); // Posted On: + AddHtmlLocalized(150, 200, 100, 20, 1062406, 16715); // Posted By: + + if (message != null) + { + AddHtml(255, 180, 150, 20, message.Time.ToString("yyyy-MM-dd HH:mm:ss")); + + var poster = message.Poster; + var name = (poster?.Name?.Trim()).DefaultIfNullOrEmpty("Someone"); + + AddHtml(255, 200, 150, 20, name); + + AddHtml(150, 240, 250, 100, message.Message ?? ""); + + if (message != board.Greeting && house.IsOwner(from)) + { + AddButton(130, 395, 1209, 1210, 6); + AddHtmlLocalized(150, 393, 150, 20, 1062410, LabelColor); // Banish Poster + + AddButton(310, 395, 1209, 1210, 7); + AddHtmlLocalized(330, 393, 150, 20, 1062411, LabelColor); // Delete Message + } + + if (from.AccessLevel >= AccessLevel.GameMaster) + { + AddButton(135, 242, 1209, 1210, 8); // Post props + } + } + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + var page = _page; + var from = _from; + var house = _house; + var board = _board; + + if (house?.HasLockedDownItem(board) != true) + { + from.SendLocalizedMessage(1062396); // This bulletin board must be locked down in a house to be usable. + return; + } + + if (!from.InRange(board.GetWorldLocation(), 2) || !from.InLOS(board)) + { + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. + return; + } + + if (!BasePlayerBB.CheckAccess(house, from)) + { + from.SendLocalizedMessage(1062398); // You are not allowed to post to this bulletin board. + return; + } + + switch (info.ButtonID) + { + case 1: // Post message + { + from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, false); + from.SendLocalizedMessage(1062397); // Please enter your message: + + break; + } + case 2: // Set title + { + if (house.IsOwner(from)) + { + from.Prompt = new BasePlayerBB.SetTitlePrompt(page, house, board); + from.SendLocalizedMessage(1062402); // Enter new title: + } + + break; + } + case 3: // Post greeting + { + if (house.IsOwner(from)) + { + from.Prompt = new BasePlayerBB.PostPrompt(page, house, board, true); + from.SendLocalizedMessage(1062404); // Enter new greeting (this will always be the first post): + } + + break; + } + case 4: // Scroll up + { + if (page == 0) + { + page = board.Messages.Count; + } + else + { + page -= 1; + } + + from.SendGump(new PlayerBBGump(from, house, board, page)); + + break; + } + case 5: // Scroll down + { + page += 1; + page %= board.Messages.Count + 1; + + from.SendGump(new PlayerBBGump(from, house, board, page)); + + break; + } + case 6: // Banish poster + { + if (house.IsOwner(from)) + { + if (page >= 1 && page <= board.Messages.Count) + { + var message = board.Messages[page - 1]; + var poster = message.Poster; + + if (poster == null) + { + from.SendGump(new PlayerBBGump(from, house, board, page)); + return; + } + + if (poster.AccessLevel > AccessLevel.Player && from.AccessLevel <= poster.AccessLevel) + { + from.SendLocalizedMessage(501354); // Uh oh...a bigger boot may be required. + } + else if (house.IsFriend(poster)) + { + // That person is a friend, co-owner, or owner of this house, and therefore cannot be banished! + from.SendLocalizedMessage(1060750); + } + else if (poster is PlayerVendor) + { + from.SendLocalizedMessage(501351); // You cannot eject a vendor. + } + else if (house.Bans.Count >= BaseHouse.MaxBans) + { + from.SendLocalizedMessage(501355); // The ban limit for this house has been reached! + } + else if (house.IsBanned(poster)) + { + from.SendLocalizedMessage(501356); // This person is already banned! + } + else if (poster is BaseCreature creature && creature.NoHouseRestrictions) + { + from.SendLocalizedMessage(1062040); // You cannot ban that. + } + else + { + if (!house.Bans.Contains(poster)) + { + house.Bans.Add(poster); + } + + from.SendLocalizedMessage(1062417); // That person has been banned from this house. + + if (house.IsInside(poster) && !BasePlayerBB.CheckAccess(house, poster)) + { + poster.MoveToWorld(house.BanLocation, house.Map); + } + } + } + + from.SendGump(new PlayerBBGump(from, house, board, page)); + } + + break; + } + case 7: // Delete message + { + if (house.IsOwner(from)) + { + if (page >= 1 && page <= board.Messages.Count) + { + board.RemoveAt(board.Messages, page - 1); + } + + from.SendGump(new PlayerBBGump(from, house, board, 0)); + } + + break; + } + case 8: // Post props + { + if (from.AccessLevel >= AccessLevel.GameMaster) + { + var message = board.Greeting; + + if (page >= 1 && page <= board.Messages.Count) + { + message = board.Messages[page - 1]; + } + + from.SendGump(new PlayerBBGump(from, house, board, page)); + from.SendGump(new PropertiesGump(from, message)); + } + + break; + } } } } diff --git a/Projects/UOContent/Items/Misc/PlayerVendorDeed.cs b/Projects/UOContent/Items/Misc/PlayerVendorDeed.cs index d14b5e526..ff115b1b8 100644 --- a/Projects/UOContent/Items/Misc/PlayerVendorDeed.cs +++ b/Projects/UOContent/Items/Misc/PlayerVendorDeed.cs @@ -1,103 +1,82 @@ +using ModernUO.Serialization; using Server.Mobiles; using Server.Multis; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class ContractOfEmployment : Item { - public class ContractOfEmployment : Item + [Constructible] + public ContractOfEmployment() : base(0x14F0) => Weight = 1.0; + + public override int LabelNumber => 1041243; // a contract of employment + + public override void OnDoubleClick(Mobile from) { - [Constructible] - public ContractOfEmployment() : base(0x14F0) => Weight = 1.0; - - public ContractOfEmployment(Serial serial) : base(serial) + if (!IsChildOf(from.Backpack)) { + from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } - - public override int LabelNumber => 1041243; // a contract of employment - - public override void Serialize(IGenericWriter writer) + else if (from.AccessLevel >= AccessLevel.GameMaster) { - base.Serialize(writer); + from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish. - writer.Write(0); // version + Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); + + v.Direction = from.Direction & Direction.Mask; + v.MoveToWorld(from.Location, from.Map); + + v.SayTo(from, 503246); // Ah! it feels good to be working again. + + Delete(); } - - public override void Deserialize(IGenericReader reader) + else { - base.Deserialize(reader); + var house = BaseHouse.FindHouseAt(from); - var version = reader.ReadInt(); - } - - public override void OnDoubleClick(Mobile from) - { - if (!IsChildOf(from.Backpack)) + if (house == null) { - from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. + from.SendLocalizedMessage(503240); // Vendors can only be placed in houses. } - else if (from.AccessLevel >= AccessLevel.GameMaster) + else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from)) { - from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish. - - Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from)); - - v.Direction = from.Direction & Direction.Mask; - v.MoveToWorld(from.Location, from.Map); - - v.SayTo(from, 503246); // Ah! it feels good to be working again. - - Delete(); + // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. + from.SendLocalizedMessage(503242); + } + else if (BaseHouse.NewVendorSystem && !house.IsOwner(from)) + { + // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. + from.SendLocalizedMessage(1062423); + } + else if (!house.Public || !house.CanPlaceNewVendor()) + { + // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. + from.SendLocalizedMessage(503241); } else { - var house = BaseHouse.FindHouseAt(from); + BaseHouse.IsThereVendor(from.Location, from.Map, out var vendor, out var contract); - if (house == null) + if (vendor) { - from.SendLocalizedMessage(503240); // Vendors can only be placed in houses. + from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. } - else if (!BaseHouse.NewVendorSystem && !house.IsFriend(from)) + else if (contract) { - from.SendLocalizedMessage( - 503242 - ); // You must ask the owner of this building to name you a friend of the household in order to place a vendor here. - } - else if (BaseHouse.NewVendorSystem && !house.IsOwner(from)) - { - from.SendLocalizedMessage( - 1062423 - ); // Only the house owner can directly place vendors. Please ask the house owner to offer you a vendor contract so that you may place a vendor in this house. - } - else if (!house.Public || !house.CanPlaceNewVendor()) - { - from.SendLocalizedMessage( - 503241 - ); // You cannot place this vendor or barkeep. Make sure the house is public and has sufficient storage available. + // You cannot place a vendor or barkeep on top of a rental contract! + from.SendLocalizedMessage(1062678); } else { - BaseHouse.IsThereVendor(from.Location, from.Map, out var vendor, out var contract); + Mobile v = new PlayerVendor(from, house); - if (vendor) - { - from.SendLocalizedMessage(1062677); // You cannot place a vendor or barkeep at this location. - } - else if (contract) - { - from.SendLocalizedMessage( - 1062678 - ); // You cannot place a vendor or barkeep on top of a rental contract! - } - else - { - Mobile v = new PlayerVendor(from, house); + v.Direction = from.Direction & Direction.Mask; + v.MoveToWorld(from.Location, from.Map); - v.Direction = from.Direction & Direction.Mask; - v.MoveToWorld(from.Location, from.Map); + v.SayTo(from, 503246); // Ah! it feels good to be working again. - v.SayTo(from, 503246); // Ah! it feels good to be working again. - - Delete(); - } + Delete(); } } } diff --git a/Projects/UOContent/Items/Misc/PowerCrystal.cs b/Projects/UOContent/Items/Misc/PowerCrystal.cs index 58d1ba015..cdd046cc6 100644 --- a/Projects/UOContent/Items/Misc/PowerCrystal.cs +++ b/Projects/UOContent/Items/Misc/PowerCrystal.cs @@ -1,42 +1,25 @@ +using ModernUO.Serialization; using Server.Network; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class PowerCrystal : Item { - public class PowerCrystal : Item + [Constructible] + public PowerCrystal() : base(0x1F1C) => Weight = 1.0; + + public override string DefaultName => "power crystal"; + + public override void OnDoubleClick(Mobile from) { - [Constructible] - public PowerCrystal() : base(0x1F1C) => Weight = 1.0; - - public PowerCrystal(Serial serial) : base(serial) + if (!from.InRange(GetWorldLocation(), 3)) { + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. } - - public override string DefaultName => "power crystal"; - - public override void OnDoubleClick(Mobile from) + else { - if (!from.InRange(GetWorldLocation(), 3)) - { - from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that. - } - else - { - from.SendAsciiMessage("This looks like part of a larger contraption."); - } - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); + from.SendAsciiMessage("This looks like part of a larger contraption."); } } } diff --git a/Projects/UOContent/Items/Misc/PowerGenerator.cs b/Projects/UOContent/Items/Misc/PowerGenerator.cs index 8474fef44..4af1ad788 100644 --- a/Projects/UOContent/Items/Misc/PowerGenerator.cs +++ b/Projects/UOContent/Items/Misc/PowerGenerator.cs @@ -489,24 +489,34 @@ namespace Server.Items switch (info.ButtonID) { case 1: // Left - newX = curNode.X - 1; - newY = curNode.Y; - break; + { + newX = curNode.X - 1; + newY = curNode.Y; + break; + } case 2: // Up - newX = curNode.X; - newY = curNode.Y - 1; - break; + { + newX = curNode.X; + newY = curNode.Y - 1; + break; + } case 3: // Right - newX = curNode.X + 1; - newY = curNode.Y; - break; + { + newX = curNode.X + 1; + newY = curNode.Y; + break; + } case 4: // Down - newX = curNode.X; - newY = curNode.Y + 1; - break; + { + newX = curNode.X; + newY = curNode.Y + 1; + break; + } default: - return; + { + return; + } } if (nextNode.X == newX && nextNode.Y == newY) diff --git a/Projects/UOContent/Items/Misc/PromotionalToken.cs b/Projects/UOContent/Items/Misc/PromotionalToken.cs index d38bff9c9..d2def4a95 100644 --- a/Projects/UOContent/Items/Misc/PromotionalToken.cs +++ b/Projects/UOContent/Items/Misc/PromotionalToken.cs @@ -1,181 +1,140 @@ +using ModernUO.Serialization; using Server.Gumps; using Server.Network; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public abstract partial class PromotionalToken : Item { - public abstract class PromotionalToken : Item + public PromotionalToken() : base(0x2AAA) { - public PromotionalToken() : base(0x2AAA) + LootType = LootType.Blessed; + Light = LightType.Circle300; + Weight = 5.0; + } + + public abstract TextDefinition ItemName { get; } + public abstract TextDefinition ItemReceiveMessage { get; } + public abstract TextDefinition ItemGumpName { get; } + + public override int LabelNumber => 1070997; // A promotional token + public abstract Item CreateItemFor(Mobile from); + + public override void GetProperties(IPropertyList list) + { + base.GetProperties(list); + + if (ItemName != null) { - LootType = LootType.Blessed; - Light = LightType.Circle300; - Weight = 5.0; - } - - public PromotionalToken(Serial serial) : base(serial) - { - } - - public abstract TextDefinition ItemName { get; } - public abstract TextDefinition ItemReceiveMessage { get; } - public abstract TextDefinition ItemGumpName { get; } - - public override int LabelNumber => 1070997; // A promotional token - public abstract Item CreateItemFor(Mobile from); - - public override void GetProperties(IPropertyList list) - { - base.GetProperties(list); - - if (ItemName != null) + if (ItemName.Number > 0) { - if (ItemName.Number > 0) - { - list.Add(1070998, ItemName.Number); // Use this to redeem
your ~1_PROMO~ - } - else - { - list.Add(1070998, ItemName.String); // Use this to redeem
your ~1_PROMO~ - } + list.Add(1070998, ItemName.Number); // Use this to redeem
your ~1_PROMO~ + } + else + { + list.Add(1070998, ItemName.String); // Use this to redeem
your ~1_PROMO~ } } + } - public override void OnDoubleClick(Mobile from) + public override void OnDoubleClick(Mobile from) + { + if (!IsChildOf(from.Backpack)) { - if (!IsChildOf(from.Backpack)) + from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used. + } + else + { + from.CloseGump(); + from.SendGump(new PromotionalTokenGump(this)); + } + } + + public override void OnRemoved(IEntity parent) + { + Mobile m = null; + + if (parent is Item item) + { + m = item.RootParent as Mobile; + } + else if (parent is Mobile mobile) + { + m = mobile; + } + + m?.CloseGump(); + } + + private class PromotionalTokenGump : Gump + { + private readonly PromotionalToken m_Token; + + public PromotionalTokenGump(PromotionalToken token) : base(10, 10) + { + m_Token = token; + + AddPage(0); + + AddBackground(0, 0, 240, 135, 0x2422); + AddHtmlLocalized( + 15, + 15, + 210, + 75, + 1070972, + 0x0, + true + ); // Click "OKAY" to redeem the following promotional item: + TextDefinition.AddHtmlText(this, 15, 60, 210, 75, m_Token.ItemGumpName, false, false); + + AddButton(160, 95, 0xF7, 0xF8, 1); // Okay + AddButton(90, 95, 0xF2, 0xF1, 0); // Cancel + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + if (info.ButtonID != 1) + { + return; + } + + var from = sender.Mobile; + + if (!m_Token.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used. } else { - from.CloseGump(); - from.SendGump(new PromotionalTokenGump(this)); - } - } + var i = m_Token.CreateItemFor(from); - public override void OnRemoved(IEntity parent) - { - Mobile m = null; - - if (parent is Item item) - { - m = item.RootParent as Mobile; - } - else if (parent is Mobile mobile) - { - m = mobile; - } - - m?.CloseGump(); - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - private class PromotionalTokenGump : Gump - { - private readonly PromotionalToken m_Token; - - public PromotionalTokenGump(PromotionalToken token) : base(10, 10) - { - m_Token = token; - - AddPage(0); - - AddBackground(0, 0, 240, 135, 0x2422); - AddHtmlLocalized( - 15, - 15, - 210, - 75, - 1070972, - 0x0, - true - ); // Click "OKAY" to redeem the following promotional item: - TextDefinition.AddHtmlText(this, 15, 60, 210, 75, m_Token.ItemGumpName, false, false); - - AddButton(160, 95, 0xF7, 0xF8, 1); // Okay - AddButton(90, 95, 0xF2, 0xF1, 0); // Cancel - } - - public override void OnResponse(NetState sender, RelayInfo info) - { - if (info.ButtonID != 1) + if (i != null) { - return; - } - - var from = sender.Mobile; - - if (!m_Token.IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used. - } - else - { - var i = m_Token.CreateItemFor(from); - - if (i != null) - { - from.BankBox.AddItem(i); - TextDefinition.SendMessageTo(from, m_Token.ItemReceiveMessage); - m_Token.Delete(); - } + from.BankBox.AddItem(i); + TextDefinition.SendMessageTo(from, m_Token.ItemReceiveMessage); + m_Token.Delete(); } } } } - - public class SoulstoneFragmentToken : PromotionalToken - { - [Constructible] - public SoulstoneFragmentToken() - { - } - - public SoulstoneFragmentToken(Serial serial) : base(serial) - { - } - - public override TextDefinition ItemGumpName => 1070999; //
Soulstone Fragment
- public override TextDefinition ItemName => 1071000; // soulstone fragment - - public override TextDefinition ItemReceiveMessage => - 1070976; // A soulstone fragment has been created in your bank box. - - public override Item CreateItemFor(Mobile from) - { - if (from?.Account != null) - { - return new SoulstoneFragment(from.Account.ToString()); - } - - return null; - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } +} + +[SerializationGenerator(0, false)] +public partial class SoulstoneFragmentToken : PromotionalToken +{ + [Constructible] + public SoulstoneFragmentToken() + { + } + + public override TextDefinition ItemGumpName => 1070999; //
Soulstone Fragment
+ public override TextDefinition ItemName => 1071000; // soulstone fragment + + // A soulstone fragment has been created in your bank box. + public override TextDefinition ItemReceiveMessage => 1070976; + + public override Item CreateItemFor(Mobile from) => + from?.Account != null ? new SoulstoneFragment(from.Account.ToString()) : null; } diff --git a/Projects/UOContent/Items/Misc/PublicMoongate.cs b/Projects/UOContent/Items/Misc/PublicMoongate.cs index 1539f7ba3..6d1a8a563 100644 --- a/Projects/UOContent/Items/Misc/PublicMoongate.cs +++ b/Projects/UOContent/Items/Misc/PublicMoongate.cs @@ -1,511 +1,494 @@ using System; using System.Collections.Generic; +using ModernUO.Serialization; using Server.Factions; using Server.Gumps; using Server.Mobiles; using Server.Network; using Server.Spells; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class PublicMoongate : Item { - public class PublicMoongate : Item + [Constructible] + public PublicMoongate() : base(0xF6C) { - [Constructible] - public PublicMoongate() : base(0xF6C) + Movable = false; + Light = LightType.Circle300; + } + + public override bool ForceShowProperties => ObjectPropertyList.Enabled; + + public override bool HandlesOnMovement => true; + + public override void OnDoubleClick(Mobile from) + { + if (!from.Player) { - Movable = false; - Light = LightType.Circle300; + return; } - public PublicMoongate(Serial serial) : base(serial) + if (from.InRange(GetWorldLocation(), 1)) { + UseGate(from); } - - public override bool ForceShowProperties => ObjectPropertyList.Enabled; - - public override bool HandlesOnMovement => true; - - public override void OnDoubleClick(Mobile from) + else { - if (!from.Player) - { - return; - } - - if (from.InRange(GetWorldLocation(), 1)) - { - UseGate(from); - } - else - { - from.SendLocalizedMessage(500446); // That is too far away. - } - } - - public override bool OnMoveOver(Mobile m) - { - // Changed so criminals are not blocked by it. - if (m.Player) - { - UseGate(m); - } - - return true; - } - - public override void OnMovement(Mobile m, Point3D oldLocation) - { - if (m is PlayerMobile) - { - if (!Utility.InRange(m.Location, Location, 1) && Utility.InRange(oldLocation, Location, 1)) - { - m.CloseGump(); - } - } - } - - public bool UseGate(Mobile m) - { - if (m.Criminal) - { - m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. - return false; - } - - if (SpellHelper.CheckCombat(m)) - { - m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? - return false; - } - - if (m.Spell != null) - { - m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. - return false; - } - - m.CloseGump(); - m.SendGump(new MoongateGump(m, this)); - - if (!m.Hidden || m.AccessLevel == AccessLevel.Player) - { - Effects.PlaySound(m.Location, m.Map, 0x20E); - } - - return true; - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - public static void Initialize() - { - CommandSystem.Register("MoonGen", AccessLevel.Administrator, MoonGen_OnCommand); - } - - [Usage("MoonGen"), Description("Generates public moongates. Removes all old moongates.")] - public static void MoonGen_OnCommand(CommandEventArgs e) - { - DeleteAll(); - - var count = 0; - - count += MoonGen(PMList.Trammel); - count += MoonGen(PMList.Felucca); - count += MoonGen(PMList.Ilshenar); - count += MoonGen(PMList.Malas); - count += MoonGen(PMList.Tokuno); - - World.Broadcast(0x35, true, "{0} moongates generated.", count); - } - - private static void DeleteAll() - { - var list = new List(); - - foreach (var item in World.Items.Values) - { - if (item is PublicMoongate) - { - list.Add(item); - } - } - - foreach (var item in list) - { - item.Delete(); - } - - if (list.Count > 0) - { - World.Broadcast(0x35, true, "{0} moongates removed.", list.Count); - } - } - - private static int MoonGen(PMList list) - { - foreach (var entry in list.Entries) - { - Item item = new PublicMoongate(); - - item.MoveToWorld(entry.Location, list.Map); - - if (entry.Number == 1060642) // Umbra - { - item.Hue = 0x497; - } - } - - return list.Entries.Length; + from.SendLocalizedMessage(500446); // That is too far away. } } - public class PMEntry + public override bool OnMoveOver(Mobile m) { - public PMEntry(Point3D loc, int number) + // Changed so criminals are not blocked by it. + if (m.Player) { - Location = loc; - Number = number; + UseGate(m); } - public Point3D Location { get; } - - public int Number { get; } + return true; } - public class PMList + public override void OnMovement(Mobile m, Point3D oldLocation) { - public static PMList Trammel = - new( - 1012000, - 1012012, - Map.Trammel, - new[] - { - new PMEntry(new Point3D(4467, 1283, 5), 1012003), // Moonglow - new PMEntry(new Point3D(1336, 1997, 5), 1012004), // Britain - new PMEntry(new Point3D(1499, 3771, 5), 1012005), // Jhelom - new PMEntry(new Point3D(771, 752, 5), 1012006), // Yew - new PMEntry(new Point3D(2701, 692, 5), 1012007), // Minoc - new PMEntry(new Point3D(1828, 2948, -20), 1012008), // Trinsic - new PMEntry(new Point3D(643, 2067, 5), 1012009), // Skara Brae - /* Dynamic Z for Magincia to support both old and new maps. */ - new PMEntry(new Point3D(3563, 2139, Map.Trammel.GetAverageZ(3563, 2139)), 1012010), // (New) Magincia - new PMEntry(new Point3D(3450, 2677, 25), 1078098) // New Haven - } - ); - - public static PMList Felucca = - new( - 1012001, - 1012013, - Map.Felucca, - new[] - { - new PMEntry(new Point3D(4467, 1283, 5), 1012003), // Moonglow - new PMEntry(new Point3D(1336, 1997, 5), 1012004), // Britain - new PMEntry(new Point3D(1499, 3771, 5), 1012005), // Jhelom - new PMEntry(new Point3D(771, 752, 5), 1012006), // Yew - new PMEntry(new Point3D(2701, 692, 5), 1012007), // Minoc - new PMEntry(new Point3D(1828, 2948, -20), 1012008), // Trinsic - new PMEntry(new Point3D(643, 2067, 5), 1012009), // Skara Brae - /* Dynamic Z for Magincia to support both old and new maps. */ - new PMEntry(new Point3D(3563, 2139, Map.Felucca.GetAverageZ(3563, 2139)), 1012010), // (New) Magincia - new PMEntry(new Point3D(2711, 2234, 0), 1019001) // Buccaneer's Den - } - ); - - public static PMList Ilshenar = - new( - 1012002, - 1012014, - Map.Ilshenar, - new[] - { - new PMEntry(new Point3D(1215, 467, -13), 1012015), // Compassion - new PMEntry(new Point3D(722, 1366, -60), 1012016), // Honesty - new PMEntry(new Point3D(744, 724, -28), 1012017), // Honor - new PMEntry(new Point3D(281, 1016, 0), 1012018), // Humility - new PMEntry(new Point3D(987, 1011, -32), 1012019), // Justice - new PMEntry(new Point3D(1174, 1286, -30), 1012020), // Sacrifice - new PMEntry(new Point3D(1532, 1340, -3), 1012021), // Spirituality - new PMEntry(new Point3D(528, 216, -45), 1012022), // Valor - new PMEntry(new Point3D(1721, 218, 96), 1019000) // Chaos - } - ); - - public static PMList Malas = - new( - 1060643, - 1062039, - Map.Malas, - new[] - { - new PMEntry(new Point3D(1015, 527, -65), 1060641), // Luna - new PMEntry(new Point3D(1997, 1386, -85), 1060642) // Umbra - } - ); - - public static PMList Tokuno = - new( - 1063258, - 1063415, - Map.Tokuno, - new[] - { - new PMEntry(new Point3D(1169, 998, 41), 1063412), // Isamu-Jima - new PMEntry(new Point3D(802, 1204, 25), 1063413), // Makoto-Jima - new PMEntry(new Point3D(270, 628, 15), 1063414) // Homare-Jima - } - ); - - public static PMList TerMur = - new( - 1113602, - 1113604, - Map.TerMur, - new[] - { - new PMEntry(new Point3D(850, 3525, -38), 1113603), // Royal City - } - ); - - public static PMList TerMurEodon = - new( - 1113602, - 1113604, - Map.TerMur, - new[] - { - new PMEntry(new Point3D(850, 3525, -38), 1113603), // Royal City - new PMEntry(new Point3D(719, 1863, 40), 1156262) // Valley of Eodon - } - ); - - public static PMList[] NoTrammelLists = { Felucca }; - public static PMList[] T2ALists = { Trammel, Felucca }; - public static PMList[] T2AListsYoung = { Trammel }; - public static PMList[] LBRLists = { Trammel, Felucca, Ilshenar }; - public static PMList[] LBRListsYoung = { Trammel, Ilshenar }; - public static PMList[] AOSLists = { Trammel, Felucca, Ilshenar, Malas }; - public static PMList[] AOSListsYoung = { Trammel, Ilshenar, Malas }; - public static PMList[] SELists = { Trammel, Felucca, Ilshenar, Malas, Tokuno }; - public static PMList[] SEListsYoung = { Trammel, Ilshenar, Malas, Tokuno }; - public static PMList[] SALists = { Trammel, Felucca, Ilshenar, Malas, Tokuno, TerMur }; - public static PMList[] SAListsYoung = { Trammel, Ilshenar, Malas, Tokuno, TerMur }; - public static PMList[] TOLLists = { Trammel, Felucca, Ilshenar, Malas, Tokuno, TerMurEodon }; - public static PMList[] TOLListsYoung = { Trammel, Ilshenar, Malas, Tokuno, TerMurEodon }; - public static PMList[] RedLists = { Felucca }; - public static PMList[] SigilLists = { Felucca }; - - public PMList(int number, int selNumber, Map map, PMEntry[] entries) + if (m is PlayerMobile) { - Number = number; - SelNumber = selNumber; - Map = map; - Entries = entries; + if (!Utility.InRange(m.Location, Location, 1) && Utility.InRange(oldLocation, Location, 1)) + { + m.CloseGump(); + } } - - public int Number { get; } - - public int SelNumber { get; } - - public Map Map { get; } - - public PMEntry[] Entries { get; } } - public class MoongateGump : Gump + public bool UseGate(Mobile m) { - private PMList[] _lists; - private Mobile _mobile; - private Item _moongate; - - public MoongateGump(Mobile mobile, Item moongate) : base(100, 100) + if (m.Criminal) { - _mobile = mobile; - _moongate = moongate; + m.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. + return false; + } - PMList[] checkLists; + if (SpellHelper.CheckCombat(m)) + { + m.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? + return false; + } - if (!mobile.Player) + if (m.Spell != null) + { + m.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. + return false; + } + + m.CloseGump(); + m.SendGump(new MoongateGump(m, this)); + + if (!m.Hidden || m.AccessLevel == AccessLevel.Player) + { + Effects.PlaySound(m.Location, m.Map, 0x20E); + } + + return true; + } + + public static void Initialize() + { + CommandSystem.Register("MoonGen", AccessLevel.Administrator, MoonGen_OnCommand); + } + + [Usage("MoonGen"), Description("Generates public moongates. Removes all old moongates.")] + public static void MoonGen_OnCommand(CommandEventArgs e) + { + DeleteAll(); + + var count = 0; + + count += MoonGen(PMList.Trammel); + count += MoonGen(PMList.Felucca); + count += MoonGen(PMList.Ilshenar); + count += MoonGen(PMList.Malas); + count += MoonGen(PMList.Tokuno); + + World.Broadcast(0x35, true, "{0} moongates generated.", count); + } + + private static void DeleteAll() + { + var list = new List(); + + foreach (var item in World.Items.Values) + { + if (item is PublicMoongate) { - checkLists = PMList.SELists; - } - else if (Sigil.ExistsOn(mobile)) - { - checkLists = PMList.SigilLists; - } - else if (mobile.Kills >= 5) - { - checkLists = PMList.RedLists; - } - else - { - var flags = mobile.NetState?.Flags ?? ClientFlags.None; - var young = mobile is PlayerMobile { Young: true }; - - checkLists = Core.Expansion switch - { - >= Expansion.TOL when (flags & ClientFlags.TerMur) != 0 => - young ? PMList.TOLListsYoung : PMList.TOLLists, - >= Expansion.SA when (flags & ClientFlags.TerMur) != 0 => young ? PMList.SAListsYoung : PMList.SALists, - >= Expansion.SE when (flags & ClientFlags.Tokuno) != 0 => young ? PMList.SEListsYoung : PMList.SELists, - >= Expansion.AOS when (flags & ClientFlags.Malas) != 0 => young ? PMList.AOSListsYoung : PMList.AOSLists, - >= Expansion.LBR when (flags & ClientFlags.Ilshenar) != 0 => - young ? PMList.LBRListsYoung : PMList.LBRLists, - >= Expansion.T2A when (flags & ClientFlags.Trammel) != 0 => - young ? PMList.T2AListsYoung : PMList.T2ALists, - _ => PMList.NoTrammelLists - }; - } - - _lists = new PMList[checkLists.Length]; - - for (var i = 0; i < _lists.Length; ++i) - { - _lists[i] = checkLists[i]; - } - - for (var i = 0; i < _lists.Length; ++i) - { - if (_lists[i].Map == mobile.Map) - { - (_lists[i], _lists[0]) = (_lists[0], _lists[i]); - break; - } - } - - AddPage(0); - - AddBackground(0, 0, 380, 280, 5054); - - AddButton(10, 210, 4005, 4007, 1); - AddHtmlLocalized(45, 210, 140, 25, 1011036); // OKAY - - AddButton(10, 235, 4005, 4007, 0); - AddHtmlLocalized(45, 235, 140, 25, 1011012); // CANCEL - - AddHtmlLocalized(5, 5, 200, 20, 1012011); // Pick your destination: - - for (var i = 0; i < checkLists.Length; ++i) - { - AddButton(10, 35 + i * 25, 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf(_lists, checkLists[i]) + 1); - AddHtmlLocalized(30, 35 + i * 25, 150, 20, checkLists[i].Number); - } - - for (var i = 0; i < _lists.Length; ++i) - { - RenderPage(i, Array.IndexOf(checkLists, _lists[i])); + list.Add(item); } } - private void RenderPage(int index, int offset) + foreach (var item in list) { - var list = _lists[index]; + item.Delete(); + } - AddPage(index + 1); + if (list.Count > 0) + { + World.Broadcast(0x35, true, "{0} moongates removed.", list.Count); + } + } - AddButton(10, 35 + offset * 25, 2117, 2118, 0, GumpButtonType.Page, index + 1); - AddHtmlLocalized(30, 35 + offset * 25, 150, 20, list.SelNumber); + private static int MoonGen(PMList list) + { + foreach (var entry in list.Entries) + { + Item item = new PublicMoongate(); - var entries = list.Entries; + item.MoveToWorld(entry.Location, list.Map); - for (var i = 0; i < entries.Length; ++i) + if (entry.Number == 1060642) // Umbra { - AddRadio(200, 35 + i * 25, 210, 211, false, index * 100 + i); - AddHtmlLocalized(225, 35 + i * 25, 150, 20, entries[i].Number); + item.Hue = 0x497; } } - public override void OnResponse(NetState state, RelayInfo info) + return list.Entries.Length; + } +} + +public class PMEntry +{ + public PMEntry(Point3D loc, int number) + { + Location = loc; + Number = number; + } + + public Point3D Location { get; } + + public int Number { get; } +} + +public class PMList +{ + public static PMList Trammel = + new( + 1012000, + 1012012, + Map.Trammel, + new[] + { + new PMEntry(new Point3D(4467, 1283, 5), 1012003), // Moonglow + new PMEntry(new Point3D(1336, 1997, 5), 1012004), // Britain + new PMEntry(new Point3D(1499, 3771, 5), 1012005), // Jhelom + new PMEntry(new Point3D(771, 752, 5), 1012006), // Yew + new PMEntry(new Point3D(2701, 692, 5), 1012007), // Minoc + new PMEntry(new Point3D(1828, 2948, -20), 1012008), // Trinsic + new PMEntry(new Point3D(643, 2067, 5), 1012009), // Skara Brae + /* Dynamic Z for Magincia to support both old and new maps. */ + new PMEntry(new Point3D(3563, 2139, Map.Trammel.GetAverageZ(3563, 2139)), 1012010), // (New) Magincia + new PMEntry(new Point3D(3450, 2677, 25), 1078098) // New Haven + } + ); + + public static PMList Felucca = + new( + 1012001, + 1012013, + Map.Felucca, + new[] + { + new PMEntry(new Point3D(4467, 1283, 5), 1012003), // Moonglow + new PMEntry(new Point3D(1336, 1997, 5), 1012004), // Britain + new PMEntry(new Point3D(1499, 3771, 5), 1012005), // Jhelom + new PMEntry(new Point3D(771, 752, 5), 1012006), // Yew + new PMEntry(new Point3D(2701, 692, 5), 1012007), // Minoc + new PMEntry(new Point3D(1828, 2948, -20), 1012008), // Trinsic + new PMEntry(new Point3D(643, 2067, 5), 1012009), // Skara Brae + /* Dynamic Z for Magincia to support both old and new maps. */ + new PMEntry(new Point3D(3563, 2139, Map.Felucca.GetAverageZ(3563, 2139)), 1012010), // (New) Magincia + new PMEntry(new Point3D(2711, 2234, 0), 1019001) // Buccaneer's Den + } + ); + + public static PMList Ilshenar = + new( + 1012002, + 1012014, + Map.Ilshenar, + new[] + { + new PMEntry(new Point3D(1215, 467, -13), 1012015), // Compassion + new PMEntry(new Point3D(722, 1366, -60), 1012016), // Honesty + new PMEntry(new Point3D(744, 724, -28), 1012017), // Honor + new PMEntry(new Point3D(281, 1016, 0), 1012018), // Humility + new PMEntry(new Point3D(987, 1011, -32), 1012019), // Justice + new PMEntry(new Point3D(1174, 1286, -30), 1012020), // Sacrifice + new PMEntry(new Point3D(1532, 1340, -3), 1012021), // Spirituality + new PMEntry(new Point3D(528, 216, -45), 1012022), // Valor + new PMEntry(new Point3D(1721, 218, 96), 1019000) // Chaos + } + ); + + public static PMList Malas = + new( + 1060643, + 1062039, + Map.Malas, + new[] + { + new PMEntry(new Point3D(1015, 527, -65), 1060641), // Luna + new PMEntry(new Point3D(1997, 1386, -85), 1060642) // Umbra + } + ); + + public static PMList Tokuno = + new( + 1063258, + 1063415, + Map.Tokuno, + new[] + { + new PMEntry(new Point3D(1169, 998, 41), 1063412), // Isamu-Jima + new PMEntry(new Point3D(802, 1204, 25), 1063413), // Makoto-Jima + new PMEntry(new Point3D(270, 628, 15), 1063414) // Homare-Jima + } + ); + + public static PMList TerMur = + new( + 1113602, + 1113604, + Map.TerMur, + new[] + { + new PMEntry(new Point3D(850, 3525, -38), 1113603), // Royal City + } + ); + + public static PMList TerMurEodon = + new( + 1113602, + 1113604, + Map.TerMur, + new[] + { + new PMEntry(new Point3D(850, 3525, -38), 1113603), // Royal City + new PMEntry(new Point3D(719, 1863, 40), 1156262) // Valley of Eodon + } + ); + + public static PMList[] NoTrammelLists = { Felucca }; + public static PMList[] T2ALists = { Trammel, Felucca }; + public static PMList[] T2AListsYoung = { Trammel }; + public static PMList[] LBRLists = { Trammel, Felucca, Ilshenar }; + public static PMList[] LBRListsYoung = { Trammel, Ilshenar }; + public static PMList[] AOSLists = { Trammel, Felucca, Ilshenar, Malas }; + public static PMList[] AOSListsYoung = { Trammel, Ilshenar, Malas }; + public static PMList[] SELists = { Trammel, Felucca, Ilshenar, Malas, Tokuno }; + public static PMList[] SEListsYoung = { Trammel, Ilshenar, Malas, Tokuno }; + public static PMList[] SALists = { Trammel, Felucca, Ilshenar, Malas, Tokuno, TerMur }; + public static PMList[] SAListsYoung = { Trammel, Ilshenar, Malas, Tokuno, TerMur }; + public static PMList[] TOLLists = { Trammel, Felucca, Ilshenar, Malas, Tokuno, TerMurEodon }; + public static PMList[] TOLListsYoung = { Trammel, Ilshenar, Malas, Tokuno, TerMurEodon }; + public static PMList[] RedLists = { Felucca }; + public static PMList[] SigilLists = { Felucca }; + + public PMList(int number, int selNumber, Map map, PMEntry[] entries) + { + Number = number; + SelNumber = selNumber; + Map = map; + Entries = entries; + } + + public int Number { get; } + + public int SelNumber { get; } + + public Map Map { get; } + + public PMEntry[] Entries { get; } +} + +public class MoongateGump : Gump +{ + private PMList[] _lists; + private Mobile _mobile; + private Item _moongate; + + public MoongateGump(Mobile mobile, Item moongate) : base(100, 100) + { + _mobile = mobile; + _moongate = moongate; + + PMList[] checkLists; + + if (!mobile.Player) { - if (info.ButtonID == 0) // Cancel - { - return; - } + checkLists = PMList.SELists; + } + else if (Sigil.ExistsOn(mobile)) + { + checkLists = PMList.SigilLists; + } + else if (mobile.Kills >= 5) + { + checkLists = PMList.RedLists; + } + else + { + var flags = mobile.NetState?.Flags ?? ClientFlags.None; + var young = mobile is PlayerMobile { Young: true }; - if (_mobile.Deleted || _moongate.Deleted || _mobile.Map == null) + checkLists = Core.Expansion switch { - return; - } + >= Expansion.TOL when (flags & ClientFlags.TerMur) != 0 => + young ? PMList.TOLListsYoung : PMList.TOLLists, + >= Expansion.SA when (flags & ClientFlags.TerMur) != 0 => young ? PMList.SAListsYoung : PMList.SALists, + >= Expansion.SE when (flags & ClientFlags.Tokuno) != 0 => young ? PMList.SEListsYoung : PMList.SELists, + >= Expansion.AOS when (flags & ClientFlags.Malas) != 0 => young ? PMList.AOSListsYoung : PMList.AOSLists, + >= Expansion.LBR when (flags & ClientFlags.Ilshenar) != 0 => + young ? PMList.LBRListsYoung : PMList.LBRLists, + >= Expansion.T2A when (flags & ClientFlags.Trammel) != 0 => + young ? PMList.T2AListsYoung : PMList.T2ALists, + _ => PMList.NoTrammelLists + }; + } - var switches = info.Switches; + _lists = new PMList[checkLists.Length]; - if (switches.Length == 0) - { - return; - } + for (var i = 0; i < _lists.Length; ++i) + { + _lists[i] = checkLists[i]; + } - var switchID = switches[0]; - var listIndex = switchID / 100; - var listEntry = switchID % 100; + for (var i = 0; i < _lists.Length; ++i) + { + if (_lists[i].Map == mobile.Map) + { + (_lists[i], _lists[0]) = (_lists[0], _lists[i]); + break; + } + } - if (listIndex < 0 || listIndex >= _lists.Length) - { - return; - } + AddPage(0); - var list = _lists[listIndex]; + AddBackground(0, 0, 380, 280, 5054); - if (listEntry < 0 || listEntry >= list.Entries.Length) - { - return; - } + AddButton(10, 210, 4005, 4007, 1); + AddHtmlLocalized(45, 210, 140, 25, 1011036); // OKAY - var entry = list.Entries[listEntry]; + AddButton(10, 235, 4005, 4007, 0); + AddHtmlLocalized(45, 235, 140, 25, 1011012); // CANCEL - if (!_mobile.InRange(_moongate.GetWorldLocation(), 1) || _mobile.Map != _moongate.Map) - { - _mobile.SendLocalizedMessage(1019002); // You are too far away to use the gate. - } - else if (_mobile.Player && _mobile.Kills >= 5 && list.Map != Map.Felucca) - { - _mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. - } - else if (Sigil.ExistsOn(_mobile) && list.Map != Faction.Facet) - { - _mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. - } - else if (_mobile.Criminal) - { - _mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. - } - else if (SpellHelper.CheckCombat(_mobile)) - { - _mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? - } - else if (_mobile.Spell != null) - { - _mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. - } - else if (_mobile.Map == list.Map && _mobile.InRange(entry.Location, 1)) - { - _mobile.SendLocalizedMessage(1019003); // You are already there. - } - else - { - BaseCreature.TeleportPets(_mobile, entry.Location, list.Map); + AddHtmlLocalized(5, 5, 200, 20, 1012011); // Pick your destination: - _mobile.Combatant = null; - _mobile.Warmode = false; - _mobile.Hidden = true; + for (var i = 0; i < checkLists.Length; ++i) + { + AddButton(10, 35 + i * 25, 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf(_lists, checkLists[i]) + 1); + AddHtmlLocalized(30, 35 + i * 25, 150, 20, checkLists[i].Number); + } - _mobile.MoveToWorld(entry.Location, list.Map); + for (var i = 0; i < _lists.Length; ++i) + { + RenderPage(i, Array.IndexOf(checkLists, _lists[i])); + } + } - Effects.PlaySound(entry.Location, list.Map, 0x1FE); - } + private void RenderPage(int index, int offset) + { + var list = _lists[index]; + + AddPage(index + 1); + + AddButton(10, 35 + offset * 25, 2117, 2118, 0, GumpButtonType.Page, index + 1); + AddHtmlLocalized(30, 35 + offset * 25, 150, 20, list.SelNumber); + + var entries = list.Entries; + + for (var i = 0; i < entries.Length; ++i) + { + AddRadio(200, 35 + i * 25, 210, 211, false, index * 100 + i); + AddHtmlLocalized(225, 35 + i * 25, 150, 20, entries[i].Number); + } + } + + public override void OnResponse(NetState state, RelayInfo info) + { + if (info.ButtonID == 0) // Cancel + { + return; + } + + if (_mobile.Deleted || _moongate.Deleted || _mobile.Map == null) + { + return; + } + + var switches = info.Switches; + + if (switches.Length == 0) + { + return; + } + + var switchID = switches[0]; + var listIndex = switchID / 100; + var listEntry = switchID % 100; + + if (listIndex < 0 || listIndex >= _lists.Length) + { + return; + } + + var list = _lists[listIndex]; + + if (listEntry < 0 || listEntry >= list.Entries.Length) + { + return; + } + + var entry = list.Entries[listEntry]; + + if (!_mobile.InRange(_moongate.GetWorldLocation(), 1) || _mobile.Map != _moongate.Map) + { + _mobile.SendLocalizedMessage(1019002); // You are too far away to use the gate. + } + else if (_mobile.Player && _mobile.Kills >= 5 && list.Map != Map.Felucca) + { + _mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. + } + else if (Sigil.ExistsOn(_mobile) && list.Map != Faction.Facet) + { + _mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. + } + else if (_mobile.Criminal) + { + _mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. + } + else if (SpellHelper.CheckCombat(_mobile)) + { + _mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? + } + else if (_mobile.Spell != null) + { + _mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. + } + else if (_mobile.Map == list.Map && _mobile.InRange(entry.Location, 1)) + { + _mobile.SendLocalizedMessage(1019003); // You are already there. + } + else + { + BaseCreature.TeleportPets(_mobile, entry.Location, list.Map); + + _mobile.Combatant = null; + _mobile.Warmode = false; + _mobile.Hidden = true; + + _mobile.MoveToWorld(entry.Location, list.Map); + + Effects.PlaySound(entry.Location, list.Map, 0x1FE); } } } diff --git a/Projects/UOContent/Items/Misc/Rares.cs b/Projects/UOContent/Items/Misc/Rares.cs index 30dbab085..2a23a7cc7 100644 --- a/Projects/UOContent/Items/Misc/Rares.cs +++ b/Projects/UOContent/Items/Misc/Rares.cs @@ -1,619 +1,209 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Rope : Item { - public class Rope : Item + [Constructible] + public Rope(int amount = 1) : base(0x14F8) { - [Constructible] - public Rope(int amount = 1) : base(0x14F8) - { - Stackable = true; - Weight = 1.0; - Amount = amount; - } - - public Rope(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class IronWire : Item - { - [Constructible] - public IronWire(int amount = 1) : base(0x1876) - { - Stackable = true; - Weight = 5.0; - Amount = amount; - } - - public IronWire(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && Weight == 2.0) - { - Weight = 5.0; - } - } - } - - public class SilverWire : Item - { - [Constructible] - public SilverWire(int amount = 1) : base(0x1877) - { - Stackable = true; - Weight = 5.0; - Amount = amount; - } - - public SilverWire(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && Weight == 2.0) - { - Weight = 5.0; - } - } - } - - public class GoldWire : Item - { - [Constructible] - public GoldWire(int amount = 1) : base(0x1878) - { - Stackable = true; - Weight = 5.0; - Amount = amount; - } - - public GoldWire(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && Weight == 2.0) - { - Weight = 5.0; - } - } - } - - public class CopperWire : Item - { - [Constructible] - public CopperWire(int amount = 1) : base(0x1879) - { - Stackable = true; - Weight = 5.0; - Amount = amount; - } - - public CopperWire(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version < 1 && Weight == 2.0) - { - Weight = 5.0; - } - } - } - - public class WhiteDriedFlowers : Item - { - [Constructible] - public WhiteDriedFlowers(int amount = 1) : base(0xC3C) - { - Stackable = true; - Weight = 1.0; - Amount = amount; - } - - public WhiteDriedFlowers(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class GreenDriedFlowers : Item - { - [Constructible] - public GreenDriedFlowers(int amount = 1) : base(0xC3E) - { - Stackable = true; - Weight = 1.0; - Amount = amount; - } - - public GreenDriedFlowers(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class DriedOnions : Item - { - [Constructible] - public DriedOnions(int amount = 1) : base(0xC40) - { - Stackable = true; - Weight = 1.0; - Amount = amount; - } - - public DriedOnions(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class DriedHerbs : Item - { - [Constructible] - public DriedHerbs(int amount = 1) : base(0xC42) - { - Stackable = true; - Weight = 1.0; - Amount = amount; - } - - public DriedHerbs(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class HorseShoes : Item - { - [Constructible] - public HorseShoes() : base(0xFB6) => Weight = 3.0; - - public HorseShoes(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class ForgedMetal : Item - { - [Constructible] - public ForgedMetal() : base(0xFB8) => Weight = 5.0; - - public ForgedMetal(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class Whip : Item - { - [Constructible] - public Whip() : base(0x166E) => Weight = 1.0; - - public Whip(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class PaintsAndBrush : Item - { - [Constructible] - public PaintsAndBrush() : base(0xFC1) => Weight = 1.0; - - public PaintsAndBrush(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class PenAndInk : Item - { - [Constructible] - public PenAndInk() : base(0xFBF) => Weight = 1.0; - - public PenAndInk(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class ChiselsNorth : Item - { - [Constructible] - public ChiselsNorth() : base(0x1026) => Weight = 1.0; - - public ChiselsNorth(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class ChiselsWest : Item - { - [Constructible] - public ChiselsWest() : base(0x1027) => Weight = 1.0; - - public ChiselsWest(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtyPan : Item - { - [Constructible] - public DirtyPan() : base(0x9E8) => Weight = 1.0; - - public DirtyPan(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtySmallRoundPot : Item - { - [Constructible] - public DirtySmallRoundPot() : base(0x9E7) => Weight = 1.0; - - public DirtySmallRoundPot(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtyPot : Item - { - [Constructible] - public DirtyPot() : base(0x9E6) => Weight = 1.0; - - public DirtyPot(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtyRoundPot : Item - { - [Constructible] - public DirtyRoundPot() : base(0x9DF) => Weight = 1.0; - - public DirtyRoundPot(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtyFrypan : Item - { - [Constructible] - public DirtyFrypan() : base(0x9DE) => Weight = 1.0; - - public DirtyFrypan(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtySmallPot : Item - { - [Constructible] - public DirtySmallPot() : base(0x9DD) => Weight = 1.0; - - public DirtySmallPot(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } - } - - public class DirtyKettle : Item - { - [Constructible] - public DirtyKettle() : base(0x9DC) => Weight = 1.0; - - public DirtyKettle(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.WriteEncodedInt(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadEncodedInt(); - } + Stackable = true; + Weight = 1.0; + Amount = amount; } } + +[SerializationGenerator(0, false)] +public partial class IronWire : Item +{ + [Constructible] + public IronWire(int amount = 1) : base(0x1876) + { + Stackable = true; + Weight = 5.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class SilverWire : Item +{ + [Constructible] + public SilverWire(int amount = 1) : base(0x1877) + { + Stackable = true; + Weight = 5.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class GoldWire : Item +{ + [Constructible] + public GoldWire(int amount = 1) : base(0x1878) + { + Stackable = true; + Weight = 5.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class CopperWire : Item +{ + [Constructible] + public CopperWire(int amount = 1) : base(0x1879) + { + Stackable = true; + Weight = 5.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class WhiteDriedFlowers : Item +{ + [Constructible] + public WhiteDriedFlowers(int amount = 1) : base(0xC3C) + { + Stackable = true; + Weight = 1.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class GreenDriedFlowers : Item +{ + [Constructible] + public GreenDriedFlowers(int amount = 1) : base(0xC3E) + { + Stackable = true; + Weight = 1.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class DriedOnions : Item +{ + [Constructible] + public DriedOnions(int amount = 1) : base(0xC40) + { + Stackable = true; + Weight = 1.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class DriedHerbs : Item +{ + [Constructible] + public DriedHerbs(int amount = 1) : base(0xC42) + { + Stackable = true; + Weight = 1.0; + Amount = amount; + } +} + +[SerializationGenerator(0, false)] +public partial class HorseShoes : Item +{ + [Constructible] + public HorseShoes() : base(0xFB6) => Weight = 3.0; +} + +[SerializationGenerator(0, false)] +public partial class ForgedMetal : Item +{ + [Constructible] + public ForgedMetal() : base(0xFB8) => Weight = 5.0; +} + +[SerializationGenerator(0, false)] +public partial class Whip : Item +{ + [Constructible] + public Whip() : base(0x166E) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class PaintsAndBrush : Item +{ + [Constructible] + public PaintsAndBrush() : base(0xFC1) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class PenAndInk : Item +{ + [Constructible] + public PenAndInk() : base(0xFBF) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class ChiselsNorth : Item +{ + [Constructible] + public ChiselsNorth() : base(0x1026) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class ChiselsWest : Item +{ + [Constructible] + public ChiselsWest() : base(0x1027) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtyPan : Item +{ + [Constructible] + public DirtyPan() : base(0x9E8) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtySmallRoundPot : Item +{ + [Constructible] + public DirtySmallRoundPot() : base(0x9E7) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtyPot : Item +{ + [Constructible] + public DirtyPot() : base(0x9E6) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtyRoundPot : Item +{ + [Constructible] + public DirtyRoundPot() : base(0x9DF) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtyFrypan : Item +{ + [Constructible] + public DirtyFrypan() : base(0x9DE) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtySmallPot : Item +{ + [Constructible] + public DirtySmallPot() : base(0x9DD) => Weight = 1.0; +} + +[SerializationGenerator(0)] +public partial class DirtyKettle : Item +{ + [Constructible] + public DirtyKettle() : base(0x9DC) => Weight = 1.0; +} diff --git a/Projects/UOContent/Migrations/Server.Accounting.Account.v4.json b/Projects/UOContent/Migrations/Server.Accounting.Account.v4.json index 07d1336c7..6e1a07f13 100644 --- a/Projects/UOContent/Migrations/Server.Accounting.Account.v4.json +++ b/Projects/UOContent/Migrations/Server.Accounting.Account.v4.json @@ -74,7 +74,6 @@ "type": "System.Collections.Generic.List\u003CServer.Accounting.AccountComment\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Accounting.AccountComment", "SerializationMethodSignatureMigrationRule", "" @@ -85,7 +84,6 @@ "type": "System.Collections.Generic.List\u003CServer.Accounting.AccountTag\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Accounting.AccountTag", "SerializationMethodSignatureMigrationRule", "" diff --git a/Projects/UOContent/Migrations/Server.Items.Aquarium.v4.json b/Projects/UOContent/Migrations/Server.Items.Aquarium.v4.json index 142c61178..6154c8f57 100644 --- a/Projects/UOContent/Migrations/Server.Items.Aquarium.v4.json +++ b/Projects/UOContent/Migrations/Server.Items.Aquarium.v4.json @@ -47,7 +47,6 @@ "type": "System.Collections.Generic.List\u003Cint\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "int", "PrimitiveTypeMigrationRule", "" diff --git a/Projects/UOContent/Migrations/Server.Items.BaseAddon.v3.json b/Projects/UOContent/Migrations/Server.Items.BaseAddon.v3.json index edb8610a0..2d6bfd547 100644 --- a/Projects/UOContent/Migrations/Server.Items.BaseAddon.v3.json +++ b/Projects/UOContent/Migrations/Server.Items.BaseAddon.v3.json @@ -7,7 +7,6 @@ "type": "System.Collections.Generic.List\u003CServer.Items.AddonComponent\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Items.AddonComponent", "SerializableInterfaceMigrationRule" ] diff --git a/Projects/UOContent/Migrations/Server.Items.BaseAddonContainer.v2.json b/Projects/UOContent/Migrations/Server.Items.BaseAddonContainer.v2.json index 9a9c284b3..61264966d 100644 --- a/Projects/UOContent/Migrations/Server.Items.BaseAddonContainer.v2.json +++ b/Projects/UOContent/Migrations/Server.Items.BaseAddonContainer.v2.json @@ -7,7 +7,6 @@ "type": "System.Collections.Generic.List\u003CServer.Items.AddonContainerComponent\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Items.AddonContainerComponent", "SerializableInterfaceMigrationRule" ] diff --git a/Projects/UOContent/Migrations/Server.Items.BasePlayerBB.v0.json b/Projects/UOContent/Migrations/Server.Items.BasePlayerBB.v0.json new file mode 100644 index 000000000..2d19ebd1a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.BasePlayerBB.v0.json @@ -0,0 +1,38 @@ +{ + "version": 0, + "type": "Server.Items.BasePlayerBB", + "properties": [ + { + "name": "Level", + "type": "Server.Multis.SecureLevel", + "rule": "EnumMigrationRule" + }, + { + "name": "Title", + "type": "string", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "Greeting", + "type": "Server.Items.PlayerBBMessage", + "rule": "RawSerializableMigrationRule", + "ruleArguments": [ + "", + "@CanBeNull" + ] + }, + { + "name": "Messages", + "type": "System.Collections.Generic.List\u003CServer.Items.PlayerBBMessage\u003E", + "rule": "ListMigrationRule", + "ruleArguments": [ + "Server.Items.PlayerBBMessage", + "RawSerializableMigrationRule", + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.BroadcastCrystal.v1.json b/Projects/UOContent/Migrations/Server.Items.BroadcastCrystal.v1.json index 17c55d0f8..1e278121e 100644 --- a/Projects/UOContent/Migrations/Server.Items.BroadcastCrystal.v1.json +++ b/Projects/UOContent/Migrations/Server.Items.BroadcastCrystal.v1.json @@ -15,7 +15,6 @@ "type": "System.Collections.Generic.List\u003CServer.Items.ReceiverCrystal\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Items.ReceiverCrystal", "SerializableInterfaceMigrationRule" ] diff --git a/Projects/UOContent/Migrations/Server.Items.ChiselsNorth.v0.json b/Projects/UOContent/Migrations/Server.Items.ChiselsNorth.v0.json new file mode 100644 index 000000000..b07e59d44 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ChiselsNorth.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ChiselsNorth" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ChiselsWest.v0.json b/Projects/UOContent/Migrations/Server.Items.ChiselsWest.v0.json new file mode 100644 index 000000000..7a29f366b --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ChiselsWest.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ChiselsWest" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ContractOfEmployment.v0.json b/Projects/UOContent/Migrations/Server.Items.ContractOfEmployment.v0.json new file mode 100644 index 000000000..eda5e4aff --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ContractOfEmployment.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ContractOfEmployment" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.CopperWire.v0.json b/Projects/UOContent/Migrations/Server.Items.CopperWire.v0.json new file mode 100644 index 000000000..0923c98ea --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.CopperWire.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.CopperWire" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtyFrypan.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtyFrypan.v0.json new file mode 100644 index 000000000..7e59330e9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtyFrypan.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtyFrypan" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtyKettle.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtyKettle.v0.json new file mode 100644 index 000000000..727f0bb5c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtyKettle.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtyKettle" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtyPan.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtyPan.v0.json new file mode 100644 index 000000000..15b0ad45b --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtyPan.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtyPan" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtyPot.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtyPot.v0.json new file mode 100644 index 000000000..1a6c0183a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtyPot.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtyPot" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtyRoundPot.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtyRoundPot.v0.json new file mode 100644 index 000000000..39ddfce4e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtyRoundPot.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtyRoundPot" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtySmallPot.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtySmallPot.v0.json new file mode 100644 index 000000000..96a200c03 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtySmallPot.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtySmallPot" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DirtySmallRoundPot.v0.json b/Projects/UOContent/Migrations/Server.Items.DirtySmallRoundPot.v0.json new file mode 100644 index 000000000..55b06157a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DirtySmallRoundPot.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DirtySmallRoundPot" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DriedHerbs.v0.json b/Projects/UOContent/Migrations/Server.Items.DriedHerbs.v0.json new file mode 100644 index 000000000..69c9120dc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DriedHerbs.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DriedHerbs" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DriedOnions.v0.json b/Projects/UOContent/Migrations/Server.Items.DriedOnions.v0.json new file mode 100644 index 000000000..299b966a9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DriedOnions.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DriedOnions" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ForgedMetal.v0.json b/Projects/UOContent/Migrations/Server.Items.ForgedMetal.v0.json new file mode 100644 index 000000000..a04e9cc79 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ForgedMetal.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ForgedMetal" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Gold.v0.json b/Projects/UOContent/Migrations/Server.Items.Gold.v0.json new file mode 100644 index 000000000..71429b084 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Gold.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Gold" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.GoldWire.v0.json b/Projects/UOContent/Migrations/Server.Items.GoldWire.v0.json new file mode 100644 index 000000000..3c4050e1a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.GoldWire.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.GoldWire" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.GreenDriedFlowers.v0.json b/Projects/UOContent/Migrations/Server.Items.GreenDriedFlowers.v0.json new file mode 100644 index 000000000..e60fac09c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.GreenDriedFlowers.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.GreenDriedFlowers" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Guillotine.v0.json b/Projects/UOContent/Migrations/Server.Items.Guillotine.v0.json new file mode 100644 index 000000000..e8e6a0f2e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Guillotine.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Guillotine" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.HairDye.v0.json b/Projects/UOContent/Migrations/Server.Items.HairDye.v0.json new file mode 100644 index 000000000..17c795d53 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.HairDye.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.HairDye" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.HorseShoes.v0.json b/Projects/UOContent/Migrations/Server.Items.HorseShoes.v0.json new file mode 100644 index 000000000..5499cd74d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.HorseShoes.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.HorseShoes" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.HoveringWisp.v0.json b/Projects/UOContent/Migrations/Server.Items.HoveringWisp.v0.json new file mode 100644 index 000000000..95c2cdafa --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.HoveringWisp.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.HoveringWisp" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.InteriorDecorator.v0.json b/Projects/UOContent/Migrations/Server.Items.InteriorDecorator.v0.json new file mode 100644 index 000000000..31ad82991 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.InteriorDecorator.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.InteriorDecorator" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.IronWire.v0.json b/Projects/UOContent/Migrations/Server.Items.IronWire.v0.json new file mode 100644 index 000000000..15cc02c96 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.IronWire.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.IronWire" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Key.v0.json b/Projects/UOContent/Migrations/Server.Items.Key.v0.json new file mode 100644 index 000000000..768782a54 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Key.v0.json @@ -0,0 +1,35 @@ +{ + "version": 0, + "type": "Server.Items.Key", + "properties": [ + { + "name": "MaxRange", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "Link", + "type": "Server.Item", + "rule": "SerializableInterfaceMigrationRule" + }, + { + "name": "Description", + "type": "string", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "KeyValue", + "type": "uint", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.KeyRing.v1.json b/Projects/UOContent/Migrations/Server.Items.KeyRing.v1.json new file mode 100644 index 000000000..17a112d6c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.KeyRing.v1.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "type": "Server.Items.KeyRing", + "properties": [ + { + "name": "Keys", + "type": "System.Collections.Generic.List\u003CServer.Items.Key\u003E", + "rule": "ListMigrationRule", + "ruleArguments": [ + "Server.Items.Key", + "SerializableInterfaceMigrationRule" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.LOSBlocker.v0.json b/Projects/UOContent/Migrations/Server.Items.LOSBlocker.v0.json new file mode 100644 index 000000000..516f57380 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.LOSBlocker.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.LOSBlocker" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MapItem.v1.json b/Projects/UOContent/Migrations/Server.Items.MapItem.v1.json index da0beae9b..21e28987f 100644 --- a/Projects/UOContent/Migrations/Server.Items.MapItem.v1.json +++ b/Projects/UOContent/Migrations/Server.Items.MapItem.v1.json @@ -39,7 +39,6 @@ "type": "System.Collections.Generic.List\u003CServer.Point2D\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Point2D", "PrimitiveUOTypeMigrationRule", "Point2D" diff --git a/Projects/UOContent/Migrations/Server.Items.Moonstone.v1.json b/Projects/UOContent/Migrations/Server.Items.Moonstone.v1.json new file mode 100644 index 000000000..4f10c3596 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Moonstone.v1.json @@ -0,0 +1,11 @@ +{ + "version": 1, + "type": "Server.Items.Moonstone", + "properties": [ + { + "name": "Type", + "type": "Server.Items.MoonstoneType", + "rule": "EnumMigrationRule" + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MoonstoneGate.v0.json b/Projects/UOContent/Migrations/Server.Items.MoonstoneGate.v0.json new file mode 100644 index 000000000..c3a87c5e3 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MoonstoneGate.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.MoonstoneGate" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.MorphItem.v0.json b/Projects/UOContent/Migrations/Server.Items.MorphItem.v0.json new file mode 100644 index 000000000..d363c0b3c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.MorphItem.v0.json @@ -0,0 +1,38 @@ +{ + "version": 0, + "type": "Server.Items.MorphItem", + "properties": [ + { + "name": "OutsideRange", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "InactiveItemId", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "ActiveItemId", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "InsideRange", + "type": "int", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OilCloth.v0.json b/Projects/UOContent/Migrations/Server.Items.OilCloth.v0.json new file mode 100644 index 000000000..ed7ccb2b8 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OilCloth.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OilCloth" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiButterfly.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiButterfly.v0.json new file mode 100644 index 000000000..41cf61acb --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiButterfly.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiButterfly" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiFish.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiFish.v0.json new file mode 100644 index 000000000..4a81d66a1 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiFish.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiFish" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiFrog.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiFrog.v0.json new file mode 100644 index 000000000..ef34951d8 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiFrog.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiFrog" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiPaper.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiPaper.v0.json new file mode 100644 index 000000000..a28036806 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiPaper.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiPaper" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiShape.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiShape.v0.json new file mode 100644 index 000000000..7480f71e6 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiShape.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiShape" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiSongbird.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiSongbird.v0.json new file mode 100644 index 000000000..ec8f97e4a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiSongbird.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiSongbird" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.OrigamiSwan.v0.json b/Projects/UOContent/Migrations/Server.Items.OrigamiSwan.v0.json new file mode 100644 index 000000000..3e33423ae --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.OrigamiSwan.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.OrigamiSwan" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PaintsAndBrush.v0.json b/Projects/UOContent/Migrations/Server.Items.PaintsAndBrush.v0.json new file mode 100644 index 000000000..224f3a957 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PaintsAndBrush.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PaintsAndBrush" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PenAndInk.v0.json b/Projects/UOContent/Migrations/Server.Items.PenAndInk.v0.json new file mode 100644 index 000000000..9baf91c97 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PenAndInk.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PenAndInk" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PlayerBBEast.v0.json b/Projects/UOContent/Migrations/Server.Items.PlayerBBEast.v0.json new file mode 100644 index 000000000..ee3a78a79 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PlayerBBEast.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PlayerBBEast" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PlayerBBMessage.v0.json b/Projects/UOContent/Migrations/Server.Items.PlayerBBMessage.v0.json new file mode 100644 index 000000000..a71c3940d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PlayerBBMessage.v0.json @@ -0,0 +1,27 @@ +{ + "version": 0, + "type": "Server.Items.PlayerBBMessage", + "properties": [ + { + "name": "Time", + "type": "System.DateTime", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + }, + { + "name": "Poster", + "type": "Server.Mobile", + "rule": "SerializableInterfaceMigrationRule" + }, + { + "name": "Message", + "type": "string", + "rule": "PrimitiveTypeMigrationRule", + "ruleArguments": [ + "" + ] + } + ] +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PlayerBBSouth.v0.json b/Projects/UOContent/Migrations/Server.Items.PlayerBBSouth.v0.json new file mode 100644 index 000000000..ada62dbcf --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PlayerBBSouth.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PlayerBBSouth" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PowerCrystal.v0.json b/Projects/UOContent/Migrations/Server.Items.PowerCrystal.v0.json new file mode 100644 index 000000000..1fc508e99 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PowerCrystal.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PowerCrystal" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PromotionalToken.v0.json b/Projects/UOContent/Migrations/Server.Items.PromotionalToken.v0.json new file mode 100644 index 000000000..4fd158eb6 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PromotionalToken.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PromotionalToken" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.PublicMoongate.v0.json b/Projects/UOContent/Migrations/Server.Items.PublicMoongate.v0.json new file mode 100644 index 000000000..c1ddd2fa0 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.PublicMoongate.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.PublicMoongate" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Rope.v0.json b/Projects/UOContent/Migrations/Server.Items.Rope.v0.json new file mode 100644 index 000000000..dc3d1fe38 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Rope.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Rope" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SilverWire.v0.json b/Projects/UOContent/Migrations/Server.Items.SilverWire.v0.json new file mode 100644 index 000000000..155523bd5 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SilverWire.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SilverWire" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SolenAntHole.v1.json b/Projects/UOContent/Migrations/Server.Items.SolenAntHole.v1.json index 5517c0a7c..661c52db2 100644 --- a/Projects/UOContent/Migrations/Server.Items.SolenAntHole.v1.json +++ b/Projects/UOContent/Migrations/Server.Items.SolenAntHole.v1.json @@ -7,7 +7,6 @@ "type": "System.Collections.Generic.List\u003CServer.Mobile\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Mobile", "SerializableInterfaceMigrationRule" ] diff --git a/Projects/UOContent/Migrations/Server.Items.SoulstoneFragmentToken.v0.json b/Projects/UOContent/Migrations/Server.Items.SoulstoneFragmentToken.v0.json new file mode 100644 index 000000000..2e1665189 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SoulstoneFragmentToken.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SoulstoneFragmentToken" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.TreasureMapChest.v2.json b/Projects/UOContent/Migrations/Server.Items.TreasureMapChest.v2.json index 9bf36d71a..6510e836b 100644 --- a/Projects/UOContent/Migrations/Server.Items.TreasureMapChest.v2.json +++ b/Projects/UOContent/Migrations/Server.Items.TreasureMapChest.v2.json @@ -7,7 +7,6 @@ "type": "System.Collections.Generic.List\u003CServer.Mobile\u003E", "rule": "ListMigrationRule", "ruleArguments": [ - "", "Server.Mobile", "SerializableInterfaceMigrationRule" ] diff --git a/Projects/UOContent/Migrations/Server.Items.Whip.v0.json b/Projects/UOContent/Migrations/Server.Items.Whip.v0.json new file mode 100644 index 000000000..f6b60771e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Whip.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Whip" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.WhiteDriedFlowers.v0.json b/Projects/UOContent/Migrations/Server.Items.WhiteDriedFlowers.v0.json new file mode 100644 index 000000000..2e7936fa4 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.WhiteDriedFlowers.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.WhiteDriedFlowers" +} \ No newline at end of file