perf: Migrate Item Interaction gumps to DynamicGump/StaticGump (#2421)

## Summary

Migrates 11 player-facing Item Interaction gumps from legacy `Gump` to `StaticGump<T>` or `DynamicGump`.

| File | Gump | Base | Reason |
|---|---|---|---|
| `Items/Deeds/NameChangeDeed.cs` | `NameChangeDeedGump` | `StaticGump<T>` | Fully fixed layout |
| `Items/Deeds/HairRestylingDeed.cs` | `HairRestylingDeedGump` (renamed from `InternalGump`) | `DynamicGump` | Per-race/per-gender cliloc IDs and gump images vary every instance |
| `Items/Deeds/HolidayTreeDeed.cs` | `HolidayTreeChoiceGump` | `StaticGump<T>` | Fully fixed (Classic/Modern radio) |
| `Items/Deeds/NewPlayerTicket.cs` | `NewPlayerTicketGump` (renamed from `InternalGump`) | `StaticGump<T>` | Fully fixed gift menu |
| `Items/Misc/PromotionalToken.cs` | `PromotionalTokenGump` | `DynamicGump` | `TextDefinition` (`ItemGumpName`) varies per token subclass — cliloc/string differs |
| `Items/Misc/SpecialHairDye.cs` | `SpecialHairDyeGump` | `StaticGump<T>` | Static entry array drives a fixed layout |
| `Items/Misc/InteriorDecorator.cs` | `InteriorDecoratorGump` (renamed from `InternalGump`) | `DynamicGump` | Button art flips per `decorator.Command` (Turn/Up/Down) |
| `Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBoxGump.cs` | `DawnsMusicBoxGump` | `DynamicGump` | Page count derived from variable `Tracks.Count` |
| `Items/Misc/PowerGenerator.cs` | `PowerGeneratorGump` (renamed from `GameGump`) | `DynamicGump` | Variable side length 3-6 and per-step node hues |
| `Gumps/HeritageTokenGump.cs` | `HeritageTokenGump` | `StaticGump<T>` | All 7 pages fully baked — only static cliloc IDs |
| `Gumps/ConfirmHeritageGump.cs` | `ConfirmHeritageGump` | `DynamicGump` | Confirmation cliloc chosen at runtime per item selected |

All gumps use `Singleton => true`, private constructors, and a static `DisplayTo` entry point that validates prerequisites before constructing.

External callers updated (`HeritageToken`, `DawnsMusicBox`) to the new `DisplayTo` entry points. `Console.WriteLine` in `ConfirmHeritageGump` exception handler replaced with `LogFactory`-backed logger.
This commit is contained in:
Kamron Batman 2026-04-26 11:31:49 -07:00 • committed by GitHub
parent 15e506ffc2
commit 598c3c125c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 709 additions and 1009 deletions

View file

@ -104,51 +104,61 @@ public partial class HolidayTreeDeed : Item
public override void OnDoubleClick(Mobile from)
{
from.SendGump(new HolidayTreeChoiceGump(from, this));
HolidayTreeChoiceGump.DisplayTo(from, this);
}
}
public class HolidayTreeChoiceGump : Gump
public class HolidayTreeChoiceGump : StaticGump<HolidayTreeChoiceGump>
{
private readonly HolidayTreeDeed m_Deed;
private readonly Mobile m_From;
private readonly HolidayTreeDeed _deed;
public override bool Singleton => true;
public HolidayTreeChoiceGump(Mobile from, HolidayTreeDeed deed) : base(200, 200)
private HolidayTreeChoiceGump(HolidayTreeDeed deed) : base(200, 200) => _deed = deed;
public static void DisplayTo(Mobile from, HolidayTreeDeed deed)
{
m_From = from;
m_Deed = deed;
if (from?.NetState == null || deed?.Deleted != false)
{
return;
}
AddPage(0);
from.SendGump(new HolidayTreeChoiceGump(deed));
}
AddBackground(0, 0, 220, 120, 5054);
AddBackground(10, 10, 200, 100, 3000);
protected override void BuildLayout(ref StaticGumpBuilder builder)
{
builder.AddPage();
AddButton(20, 35, 4005, 4007, 1);
AddHtmlLocalized(55, 35, 145, 25, 1018322); // Classic
builder.AddBackground(0, 0, 220, 120, 5054);
builder.AddBackground(10, 10, 200, 100, 3000);
AddButton(20, 65, 4005, 4007, 2);
AddHtmlLocalized(55, 65, 145, 25, 1018321); // Modern
builder.AddButton(20, 35, 4005, 4007, 1);
builder.AddHtmlLocalized(55, 35, 145, 25, 1018322); // Classic
builder.AddButton(20, 65, 4005, 4007, 2);
builder.AddHtmlLocalized(55, 65, 145, 25, 1018321); // Modern
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
if (m_Deed.Deleted)
if (_deed.Deleted)
{
return;
}
var from = sender.Mobile;
switch (info.ButtonID)
{
case 1:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Classic);
_deed.BeginPlace(from, HolidayTreeType.Classic);
break;
}
case 2:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Modern);
_deed.BeginPlace(from, HolidayTreeType.Modern);
break;
}
}