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:
parent
40d99f6d1c
commit
8282b00ca2
246 changed files with 1722 additions and 1383 deletions
|
|
@ -13,6 +13,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using Server.Accounting;
|
||||
using Server.Collections;
|
||||
using Server.Diagnostics;
|
||||
using Server.HuePickers;
|
||||
using Server.Items;
|
||||
using Server.Logging;
|
||||
using Server.Menus;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Concurrent;
|
||||
|
|
@ -23,14 +30,6 @@ using System.Net.Sockets;
|
|||
using System.Network;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Server.Accounting;
|
||||
using Server.Collections;
|
||||
using Server.Diagnostics;
|
||||
using Server.Gumps;
|
||||
using Server.HuePickers;
|
||||
using Server.Items;
|
||||
using Server.Logging;
|
||||
using Server.Menus;
|
||||
|
||||
namespace Server.Network;
|
||||
|
||||
|
|
@ -46,7 +45,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
private static readonly TimeSpan ConnectingSocketIdleLimit = TimeSpan.FromMilliseconds(5000); // 5 seconds
|
||||
private const int RecvPipeSize = 1024 * 64;
|
||||
private const int SendPipeSize = 1024 * 256;
|
||||
private const int GumpCap = 512;
|
||||
private const int HuePickerCap = 512;
|
||||
private const int MenuCap = 512;
|
||||
private const int PacketPerSecondThreshold = 3000;
|
||||
|
|
@ -126,7 +124,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
{
|
||||
Connection = connection;
|
||||
Seeded = false;
|
||||
Gumps = [];
|
||||
HuePickers = [];
|
||||
Menus = [];
|
||||
Trades = [];
|
||||
|
|
@ -226,8 +223,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
|
||||
public int Sequence { get; set; }
|
||||
|
||||
public List<BaseGump> Gumps { get; private set; }
|
||||
|
||||
public List<HuePicker> HuePickers { get; private set; }
|
||||
|
||||
public List<IMenu> Menus { get; private set; }
|
||||
|
|
@ -419,36 +414,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
HuePickers?.Clear();
|
||||
}
|
||||
|
||||
public void AddGump(BaseGump gump)
|
||||
{
|
||||
Gumps ??= [];
|
||||
|
||||
if (Gumps.Count < GumpCap)
|
||||
{
|
||||
Gumps.Add(gump);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogInfo("Exceeded gump cap, disconnecting...");
|
||||
Disconnect("Exceeded gump cap.");
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveGump(BaseGump gump)
|
||||
{
|
||||
Gumps?.Remove(gump);
|
||||
}
|
||||
|
||||
public void RemoveGump(int index)
|
||||
{
|
||||
Gumps?.RemoveAt(index);
|
||||
}
|
||||
|
||||
public void ClearGumps()
|
||||
{
|
||||
Gumps?.Clear();
|
||||
}
|
||||
|
||||
public void LaunchBrowser(string url)
|
||||
{
|
||||
this.SendMessageLocalized(Serial.MinusOne, -1, MessageType.Label, 0x35, 3, 501231);
|
||||
|
|
@ -1217,7 +1182,6 @@ public partial class NetState : IComparable<NetState>, IValueLinkListNode<NetSta
|
|||
|
||||
var a = Account;
|
||||
|
||||
Gumps.Clear();
|
||||
Menus.Clear();
|
||||
HuePickers.Clear();
|
||||
Account = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue