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

@ -6,24 +6,36 @@ namespace Server.Gumps
{
public class GuildAdminCandidatesGump : GuildMobileListGump
{
public GuildAdminCandidatesGump(Mobile from, Guild guild) : base(from, guild, true, guild.Candidates)
private GuildAdminCandidatesGump(Guild guild) : base(guild, true, guild.Candidates)
{
}
protected override void Design()
public static void DisplayTo(Mobile from, Guild guild)
{
AddHtmlLocalized(20, 10, 400, 35, 1013075); // Accept or Refuse candidates for membership
if (from?.NetState == null || guild == null)
{
return;
}
AddButton(20, 400, 4005, 4007, 1);
AddHtmlLocalized(55, 400, 245, 30, 1013076); // Accept
GuildGump.EnsureClosed(from);
from.SendGump(new GuildAdminCandidatesGump(guild));
}
AddButton(300, 400, 4005, 4007, 2);
AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
protected override void BuildHeader(ref DynamicGumpBuilder builder)
{
builder.AddHtmlLocalized(20, 10, 400, 35, 1013075); // Accept or Refuse candidates for membership
builder.AddButton(20, 400, 4005, 4007, 1);
builder.AddHtmlLocalized(55, 400, 245, 30, 1013076); // Accept
builder.AddButton(300, 400, 4005, 4007, 2);
builder.AddHtmlLocalized(335, 400, 100, 35, 1013077); // Refuse
}
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;
}
@ -32,9 +44,7 @@ namespace Server.Gumps
{
case 0:
{
GuildGump.EnsureClosed(m_Mobile);
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
GuildmasterGump.DisplayTo(from, _guild);
break;
}
case 1: // Accept
@ -45,13 +55,13 @@ namespace Server.Gumps
{
var index = switches[0];
if (index >= 0 && index < m_List.Count)
if (index >= 0 && index < _list.Count)
{
var m = m_List[index];
var m = _list[index];
if (m?.Deleted == false)
{
var guildState = PlayerState.Find(m_Guild.Leader);
var guildState = PlayerState.Find(_guild.Leader);
var targetState = PlayerState.Find(m);
var guildFaction = guildState?.Faction;
@ -61,21 +71,18 @@ namespace Server.Gumps
{
if (guildFaction == null)
{
m_Mobile.SendLocalizedMessage(
1013027
); // That player cannot join a non-faction guild.
// That player cannot join a non-faction guild.
from.SendLocalizedMessage(1013027);
}
else if (targetFaction == null)
{
m_Mobile.SendLocalizedMessage(
1013026
); // That player must be in a faction before joining this guild.
// That player must be in a faction before joining this guild.
from.SendLocalizedMessage(1013026);
}
else
{
m_Mobile.SendLocalizedMessage(
1013028
); // That person has a different faction affiliation.
// That person has a different faction affiliation.
from.SendLocalizedMessage(1013028);
}
break;
@ -84,24 +91,22 @@ namespace Server.Gumps
if (targetState?.IsLeaving == true)
{
// OSI does this quite strangely, so we'll just do it this way
m_Mobile.SendMessage(
from.SendMessage(
"That person is quitting their faction and so you may not recruit them."
);
break;
}
m_Guild.Candidates.Remove(m);
m_Guild.Accepted.Add(m);
_guild.Candidates.Remove(m);
_guild.Accepted.Add(m);
GuildGump.EnsureClosed(m_Mobile);
if (m_Guild.Candidates.Count > 0)
if (_guild.Candidates.Count > 0)
{
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
DisplayTo(from, _guild);
}
else
{
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
GuildmasterGump.DisplayTo(from, _guild);
}
}
}
@ -117,23 +122,21 @@ namespace Server.Gumps
{
var index = switches[0];
if (index >= 0 && index < m_List.Count)
if (index >= 0 && index < _list.Count)
{
var m = m_List[index];
var m = _list[index];
if (m?.Deleted == false)
{
m_Guild.Candidates.Remove(m);
_guild.Candidates.Remove(m);
GuildGump.EnsureClosed(m_Mobile);
if (m_Guild.Candidates.Count > 0)
if (_guild.Candidates.Count > 0)
{
m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild));
DisplayTo(from, _guild);
}
else
{
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
GuildmasterGump.DisplayTo(from, _guild);
}
}
}