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:
parent
70a69d3efe
commit
15e506ffc2
33 changed files with 848 additions and 761 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
|
||||
|
|
@ -5,55 +6,49 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GuildNamePrompt : Prompt
|
||||
{
|
||||
private readonly Guild m_Guild;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly Guild _guild;
|
||||
|
||||
public GuildNamePrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildNamePrompt(Mobile m, Guild g) => _guild = g;
|
||||
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
if (GuildGump.BadLeader(from, _guild))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
GuildmasterGump.DisplayTo(from, _guild);
|
||||
}
|
||||
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
if (GuildGump.BadLeader(from, _guild))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
text = text.Trim();
|
||||
var textSpan = text.AsSpan().Trim();
|
||||
|
||||
if (text.Length > 40)
|
||||
if (textSpan.Length > 40)
|
||||
{
|
||||
text = text[..40];
|
||||
textSpan = textSpan[..40];
|
||||
}
|
||||
|
||||
if (text.Length > 0)
|
||||
if (textSpan.Length > 0)
|
||||
{
|
||||
if (BaseGuild.FindByName(text) != null)
|
||||
if (BaseGuild.FindByName(textSpan) != null)
|
||||
{
|
||||
m_Mobile.SendMessage($"{text} conflicts with the name of an existing guild.");
|
||||
from.SendMessage($"{textSpan} conflicts with the name of an existing guild.");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Name = text;
|
||||
m_Guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
||||
text = textSpan.ToString();
|
||||
_guild.Name = text;
|
||||
_guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
GuildmasterGump.DisplayTo(from, _guild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue