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

@ -61,7 +61,6 @@ public partial class AnkhOfSacrificeComponent : AddonComponent
}
else
{
m.CloseGump<AnkhResurrectGump>();
m.SendGump(new AnkhResurrectGump(m, ResurrectMessage.VirtueShrine));
}
}
@ -215,7 +214,6 @@ public partial class AnkhOfSacrificeDeed : BaseAddonDeed, IRewardItem, IRewardOp
if (IsChildOf(from.Backpack))
{
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -77,7 +77,6 @@ public partial class Banner : Item, IAddon, IDyable, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
}
else
@ -133,7 +132,6 @@ public partial class BannerDeed : Item, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -154,6 +152,8 @@ public partial class BannerDeed : Item, IRewardItem
private readonly BannerDeed _banner;
public override bool Singleton => true;
public InternalGump(BannerDeed banner) : base(100, 200)
{
_banner = banner;
@ -274,7 +274,6 @@ public partial class BannerDeed : Item, IRewardItem
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(_banner, _itemID, p3d, house));
}
else if (north || west)
@ -301,6 +300,8 @@ public partial class BannerDeed : Item, IRewardItem
private readonly int m_ItemID;
private readonly Point3D m_Location;
public override bool Singleton => true;
public FacingGump(BannerDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{
m_Banner = banner;

View file

@ -136,7 +136,6 @@ public partial class RewardBrazierDeed : Item, IRewardItem
return;
}
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
@ -154,6 +153,8 @@ public partial class RewardBrazierDeed : Item, IRewardItem
{
private readonly RewardBrazierDeed _brazier;
public override bool Singleton => true;
public InternalGump(RewardBrazierDeed brazier) : base(100, 200)
{
_brazier = brazier;

View file

@ -420,7 +420,6 @@ public partial class CannonDeed : BaseAddonDeed, IRewardItem, IRewardOption
if (IsChildOf(from.Backpack))
{
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -61,7 +61,6 @@ public partial class DecorativeShield : Item, IAddon, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -113,7 +112,6 @@ public partial class DecorativeShieldDeed : Item, IRewardItem
if (IsChildOf(from.Backpack))
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -141,6 +139,8 @@ public partial class DecorativeShieldDeed : Item, IRewardItem
private readonly DecorativeShieldDeed _shield;
public override bool Singleton => true;
public InternalGump(DecorativeShieldDeed shield) : base(150, 50)
{
_shield = shield;
@ -267,7 +267,6 @@ public partial class DecorativeShieldDeed : Item, IRewardItem
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(_shield, _itemID, p3d, house));
}
else if (north || west)
@ -294,6 +293,8 @@ public partial class DecorativeShieldDeed : Item, IRewardItem
private readonly Point3D _location;
private readonly DecorativeShieldDeed _shield;
public override bool Singleton => true;
public FacingGump(DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{
_shield = shield;

View file

@ -75,7 +75,6 @@ public partial class FlamingHead : StoneFaceTrapNoDamage, IAddon, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
}
else

View file

@ -65,7 +65,6 @@ public partial class HangingSkeleton : Item, IAddon, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -129,7 +128,6 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
return;
}
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
@ -147,6 +145,8 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
{
private readonly HangingSkeletonDeed _deed;
public override bool Singleton => true;
public InternalGump(HangingSkeletonDeed skeleton) : base(100, 200)
{
_deed = skeleton;
@ -253,7 +253,6 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(_deed, _itemID, p3d, house));
}
else if (north || west)
@ -280,6 +279,8 @@ public partial class HangingSkeletonDeed : Item, IRewardItem
private readonly Point3D _location;
private readonly HangingSkeletonDeed _skeleton;
public override bool Singleton => true;
public FacingGump(HangingSkeletonDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{
_skeleton = banner;

View file

@ -368,7 +368,6 @@ public partial class MiningCartDeed : BaseAddonDeed, IRewardItem, IRewardOption
if (IsChildOf(from.Backpack))
{
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -110,7 +110,6 @@ public partial class MinotaurStatueDeed : BaseAddonDeed, IRewardItem, IRewardOpt
if (IsChildOf(from.Backpack))
{
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -50,7 +50,6 @@ public partial class PottedCactusDeed : Item, IRewardItem
if (IsChildOf(from.Backpack))
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -73,6 +72,8 @@ public partial class PottedCactusDeed : Item, IRewardItem
{
private readonly PottedCactusDeed _deed;
public override bool Singleton => true;
public InternalGump(PottedCactusDeed cactus) : base(100, 200)
{
_deed = cactus;

View file

@ -76,7 +76,6 @@ public partial class StoneAnkh : BaseAddon, IRewardItem
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
}
else
@ -122,7 +121,6 @@ public partial class StoneAnkhDeed : BaseAddonDeed, IRewardItem
if (IsChildOf(from.Backpack))
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -150,6 +148,8 @@ public partial class StoneAnkhDeed : BaseAddonDeed, IRewardItem
{
private readonly StoneAnkhDeed _deed;
public override bool Singleton => true;
public InternalGump(StoneAnkhDeed deed) : base(150, 50)
{
_deed = deed;

View file

@ -203,7 +203,6 @@ public partial class TreeStumpDeed : BaseAddonDeed, IRewardItem, IRewardOption
if (IsChildOf(from.Backpack))
{
from.CloseGump<RewardOptionGump>();
from.SendGump(new RewardOptionGump(this));
}
else

View file

@ -304,7 +304,6 @@ public partial class WallBannerDeed : BaseAddonDeed, IRewardItem
if (IsChildOf(from.Backpack))
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
}
else
@ -324,6 +323,8 @@ public partial class WallBannerDeed : BaseAddonDeed, IRewardItem
{
private readonly WallBannerDeed _wallBanner;
public override bool Singleton => true;
public InternalGump(WallBannerDeed wallBanner) : base(150, 50)
{
_wallBanner = wallBanner;

View file

@ -174,7 +174,6 @@ public partial class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem
if (targeted is BaseWeapon item)
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(_tool, item));
}
else
@ -189,6 +188,8 @@ public partial class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem
private readonly BaseWeapon _target;
private readonly WeaponEngravingTool _tool;
public override bool Singleton => true;
public InternalGump(WeaponEngravingTool tool, BaseWeapon target) : base(0, 0)
{
_tool = tool;