chore: Fixes variable types for possible performance issues (#2172)

This commit is contained in:
Kamron Batman 2025-05-01 21:54:41 -07:00 • committed by GitHub
parent 6d43f2549c
commit da517f56c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
82 changed files with 332 additions and 343 deletions

View file

@ -101,7 +101,7 @@ public partial class StrongBox : BaseContainer, IChoppable
public Container ConvertToStandardContainer()
{
Container metalBox = new MetalBox();
var metalBox = new MetalBox();
var subItems = new List<Item>(Items);
foreach (var subItem in subItems)

View file

@ -26,9 +26,11 @@ public partial class BarkeepContract : Item
{
from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish.
Mobile v = new PlayerBarkeeper(from, BaseHouse.FindHouseAt(from));
var v = new PlayerBarkeeper(from, BaseHouse.FindHouseAt(from))
{
Direction = from.Direction & Direction.Mask
};
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld(from.Location, from.Map);
Delete();
@ -68,9 +70,11 @@ public partial class BarkeepContract : Item
}
else
{
Mobile v = new PlayerBarkeeper(from, house);
var v = new PlayerBarkeeper(from, house)
{
Direction = from.Direction & Direction.Mask
};
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld(from.Location, from.Map);
Delete();

View file

@ -912,7 +912,7 @@ public partial class Corpse : Container, ICarvable
var obj = qs.FindObjective<GetDaemonBoneObjective>();
if (obj?.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
{
Item bone = new QuestDaemonBone();
var bone = new QuestDaemonBone();
if (player.PlaceInBackpack(bone))
{

View file

@ -22,9 +22,11 @@ public partial class ContractOfEmployment : Item
{
from.SendLocalizedMessage(503248); // Your godly powers allow you to place this vendor whereever you wish.
Mobile v = new PlayerVendor(from, BaseHouse.FindHouseAt(from));
var v = new PlayerVendor(from, BaseHouse.FindHouseAt(from))
{
Direction = from.Direction & Direction.Mask
};
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld(from.Location, from.Map);
v.SayTo(from, 503246); // Ah! it feels good to be working again.
@ -69,9 +71,11 @@ public partial class ContractOfEmployment : Item
}
else
{
Mobile v = new PlayerVendor(from, house);
var v = new PlayerVendor(from, house)
{
Direction = from.Direction & Direction.Mask
};
v.Direction = from.Direction & Direction.Mask;
v.MoveToWorld(from.Location, from.Map);
v.SayTo(from, 503246); // Ah! it feels good to be working again.

View file

@ -147,7 +147,7 @@ public partial class PublicMoongate : Item
foreach (var entry in list.Entries)
{
Item item = new PublicMoongate();
var item = new PublicMoongate();
item.MoveToWorld(entry.Location, list.Map);

View file

@ -41,10 +41,10 @@ public partial class Cotton : Item, IDyable
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.AddToBackpack(new SpoolOfThread(6)
{
Hue = hue
});
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
@ -89,4 +89,4 @@ public partial class Cotton : Item, IDyable
}
}
}
}
}

View file

@ -42,10 +42,10 @@ public partial class Flax : Item
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.AddToBackpack(new SpoolOfThread(6)
{
Hue = hue
});
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}

View file

@ -41,10 +41,10 @@ public partial class Wool : Item, IDyable
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn(3);
item.Hue = hue;
from.AddToBackpack(item);
from.AddToBackpack(new DarkYarn(3)
{
Hue = hue
});
from.SendLocalizedMessage(1010576); // You put the balls of yarn in your backpack.
}
@ -105,10 +105,10 @@ public partial class TaintedWool : Wool
public override void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn();
item.Hue = hue;
from.AddToBackpack(item);
from.AddToBackpack(new DarkYarn
{
Hue = hue
});
from.SendLocalizedMessage(1010574); // You put a ball of yarn in your backpack.
}
}
}

View file

@ -75,8 +75,10 @@ public abstract partial class BaseClothMaterial : Item, IDyable
}
else
{
Item create = new BoltOfCloth();
create.Hue = m_Material.Hue;
var create = new BoltOfCloth
{
Hue = m_Material.Hue
};
m_Material.Consume();
loom.Phase = 0;
@ -126,4 +128,4 @@ public partial class SpoolOfThread : BaseClothMaterial
public SpoolOfThread(int amount = 1) : base(0xFA0, amount)
{
}
}
}

View file

@ -61,7 +61,7 @@ public partial class ProspectorsTool : BaseBashing, IUsesRemaining
return;
}
HarvestSystem system = Mining.System;
var system = Mining.System;
if (!system.GetHarvestDetails(from, this, toProspect, out var tileID, out var map, out var loc, out var isLand))
{

View file

@ -257,11 +257,12 @@ public partial class WreathDeed : Item
if (itemID > 0)
{
Item addon = new WreathAddon(Hue);
var addon = new WreathAddon(Hue)
{
ItemID = itemID
};
addon.ItemID = itemID;
addon.MoveToWorld(loc, from.Map);
house.Addons.Add(addon);
Delete();
}

View file

@ -260,8 +260,7 @@ public partial class BaseTalisman : Item, IAosItem
[SerializableFieldSaveFlag(14)]
public bool ShouldSerializeSlayer() => _slayer != TalismanSlayerName.None;
private Mobile _creature;
private BaseCreature _creature;
private TimerExecutionToken _timerToken;

View file

@ -8,7 +8,8 @@ namespace Server.Items;
public partial class FlameSpurtTrap : BaseTrap
{
[SerializableField(0)]
private Item _spurt;
private Static _spurt;
private TimerExecutionToken _timerToken;
[Constructible]

View file

@ -3662,7 +3662,7 @@ public abstract partial class BaseWeapon
attacker.DoHarmful(defender);
MagerySpell sp = new DispelSpell(attacker);
var sp = new DispelSpell(attacker);
if (sp.CheckResisted(defender))
{