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
|
|
@ -7,25 +7,36 @@ namespace Server.Gumps
|
|||
{
|
||||
public class GuildDeclareWarGump : GuildListGump
|
||||
{
|
||||
public GuildDeclareWarGump(Mobile from, Guild guild, List<Guild> list)
|
||||
: base(from, guild, true, list)
|
||||
private GuildDeclareWarGump(Guild guild, List<Guild> list) : base(guild, true, list)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
public static void DisplayTo(Mobile from, Guild guild, List<Guild> list)
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011065); // Select the guild you wish to declare war on.
|
||||
if (from?.NetState == null || guild == null || list == null || list.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011068); // Send the challenge!
|
||||
GuildGump.EnsureClosed(from);
|
||||
from.SendGump(new GuildDeclareWarGump(guild, list));
|
||||
}
|
||||
|
||||
AddButton(300, 400, 4005, 4007, 2);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
protected override void BuildHeader(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
builder.AddHtmlLocalized(20, 10, 400, 35, 1011065); // Select the guild you wish to declare war on.
|
||||
|
||||
builder.AddButton(20, 400, 4005, 4007, 1);
|
||||
builder.AddHtmlLocalized(55, 400, 245, 30, 1011068); // Send the challenge!
|
||||
|
||||
builder.AddButton(300, 400, 4005, 4007, 2);
|
||||
builder.AddHtmlLocalized(335, 400, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -38,52 +49,50 @@ namespace Server.Gumps
|
|||
{
|
||||
var index = switches[0];
|
||||
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
if (index >= 0 && index < _list.Count)
|
||||
{
|
||||
var g = m_List[index];
|
||||
var g = _list[index];
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
if (g == m_Guild)
|
||||
if (g == _guild)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself!
|
||||
from.SendLocalizedMessage(501184); // You cannot declare war against yourself!
|
||||
}
|
||||
else if (g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g) ||
|
||||
m_Guild.IsWar(g))
|
||||
else if (g.WarInvitations.Contains(_guild) && _guild.WarDeclarations.Contains(g) ||
|
||||
_guild.IsWar(g))
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild.
|
||||
from.SendLocalizedMessage(501183); // You are already at war with that guild.
|
||||
}
|
||||
else if (Faction.Find(m_Guild.Leader) != null)
|
||||
else if (Faction.Find(_guild.Leader) != null)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
|
||||
from.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_Guild.WarDeclarations.Contains(g))
|
||||
if (!_guild.WarDeclarations.Contains(g))
|
||||
{
|
||||
m_Guild.WarDeclarations.Add(g);
|
||||
_guild.WarDeclarations.Add(g);
|
||||
// Guild Message: Your guild has sent an invitation for war:
|
||||
m_Guild.GuildMessage(1018019, true, $"{g.Name} ({g.Abbreviation})");
|
||||
_guild.GuildMessage(1018019, true, $"{g.Name} ({g.Abbreviation})");
|
||||
}
|
||||
|
||||
if (!g.WarInvitations.Contains(m_Guild))
|
||||
if (!g.WarInvitations.Contains(_guild))
|
||||
{
|
||||
g.WarInvitations.Add(m_Guild);
|
||||
g.WarInvitations.Add(_guild);
|
||||
// Guild Message: Your guild has received an invitation to war:
|
||||
g.GuildMessage(1018021, true, $"{m_Guild.Name} ({m_Guild.Abbreviation})");
|
||||
g.GuildMessage(1018021, true, $"{_guild.Name} ({_guild.Abbreviation})");
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
GuildWarAdminGump.DisplayTo(from, _guild);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
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