chore: Use var everywhere (#2294)

This commit is contained in:
Kamron Batman 2025-12-27 16:47:28 -08:00 • committed by GitHub
parent 0b34cc4417
commit ebaf104935
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
267 changed files with 873 additions and 873 deletions

View file

@ -1372,7 +1372,7 @@ namespace Server.Multis
}
// Changing the interval or flipping between commands: "Forward" and "Forward One"
TimeSpan delay = TimeSpan.Zero;
var delay = TimeSpan.Zero;
if (interval.TotalMilliseconds > Math.Abs(moverTimerNext))
{
var addedDelay = (int)(interval.TotalMilliseconds - Math.Abs(moverTimerNext));
@ -1789,7 +1789,7 @@ namespace Server.Multis
list.Add(e);
}
Span<byte> moveBoatPacket = stackalloc byte[BoatPackets.GetMoveBoatHSPacketLength(list.Count)]
var moveBoatPacket = stackalloc byte[BoatPackets.GetMoveBoatHSPacketLength(list.Count)]
.InitializePacket();
// Packet must be sent before actual locations are changed

View file

@ -146,7 +146,7 @@ public abstract partial class BaseDockedBoat : Item
return;
}
Point3D p = ip switch
var p = ip switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,

View file

@ -74,7 +74,7 @@ public static class BoatPackets
return;
}
Span<byte> moveBoatPacket = stackalloc byte[GetMoveBoatHSPacketLength(entities.Count)]
var moveBoatPacket = stackalloc byte[GetMoveBoatHSPacketLength(entities.Count)]
.InitializePacket();
CreateMoveBoatHS(moveBoatPacket, boat, entities, d, speed, xOffset, yOffset);
@ -113,7 +113,7 @@ public static class BoatPackets
continue;
}
Span<byte> buffer = builder.GetSpan(OutgoingEntityPackets.MaxWorldEntityPacketLength).InitializePacket();
var buffer = builder.GetSpan(OutgoingEntityPackets.MaxWorldEntityPacketLength).InitializePacket();
var bytesWritten = OutgoingEntityPackets.CreateWorldEntity(buffer, entity, true);
builder.Advance(bytesWritten);
}

View file

@ -16,7 +16,7 @@ public class HousePlacementTarget : MultiTarget
return;
}
Point3D p = ip switch
var p = ip switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,

View file

@ -793,8 +793,8 @@ namespace Server.Multis
public List<Mobile> AvailableVendorsFor(Mobile m)
{
List<Mobile> list = new List<Mobile>();
foreach (PlayerVendor vendor in PlayerVendors)
var list = new List<Mobile>();
foreach (var vendor in PlayerVendors)
{
if (vendor.CanInteractWith(m, false))
{

View file

@ -119,7 +119,7 @@ public static class HousePackets
int z = mte.OffsetZ;
var floor = TileData.ItemTable[mte.ItemId & TileData.MaxItemValue].Height <= 0;
int plane = z switch
var plane = z switch
{
0 => 0,
7 => 1,
@ -195,7 +195,7 @@ public static class HousePackets
continue;
}
int size = i switch
var size = i switch
{
0 => planeLength,
< 5 => (width - 1) * (height - 2) * 2,
@ -208,7 +208,7 @@ public static class HousePackets
writer.Write((byte)(0x20 | i));
writer.Write((byte)size);
WritePacked(source, ref writer, out int destLength);
WritePacked(source, ref writer, out var destLength);
totalLength += 4 + destLength;
}
@ -224,7 +224,7 @@ public static class HousePackets
writer.Write((byte)(9 + index++));
writer.Write((byte)size);
WritePacked(source, ref writer, out int destLength);
WritePacked(source, ref writer, out var destLength);
totalLength += 4 + destLength;
totalPlanes++;
}

View file

@ -377,10 +377,10 @@ namespace Server.Multis
var absYOffset = Math.Abs(yOffset);
var yardPoint = new Point2D(tileX + xOffset, tileY + yOffset);
bool inSouthYard = yOffset > 0 && yOffset <= yardSize && absXOffset <= 1;
bool inEastYard = xOffset > 0 && xOffset <= yardSize && absYOffset <= 1;
bool inNorthYard = yOffset < 0 && yOffset >= -yardSize && absXOffset <= 1;
bool inWestYard = xOffset < 0 && xOffset >= -yardSize && absYOffset <= 1;
var inSouthYard = yOffset > 0 && yOffset <= yardSize && absXOffset <= 1;
var inEastYard = xOffset > 0 && xOffset <= yardSize && absYOffset <= 1;
var inNorthYard = yOffset < 0 && yOffset >= -yardSize && absXOffset <= 1;
var inWestYard = xOffset < 0 && xOffset >= -yardSize && absYOffset <= 1;
// Check each house at this point
foreach (var house in map.GetMultisInSector<BaseHouse>(yardPoint))

View file

@ -234,7 +234,7 @@ public class NewHousePlacementTarget : MultiTarget
return;
}
Point3D p = ip switch
var p = ip switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,