feat: Standardizes South/East selection gumps (#1839)

This commit is contained in:
Kamron Batman 2025-02-14 00:15:14 -08:00 • committed by GitHub
parent 279b10dd0f
commit 2e08eda8cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 263 additions and 520 deletions

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -30,14 +29,14 @@ public partial class BrokenBedAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class BrokenBedDeed : BaseAddonDeed
public partial class BrokenBedDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public BrokenBedDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new BrokenBedAddon(_east);
public override BaseAddon Addon => new BrokenBedAddon(East);
public override int LabelNumber => 1076263; // Broken Bed
@ -53,49 +52,17 @@ public partial class BrokenBedDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly BrokenBedDeed _deed;
public override bool Singleton => true;
public InternalGump(BrokenBedDeed deed) : base(60, 36)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076749, 0x7FFF); // Please select your broken bed position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076749; // Please select your broken bed position
}
}

View file

@ -1,6 +1,5 @@
using ModernUO.Serialization;
using Server.Gumps;
using Server.Network;
namespace Server.Items;
@ -26,14 +25,15 @@ public partial class BrokenVanityAddon : BaseAddon
}
[SerializationGenerator(0)]
public partial class BrokenVanityDeed : BaseAddonDeed
public partial class BrokenVanityDeed : BaseAddonDeed, IDirectionAddonDeed
{
private bool _east;
public bool East { get; set; }
[Constructible]
public BrokenVanityDeed() => LootType = LootType.Blessed;
public override BaseAddon Addon => new BrokenVanityAddon(_east);
public override BaseAddon Addon => new BrokenVanityAddon(East);
public override int LabelNumber => 1076260; // Broken Vanity
public override void OnDoubleClick(Mobile from)
@ -48,49 +48,17 @@ public partial class BrokenVanityDeed : BaseAddonDeed
}
}
private void SendTarget(Mobile m)
public void SendTarget(Mobile m)
{
base.OnDoubleClick(m);
}
private class InternalGump : Gump
private class InternalGump : SelectAddonDirectionGump<InternalGump>
{
private readonly BrokenVanityDeed _deed;
public override bool Singleton => true;
public InternalGump(BrokenVanityDeed deed) : base(60, 63)
public InternalGump(IDirectionAddonDeed deed) : base(deed)
{
_deed = deed;
AddPage(0);
AddBackground(0, 0, 273, 324, 0x13BE);
AddImageTiled(10, 10, 253, 20, 0xA40);
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076747, 0x7FFF); // Please select your broken vanity position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (_deed?.Deleted != false || info.ButtonID == 0)
{
return;
}
_deed._east = info.ButtonID != 1;
_deed.SendTarget(sender.Mobile);
}
public override int SelectionNumber => 1076747; // Please select your broken vanity position
}
}