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

@ -107,17 +107,17 @@ public abstract partial class BaseMulti : Item
return false;
}
int minX = Math.Max(bounds.X, Location.X + Components.Min.X);
int maxX = Math.Min(bounds.X + bounds.Width, Location.X + Components.Max.X);
int minY = Math.Max(bounds.Y, Location.Y + Components.Min.Y);
int maxY = Math.Min(bounds.Y + bounds.Height, Location.Y + Components.Max.Y);
var minX = Math.Max(bounds.X, Location.X + Components.Min.X);
var maxX = Math.Min(bounds.X + bounds.Width, Location.X + Components.Max.X);
var minY = Math.Max(bounds.Y, Location.Y + Components.Min.Y);
var maxY = Math.Min(bounds.Y + bounds.Height, Location.Y + Components.Max.Y);
for (int x = minX; x <= maxX; x++)
for (var x = minX; x <= maxX; x++)
{
for (int y = minY; y <= maxY; y++)
for (var y = minY; y <= maxY; y++)
{
int offsetX = x - Location.X - Components.Min.X;
int offsetY = y - Location.Y - Components.Min.Y;
var offsetX = x - Location.X - Components.Min.X;
var offsetY = y - Location.Y - Components.Min.Y;
if (offsetX < 0 || offsetY < 0 || offsetX >= Components.Width || offsetY >= Components.Height)
{

View file

@ -268,7 +268,7 @@ public partial class Item
while (_index < _items.Length)
{
Item item = _items[_index++];
var item = _items[_index++];
if (_recurse && item.LookupItems() is { Count: > 0 } items)
{
_containers.Enqueue(item);

View file

@ -131,7 +131,7 @@ public class BounceInfo
var loc = reader.ReadPoint3D();
var worldLoc = reader.ReadPoint3D();
IEntity parent = reader.ReadEntity<IEntity>();
var parent = reader.ReadEntity<IEntity>();
return new BounceInfo(map, loc, worldLoc, parent);
}
@ -353,7 +353,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
{
var worldLoc = GetWorldLocation();
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
var removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(worldLoc, GetMaxUpdateRange()))
{
@ -1139,9 +1139,9 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
if (m_Map != null)
{
Span<byte> oldWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
Span<byte> saWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
Span<byte> hsWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var oldWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var saWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var hsWorldItem = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(m_Location, GetMaxUpdateRange()))
{
@ -1194,7 +1194,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
{
if (oldLocation.m_X != 0)
{
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
var removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(oldLocation, GetMaxUpdateRange()))
{
@ -1522,7 +1522,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
{
if (m_Location.m_X != 0)
{
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
var removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(oldLocation, GetMaxUpdateRange()))
{
@ -2663,7 +2663,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
if (GetSaveFlag(flags, SaveFlag.Parent))
{
Serial parent = reader.ReadSerial();
var parent = reader.ReadSerial();
if (parent.IsMobile)
{
@ -2824,7 +2824,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
if (GetSaveFlag(flags, SaveFlag.Parent))
{
Serial parent = reader.ReadSerial();
var parent = reader.ReadSerial();
if (parent.IsMobile)
{
@ -2942,7 +2942,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
AcquireCompactInfo().m_Name = name;
}
Serial parent = reader.ReadSerial();
var parent = reader.ReadSerial();
if (parent.IsMobile)
{
@ -3296,7 +3296,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
var worldLoc = GetWorldLocation();
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(worldLoc, GetMaxUpdateRange()))
{
@ -3327,7 +3327,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
var worldLoc = GetWorldLocation();
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength(args)].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength(args)].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(worldLoc, GetMaxUpdateRange()))
{
@ -3820,7 +3820,7 @@ public partial class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropert
return;
}
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
var removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
foreach (var state in m_Map.GetClientsInRange(worldLoc, GetMaxUpdateRange()))
{

View file

@ -17,7 +17,7 @@ public static class OutgoingVirtualHairPackets
return;
}
Span<byte> buffer = stackalloc byte[EquipUpdatePacketLength].InitializePacket();
var buffer = stackalloc byte[EquipUpdatePacketLength].InitializePacket();
CreateHairEquipUpdatePacket(buffer, m, hairSerial, itemId, hue, layer);
ns.Send(buffer);
}
@ -47,7 +47,7 @@ public static class OutgoingVirtualHairPackets
return;
}
Span<byte> buffer = stackalloc byte[RemovePacketLength].InitializePacket();
var buffer = stackalloc byte[RemovePacketLength].InitializePacket();
CreateRemoveHairPacket(buffer, hairSerial);
ns.Send(buffer);
}