using System; using Server.Gumps; using Server.Network; namespace Server.Items { [Serializable(0, false)] public abstract partial class StValentinesBear : Item { [InternString] [InvalidateProperties] [SerializableField(0)] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] private string _owner; [InternString] [InvalidateProperties] [SerializableField(1)] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] private string _line1; [InternString] [InvalidateProperties] [SerializableField(2)] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] private string _line2; [InternString] [InvalidateProperties] [SerializableField(3)] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] private string _line3; public StValentinesBear(int itemid, string name) : base(itemid) { Owner = name; LootType = LootType.Blessed; } public override string DefaultName => _owner != null ? $"{_owner}'s St. Valentine Bear" : "St. Valentine Bear"; [CommandProperty(AccessLevel.GameMaster)] public DateTime EditLimit { get; set; } public bool IsSigned => _line1 != null || _line2 != null || _line3 != null; public bool CanSign => !IsSigned || Core.Now <= EditLimit; public override void AddNameProperty(ObjectPropertyList list) { if (_owner != null) { list.Add(1150295, _owner); // ~1_NAME~'s St. Valentine Bear } else { list.Add(1150294); // St. Valentine Bear } AddLine(list, 1150301, _line1); // [ ~1_LINE0~ ] AddLine(list, 1150302, _line2); // [ ~1_LINE1~ ] AddLine(list, 1150303, _line3); // [ ~1_LINE2~ ] } private static void AddLine(ObjectPropertyList list, int cliloc, string line) { if (line != null) { list.Add(cliloc, line); } } public override void OnSingleClick(Mobile from) { base.OnSingleClick(from); ShowLine(from, 1150301, _line1); // [ ~1_LINE0~ ] ShowLine(from, 1150302, _line2); // [ ~1_LINE1~ ] ShowLine(from, 1150303, _line3); // [ ~1_LINE2~ ] } private void ShowLine(Mobile from, int cliloc, string line) { if (line != null) { LabelTo(from, cliloc, line); } } public override void OnDoubleClick(Mobile from) { if (!CupidsArrow.CheckSeason(from) || !CanSign) { return; } if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1080063); // This must be in your backpack to use it. return; } from.SendGump(new InternalGump(this)); } private class InternalGump : Gump { private readonly StValentinesBear m_Bear; public InternalGump(StValentinesBear bear) : base(50, 50) { m_Bear = bear; AddPage(0); AddBackground(0, 0, 420, 320, 9300); AddHtml(10, 10, 400, 21, "