perf: Migrates New Guild System gumps from legacy Gump. (#2422)

## Summary

Migrates the eight concrete New Guild System gumps (CreateGuild, GuildInfo,
GuildMemberInfo, GuildRoster, GuildDiplomacy, WarDeclaration,
GuildAdvancedSearch, GuildInvitationRequest) and three abstract bases
(BaseGuildGump, BaseGuildListGump, OtherGuildInfo) from the legacy `Gump`
class to `DynamicGump`. Layout work moves from constructor-side `AddX(...)`
calls into `BuildLayout(ref DynamicGumpBuilder builder)` — the abstract
`BaseGuildGump` now provides a `BuildContent` callout for shared
tab-strip chrome, and `BaseGuildListGump<T>` adds another
`BuildListExtras` hook so subclasses can paint highlighted titles after
the filter/sort/pagination chrome.

The headline win is the **self-refresh pattern** on the list gumps and
diplomacy advanced search. Previously each filter/sort/back/forward
click allocated a brand new gump via `GetResentGump`. After migration,
those handlers mutate `_filter`, `_startNumber`, `_comparer`, `_ascending`,
or `_display` on the existing gump and call `from.SendGump(this)`,
letting the singleton path in `NetStateGumps.Send` swap in the same
instance with the new layout. The original list is preserved separately
from the per-render filtered/sorted `_displayList`, so refreshes pick up
the latest state without losing the source list.

All guild gumps deal with per-instance dynamic strings (guild names,
member names, war declarations, alliance names), which would defeat
`StaticGump<T>` caching per the cliloc rule, so every concrete subclass
migrates to `DynamicGump`. `AllianceRosterGump` (in `Misc/Guild.cs`)
is a `GuildDiplomacyGump` subclass and inherits the new behavior; its
unused override and stored alliance reference were dropped along with
the now-obsolete `GetResentGump` abstract.
This commit is contained in:
Kamron Batman 2026-05-03 00:09:22 -07:00 • committed by GitHub
parent 598c3c125c
commit 9c2ac2b8ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 642 additions and 689 deletions

View file

@ -8,55 +8,53 @@ namespace Server.Guilds
public class GuildAdvancedSearchGump : BaseGuildGump
{
private readonly SearchSelectionCallback m_Callback;
private readonly GuildDisplayType m_Display;
private readonly SearchSelectionCallback _callback;
private readonly GuildDisplayType _display;
public GuildAdvancedSearchGump(PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback)
: base(pm, g)
{
m_Callback = callback;
m_Display = display;
PopulateGump();
_callback = callback;
_display = display;
}
public override void PopulateGump()
protected override void BuildContent(ref DynamicGumpBuilder builder)
{
base.PopulateGump();
builder.AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF); // Diplomacy
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF); // Diplomacy
builder.AddHtmlLocalized(65, 80, 480, 26, 1063124, 0xF, true); // <i>Advanced Search Options</i>
AddHtmlLocalized(65, 80, 480, 26, 1063124, 0xF, true); // <i>Advanced Search Options</i>
AddHtmlLocalized(
// Showing All Guilds/w/Relation/Waiting Relation
builder.AddHtmlLocalized(
65,
110,
480,
26,
1063136 + (int)m_Display,
1063136 + (int)_display,
0xF
); // Showing All Guilds/w/Relation/Waiting Relation
);
AddGroup(1);
AddRadio(75, 140, 0xD2, 0xD3, false, 2);
AddHtmlLocalized(105, 140, 200, 26, 1063006, 0x0); // Show Guilds with Relationship
AddRadio(75, 170, 0xD2, 0xD3, false, 1);
AddHtmlLocalized(105, 170, 200, 26, 1063005, 0x0); // Show Guilds Awaiting Action
AddRadio(75, 200, 0xD2, 0xD3, false, 0);
AddHtmlLocalized(105, 200, 200, 26, 1063007, 0x0); // Show All Guilds
builder.AddGroup(1);
builder.AddRadio(75, 140, 0xD2, 0xD3, false, 2);
builder.AddHtmlLocalized(105, 140, 200, 26, 1063006, 0x0); // Show Guilds with Relationship
builder.AddRadio(75, 170, 0xD2, 0xD3, false, 1);
builder.AddHtmlLocalized(105, 170, 200, 26, 1063005, 0x0); // Show Guilds Awaiting Action
builder.AddRadio(75, 200, 0xD2, 0xD3, false, 0);
builder.AddHtmlLocalized(105, 200, 200, 26, 1063007, 0x0); // Show All Guilds
AddBackground(450, 370, 100, 26, 0x2486);
AddButton(455, 375, 0x845, 0x846, 5);
AddHtmlLocalized(480, 373, 60, 26, 1006044, 0x0); // OK
AddBackground(340, 370, 100, 26, 0x2486);
AddButton(345, 375, 0x845, 0x846, 0);
AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0); // Cancel
builder.AddBackground(450, 370, 100, 26, 0x2486);
builder.AddButton(455, 375, 0x845, 0x846, 5);
builder.AddHtmlLocalized(480, 373, 60, 26, 1006044, 0x0); // OK
builder.AddBackground(340, 370, 100, 26, 0x2486);
builder.AddButton(345, 375, 0x845, 0x846, 0);
builder.AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0); // Cancel
}
public override void OnResponse(NetState sender, in RelayInfo info)
{
base.OnResponse(sender, info);
if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, guild))
if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, Guild))
{
return;
}
@ -68,7 +66,7 @@ namespace Server.Guilds
if (info.IsSwitched(i))
{
var display = (GuildDisplayType)i;
m_Callback(display);
_callback(display);
break;
}
}