feat: Moves gumps out of the core (#1916)

> [!Important]
> **Developer Note**
> This code change will **completely move gumps out of the core**


### Summary

- Adds `GetGumps()` convenience which exposes methods to Find/Close/Send multiple gumps. This helper is a performance improvement by eliminating the Dictionary<Player, List> lookup for gumps.
This commit is contained in:
Kamron Batman 2024-08-09 19:07:32 -07:00 • committed by GitHub
parent 40d99f6d1c
commit 8282b00ca2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
246 changed files with 1722 additions and 1383 deletions

View file

@ -50,7 +50,6 @@ namespace Server.Engines.ConPVP
return false;
}
from.CloseGump<ArenaGump>();
from.SendGump(new ArenaGump(from, this));
if (!from.Hidden || from.AccessLevel == AccessLevel.Player)
@ -84,6 +83,8 @@ namespace Server.Engines.ConPVP
private int m_ColumnX = 12;
public override bool Singleton => true;
public ArenaGump(Mobile from, ArenasMoongate gate) : base(50, 50)
{
m_From = from;

View file

@ -19,6 +19,8 @@ namespace Server.Engines.ConPVP
private readonly Mobile m_Registrar;
private readonly Tournament m_Tournament;
public override bool Singleton => true;
public ConfirmSignupGump(Mobile from, Mobile registrar, Tournament tourney, List<Mobile> players) : base(50, 50)
{
m_From = from;
@ -26,10 +28,11 @@ namespace Server.Engines.ConPVP
m_Tournament = tourney;
m_Players = players;
m_From.CloseGump<AcceptTeamGump>();
m_From.CloseGump<AcceptDuelGump>();
m_From.CloseGump<DuelContextGump>();
m_From.CloseGump<ConfirmSignupGump>();
var gumps = m_From.GetGumps();
gumps.Close<AcceptTeamGump>();
gumps.Close<AcceptDuelGump>();
gumps.Close<DuelContextGump>();
var ruleset = tourney.Ruleset;
var basedef = ruleset.Base;

View file

@ -5,14 +5,17 @@ namespace Server.Engines.ConPVP
{
public class DuelContextGump : Gump
{
public override bool Singleton => true;
public DuelContextGump(Mobile from, DuelContext context) : base(50, 50)
{
From = from;
Context = context;
from.CloseGump<RulesetGump>();
from.CloseGump<DuelContextGump>();
from.CloseGump<ParticipantGump>();
var gumps = from.GetGumps();
gumps.Close<RulesetGump>();
gumps.Close<ParticipantGump>();
var count = context.Participants.Count;

View file

@ -52,8 +52,7 @@ namespace Server.Engines.ConPVP
if (ladder != null)
{
from.CloseGump<LadderGump>();
from.SendGump(new LadderGump(ladder));
from.SendGump(new LadderGump(ladder), true);
}
}
else

View file

@ -7,15 +7,18 @@ namespace Server.Engines.ConPVP
{
public class ParticipantGump : Gump
{
public override bool Singleton => true;
public ParticipantGump(Mobile from, DuelContext context, Participant p) : base(50, 50)
{
From = from;
Context = context;
Participant = p;
from.CloseGump<RulesetGump>();
from.CloseGump<DuelContextGump>();
from.CloseGump<ParticipantGump>();
var gumps = from.GetGumps();
gumps.Close<RulesetGump>();
gumps.Close<DuelContextGump>();
var count = p.Players.Length;

View file

@ -12,6 +12,8 @@ namespace Server.Engines.ConPVP
private readonly bool m_ReadOnly;
private readonly Ruleset m_Ruleset;
public override bool Singleton => true;
public RulesetGump(Mobile from, Ruleset ruleset, RulesetLayout page, DuelContext duelContext, bool readOnly = false)
: base(readOnly ? 310 : 50, 50)
{
@ -23,9 +25,10 @@ namespace Server.Engines.ConPVP
Draggable = !readOnly;
from.CloseGump<RulesetGump>();
from.CloseGump<DuelContextGump>();
from.CloseGump<ParticipantGump>();
var gumps = from.GetGumps();
gumps.Close<DuelContextGump>();
gumps.Close<ParticipantGump>();
var depthCounter = page;