perf: Migrate Old Guild System gumps to DynamicGump (#2420)

## Summary

Migrates the Old Guild System (pre-AOS guild stones) gumps from the legacy `Gump` class to `DynamicGump`, following the same pattern used for the Quest gump migration in #2416. All concrete gumps now have private constructors gated by static `DisplayTo` entry points (empty-gump rule), and `Singleton => true` is set across the board so reopening a sibling dialog automatically closes the previous one.

**Migrated gumps:**
- `GuildGump` - main guild dialog
- `GuildmasterGump` - guildmaster functions
- `GuildCharterGump` - charter and website display
- `GuildWarGump` - warfare status (kept as player-facing)
- `GuildWarAdminGump` - war menu (retained as player-facing - reachable from `GuildmasterGump`'s WAR button by guildmasters)
- `GuildChangeTypeGump` - Standard/Order/Chaos selection

**Abstract bases:** `GuildListGump` and `GuildMobileListGump` keep their shared list-rendering chrome inside a single concrete `BuildLayout` on the abstract class and expose a `protected abstract void BuildHeader(ref DynamicGumpBuilder builder)` hook for subclasses (replacing the old `Design()` override). This mirrors the abstract-base treatment used for the ML quest base in the quest-gump migration PR.

**Concrete subclasses migrated alongside the abstract bases:**
- `GuildListGump` subclasses: `GuildAcceptWarGump`, `GuildDeclarePeaceGump`, `GuildDeclareWarGump`, `GuildRejectWarGump`, `GuildRescindDeclarationGump`
- `GuildMobileListGump` subclasses: `DeclareFealtyGump`, `GrantGuildTitleGump`, `GuildAdminCandidatesGump`, `GuildCandidatesGump`, `GuildDismissGump`, `GuildRosterGump`

**Cliloc rule:** Every gump bakes per-instance dynamic content (guild names, member names, war declarations, candidate lists), which would defeat `StaticGump<T>` caching. Per the cliloc rule, all are `DynamicGump`.

**External callers updated:** the prompt files (`GuildAbbrvPrompt`, `GuildCharterPrompt`, `GuildDeclareWarPrompt`, `GuildNamePrompt`, `GuildTitlePrompt`, `GuildWebsitePrompt`), `RecruitTarget`, the `Guildstone` item, and the New Guild System `GuildInfoGump`'s Order/Chaos handler all now go through static `DisplayTo` entry points instead of `new XGump(...)`.
This commit is contained in:
Kamron Batman 2026-04-26 10:44:11 -07:00 • committed by GitHub
parent 70a69d3efe
commit 15e506ffc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 848 additions and 761 deletions

View file

@ -3,69 +3,79 @@ using Server.Network;
namespace Server.Gumps
{
public class GuildWarAdminGump : Gump
public class GuildWarAdminGump : DynamicGump
{
private readonly Guild m_Guild;
private readonly Mobile m_Mobile;
private readonly Guild _guild;
public GuildWarAdminGump(Mobile from, Guild guild) : base(20, 30)
public override bool Singleton => true;
private GuildWarAdminGump(Guild guild) : base(20, 30) => _guild = guild;
public static void DisplayTo(Mobile from, Guild guild)
{
m_Mobile = from;
m_Guild = guild;
Draggable = false;
AddPage(0);
AddBackground(0, 0, 550, 440, 5054);
AddBackground(10, 10, 530, 420, 3000);
AddHtmlLocalized(20, 10, 510, 35, 1011105); // <center>WAR FUNCTIONS</center>
AddButton(20, 40, 4005, 4007, 1);
AddHtmlLocalized(55, 40, 400, 30, 1011099); // Declare war through guild name search.
var count = 0;
if (guild.Enemies.Count > 0)
if (from?.NetState == null || guild == null)
{
AddButton(20, 160 + count * 30, 4005, 4007, 2);
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011103); // Declare peace.
return;
}
GuildGump.EnsureClosed(from);
from.SendGump(new GuildWarAdminGump(guild));
}
protected override void BuildLayout(ref DynamicGumpBuilder builder)
{
builder.SetNoMove();
builder.AddPage();
builder.AddBackground(0, 0, 550, 440, 5054);
builder.AddBackground(10, 10, 530, 420, 3000);
builder.AddHtmlLocalized(20, 10, 510, 35, 1011105); // <center>WAR FUNCTIONS</center>
builder.AddButton(20, 40, 4005, 4007, 1);
builder.AddHtmlLocalized(55, 40, 400, 30, 1011099); // Declare war through guild name search.
if (_guild.Enemies.Count > 0)
{
builder.AddButton(20, 160 + 30, 4005, 4007, 2);
builder.AddHtmlLocalized(55, 160, 400, 30, 1011103); // Declare peace.
}
else
{
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013033); // No current wars
builder.AddHtmlLocalized(20, 160, 400, 30, 1013033); // No current wars
}
if (guild.WarInvitations.Count > 0)
if (_guild.WarInvitations.Count > 0)
{
AddButton(20, 160 + count * 30, 4005, 4007, 3);
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011100); // Accept war invitations.
builder.AddButton(20, 190, 4005, 4007, 3);
builder.AddHtmlLocalized(55, 190, 400, 30, 1011100); // Accept war invitations.
AddButton(20, 160 + count * 30, 4005, 4007, 4);
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011101); // Reject war invitations.
builder.AddButton(20, 190, 4005, 4007, 4);
builder.AddHtmlLocalized(55, 190, 400, 30, 1011101); // Reject war invitations.
}
else
{
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1018012); // No current invitations received for war.
builder.AddHtmlLocalized(20, 190, 400, 30, 1018012); // No current invitations received for war.
}
if (guild.WarDeclarations.Count > 0)
if (_guild.WarDeclarations.Count > 0)
{
AddButton(20, 160 + count * 30, 4005, 4007, 5);
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011102); // Rescind your war declarations.
builder.AddButton(20, 220, 4005, 4007, 5);
builder.AddHtmlLocalized(55, 220, 400, 30, 1011102); // Rescind your war declarations.
}
else
{
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013055); // No current war declarations
builder.AddHtmlLocalized(20, 220, 400, 30, 1013055); // No current war declarations
}
AddButton(20, 400, 4005, 4007, 6);
AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
builder.AddButton(20, 400, 4005, 4007, 6);
builder.AddHtmlLocalized(55, 400, 400, 35, 1011104); // Return to the previous menu.
}
public override void OnResponse(NetState state, in RelayInfo info)
{
if (GuildGump.BadLeader(m_Mobile, m_Guild))
var from = state.Mobile;
if (GuildGump.BadLeader(from, _guild))
{
return;
}
@ -74,44 +84,33 @@ namespace Server.Gumps
{
case 1: // Declare war
{
m_Mobile.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
m_Mobile.Prompt = new GuildDeclareWarPrompt(m_Mobile, m_Guild);
from.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
from.Prompt = new GuildDeclareWarPrompt(_guild);
break;
}
case 2: // Declare peace
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild));
GuildDeclarePeaceGump.DisplayTo(from, _guild);
break;
}
case 3: // Accept war
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild));
GuildAcceptWarGump.DisplayTo(from, _guild);
break;
}
case 4: // Reject war
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild));
GuildRejectWarGump.DisplayTo(from, _guild);
break;
}
case 5: // Rescind declarations
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild));
GuildRescindDeclarationGump.DisplayTo(from, _guild);
break;
}
case 6: // Return
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
GuildmasterGump.DisplayTo(from, _guild);
break;
}
}