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

@ -163,8 +163,8 @@ namespace Server.Engines.Doom
public static BaseDoor CreateDoorSet(int xDoor, int yDoor, bool doorEastToWest, int hue)
{
BaseDoor hiDoor = new MetalDoor(doorEastToWest ? DoorFacing.NorthCCW : DoorFacing.WestCW);
BaseDoor loDoor = new MetalDoor(doorEastToWest ? DoorFacing.SouthCW : DoorFacing.EastCCW);
var hiDoor = new MetalDoor(doorEastToWest ? DoorFacing.NorthCCW : DoorFacing.WestCW);
var loDoor = new MetalDoor(doorEastToWest ? DoorFacing.SouthCW : DoorFacing.EastCCW);
hiDoor.MoveToWorld(new Point3D(xDoor, yDoor, -1), Map.Malas);
loDoor.MoveToWorld(

View file

@ -321,8 +321,8 @@ public partial class LeverPuzzleController : Item
{
for (var i = 0; i < 4; i++)
{
Item l;
if ((l = GetLever(i)) != null)
var l = GetLever(i);
if (l != null)
{
l.ItemID = 0x108E;
Effects.PlaySound(l.Location, Map, 0x3E8);
@ -361,43 +361,41 @@ public partial class LeverPuzzleController : Item
{
PuzzleStatus(1050004); // The circle is the key...
}
else if (TheirKey == MyKey)
{
GenKey();
Successful = GetOccupant(0);
if (Successful != null)
{
SendLocationEffect(lp_Center, 0x1153, 0, 60, 1);
PlaySounds(lp_Center, cs1);
Effects.SendBoltEffect(Successful);
Successful.MoveToWorld(lr_Enter, Map.Malas);
m_Timer = new LampRoomTimer(this);
m_Timer.Start();
Enabled = false;
}
}
else
{
Mobile player;
if (TheirKey == MyKey)
for (var i = 0; i < 16; i++) /* Count matching SET bits, ie correct codes */
{
GenKey();
if ((Successful = player = GetOccupant(0)) != null)
if (((MyKey >> i) & 1) == 1 && ((TheirKey >> i) & 1) == 1)
{
SendLocationEffect(lp_Center, 0x1153, 0, 60, 1);
PlaySounds(lp_Center, cs1);
Effects.SendBoltEffect(player);
player.MoveToWorld(lr_Enter, Map.Malas);
m_Timer = new LampRoomTimer(this);
m_Timer.Start();
Enabled = false;
correct++;
}
}
else
PuzzleStatus(Statue_Msg[correct], correct > 0 ? correct.ToString() : null);
for (var i = 0; i < 5; i++)
{
for (var i = 0; i < 16; i++) /* Count matching SET bits, ie correct codes */
var player = GetOccupant(i);
if (player != null)
{
if (((MyKey >> i) & 1) == 1 && ((TheirKey >> i) & 1) == 1)
{
correct++;
}
}
PuzzleStatus(Statue_Msg[correct], correct > 0 ? correct.ToString() : null);
for (var i = 0; i < 5; i++)
{
if ((player = GetOccupant(i)) != null)
{
new RockTimer(player).Start();
}
new RockTimer(player).Start();
}
}
}

View file

@ -10,7 +10,7 @@ public partial class LampRoomBox : Item
{
[SerializableField(0)]
private LeverPuzzleController _controller;
private Mobile _wanderer;
private WandererOfTheVoid _wanderer;
public LampRoomBox(LeverPuzzleController controller) : base(0xe80)
{