## 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(...)`.
65 lines
2 KiB
C#
65 lines
2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Server.Guilds;
|
|
|
|
namespace Server.Gumps
|
|
{
|
|
public abstract class GuildMobileListGump : DynamicGump
|
|
{
|
|
protected Guild _guild;
|
|
protected List<Mobile> _list;
|
|
private readonly bool _radio;
|
|
|
|
public override bool Singleton => true;
|
|
|
|
protected GuildMobileListGump(Guild guild, bool radio, List<Mobile> list) : base(20, 30)
|
|
{
|
|
_guild = guild;
|
|
_radio = radio;
|
|
_list = new List<Mobile>(list);
|
|
}
|
|
|
|
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);
|
|
|
|
BuildHeader(ref builder);
|
|
|
|
for (var i = 0; i < _list.Count; ++i)
|
|
{
|
|
if (i % 11 == 0)
|
|
{
|
|
if (i != 0)
|
|
{
|
|
builder.AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
|
builder.AddHtmlLocalized(335, 370, 300, 35, 1011066); // Next page
|
|
}
|
|
|
|
builder.AddPage(i / 11 + 1);
|
|
|
|
if (i != 0)
|
|
{
|
|
builder.AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
|
builder.AddHtmlLocalized(55, 370, 300, 35, 1011067); // Previous page
|
|
}
|
|
}
|
|
|
|
if (_radio)
|
|
{
|
|
builder.AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
|
}
|
|
|
|
var m = _list[i];
|
|
|
|
var name = m.Name;
|
|
builder.AddLabel(_radio ? 55 : 20, 35 + i % 11 * 30, 0, name != null ? name.AsSpan().Trim() : "(empty)");
|
|
}
|
|
}
|
|
|
|
protected abstract void BuildHeader(ref DynamicGumpBuilder builder);
|
|
}
|
|
}
|