## 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(...)`.
80 lines
2.4 KiB
C#
80 lines
2.4 KiB
C#
using Server.Guilds;
|
|
using Server.Network;
|
|
|
|
namespace Server.Gumps
|
|
{
|
|
public class GuildAcceptWarGump : GuildListGump
|
|
{
|
|
private GuildAcceptWarGump(Guild guild) : base(guild, true, guild.WarInvitations)
|
|
{
|
|
}
|
|
|
|
public static void DisplayTo(Mobile from, Guild guild)
|
|
{
|
|
if (from?.NetState == null || guild == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
GuildGump.EnsureClosed(from);
|
|
from.SendGump(new GuildAcceptWarGump(guild));
|
|
}
|
|
|
|
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
|
{
|
|
builder.AddHtmlLocalized(20, 10, 400, 35, 1011147); // Select the guild to accept the invitations:
|
|
|
|
builder.AddButton(20, 400, 4005, 4007, 1);
|
|
builder.AddHtmlLocalized(55, 400, 245, 30, 1011100); // Accept war invitations.
|
|
|
|
builder.AddButton(300, 400, 4005, 4007, 2);
|
|
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
|
}
|
|
|
|
public override void OnResponse(NetState state, in RelayInfo info)
|
|
{
|
|
var from = state.Mobile;
|
|
if (GuildGump.BadLeader(from, _guild))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (info.ButtonID == 1)
|
|
{
|
|
var switches = info.Switches;
|
|
|
|
if (switches.Length > 0)
|
|
{
|
|
var index = switches[0];
|
|
|
|
if (index >= 0 && index < _list.Count)
|
|
{
|
|
var g = _list[index];
|
|
|
|
if (g != null)
|
|
{
|
|
_guild.WarInvitations.Remove(g);
|
|
g.WarDeclarations.Remove(_guild);
|
|
|
|
_guild.AddEnemy(g);
|
|
_guild.GuildMessage(1018020, true, $"{g.Name} ({g.Abbreviation})");
|
|
|
|
if (_guild.WarInvitations.Count > 0)
|
|
{
|
|
DisplayTo(from, _guild);
|
|
}
|
|
else
|
|
{
|
|
GuildmasterGump.DisplayTo(from, _guild);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (info.ButtonID == 2)
|
|
{
|
|
GuildmasterGump.DisplayTo(from, _guild);
|
|
}
|
|
}
|
|
}
|
|
}
|