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:
parent
598c3c125c
commit
9c2ac2b8ea
12 changed files with 642 additions and 689 deletions
|
|
@ -6,39 +6,30 @@ namespace Server.Guilds
|
|||
{
|
||||
public class GuildInvitationRequest : BaseGuildGump
|
||||
{
|
||||
private readonly PlayerMobile m_Inviter;
|
||||
private readonly PlayerMobile _inviter;
|
||||
|
||||
public GuildInvitationRequest(PlayerMobile pm, Guild g, PlayerMobile inviter) : base(pm, g)
|
||||
{
|
||||
m_Inviter = inviter;
|
||||
|
||||
PopulateGump();
|
||||
_inviter = inviter;
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
protected override bool ShowTabStrip => false;
|
||||
|
||||
AddBackground(0, 0, 350, 170, 0x2422);
|
||||
AddHtmlLocalized(
|
||||
25,
|
||||
20,
|
||||
300,
|
||||
45,
|
||||
1062946,
|
||||
0x0,
|
||||
true
|
||||
); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
|
||||
AddHtml(25, 75, 300, 25, $"<center>{guild.Name}</center>", true);
|
||||
AddButton(265, 130, 0xF7, 0xF8, 1);
|
||||
AddButton(195, 130, 0xF2, 0xF1, 0);
|
||||
AddButton(20, 130, 0xD2, 0xD3, 2);
|
||||
AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0); // <i>Ignore Guild Invites</i>
|
||||
protected override void BuildContent(ref DynamicGumpBuilder builder)
|
||||
{
|
||||
builder.AddBackground(0, 0, 350, 170, 0x2422);
|
||||
// <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
|
||||
builder.AddHtmlLocalized(25, 20, 300, 45, 1062946, 0x0, true);
|
||||
builder.AddHtml(25, 75, 300, 25, $"<center>{Guild.Name}</center>", background: true);
|
||||
builder.AddButton(265, 130, 0xF7, 0xF8, 1);
|
||||
builder.AddButton(195, 130, 0xF2, 0xF1, 0);
|
||||
builder.AddButton(20, 130, 0xD2, 0xD3, 2);
|
||||
builder.AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||
{
|
||||
if (guild.Disbanded || player.Guild != null)
|
||||
if (Guild.Disbanded || Player.Guild != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -47,27 +38,23 @@ namespace Server.Guilds
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Inviter.SendLocalizedMessage(
|
||||
1063250,
|
||||
$"{player.Name}\t{guild.Name}"
|
||||
); // ~1_val~ has declined your invitation to join ~2_val~.
|
||||
// ~1_val~ has declined your invitation to join ~2_val~.
|
||||
_inviter.SendLocalizedMessage(1063250, $"{Player.Name}\t{Guild.Name}");
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
guild.AddMember(player);
|
||||
player.SendLocalizedMessage(1063056, guild.Name); // You have joined ~1_val~.
|
||||
m_Inviter.SendLocalizedMessage(
|
||||
1063249,
|
||||
$"{player.Name}\t{guild.Name}"
|
||||
); // ~1_val~ has accepted your invitation to join ~2_val~.
|
||||
Guild.AddMember(Player);
|
||||
Player.SendLocalizedMessage(1063056, Guild.Name); // You have joined ~1_val~.
|
||||
// ~1_val~ has accepted your invitation to join ~2_val~.
|
||||
_inviter.SendLocalizedMessage(1063249, $"{Player.Name}\t{Guild.Name}");
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
player.AcceptGuildInvites = false;
|
||||
player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
|
||||
Player.AcceptGuildInvites = false;
|
||||
Player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue