diff --git a/Projects/UOContent/Engines/ConPVP/DuelContext.cs b/Projects/UOContent/Engines/ConPVP/DuelContext.cs index d538c061a..fac77dace 100644 --- a/Projects/UOContent/Engines/ConPVP/DuelContext.cs +++ b/Projects/UOContent/Engines/ConPVP/DuelContext.cs @@ -1854,11 +1854,7 @@ namespace Server.Engines.ConPVP TransformationSpellHelper.RemoveContext(mob, true); AnimalForm.RemoveContext(mob, true); - - if (DisguiseTimers.IsDisguised(mob)) - { - DisguiseTimers.StopTimer(mob); - } + DisguisePersistence.StopTimer(mob); if (!mob.CanBeginAction()) { diff --git a/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs b/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs index 17334bb53..e1b470b49 100644 --- a/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs +++ b/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using ModernUO.Serialization; using Server.Gumps; using Server.Items; using Server.Mobiles; @@ -167,9 +168,10 @@ namespace Server.Engines.MLQuests.Gumps { from.SendLocalizedMessage(1073647); // You may not continue while mounted... } - else if (!from.CanBeginAction() || DisguiseTimers.IsDisguised(from) || + // TODO: Does this cover everything? + else if (!from.CanBeginAction() || DisguisePersistence.IsDisguised(from) || AnimalForm.UnderTransformation(from) || !from.CanBeginAction() || - from.IsBodyMod) // TODO: Does this cover everything? + from.IsBodyMod) { from.SendLocalizedMessage(1073648); // You may only proceed while in your original state... } @@ -284,17 +286,11 @@ namespace Server.Engines.MLQuests.Gumps } } - public class RaceChangeDeed : Item, IRaceChanger + [SerializationGenerator(0, false)] + public partial class RaceChangeDeed : Item, IRaceChanger { [Constructible] - public RaceChangeDeed() - : base(0x14F0) => - LootType = LootType.Blessed; - - public RaceChangeDeed(Serial serial) - : base(serial) - { - } + public RaceChangeDeed() : base(0x14F0) => LootType = LootType.Blessed; public override string DefaultName => "a race change deed"; @@ -335,19 +331,5 @@ namespace Server.Engines.MLQuests.Gumps pm.SendGump(new RaceChangeConfirmGump(this, pm, pm.Race == Race.Human ? Race.Elf : Race.Human)); } } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dressform.cs b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dressform.cs index 91e7b1a71..a4b77facb 100644 --- a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dressform.cs +++ b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dressform.cs @@ -1,27 +1,11 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0xec6, 0xec7)] +[SerializationGenerator(0, false)] +public partial class Dressform : Item { - [Flippable(0xec6, 0xec7)] - public class Dressform : Item - { - [Constructible] - public Dressform() : base(0xec6) => Weight = 10; - - public Dressform(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(); - } - } + [Constructible] + public Dressform() : base(0xec6) => Weight = 10; } diff --git a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dyes.cs b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dyes.cs index ed601f36e..107331e7d 100644 --- a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dyes.cs +++ b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Dyes.cs @@ -1,110 +1,77 @@ +using ModernUO.Serialization; using Server.HuePickers; using Server.Targeting; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class Dyes : Item { - public class Dyes : Item /* , IUsesRemaining */ /* TODO complete usesremaing */ + // TODO: Add uses remaining + + [Constructible] + public Dyes() : base(0xFA9) => Weight = 3.0; + + public override void OnDoubleClick(Mobile from) { - /* - public bool ShowUsesRemaining { get { return false; } set { } } + from.SendLocalizedMessage(500856); // Select the dye tub to use the dyes on. + from.Target = new InternalTarget(); + } - [CommandProperty( AccessLevel.GameMaster )] - public virtual int UsesRemaining { get { return m_UsesRemaining; } set { m_UsesRemaining = value; } } - - private int m_UsesRemaining; - */ - - [Constructible] - public Dyes() : base(0xFA9) => Weight = 3.0; - - public Dyes(Serial serial) : base(serial) + private class InternalTarget : Target + { + public InternalTarget() : base(1, false, TargetFlags.None) { } - public override void Serialize(IGenericWriter writer) + public virtual void SetTubHue(Mobile from, DyeTub tub, int hue) { - base.Serialize(writer); - - writer.Write(1); // version - - /* writer.Write( ( int )m_UsesRemaining ); */ + tub.DyedHue = hue; } - public override void Deserialize(IGenericReader reader) + protected override void OnTarget(Mobile from, object targeted) { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (Weight == 0.0) + if (targeted is DyeTub tub) { - Weight = 3.0; - } - - /* m_UsesRemaining = ( version == 0 ) ? 25 : reader.ReadInt(); */ - } - - public override void OnDoubleClick(Mobile from) - { - from.SendLocalizedMessage(500856); // Select the dye tub to use the dyes on. - from.Target = new InternalTarget(); - } - - private class InternalTarget : Target - { - public InternalTarget() : base(1, false, TargetFlags.None) - { - } - - public virtual void SetTubHue(Mobile from, DyeTub tub, int hue) - { - tub.DyedHue = hue; - } - - protected override void OnTarget(Mobile from, object targeted) - { - if (targeted is DyeTub tub) + if (tub.Redyable) { - if (tub.Redyable) + if (tub.MetallicHues) /* OSI has three metallic tubs now */ { - if (tub.MetallicHues) /* OSI has three metallic tubs now */ - { - from.SendGump(new MetallicHuePicker(from, SetTubHue, tub)); - } - else if (tub.CustomHuePicker != null) - { - from.SendGump(new CustomHuePickerGump(from, tub.CustomHuePicker, SetTubHue, tub)); - } - else - { - from.SendHuePicker(new InternalPicker(tub)); - } + from.SendGump(new MetallicHuePicker(from, SetTubHue, tub)); } - else if (tub is BlackDyeTub) + else if (tub.CustomHuePicker != null) { - from.SendLocalizedMessage(1010092); // You can not use this on a black dye tub. + from.SendGump(new CustomHuePickerGump(from, tub.CustomHuePicker, SetTubHue, tub)); } else { - from.SendMessage("That dye tub may not be redyed."); + from.SendHuePicker(new InternalPicker(tub)); } } + else if (tub is BlackDyeTub) + { + from.SendLocalizedMessage(1010092); // You can not use this on a black dye tub. + } else { - from.SendLocalizedMessage(500857); // Use this on a dye tub. + from.SendMessage("That dye tub may not be redyed."); } } - - private class InternalPicker : HuePicker + else { - private readonly DyeTub m_Tub; + from.SendLocalizedMessage(500857); // Use this on a dye tub. + } + } - public InternalPicker(DyeTub tub) : base(tub.ItemID) => m_Tub = tub; + private class InternalPicker : HuePicker + { + private readonly DyeTub m_Tub; - public override void OnResponse(int hue) - { - m_Tub.DyedHue = hue; - } + public InternalPicker(DyeTub tub) : base(tub.ItemID) => m_Tub = tub; + + public override void OnResponse(int hue) + { + m_Tub.DyedHue = hue; } } } diff --git a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs index 044d2b9a2..8880cdc60 100644 --- a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs +++ b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs @@ -1,123 +1,98 @@ +using ModernUO.Serialization; using Server.Targeting; -namespace Server.Items +namespace Server.Items; + +public interface IScissorable { - public interface IScissorable + bool Scissor(Mobile from, Scissors scissors); +} + +[Flippable(0xf9f, 0xf9e)] +[SerializationGenerator(0, false)] +public partial class Scissors : Item +{ + [Constructible] + public Scissors() : base(0xF9F) => Weight = 1.0; + + public override void OnDoubleClick(Mobile from) { - bool Scissor(Mobile from, Scissors scissors); + from.SendLocalizedMessage(502434); // What should I use these scissors on? + + from.Target = new InternalTarget(this); } - [Flippable(0xf9f, 0xf9e)] - public class Scissors : Item + public static bool CanScissor(Mobile from, IScissorable obj) { - [Constructible] - public Scissors() : base(0xF9F) => Weight = 1.0; - - public Scissors(Serial serial) : base(serial) + if (obj is Item item && item.Nontransferable) { + from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. + return false; } - public override void Serialize(IGenericWriter writer) + // TODO: Move other general checks from the different implementations here + + return true; + } + + private class InternalTarget : Target + { + private readonly Scissors m_Item; + + public InternalTarget(Scissors item) : base(2, false, TargetFlags.None) => m_Item = item; + + protected override void OnTarget(Mobile from, object targeted) { - base.Serialize(writer); + if (m_Item.Deleted) + { + return; + } - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - public override void OnDoubleClick(Mobile from) - { - from.SendLocalizedMessage(502434); // What should I use these scissors on? - - from.Target = new InternalTarget(this); - } - - public static bool CanScissor(Mobile from, IScissorable obj) - { - if (obj is Item item && item.Nontransferable) + if (Core.AOS && targeted == from) + { + // "That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!" + from.SendLocalizedMessage(1062845 + Utility.Random(3)); + } + else if (Core.SE && Utility.RandomDouble() < 0.80 && (from.Direction & Direction.Running) != 0 && + Core.TickCount - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction)) + { + // Didn't your parents ever tell you not to run with scissors in your hand?! + from.SendLocalizedMessage(1063305); + } + else if (targeted is Item item && !item.Movable) + { + if (item is IScissorable obj && obj is PlagueBeastInnard or PlagueBeastMutationCore) + { + if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) + { + from.PlaySound(0x248); + } + } + } + else if (targeted is IScissorable obj) + { + if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) + { + from.PlaySound(0x248); + } + } + else { from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. - return false; } - - // TODO: Move other general checks from the different implementations here - - return true; } - private class InternalTarget : Target + protected override void OnNonlocalTarget(Mobile from, object targeted) { - private readonly Scissors m_Item; - - public InternalTarget(Scissors item) : base(2, false, TargetFlags.None) => m_Item = item; - - protected override void OnTarget(Mobile from, object targeted) + if (targeted is not (IScissorable obj and (PlagueBeastInnard or PlagueBeastMutationCore))) { - if (m_Item.Deleted) - { - return; - } - - /*if (targeted is Item && !((Item)targeted).IsStandardLoot()) - { - from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything. - } - else */ - if (Core.AOS && targeted == from) - { - from.SendLocalizedMessage( - 1062845 + Utility - .Random(3) - ); // "That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!" - } - else if (Core.SE && Utility.RandomDouble() < 0.80 && (from.Direction & Direction.Running) != 0 && - Core.TickCount - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction)) - { - // Didn't your parents ever tell you not to run with scissors in your hand?! - from.SendLocalizedMessage(1063305); - } - else if (targeted is Item item && !item.Movable) - { - if (item is IScissorable obj && obj is PlagueBeastInnard or PlagueBeastMutationCore) - { - if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) - { - from.PlaySound(0x248); - } - } - } - else if (targeted is IScissorable obj) - { - if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) - { - from.PlaySound(0x248); - } - } - else - { - from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything. - } + base.OnNonlocalTarget(from, targeted); + return; } - protected override void OnNonlocalTarget(Mobile from, object targeted) + if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) { - if (targeted is IScissorable obj && obj is PlagueBeastInnard or PlagueBeastMutationCore) - { - if (CanScissor(from, obj) && obj.Scissor(from, m_Item)) - { - from.PlaySound(0x248); - } - } - else - { - base.OnNonlocalTarget(from, targeted); - } + from.PlaySound(0x248); } } } diff --git a/Projects/UOContent/Items/Skill Items/Thief/DisguiseKit.cs b/Projects/UOContent/Items/Skill Items/Thief/DisguiseKit.cs index ff86719d6..131179120 100644 --- a/Projects/UOContent/Items/Skill Items/Thief/DisguiseKit.cs +++ b/Projects/UOContent/Items/Skill Items/Thief/DisguiseKit.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using ModernUO.Serialization; using Server.Factions; using Server.Gumps; using Server.Mobiles; @@ -9,347 +10,257 @@ using Server.Spells; using Server.Spells.Fifth; using Server.Spells.Seventh; -namespace Server.Items +namespace Server.Items; + +[SerializationGenerator(0, false)] +public partial class DisguiseKit : Item { - public class DisguiseKit : Item + [Constructible] + public DisguiseKit() : base(0xE05) => Weight = 1.0; + + public bool ValidateUse(Mobile from) { - [Constructible] - public DisguiseKit() : base(0xE05) => Weight = 1.0; + var pm = from as PlayerMobile; - public DisguiseKit(Serial serial) : base(serial) + if (!IsChildOf(from.Backpack)) { + from.SendLocalizedMessage(1042001); + } + else if (pm?.NpcGuild != NpcGuild.ThievesGuild) + { + from.SendLocalizedMessage(501702); + } + else if (Stealing.SuspendOnMurder && pm.Kills > 0) + { + from.SendLocalizedMessage(501703); + } + else if (!from.CanBeginAction()) + { + from.SendLocalizedMessage(501704); + } + else if (Sigil.ExistsOn(from)) + { + from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil + } + else if (TransformationSpellHelper.UnderTransformation(from)) + { + from.SendLocalizedMessage(1061634); + } + else if (from.BodyMod == 183 || from.BodyMod == 184) + { + from.SendLocalizedMessage(1040002); + } + else if (!from.CanBeginAction() || from.IsBodyMod) + { + from.SendLocalizedMessage(501705); + } + else + { + return true; } - public override int LabelNumber => 1041078; // a disguise kit - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - - public bool ValidateUse(Mobile from) - { - var pm = from as PlayerMobile; - - if (!IsChildOf(from.Backpack)) - { - from.SendLocalizedMessage(1042001); - } - else if (pm?.NpcGuild != NpcGuild.ThievesGuild) - { - from.SendLocalizedMessage(501702); - } - else if (Stealing.SuspendOnMurder && pm.Kills > 0) - { - from.SendLocalizedMessage(501703); - } - else if (!from.CanBeginAction()) - { - from.SendLocalizedMessage(501704); - } - else if (Sigil.ExistsOn(from)) - { - from.SendLocalizedMessage(1010465); // You cannot disguise yourself while holding a sigil - } - else if (TransformationSpellHelper.UnderTransformation(from)) - { - from.SendLocalizedMessage(1061634); - } - else if (from.BodyMod == 183 || from.BodyMod == 184) - { - from.SendLocalizedMessage(1040002); - } - else if (!from.CanBeginAction() || from.IsBodyMod) - { - from.SendLocalizedMessage(501705); - } - else - { - return true; - } - - return false; - } - - public override void OnDoubleClick(Mobile from) - { - if (ValidateUse(from)) - { - from.SendGump(new DisguiseGump(from, this, true, false)); - } - } + return false; } - public class DisguiseGump : Gump + public override void OnDoubleClick(Mobile from) { - private static readonly DisguiseEntry[] m_HairEntries = + if (ValidateUse(from)) { - new(8251, 50700, 0, 5, 1011052), // Short - new(8261, 60710, 0, 3, 1011047), // Pageboy - new(8252, 60708, 0, -5, 1011053), // Long - new(8264, 60901, 0, 5, 1011048), // Receding - new(8253, 60702, 0, -5, 1011054), // Ponytail - new(8265, 60707, 0, -5, 1011049), // 2-tails - new(8260, 50703, 0, 5, 1011055), // Mohawk - new(8266, 60713, 0, 10, 1011050), // Topknot - null, - new(0, 0, 0, 0, 1011051) // None - }; - - private static readonly DisguiseEntry[] m_BeardEntries = - { - new(8269, 50906, 0, 0, 1011401), // Vandyke - new(8257, 50808, 0, -2, 1011062), // Mustache - new(8255, 50802, 0, 0, 1011060), // Short beard - new(8268, 50905, 0, -10, 1011061), // Long beard - new(8267, 50904, 0, 0, 1011060), // Short beard - new(8254, 50801, 0, -10, 1011061), // Long beard - null, - new(0, 0, 0, 0, 1011051) // None - }; - - private readonly Mobile m_From; - private readonly DisguiseKit m_Kit; - private readonly bool m_Used; - - public DisguiseGump(Mobile from, DisguiseKit kit, bool startAtHair, bool used) : base(50, 50) - { - m_From = from; - m_Kit = kit; - m_Used = used; - - from.CloseGump(); - - AddPage(0); - - AddBackground(100, 10, 400, 385, 2600); - - //
THIEF DISGUISE KIT
- AddHtmlLocalized(100, 25, 400, 35, 1011045); - - AddButton(140, 353, 4005, 4007, 0); - AddHtmlLocalized(172, 355, 90, 35, 1011036); // OKAY - - AddButton(257, 353, 4005, 4007, 1); - AddHtmlLocalized(289, 355, 90, 35, 1011046); // APPLY - - if (from.Female || from.Body.IsFemale) - { - DrawEntries(0, 1, -1, m_HairEntries, -1); - } - else if (startAtHair) - { - DrawEntries(0, 1, 2, m_HairEntries, 1011056); - DrawEntries(1, 2, 1, m_BeardEntries, 1011059); - } - else - { - DrawEntries(1, 1, 2, m_BeardEntries, 1011059); - DrawEntries(0, 2, 1, m_HairEntries, 1011056); - } - } - - private void DrawEntries(int index, int page, int nextPage, DisguiseEntry[] entries, int nextNumber) - { - AddPage(page); - - if (nextPage != -1) - { - AddButton(155, 320, 250 + index * 2, 251 + index * 2, 0, GumpButtonType.Page, nextPage); - AddHtmlLocalized(180, 320, 150, 35, nextNumber); - } - - for (var i = 0; i < entries.Length; ++i) - { - var entry = entries[i]; - - if (entry == null) - { - continue; - } - - var x = i % 2 * 205; - var y = i / 2 * 55; - - if (entry.m_GumpID != 0) - { - AddBackground(220 + x, 60 + y, 50, 50, 2620); - AddImage(153 + x + entry.m_OffsetX, 15 + y + entry.m_OffsetY, entry.m_GumpID); - } - - AddHtmlLocalized(140 + x, 72 + y, 80, 35, entry.m_Number); - AddRadio(118 + x, 73 + y, 208, 209, false, i * 2 + index); - } - } - - public override void OnResponse(NetState sender, RelayInfo info) - { - if (info.ButtonID == 0) - { - if (m_Used) - { - m_From.SendLocalizedMessage(501706); // Disguises wear off after 2 hours. - } - else - { - m_From.SendLocalizedMessage(501707); // You're looking good. - } - - return; - } - - var switches = info.Switches; - - if (switches.Length == 0) - { - return; - } - - var switched = switches[0]; - var type = switched % 2; - var index = switched / 2; - - var hair = type == 0; - - var entries = hair ? m_HairEntries : m_BeardEntries; - - if (index >= 0 && index < entries.Length) - { - var entry = entries[index]; - - if (entry == null) - { - return; - } - - if (!m_Kit.ValidateUse(m_From)) - { - return; - } - - if (!hair && (m_From.Female || m_From.Body.IsFemale)) - { - return; - } - - m_From.NameMod = NameList.RandomName(m_From.Female ? "female" : "male"); - - if (m_From is PlayerMobile pm) - { - if (hair) - { - pm.SetHairMods(entry.m_ItemID, -2); - } - else - { - pm.SetHairMods(-2, entry.m_ItemID); - } - } - - m_From.SendGump(new DisguiseGump(m_From, m_Kit, hair, true)); - - DisguiseTimers.RemoveTimer(m_From); - - DisguiseTimers.CreateTimer(m_From, TimeSpan.FromHours(2.0)); - DisguiseTimers.StartTimer(m_From); - } - } - - private class DisguiseEntry - { - public readonly int m_GumpID; - public readonly int m_ItemID; - public readonly int m_Number; - public readonly int m_OffsetX; - public readonly int m_OffsetY; - - public DisguiseEntry(int itemID, int gumpID, int ox, int oy, int name) - { - m_ItemID = itemID; - m_GumpID = gumpID; - m_OffsetX = ox; - m_OffsetY = oy; - m_Number = name; - } - } - } - - public static class DisguiseTimers - { - public static Dictionary Timers { get; } = new(); - - public static void Initialize() - { - new DisguisePersistance(); - } - - public static void CreateTimer(Mobile m, TimeSpan delay) - { - if (m != null && !IsDisguised(m)) - { - Timers[m] = new InternalTimer(m, delay); - } - } - - public static void StartTimer(Mobile m) - { - Timers.TryGetValue(m, out var t); - t?.Start(); - } - - public static bool IsDisguised(Mobile m) => Timers.ContainsKey(m); - - public static void StopTimer(Mobile m) - { - if (!Timers.TryGetValue(m, out var t)) - { - return; - } - - t.Delay = Utility.Max(t.Next - Core.Now, TimeSpan.Zero); - t.Stop(); - } - - public static void RemoveTimer(Mobile m) - { - if (Timers.Remove(m, out var t)) - { - t.Stop(); - } - } - - public static TimeSpan TimeRemaining(Mobile m) => - Timers.TryGetValue(m, out var t) ? t.Next - Core.Now : TimeSpan.Zero; - - private class InternalTimer : Timer - { - private readonly Mobile m_Player; - - public InternalTimer(Mobile m, TimeSpan delay) : base(delay) - { - m_Player = m; - } - - protected override void OnTick() - { - m_Player.NameMod = null; - - if (m_Player is PlayerMobile mobile) - { - mobile.SetHairMods(-1, -1); - } - - RemoveTimer(m_Player); - } + from.SendGump(new DisguiseGump(from, this, true, false)); + } + } +} + +public class DisguiseGump : Gump +{ + private static readonly DisguiseEntry[] m_HairEntries = + { + new(8251, 50700, 0, 5, 1011052), // Short + new(8261, 60710, 0, 3, 1011047), // Pageboy + new(8252, 60708, 0, -5, 1011053), // Long + new(8264, 60901, 0, 5, 1011048), // Receding + new(8253, 60702, 0, -5, 1011054), // Ponytail + new(8265, 60707, 0, -5, 1011049), // 2-tails + new(8260, 50703, 0, 5, 1011055), // Mohawk + new(8266, 60713, 0, 10, 1011050), // Topknot + null, + new(0, 0, 0, 0, 1011051) // None + }; + + private static readonly DisguiseEntry[] m_BeardEntries = + { + new(8269, 50906, 0, 0, 1011401), // Vandyke + new(8257, 50808, 0, -2, 1011062), // Mustache + new(8255, 50802, 0, 0, 1011060), // Short beard + new(8268, 50905, 0, -10, 1011061), // Long beard + new(8267, 50904, 0, 0, 1011060), // Short beard + new(8254, 50801, 0, -10, 1011061), // Long beard + null, + new(0, 0, 0, 0, 1011051) // None + }; + + private readonly Mobile m_From; + private readonly DisguiseKit m_Kit; + private readonly bool m_Used; + + public DisguiseGump(Mobile from, DisguiseKit kit, bool startAtHair, bool used) : base(50, 50) + { + m_From = from; + m_Kit = kit; + m_Used = used; + + from.CloseGump(); + + AddPage(0); + + AddBackground(100, 10, 400, 385, 2600); + + //
THIEF DISGUISE KIT
+ AddHtmlLocalized(100, 25, 400, 35, 1011045); + + AddButton(140, 353, 4005, 4007, 0); + AddHtmlLocalized(172, 355, 90, 35, 1011036); // OKAY + + AddButton(257, 353, 4005, 4007, 1); + AddHtmlLocalized(289, 355, 90, 35, 1011046); // APPLY + + if (from.Female || from.Body.IsFemale) + { + DrawEntries(0, 1, -1, m_HairEntries, -1); + } + else if (startAtHair) + { + DrawEntries(0, 1, 2, m_HairEntries, 1011056); + DrawEntries(1, 2, 1, m_BeardEntries, 1011059); + } + else + { + DrawEntries(1, 1, 2, m_BeardEntries, 1011059); + DrawEntries(0, 2, 1, m_HairEntries, 1011056); + } + } + + private void DrawEntries(int index, int page, int nextPage, DisguiseEntry[] entries, int nextNumber) + { + AddPage(page); + + if (nextPage != -1) + { + AddButton(155, 320, 250 + index * 2, 251 + index * 2, 0, GumpButtonType.Page, nextPage); + AddHtmlLocalized(180, 320, 150, 35, nextNumber); + } + + for (var i = 0; i < entries.Length; ++i) + { + var entry = entries[i]; + + if (entry == null) + { + continue; + } + + var x = i % 2 * 205; + var y = i / 2 * 55; + + if (entry.m_GumpID != 0) + { + AddBackground(220 + x, 60 + y, 50, 50, 2620); + AddImage(153 + x + entry.m_OffsetX, 15 + y + entry.m_OffsetY, entry.m_GumpID); + } + + AddHtmlLocalized(140 + x, 72 + y, 80, 35, entry.m_Number); + AddRadio(118 + x, 73 + y, 208, 209, false, i * 2 + index); + } + } + + public override void OnResponse(NetState sender, RelayInfo info) + { + if (info.ButtonID == 0) + { + if (m_Used) + { + m_From.SendLocalizedMessage(501706); // Disguises wear off after 2 hours. + } + else + { + m_From.SendLocalizedMessage(501707); // You're looking good. + } + + return; + } + + var switches = info.Switches; + + if (switches.Length == 0) + { + return; + } + + var switched = switches[0]; + var type = switched % 2; + var index = switched / 2; + + var hair = type == 0; + + var entries = hair ? m_HairEntries : m_BeardEntries; + + if (index >= 0 && index < entries.Length) + { + var entry = entries[index]; + + if (entry == null) + { + return; + } + + if (!m_Kit.ValidateUse(m_From)) + { + return; + } + + if (!hair && (m_From.Female || m_From.Body.IsFemale)) + { + return; + } + + m_From.NameMod = NameList.RandomName(m_From.Female ? "female" : "male"); + + if (m_From is PlayerMobile pm) + { + if (hair) + { + pm.SetHairMods(entry.m_ItemID, -2); + } + else + { + pm.SetHairMods(-2, entry.m_ItemID); + } + } + + m_From.SendGump(new DisguiseGump(m_From, m_Kit, hair, true)); + + DisguisePersistence.RemoveTimer(m_From); + + DisguisePersistence.CreateTimer(m_From, TimeSpan.FromHours(2.0)); + DisguisePersistence.StartTimer(m_From); + } + } + + private class DisguiseEntry + { + public readonly int m_GumpID; + public readonly int m_ItemID; + public readonly int m_Number; + public readonly int m_OffsetX; + public readonly int m_OffsetY; + + public DisguiseEntry(int itemID, int gumpID, int ox, int oy, int name) + { + m_ItemID = itemID; + m_GumpID = gumpID; + m_OffsetX = ox; + m_OffsetY = oy; + m_Number = name; } } } diff --git a/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistance.cs b/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistance.cs deleted file mode 100644 index e7ce82c96..000000000 --- a/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistance.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Server.Items -{ - public class DisguisePersistance : Item - { - public DisguisePersistance() : base(1) - { - Movable = false; - - if (Instance?.Deleted != false) - { - Instance = this; - } - else - { - base.Delete(); - } - } - - public DisguisePersistance(Serial serial) : base(serial) => Instance = this; - - public static DisguisePersistance Instance { get; private set; } - - public override string DefaultName => "Disguise Persistance - Internal"; - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - - var timerCount = DisguiseTimers.Timers.Count; - - writer.Write(timerCount); - - foreach (var entry in DisguiseTimers.Timers) - { - var m = entry.Key; - - writer.Write(m); - writer.Write(entry.Value.Next - Core.Now); - writer.Write(m.NameMod); - } - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - switch (version) - { - case 0: - { - var count = reader.ReadInt(); - - for (var i = 0; i < count; ++i) - { - var m = reader.ReadEntity(); - DisguiseTimers.CreateTimer(m, reader.ReadTimeSpan()); - m.NameMod = reader.ReadString(); - } - - break; - } - } - } - - public override void Delete() - { - } - } -} diff --git a/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistence.cs b/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistence.cs new file mode 100644 index 000000000..bdf385050 --- /dev/null +++ b/Projects/UOContent/Items/Skill Items/Thief/DisguisePersistence.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using Server.Mobiles; + +namespace Server.Items; + +public static class DisguisePersistence +{ + public static Dictionary Timers { get; } = new(); + + public static void Configure() + { + GenericPersistence.Register("Disguises", Serialize, Deserialize); + } + + private static void Deserialize(IGenericReader reader) + { + var count = reader.ReadEncodedInt(); + for (var i = 0; i < count; ++i) + { + var m = reader.ReadEntity(); + CreateTimer(m, reader.ReadTimeSpan()); + m.NameMod = reader.ReadString(); + } + } + + private static void Serialize(IGenericWriter writer) + { + writer.WriteEncodedInt(Timers.Count); + foreach (var (m, timer) in Timers) + { + writer.Write(m); + writer.Write(timer.Next - Core.Now); + } + } + + public static void CreateTimer(Mobile m, TimeSpan delay) + { + if (m != null && !IsDisguised(m)) + { + Timers[m] = new InternalTimer(m, delay); + } + } + + public static void StartTimer(Mobile m) + { + if (Timers.TryGetValue(m, out var t)) + { + t.Start(); + } + } + + public static bool IsDisguised(Mobile m) => Timers.ContainsKey(m); + + public static void StopTimer(Mobile m) + { + if (!Timers.TryGetValue(m, out var t)) + { + return; + } + + t.Delay = Utility.Max(t.Next - Core.Now, TimeSpan.Zero); + t.Stop(); + } + + public static void RemoveTimer(Mobile m) + { + if (Timers.Remove(m, out var t)) + { + t.Stop(); + } + } + + public static TimeSpan TimeRemaining(Mobile m) => + Timers.TryGetValue(m, out var t) ? t.Next - Core.Now : TimeSpan.Zero; + + private class InternalTimer : Timer + { + private readonly Mobile _player; + + public InternalTimer(Mobile m, TimeSpan delay) : base(delay) => _player = m; + + protected override void OnTick() + { + _player.NameMod = null; + + if (_player is PlayerMobile mobile) + { + mobile.SetHairMods(-1, -1); + } + + RemoveTimer(_player); + } + } +} + +[ManualDirtyChecking] +[TypeAlias("Server.Items.DisguisePersistance")] +[Obsolete("Deprecated in favor of the static system. Only used for legacy deserialization")] +public class DisguisePersistenceTimers : Item +{ + public DisguisePersistenceTimers() : base(1) + { + Movable = false; + } + + public DisguisePersistenceTimers(Serial serial) : base(serial) + { + } + + public override string DefaultName => "Disguise Persistence - Internal"; + + public override void Serialize(IGenericWriter writer) + { + } + + public override void Deserialize(IGenericReader reader) + { + base.Deserialize(reader); + + var version = reader.ReadInt(); + + var count = reader.ReadInt(); + for (var i = 0; i < count; ++i) + { + var m = reader.ReadEntity(); + DisguisePersistence.CreateTimer(m, reader.ReadTimeSpan()); + m.NameMod = reader.ReadString(); + } + + Timer.DelayCall(Delete); + } +} diff --git a/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs b/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs index 128ad0cef..a839a0858 100644 --- a/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs +++ b/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs @@ -1,4 +1,5 @@ using System; +using ModernUO.Serialization; using Server.Targeting; namespace Server.Items; @@ -18,7 +19,8 @@ public interface ILockpickable : IPoint2D } [Flippable(0x14fc, 0x14fb)] -public class Lockpick : Item +[SerializationGenerator(0, false)] +public partial class Lockpick : Item { [Constructible] public Lockpick(int amount = 1) : base(0x14FC) @@ -27,29 +29,6 @@ public class Lockpick : Item Amount = amount; } - public Lockpick(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(1); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - - if (version == 0 && Weight == 0.1) - { - Weight = -1; - } - } - public override void OnDoubleClick(Mobile from) { from.SendLocalizedMessage(502068); // What do you want to pick? @@ -96,15 +75,15 @@ public class Lockpick : Item private class InternalTimer : Timer { - private readonly Mobile m_From; - private readonly ILockpickable m_Item; - private readonly Lockpick m_Lockpick; + private readonly Mobile _from; + private readonly ILockpickable _item; + private readonly Lockpick _lockpick; public InternalTimer(Mobile from, ILockpickable item, Lockpick lockpick) : base(TimeSpan.FromSeconds(3.0)) { - m_From = from; - m_Item = item; - m_Lockpick = lockpick; + _from = from; + _item = item; + _lockpick = lockpick; } protected void BrokeLockPickTest() @@ -112,56 +91,52 @@ public class Lockpick : Item // When failed, a 25% chance to break the lockpick if (Utility.Random(4) == 0) { - var item = (Item)m_Item; + var item = (Item)_item; // You broke the lockpick. - item.SendLocalizedMessageTo(m_From, 502074); + item.SendLocalizedMessageTo(_from, 502074); - m_From.PlaySound(0x3A4); - m_Lockpick.Consume(); + _from.PlaySound(0x3A4); + _lockpick.Consume(); } } protected override void OnTick() { - var item = (Item)m_Item; + var item = (Item)_item; - if (!m_From.InRange(item.GetWorldLocation(), 1)) + if (!_from.InRange(item.GetWorldLocation(), 1)) { return; } - if (m_Item.LockLevel is ILockpickable.CannotPick or ILockpickable.MagicLock) + if (_item.LockLevel is ILockpickable.CannotPick or ILockpickable.MagicLock) { // LockLevel of 0 means that the door can't be picklocked // LockLevel of -255 means it's magic locked - item.SendLocalizedMessageTo(m_From, 502073); // This lock cannot be picked by normal means + item.SendLocalizedMessageTo(_from, 502073); // This lock cannot be picked by normal means return; } - if (m_From.Skills.Lockpicking.Value < m_Item.RequiredSkill) + if (_from.Skills.Lockpicking.Value < _item.RequiredSkill) { - /* - // Do some training to gain skills - m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/ - // The LockLevel is higher thant the LockPicking of the player - item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated. + item.SendLocalizedMessageTo(_from, 502072); // You don't see how that lock can be manipulated. return; } - if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel)) + if (_from.CheckTargetSkill(SkillName.Lockpicking, _item, _item.LockLevel, _item.MaxLockLevel)) { // Success! Pick the lock! - item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill. - m_From.PlaySound(0x4A); - m_Item.LockPick(m_From); + item.SendLocalizedMessageTo(_from, 502076); // The lock quickly yields to your skill. + _from.PlaySound(0x4A); + _item.LockPick(_from); } else { // The player failed to pick the lock BrokeLockPickTest(); - item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock. + item.SendLocalizedMessageTo(_from, 502075); // You are unable to pick the lock. } } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Axle.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Axle.cs index 2daee8916..0f9a592ea 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Axle.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Axle.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x105B, 0x105C)] +[SerializationGenerator(0, false)] +public partial class Axle : Item { - [Flippable(0x105B, 0x105C)] - public class Axle : Item + [Constructible] + public Axle(int amount = 1) : base(0x105B) { - [Constructible] - public Axle(int amount = 1) : base(0x105B) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public Axle(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/AxleGears.cs b/Projects/UOContent/Items/Skill Items/Tinkering/AxleGears.cs index 0ccf367ce..113c1392f 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/AxleGears.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/AxleGears.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x1051, 0x1052)] +[SerializationGenerator(0, false)] +public partial class AxleGears : Item { - [Flippable(0x1051, 0x1052)] - public class AxleGears : Item + [Constructible] + public AxleGears(int amount = 1) : base(0x1051) { - [Constructible] - public AxleGears(int amount = 1) : base(0x1051) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public AxleGears(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/ClockFrame.cs b/Projects/UOContent/Items/Skill Items/Tinkering/ClockFrame.cs index 263ee4057..df30cab2c 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/ClockFrame.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/ClockFrame.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x104D, 0x104E)] +[SerializationGenerator(0, false)] +public partial class ClockFrame : Item { - [Flippable(0x104D, 0x104E)] - public class ClockFrame : Item + [Constructible] + public ClockFrame(int amount = 1) : base(0x104D) { - [Constructible] - public ClockFrame(int amount = 1) : base(0x104D) - { - Stackable = true; - Amount = amount; - Weight = 2.0; - } - - public ClockFrame(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 2.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/ClockParts.cs b/Projects/UOContent/Items/Skill Items/Tinkering/ClockParts.cs index f55b90831..68f0dde40 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/ClockParts.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/ClockParts.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x104F, 0x1050)] +[SerializationGenerator(0, false)] +public partial class ClockParts : Item { - [Flippable(0x104F, 0x1050)] - public class ClockParts : Item + [Constructible] + public ClockParts(int amount = 1) : base(0x104F) { - [Constructible] - public ClockParts(int amount = 1) : base(0x104F) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public ClockParts(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Clocks.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Clocks.cs index 346853307..46b1dfd5b 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Clocks.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Clocks.cs @@ -1,216 +1,144 @@ using System; +using ModernUO.Serialization; -namespace Server.Items +namespace Server.Items; + +public enum MoonPhase { - public enum MoonPhase + NewMoon, + WaxingCrescentMoon, + FirstQuarter, + WaxingGibbous, + FullMoon, + WaningGibbous, + LastQuarter, + WaningCrescent +} + +[Flippable(0x104B, 0x104C)] +[SerializationGenerator(0, false)] +public partial class Clock : Item +{ + public const double SecondsPerUOMinute = 5.0; + public const double MinutesPerUODay = SecondsPerUOMinute * 24; + + private static readonly DateTime WorldStart = new(1997, 9, 1); + + [Constructible] + public Clock(int itemID = 0x104B) : base(itemID) => Weight = 3.0; + + public static DateTime ServerStart { get; private set; } + + public static void Configure() { - NewMoon, - WaxingCrescentMoon, - FirstQuarter, - WaxingGibbous, - FullMoon, - WaningGibbous, - LastQuarter, - WaningCrescent + ServerStart = Core.Now; } - [Flippable(0x104B, 0x104C)] - public class Clock : Item + public static MoonPhase GetMoonPhase(Map map, int x, int y) { - public const double SecondsPerUOMinute = 5.0; - public const double MinutesPerUODay = SecondsPerUOMinute * 24; + GetTime(map, x, y, out _, out _, out var totalMinutes); - private static readonly DateTime WorldStart = new(1997, 9, 1); - - [Constructible] - public Clock(int itemID = 0x104B) : base(itemID) => Weight = 3.0; - - public Clock(Serial serial) : base(serial) + if (map != null) { + totalMinutes /= 10 + map.MapIndex * 20; } - public static DateTime ServerStart { get; private set; } - - public static void Configure() - { - ServerStart = Core.Now; - } - - public static MoonPhase GetMoonPhase(Map map, int x, int y) - { - GetTime(map, x, y, out _, out _, out var totalMinutes); - - if (map != null) - { - totalMinutes /= 10 + map.MapIndex * 20; - } - - return (MoonPhase)(totalMinutes % 8); - } - - public static void GetTime(Map map, int x, int y, out int hours, out int minutes) - { - GetTime(map, x, y, out hours, out minutes, out _); - } - - public static void GetTime(Map map, int x, int y, out int hours, out int minutes, out int totalMinutes) - { - var timeSpan = Core.Now - WorldStart; - - totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute); - - if (map != null) - { - totalMinutes += map.MapIndex * 320; - } - - // Really on OSI this must be by subserver - totalMinutes += x / 16; - - hours = totalMinutes / 60 % 24; - minutes = totalMinutes % 60; - } - - public static void GetTime(out int generalNumber, out string exactTime) - { - GetTime(null, 0, 0, out generalNumber, out exactTime); - } - - public static void GetTime(Mobile from, out int generalNumber, out string exactTime) - { - GetTime(from.Map, from.X, from.Y, out generalNumber, out exactTime); - } - - public static void GetTime(Map map, int x, int y, out int generalNumber, out string exactTime) - { - GetTime(map, x, y, out var hours, out int minutes); - - // 00:00 AM - 00:59 AM : Witching hour - // 01:00 AM - 03:59 AM : Middle of night - // 04:00 AM - 07:59 AM : Early morning - // 08:00 AM - 11:59 AM : Late morning - // 12:00 PM - 12:59 PM : Noon - // 01:00 PM - 03:59 PM : Afternoon - // 04:00 PM - 07:59 PM : Early evening - // 08:00 PM - 11:59 AM : Late at night - - if (hours >= 20) - { - generalNumber = 1042957; // It's late at night - } - else if (hours >= 16) - { - generalNumber = 1042956; // It's early in the evening - } - else if (hours >= 13) - { - generalNumber = 1042955; // It's the afternoon - } - else if (hours >= 12) - { - generalNumber = 1042954; // It's around noon - } - else if (hours >= 08) - { - generalNumber = 1042953; // It's late in the morning - } - else if (hours >= 04) - { - generalNumber = 1042952; // It's early in the morning - } - else if (hours >= 01) - { - generalNumber = 1042951; // It's the middle of the night - } - else - { - generalNumber = 1042950; // 'Tis the witching hour. 12 Midnight. - } - - hours %= 12; - - if (hours == 0) - { - hours = 12; - } - - exactTime = $"{hours}:{minutes:D2}"; - } - - public override void OnDoubleClick(Mobile from) - { - GetTime(from, out var genericNumber, out var exactTime); - - SendLocalizedMessageTo(from, genericNumber); - SendLocalizedMessageTo(from, 1042958, exactTime); // ~1_TIME~ to be exact - } - - 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 (MoonPhase)(totalMinutes % 8); } - [Flippable(0x104B, 0x104C)] - public class ClockRight : Clock + public static void GetTime(Map map, int x, int y, out int hours, out int minutes) { - [Constructible] - public ClockRight() - { - } - - public ClockRight(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + GetTime(map, x, y, out hours, out minutes, out _); } - [Flippable(0x104B, 0x104C)] - public class ClockLeft : Clock + public static void GetTime(Map map, int x, int y, out int hours, out int minutes, out int totalMinutes) { - [Constructible] - public ClockLeft() : base(0x104C) + var timeSpan = Core.Now - WorldStart; + + totalMinutes = (int)(timeSpan.TotalSeconds / SecondsPerUOMinute); + + if (map != null) { + totalMinutes += map.MapIndex * 320; } - public ClockLeft(Serial serial) : base(serial) + // Really on OSI this must be by subserver + totalMinutes += x / 16; + + hours = totalMinutes / 60 % 24; + minutes = totalMinutes % 60; + } + + public static void GetTime(out int generalNumber, out string exactTime) + { + GetTime(null, 0, 0, out generalNumber, out exactTime); + } + + public static void GetTime(Mobile from, out int generalNumber, out string exactTime) + { + GetTime(from.Map, from.X, from.Y, out generalNumber, out exactTime); + } + + public static void GetTime(Map map, int x, int y, out int generalNumber, out string exactTime) + { + GetTime(map, x, y, out var hours, out int minutes); + + // 00:00 AM - 00:59 AM : Witching hour + // 01:00 AM - 03:59 AM : Middle of night + // 04:00 AM - 07:59 AM : Early morning + // 08:00 AM - 11:59 AM : Late morning + // 12:00 PM - 12:59 PM : Noon + // 01:00 PM - 03:59 PM : Afternoon + // 04:00 PM - 07:59 PM : Early evening + // 08:00 PM - 11:59 AM : Late at night + + generalNumber = hours switch { + >= 20 => 1042957, // It's late at night + >= 16 => 1042956, // It's early in the evening + >= 13 => 1042955, // It's the afternoon + >= 12 => 1042954, // It's around noon + >= 08 => 1042953, // It's late in the morning + >= 04 => 1042952, // It's early in the morning + >= 01 => 1042951, // It's the middle of the night + _ => 1042950 // 'Tis the witching hour. 12 Midnight. + }; + + hours %= 12; + + if (hours == 0) + { + hours = 12; } - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); + exactTime = $"{hours}:{minutes:D2}"; + } - writer.Write(0); // version - } + public override void OnDoubleClick(Mobile from) + { + GetTime(from, out var genericNumber, out var exactTime); - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + SendLocalizedMessageTo(from, genericNumber); + SendLocalizedMessageTo(from, 1042958, exactTime); // ~1_TIME~ to be exact + } +} + +[Flippable(0x104B, 0x104C)] +[SerializationGenerator(0, false)] +public partial class ClockRight : Clock +{ + [Constructible] + public ClockRight() + { + } +} + +[Flippable(0x104B, 0x104C)] +[SerializationGenerator(0, false)] +public partial class ClockLeft : Clock +{ + [Constructible] + public ClockLeft() : base(0x104C) + { } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Gears.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Gears.cs index 72c57e9d5..d4c382740 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Gears.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Gears.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x1053, 0x1054)] +[SerializationGenerator(0, false)] +public partial class Gears : Item { - [Flippable(0x1053, 0x1054)] - public class Gears : Item + [Constructible] + public Gears(int amount = 1) : base(0x1053) { - [Constructible] - public Gears(int amount = 1) : base(0x1053) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public Gears(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Globe.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Globe.cs index 80290a8f2..6f1d8559c 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Globe.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Globe.cs @@ -1,28 +1,11 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +// It isn't flippable +[SerializationGenerator(0)] +public partial class Globe : Item { - public class Globe : Item - { - [Constructible] - public Globe() : base(0x1047) // It isn't flippable - => - Weight = 3.0; - - public Globe(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(); - } - } + [Constructible] + public Globe() : base(0x1047) => Weight = 3.0; } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Hinge.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Hinge.cs index ae22ce999..b602afa32 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Hinge.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Hinge.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x1055, 0x1056)] +[SerializationGenerator(0, false)] +public partial class Hinge : Item { - [Flippable(0x1055, 0x1056)] - public class Hinge : Item + [Constructible] + public Hinge(int amount = 1) : base(0x1055) { - [Constructible] - public Hinge(int amount = 1) : base(0x1055) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public Hinge(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/SextantParts.cs b/Projects/UOContent/Items/Skill Items/Tinkering/SextantParts.cs index f1653394c..069ced6ff 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/SextantParts.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/SextantParts.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x1059, 0x105A)] +[SerializationGenerator(0, false)] +public partial class SextantParts : Item { - [Flippable(0x1059, 0x105A)] - public class SextantParts : Item + [Constructible] + public SextantParts(int amount = 1) : base(0x1059) { - [Constructible] - public SextantParts(int amount = 1) : base(0x1059) - { - Stackable = true; - Amount = amount; - Weight = 2.0; - } - - public SextantParts(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 2.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Springs.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Springs.cs index 6faf9b76d..451706d78 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Springs.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Springs.cs @@ -1,32 +1,16 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x105D, 0x105E)] +[SerializationGenerator(0, false)] +public partial class Springs : Item { - [Flippable(0x105D, 0x105E)] - public class Springs : Item + [Constructible] + public Springs(int amount = 1) : base(0x105D) { - [Constructible] - public Springs(int amount = 1) : base(0x105D) - { - Stackable = true; - Amount = amount; - Weight = 1.0; - } - - public Springs(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } + Stackable = true; + Amount = amount; + Weight = 1.0; } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs index 45881715f..773714837 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs @@ -1,96 +1,74 @@ +using ModernUO.Serialization; using Server.Engines.Quests.Hag; using Server.Mobiles; using Server.Network; -namespace Server.Items +namespace Server.Items; + +[Flippable(0x14F5, 0x14F6)] +[SerializationGenerator(0, false)] +public partial class Spyglass : Item { - [Flippable(0x14F5, 0x14F6)] - public class Spyglass : Item + [Constructible] + public Spyglass() : base(0x14F5) => Weight = 3.0; + + public override void OnDoubleClick(Mobile from) { - [Constructible] - public Spyglass() : base(0x14F5) => Weight = 3.0; + // You peer into the heavens, seeking the moons... + from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1008155); - public Spyglass(Serial serial) : base(serial) + from.NetState.SendMessageLocalizedAffix( + from.Serial, + from.Body, + MessageType.Regular, + 0x3B2, + 3, + 1008146 + (int)Clock.GetMoonPhase(Map.Trammel, from.X, from.Y), + "", + AffixType.Prepend, + "Trammel : " + ); + + from.NetState.SendMessageLocalizedAffix( + from.Serial, + from.Body, + MessageType.Regular, + 0x3B2, + 3, + 1008146 + (int)Clock.GetMoonPhase(Map.Felucca, from.X, from.Y), + "", + AffixType.Prepend, + "Felucca : " + ); + + if (from is PlayerMobile player) { - } + var qs = player.Quest; - public override void OnDoubleClick(Mobile from) - { - from.LocalOverheadMessage( - MessageType.Regular, - 0x3B2, - 1008155 - ); // You peer into the heavens, seeking the moons... - - from.NetState.SendMessageLocalizedAffix( - from.Serial, - from.Body, - MessageType.Regular, - 0x3B2, - 3, - 1008146 + (int)Clock.GetMoonPhase(Map.Trammel, from.X, from.Y), - "", - AffixType.Prepend, - "Trammel : " - ); - - from.NetState.SendMessageLocalizedAffix( - from.Serial, - from.Body, - MessageType.Regular, - 0x3B2, - 3, - 1008146 + (int)Clock.GetMoonPhase(Map.Felucca, from.X, from.Y), - "", - AffixType.Prepend, - "Felucca : " - ); - - if (from is PlayerMobile player) + if (qs is not WitchApprenticeQuest) { - var qs = player.Quest; + return; + } - if (qs is not WitchApprenticeQuest) + var obj = qs.FindObjective(); + + if (obj?.Completed == false && obj.Ingredient == Ingredient.StarChart) + { + Clock.GetTime(from.Map, from.X, from.Y, out var hours, out int _); + + if (hours is < 5 or > 17) { - return; + // You gaze up into the glittering night sky. With great care, you compose a chart of the most prominent star patterns. + player.SendLocalizedMessage(1055040); + + obj.Complete(); } - - var obj = qs.FindObjective(); - - if (obj?.Completed == false && obj.Ingredient == Ingredient.StarChart) + else { - Clock.GetTime(from.Map, from.X, from.Y, out var hours, out int _); - - if (hours is < 5 or > 17) - { - player.SendLocalizedMessage( - 1055040 - ); // You gaze up into the glittering night sky. With great care, you compose a chart of the most prominent star patterns. - - obj.Complete(); - } - else - { - player.SendLocalizedMessage( - 1055039 - ); // You gaze up into the sky, but it is not dark enough to see any stars. - } + // You gaze up into the sky, but it is not dark enough to see any stars. + player.SendLocalizedMessage(1055039); } } } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } } } diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Utensils.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Utensils.cs index 7c0fd70c1..c9449a6ed 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Utensils.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Utensils.cs @@ -1,245 +1,76 @@ -namespace Server.Items +using ModernUO.Serialization; + +namespace Server.Items; + +[Flippable(0x9F4, 0x9F5, 0x9A3, 0x9A4)] +[SerializationGenerator(0, false)] +public partial class Fork : Item { - [Flippable(0x9F4, 0x9F5, 0x9A3, 0x9A4)] - public class Fork : Item - { - [Constructible] - public Fork() : base(0x9F4) => Weight = 1.0; - - public Fork(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class ForkLeft : Item - { - [Constructible] - public ForkLeft() : base(0x9F4) => Weight = 1.0; - - public ForkLeft(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class ForkRight : Item - { - [Constructible] - public ForkRight() : base(0x9F5) => Weight = 1.0; - - public ForkRight(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - [Flippable(0x9F8, 0x9F9, 0x9C2, 0x9C3)] - public class Spoon : Item - { - [Constructible] - public Spoon() : base(0x9F8) => Weight = 1.0; - - public Spoon(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class SpoonLeft : Item - { - [Constructible] - public SpoonLeft() : base(0x9F8) => Weight = 1.0; - - public SpoonLeft(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class SpoonRight : Item - { - [Constructible] - public SpoonRight() : base(0x9F9) => Weight = 1.0; - - public SpoonRight(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - [Flippable(0x9F6, 0x9F7, 0x9A5, 0x9A6)] - public class Knife : Item - { - [Constructible] - public Knife() : base(0x9F6) => Weight = 1.0; - - public Knife(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class KnifeLeft : Item - { - [Constructible] - public KnifeLeft() : base(0x9F6) => Weight = 1.0; - - public KnifeLeft(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class KnifeRight : Item - { - [Constructible] - public KnifeRight() : base(0x9F7) => Weight = 1.0; - - public KnifeRight(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } - - public class Plate : Item - { - [Constructible] - public Plate() : base(0x9D7) => Weight = 1.0; - - public Plate(Serial serial) : base(serial) - { - } - - public override void Serialize(IGenericWriter writer) - { - base.Serialize(writer); - - writer.Write(0); // version - } - - public override void Deserialize(IGenericReader reader) - { - base.Deserialize(reader); - - var version = reader.ReadInt(); - } - } + [Constructible] + public Fork() : base(0x9F4) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class ForkLeft : Item +{ + [Constructible] + public ForkLeft() : base(0x9F4) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class ForkRight : Item +{ + [Constructible] + public ForkRight() : base(0x9F5) => Weight = 1.0; +} + +[Flippable(0x9F8, 0x9F9, 0x9C2, 0x9C3)] +[SerializationGenerator(0, false)] +public partial class Spoon : Item +{ + [Constructible] + public Spoon() : base(0x9F8) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class SpoonLeft : Item +{ + [Constructible] + public SpoonLeft() : base(0x9F8) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class SpoonRight : Item +{ + [Constructible] + public SpoonRight() : base(0x9F9) => Weight = 1.0; +} + +[Flippable(0x9F6, 0x9F7, 0x9A5, 0x9A6)] +[SerializationGenerator(0, false)] +public partial class Knife : Item +{ + [Constructible] + public Knife() : base(0x9F6) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class KnifeLeft : Item +{ + [Constructible] + public KnifeLeft() : base(0x9F6) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class KnifeRight : Item +{ + [Constructible] + public KnifeRight() : base(0x9F7) => Weight = 1.0; +} + +[SerializationGenerator(0, false)] +public partial class Plate : Item +{ + [Constructible] + public Plate() : base(0x9D7) => Weight = 1.0; } diff --git a/Projects/UOContent/Migrations/Server.Engines.MLQuests.Gumps.RaceChangeDeed.v0.json b/Projects/UOContent/Migrations/Server.Engines.MLQuests.Gumps.RaceChangeDeed.v0.json new file mode 100644 index 000000000..54e38d8fe --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Engines.MLQuests.Gumps.RaceChangeDeed.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Engines.MLQuests.Gumps.RaceChangeDeed" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Axle.v0.json b/Projects/UOContent/Migrations/Server.Items.Axle.v0.json new file mode 100644 index 000000000..eda025b78 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Axle.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Axle" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.AxleGears.v0.json b/Projects/UOContent/Migrations/Server.Items.AxleGears.v0.json new file mode 100644 index 000000000..3a2e5c12e --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.AxleGears.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.AxleGears" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Clock.v0.json b/Projects/UOContent/Migrations/Server.Items.Clock.v0.json new file mode 100644 index 000000000..e79bcfe81 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Clock.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Clock" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ClockFrame.v0.json b/Projects/UOContent/Migrations/Server.Items.ClockFrame.v0.json new file mode 100644 index 000000000..9657fb6ae --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ClockFrame.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ClockFrame" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ClockLeft.v0.json b/Projects/UOContent/Migrations/Server.Items.ClockLeft.v0.json new file mode 100644 index 000000000..7fc771bbc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ClockLeft.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ClockLeft" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ClockParts.v0.json b/Projects/UOContent/Migrations/Server.Items.ClockParts.v0.json new file mode 100644 index 000000000..10a763e6a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ClockParts.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ClockParts" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ClockRight.v0.json b/Projects/UOContent/Migrations/Server.Items.ClockRight.v0.json new file mode 100644 index 000000000..505ff5871 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ClockRight.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ClockRight" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.DisguiseKit.v0.json b/Projects/UOContent/Migrations/Server.Items.DisguiseKit.v0.json new file mode 100644 index 000000000..60f2d30f0 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.DisguiseKit.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.DisguiseKit" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Dressform.v0.json b/Projects/UOContent/Migrations/Server.Items.Dressform.v0.json new file mode 100644 index 000000000..1a246afe3 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Dressform.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Dressform" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Dyes.v0.json b/Projects/UOContent/Migrations/Server.Items.Dyes.v0.json new file mode 100644 index 000000000..844938bec --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Dyes.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Dyes" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Fork.v0.json b/Projects/UOContent/Migrations/Server.Items.Fork.v0.json new file mode 100644 index 000000000..d6b408b73 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Fork.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Fork" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ForkLeft.v0.json b/Projects/UOContent/Migrations/Server.Items.ForkLeft.v0.json new file mode 100644 index 000000000..59c60cc72 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ForkLeft.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ForkLeft" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.ForkRight.v0.json b/Projects/UOContent/Migrations/Server.Items.ForkRight.v0.json new file mode 100644 index 000000000..7b0f2f268 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.ForkRight.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.ForkRight" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Gears.v0.json b/Projects/UOContent/Migrations/Server.Items.Gears.v0.json new file mode 100644 index 000000000..64ecea49c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Gears.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Gears" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Globe.v0.json b/Projects/UOContent/Migrations/Server.Items.Globe.v0.json new file mode 100644 index 000000000..2f879c450 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Globe.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Globe" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Hinge.v0.json b/Projects/UOContent/Migrations/Server.Items.Hinge.v0.json new file mode 100644 index 000000000..4518d221b --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Hinge.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Hinge" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Knife.v0.json b/Projects/UOContent/Migrations/Server.Items.Knife.v0.json new file mode 100644 index 000000000..d3957b13d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Knife.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Knife" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.KnifeLeft.v0.json b/Projects/UOContent/Migrations/Server.Items.KnifeLeft.v0.json new file mode 100644 index 000000000..81b2a4aa2 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.KnifeLeft.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.KnifeLeft" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.KnifeRight.v0.json b/Projects/UOContent/Migrations/Server.Items.KnifeRight.v0.json new file mode 100644 index 000000000..d653bbfbd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.KnifeRight.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.KnifeRight" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Lockpick.v0.json b/Projects/UOContent/Migrations/Server.Items.Lockpick.v0.json new file mode 100644 index 000000000..8ec4f025c --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Lockpick.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Lockpick" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Plate.v0.json b/Projects/UOContent/Migrations/Server.Items.Plate.v0.json new file mode 100644 index 000000000..cb78a4430 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Plate.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Plate" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Scissors.v0.json b/Projects/UOContent/Migrations/Server.Items.Scissors.v0.json new file mode 100644 index 000000000..96034220a --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Scissors.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Scissors" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SextantParts.v0.json b/Projects/UOContent/Migrations/Server.Items.SextantParts.v0.json new file mode 100644 index 000000000..19823462d --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SextantParts.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SextantParts" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Spoon.v0.json b/Projects/UOContent/Migrations/Server.Items.Spoon.v0.json new file mode 100644 index 000000000..e7605cdb9 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Spoon.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Spoon" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SpoonLeft.v0.json b/Projects/UOContent/Migrations/Server.Items.SpoonLeft.v0.json new file mode 100644 index 000000000..6470f4893 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SpoonLeft.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SpoonLeft" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.SpoonRight.v0.json b/Projects/UOContent/Migrations/Server.Items.SpoonRight.v0.json new file mode 100644 index 000000000..8b08293bd --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.SpoonRight.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.SpoonRight" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Springs.v0.json b/Projects/UOContent/Migrations/Server.Items.Springs.v0.json new file mode 100644 index 000000000..6f7a842fc --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Springs.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Springs" +} \ No newline at end of file diff --git a/Projects/UOContent/Migrations/Server.Items.Spyglass.v0.json b/Projects/UOContent/Migrations/Server.Items.Spyglass.v0.json new file mode 100644 index 000000000..4bb6b1801 --- /dev/null +++ b/Projects/UOContent/Migrations/Server.Items.Spyglass.v0.json @@ -0,0 +1,4 @@ +{ + "version": 0, + "type": "Server.Items.Spyglass" +} \ No newline at end of file diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index 874b7f5f5..cc42e627c 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -231,7 +231,7 @@ namespace Server.Mobiles public DateTime AnkhNextUse { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public TimeSpan DisguiseTimeLeft => DisguiseTimers.TimeRemaining(this); + public TimeSpan DisguiseTimeLeft => DisguisePersistence.TimeRemaining(this); [CommandProperty(AccessLevel.GameMaster)] public DateTime PeacedUntil { get; set; } @@ -1527,7 +1527,7 @@ namespace Server.Mobiles pm.LastOnline = Core.Now; } - DisguiseTimers.StartTimer(m); + DisguisePersistence.StartTimer(m); Timer.StartTimer(() => SpecialMove.ClearAllMoves(m)); } @@ -1575,7 +1575,7 @@ namespace Server.Mobiles pm.LastOnline = Core.Now; } - DisguiseTimers.StopTimer(from); + DisguisePersistence.StopTimer(from); } public override void RevealingAction() @@ -2577,7 +2577,7 @@ namespace Server.Mobiles PolymorphSpell.StopTimer(this); IncognitoSpell.StopTimer(this); - DisguiseTimers.RemoveTimer(this); + DisguisePersistence.RemoveTimer(this); EndAction(); EndAction(); @@ -3487,7 +3487,7 @@ namespace Server.Mobiles BaseHouse.HandleDeletion(this); - DisguiseTimers.RemoveTimer(this); + DisguisePersistence.RemoveTimer(this); } public override void GetProperties(IPropertyList list) diff --git a/Projects/UOContent/Skills/Stealing.cs b/Projects/UOContent/Skills/Stealing.cs index 757614282..760dfed43 100644 --- a/Projects/UOContent/Skills/Stealing.cs +++ b/Projects/UOContent/Skills/Stealing.cs @@ -136,7 +136,7 @@ namespace Server.SkillHandlers { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } - else if (DisguiseTimers.IsDisguised(m_Thief)) + else if (DisguisePersistence.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } diff --git a/Projects/UOContent/Spells/Base/SpellHelper.cs b/Projects/UOContent/Spells/Base/SpellHelper.cs index 6c15ff6b0..dd63413cc 100644 --- a/Projects/UOContent/Spells/Base/SpellHelper.cs +++ b/Projects/UOContent/Spells/Base/SpellHelper.cs @@ -1204,7 +1204,7 @@ namespace Server.Spells { caster.SendLocalizedMessage(1061628); // You can't do that while polymorphed. } - else if (DisguiseTimers.IsDisguised(caster)) + else if (DisguisePersistence.IsDisguised(caster)) { caster.SendLocalizedMessage(1061631); // You can't do that while disguised. return false; diff --git a/Projects/UOContent/Spells/Fifth/Incognito.cs b/Projects/UOContent/Spells/Fifth/Incognito.cs index 39028b68d..68797a656 100644 --- a/Projects/UOContent/Spells/Fifth/Incognito.cs +++ b/Projects/UOContent/Spells/Fifth/Incognito.cs @@ -70,7 +70,7 @@ namespace Server.Spells.Fifth return; } - if (DisguiseTimers.IsDisguised(Caster)) + if (DisguisePersistence.IsDisguised(Caster)) { Caster.SendLocalizedMessage(1061631); // You can't do that while disguised. return; @@ -86,7 +86,7 @@ namespace Server.Spells.Fifth { if (Caster.BeginAction()) { - DisguiseTimers.StopTimer(Caster); + DisguisePersistence.StopTimer(Caster); Caster.HueMod = Caster.Race.RandomSkinHue(); Caster.NameMod = Caster.Female ? NameList.RandomName("female") : NameList.RandomName("male"); diff --git a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs index 432fb8a28..472aa1ab1 100644 --- a/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs +++ b/Projects/UOContent/Spells/Ninjitsu/AnimalForm.cs @@ -89,7 +89,7 @@ namespace Server.Spells.Ninjitsu return false; } - if (DisguiseTimers.IsDisguised(Caster)) + if (DisguisePersistence.IsDisguised(Caster)) { Caster.SendLocalizedMessage(1061631); // You can't do that while disguised. return false; diff --git a/Projects/UOContent/Spells/Seventh/Polymorph.cs b/Projects/UOContent/Spells/Seventh/Polymorph.cs index c8eb67b10..b9566efaf 100644 --- a/Projects/UOContent/Spells/Seventh/Polymorph.cs +++ b/Projects/UOContent/Spells/Seventh/Polymorph.cs @@ -49,7 +49,7 @@ namespace Server.Spells.Seventh return false; } - if (DisguiseTimers.IsDisguised(caster)) + if (DisguisePersistence.IsDisguised(caster)) { caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. return false; @@ -122,7 +122,7 @@ namespace Server.Spells.Seventh return; } - if (DisguiseTimers.IsDisguised(caster)) + if (DisguisePersistence.IsDisguised(caster)) { caster.SendLocalizedMessage(502167); // You cannot polymorph while disguised. return;