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
|
|
@ -86,7 +86,6 @@ public abstract partial class BaseHealer : BaseVendor
|
|||
m.PlaySound(0x1F2);
|
||||
m.FixedEffect(0x376A, 10, 16);
|
||||
|
||||
m.CloseGump<ResurrectGump>();
|
||||
m.SendGump(new ResurrectGump(m, ResurrectMessage.Healer));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ public partial class PricedHealer : BaseHealer
|
|||
m.PlaySound(0x214);
|
||||
m.FixedEffect(0x376A, 10, 16);
|
||||
|
||||
m.CloseGump<PricedResurrectGump>();
|
||||
m.SendGump(new PricedResurrectGump(this, Price));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace Server.Mobiles
|
|||
Direction = GetDirectionTo(from);
|
||||
from.PlaySound(0x1F2);
|
||||
from.FixedEffect(0x376A, 10, 16);
|
||||
from.CloseGump<ResurrectGump>();
|
||||
from.SendGump(new ResurrectGump(from, ResurrectMessage.Healer));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -900,17 +900,17 @@ namespace Server.Mobiles
|
|||
{
|
||||
Direction.North => itemIDs[0],
|
||||
Direction.South => itemIDs[0],
|
||||
Direction.East => itemIDs[1],
|
||||
Direction.West => itemIDs[1],
|
||||
_ => item.ItemID
|
||||
Direction.East => itemIDs[1],
|
||||
Direction.West => itemIDs[1],
|
||||
_ => item.ItemID
|
||||
},
|
||||
4 => dir switch
|
||||
{
|
||||
Direction.South => itemIDs[0],
|
||||
Direction.East => itemIDs[1],
|
||||
Direction.East => itemIDs[1],
|
||||
Direction.North => itemIDs[2],
|
||||
Direction.West => itemIDs[3],
|
||||
_ => item.ItemID
|
||||
Direction.West => itemIDs[3],
|
||||
_ => item.ItemID
|
||||
},
|
||||
_ => item.ItemID
|
||||
};
|
||||
|
|
@ -981,7 +981,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
if (skillId == 35)
|
||||
// AnimalTaming.DeferredTarget = true;
|
||||
// AnimalTaming.DeferredTarget = true;
|
||||
{
|
||||
AnimalTaming.DisableMessage = false;
|
||||
}
|
||||
|
|
@ -1723,22 +1723,10 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool Move(Direction d)
|
||||
{
|
||||
var ns = NetState;
|
||||
|
||||
if (ns != null)
|
||||
if (NetState != null && Alive && !NetState.CloseGump<ResurrectGump>())
|
||||
{
|
||||
if (HasGump<ResurrectGump>())
|
||||
{
|
||||
if (Alive)
|
||||
{
|
||||
CloseGump<ResurrectGump>();
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessage(500111); // You are frozen and cannot move.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
SendLocalizedMessage(500111); // You are frozen and cannot move.
|
||||
return false;
|
||||
}
|
||||
|
||||
// var speed = ComputeMovementSpeed(d);
|
||||
|
|
@ -1998,10 +1986,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
var house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (CheckAlive() && house?.IsOwner(this) == true && house.InternalizedVendors.Count > 0)
|
||||
if (CheckAlive() && house?.IsOwner(this) == true && house.InternalizedVendors.Count > 0 && NetState is NetState { } ns)
|
||||
{
|
||||
CloseGump<ReclaimVendorGump>();
|
||||
SendGump(new ReclaimVendorGump(house));
|
||||
ns.SendGump(new ReclaimVendorGump(house));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3760,8 +3747,8 @@ namespace Server.Mobiles
|
|||
var name = ammo.Name ?? ammo switch
|
||||
{
|
||||
Arrow _ => $"arrow{(ammo.Amount != 1 ? "s" : "")}",
|
||||
Bolt _ => $"bolt{(ammo.Amount != 1 ? "s" : "")}",
|
||||
_ => $"#{ammo.LabelNumber}"
|
||||
Bolt _ => $"bolt{(ammo.Amount != 1 ? "s" : "")}",
|
||||
_ => $"#{ammo.LabelNumber}"
|
||||
};
|
||||
|
||||
PlaceInBackpack(ammo);
|
||||
|
|
@ -3924,11 +3911,11 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if (Core.SE)
|
||||
if (Core.SE && NetState is { } ns)
|
||||
{
|
||||
if (!HasGump<CancelRenewInventoryInsuranceGump>())
|
||||
if (!ns.HasGump<CancelRenewInventoryInsuranceGump>())
|
||||
{
|
||||
SendGump(new CancelRenewInventoryInsuranceGump(this, null));
|
||||
ns.SendGump(new CancelRenewInventoryInsuranceGump(this, null));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -3974,15 +3961,18 @@ namespace Server.Mobiles
|
|||
|
||||
// TODO: Investigate item sorting
|
||||
|
||||
CloseGump<ItemInsuranceMenuGump>();
|
||||
if (NetState is { } ns)
|
||||
{
|
||||
ns.CloseGump<ItemInsuranceMenuGump>();
|
||||
|
||||
if (queue.Count == 0)
|
||||
{
|
||||
SendLocalizedMessage(1114915, "", 0x35); // None of your current items meet the requirements for insurance.
|
||||
}
|
||||
else
|
||||
{
|
||||
SendGump(new ItemInsuranceMenuGump(this, queue.ToArray()));
|
||||
if (queue.Count == 0)
|
||||
{
|
||||
SendLocalizedMessage(1114915, "", 0x35); // None of your current items meet the requirements for insurance.
|
||||
}
|
||||
else
|
||||
{
|
||||
ns.SendGump(new ItemInsuranceMenuGump(this, queue.ToArray()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4001,12 +3991,14 @@ namespace Server.Mobiles
|
|||
|
||||
private void ToggleQuestItemTarget()
|
||||
{
|
||||
BaseQuestGump.CloseOtherGumps(this);
|
||||
CloseGump<QuestLogDetailedGump>();
|
||||
CloseGump<QuestLogGump>();
|
||||
CloseGump<QuestOfferGump>();
|
||||
// CloseGump( typeof( UnknownGump802 ) );
|
||||
// CloseGump( typeof( UnknownGump804 ) );
|
||||
if (NetState != null)
|
||||
{
|
||||
BaseQuestGump.CloseOtherGumps(this);
|
||||
var gumps = this.GetGumps();
|
||||
gumps.Close<QuestLogDetailedGump>();
|
||||
gumps.Close<QuestLogGump>();
|
||||
gumps.Close<QuestOfferGump>();
|
||||
}
|
||||
|
||||
BeginTarget(-1, false, TargetFlags.None, ToggleQuestItem_Callback);
|
||||
SendLocalizedMessage(1072352); // Target the item you wish to toggle Quest Item status on <ESC> to cancel
|
||||
|
|
@ -4456,7 +4448,10 @@ namespace Server.Mobiles
|
|||
|
||||
private void SendYoungDeathNotice()
|
||||
{
|
||||
SendGump(new YoungDeathNoticeGump());
|
||||
if (NetState is { } ns)
|
||||
{
|
||||
ns.SendGump(new YoungDeathNoticeGump());
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSpeech(SpeechEventArgs e)
|
||||
|
|
|
|||
|
|
@ -197,13 +197,13 @@ public class TownCrierGump : Gump
|
|||
private readonly Mobile m_From;
|
||||
private readonly ITownCrierEntryList m_Owner;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public TownCrierGump(Mobile from, ITownCrierEntryList owner) : base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Owner = owner;
|
||||
|
||||
from.CloseGump<TownCrierGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
var entries = owner.Entries;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Server.Collections;
|
|||
using Server.ContextMenus;
|
||||
using Server.Engines.BulkOrders;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Mobiles
|
|||
return max;
|
||||
}
|
||||
|
||||
private void CloseClaimList(Mobile from)
|
||||
private static void CloseClaimList(Mobile from)
|
||||
{
|
||||
from.CloseGump<ClaimListGump>();
|
||||
}
|
||||
|
|
@ -427,14 +427,14 @@ namespace Server.Mobiles
|
|||
private readonly List<BaseCreature> m_List;
|
||||
private readonly AnimalTrainer m_Trainer;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public ClaimListGump(AnimalTrainer trainer, Mobile from, List<BaseCreature> list) : base(50, 50)
|
||||
{
|
||||
m_Trainer = trainer;
|
||||
m_From = from;
|
||||
m_List = list;
|
||||
|
||||
from.CloseGump<ClaimListGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 325, 50 + list.Count * 20, 9250);
|
||||
|
|
|
|||
|
|
@ -155,16 +155,17 @@ namespace Server.Mobiles
|
|||
private readonly Mobile m_From;
|
||||
private readonly HairstylistBuyInfo[] m_SellList;
|
||||
private readonly Mobile m_Vendor;
|
||||
|
||||
public override bool Singleton => true;
|
||||
public HairstylistBuyGump(Mobile from, Mobile vendor, HairstylistBuyInfo[] sellList) : base(50, 50)
|
||||
{
|
||||
m_From = from;
|
||||
m_Vendor = vendor;
|
||||
m_SellList = sellList;
|
||||
|
||||
from.CloseGump<HairstylistBuyGump>();
|
||||
from.CloseGump<ChangeHairHueGump>();
|
||||
from.CloseGump<ChangeHairstyleGump>();
|
||||
var gumps = from.GetGumps();
|
||||
|
||||
gumps.Close<ChangeHairHueGump>();
|
||||
gumps.Close<ChangeHairstyleGump>();
|
||||
|
||||
var isFemale = from.Female || from.Body.IsFemale;
|
||||
|
||||
|
|
@ -327,6 +328,8 @@ namespace Server.Mobiles
|
|||
private readonly int m_Price;
|
||||
private readonly Mobile m_Vendor;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public ChangeHairHueGump(
|
||||
Mobile from, Mobile vendor, int price, bool hair, bool facialHair,
|
||||
ChangeHairHueEntry[] entries
|
||||
|
|
@ -339,10 +342,6 @@ namespace Server.Mobiles
|
|||
m_FacialHair = facialHair;
|
||||
m_Entries = entries;
|
||||
|
||||
from.CloseGump<HairstylistBuyGump>();
|
||||
from.CloseGump<ChangeHairHueGump>();
|
||||
from.CloseGump<ChangeHairstyleGump>();
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(100, 10, 350, 370, 2600);
|
||||
|
|
@ -496,6 +495,8 @@ namespace Server.Mobiles
|
|||
private readonly int m_Price;
|
||||
private readonly Mobile m_Vendor;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public ChangeHairstyleGump(
|
||||
Mobile from, Mobile vendor, int price, bool facialHair, ChangeHairstyleEntry[] entries
|
||||
) : base(50, 50)
|
||||
|
|
@ -506,9 +507,10 @@ namespace Server.Mobiles
|
|||
m_FacialHair = facialHair;
|
||||
m_Entries = entries;
|
||||
|
||||
from.CloseGump<HairstylistBuyGump>();
|
||||
from.CloseGump<ChangeHairHueGump>();
|
||||
from.CloseGump<ChangeHairstyleGump>();
|
||||
var gumps = from.GetGumps();
|
||||
|
||||
gumps.Close<HairstylistBuyGump>();
|
||||
gumps.Close<ChangeHairHueGump>();
|
||||
|
||||
var tableWidth = m_FacialHair ? 2 : 3;
|
||||
var tableHeight = (entries.Length + tableWidth - (m_FacialHair ? 1 : 2)) / tableWidth;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.ContextMenus;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Mobiles
|
||||
|
|
|
|||
|
|
@ -513,7 +513,6 @@ namespace Server.Mobiles
|
|||
|
||||
public void BeginChangeAppearance(Mobile from)
|
||||
{
|
||||
from.CloseGump<PlayerVendorCustomizeGump>();
|
||||
from.SendGump(new PlayerVendorCustomizeGump(this, from));
|
||||
}
|
||||
|
||||
|
|
@ -682,13 +681,14 @@ namespace Server.Mobiles
|
|||
private readonly PlayerBarkeeper m_Barkeeper;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public BarkeeperTitleGump(Mobile from, PlayerBarkeeper barkeeper) : base(0, 0)
|
||||
{
|
||||
m_From = from;
|
||||
m_Barkeeper = barkeeper;
|
||||
|
||||
from.CloseGump<BarkeeperGump>();
|
||||
from.CloseGump<BarkeeperTitleGump>();
|
||||
|
||||
var entries = m_Entries;
|
||||
|
||||
|
|
@ -832,12 +832,13 @@ namespace Server.Mobiles
|
|||
private readonly PlayerBarkeeper m_Barkeeper;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public override bool Singleton => true;
|
||||
|
||||
public BarkeeperGump(Mobile from, PlayerBarkeeper barkeeper) : base(0, 0)
|
||||
{
|
||||
m_From = from;
|
||||
m_Barkeeper = barkeeper;
|
||||
|
||||
from.CloseGump<BarkeeperGump>();
|
||||
from.CloseGump<BarkeeperTitleGump>();
|
||||
|
||||
RenderBackground();
|
||||
|
|
|
|||
|
|
@ -668,19 +668,19 @@ public partial class PlayerVendor : Mobile
|
|||
|
||||
public void SendOwnerGump(Mobile to)
|
||||
{
|
||||
var gumps = to.GetGumps();
|
||||
|
||||
if (BaseHouse.NewVendorSystem)
|
||||
{
|
||||
to.CloseGump<NewPlayerVendorOwnerGump>();
|
||||
to.CloseGump<NewPlayerVendorCustomizeGump>();
|
||||
|
||||
to.SendGump(new NewPlayerVendorOwnerGump(this));
|
||||
gumps.Close<NewPlayerVendorCustomizeGump>();
|
||||
gumps.Close<NewPlayerVendorOwnerGump>();
|
||||
gumps.Send(new NewPlayerVendorOwnerGump(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
to.CloseGump<PlayerVendorOwnerGump>();
|
||||
to.CloseGump<PlayerVendorCustomizeGump>();
|
||||
|
||||
to.SendGump(new PlayerVendorOwnerGump(this));
|
||||
gumps.Close<PlayerVendorCustomizeGump>();
|
||||
gumps.Close<PlayerVendorOwnerGump>();
|
||||
gumps.Send(new PlayerVendorOwnerGump(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -723,7 +723,6 @@ public partial class PlayerVendor : Mobile
|
|||
}
|
||||
else
|
||||
{
|
||||
from.CloseGump<PlayerVendorBuyGump>();
|
||||
from.SendGump(new PlayerVendorBuyGump(vendor, vi));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,15 +203,13 @@ public partial class RentedVendor : PlayerVendor
|
|||
|
||||
if (vendor.IsOwner(from))
|
||||
{
|
||||
from.CloseGump<RenterVendorRentalGump>();
|
||||
from.SendGump(new RenterVendorRentalGump(vendor));
|
||||
from.SendGump(new RenterVendorRentalGump(vendor), true);
|
||||
|
||||
vendor.SendRentalExpireMessage(from);
|
||||
}
|
||||
else if (vendor.IsLandlord(from))
|
||||
{
|
||||
from.CloseGump<LandlordVendorRentalGump>();
|
||||
from.SendGump(new LandlordVendorRentalGump(vendor));
|
||||
from.SendGump(new LandlordVendorRentalGump(vendor), true);
|
||||
|
||||
vendor.SendRentalExpireMessage(from);
|
||||
}
|
||||
|
|
@ -313,7 +311,6 @@ public partial class RentedVendor : PlayerVendor
|
|||
{
|
||||
from.SendLocalizedMessage(1062504); // Please wait while the renter considers your offer.
|
||||
|
||||
owner.CloseGump<VendorRentalRefundGump>();
|
||||
owner.SendGump(new VendorRentalRefundGump(m_Vendor, from, amount));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue