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

@ -86,28 +86,28 @@ public partial class Account
var length = reader.ReadInt();
_mobiles = new Mobile[length];
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
_mobiles[i] = reader.ReadEntity<Mobile>();
}
length = reader.ReadInt();
_comments = length > 0 ? new List<AccountComment>(length) : null;
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
_comments!.Add(new AccountComment(reader));
}
length = reader.ReadInt();
_tags = length > 0 ? new List<AccountTag>(length) : null;
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
_tags!.Add(new AccountTag(reader));
}
length = reader.ReadInt();
_loginIPs = new IPAddress[length];
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
if (version < 2)
{
@ -123,7 +123,7 @@ public partial class Account
}
length = reader.ReadInt();
for (int i = 0; i < length; i++)
for (var i = 0; i < length; i++)
{
reader.ReadString(); // IP Restrictions
}

View file

@ -1134,7 +1134,7 @@ public partial class Account : IAccount, IComparable<Account>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool MoveNext()
{
Mobile[] localList = _mobiles;
var localList = _mobiles;
while ((uint)_index < (uint)localList.Length)
{

View file

@ -30,7 +30,7 @@ public class HashAlgorithmPasswordProtection : IPasswordProtection
public string EncryptPassword(string plainPassword)
{
byte[] bytes = plainPassword.AsSpan(0, Math.Min(256, plainPassword.Length)).GetBytesAscii();
var bytes = plainPassword.AsSpan(0, Math.Min(256, plainPassword.Length)).GetBytesAscii();
return _hashAlgorithm.ComputeHash(bytes).ToHexString();
}

View file

@ -79,7 +79,7 @@ public static class AssistantHandler
private static void HandshakeResponse(NetState state, SpanReader reader)
{
Mobile m = state.Mobile;
var m = state.Mobile;
if (m == null || !_handshakes.TryGetValue(m, out var t))
{

View file

@ -113,41 +113,41 @@ public class AddonGenerator
(start.Y, end.Y) = (end.Y, start.Y);
}
Point2D startPoint2D = new Point2D(start.X, start.Y);
Point2D endPoint2D = new Point2D(end.X, end.Y);
Rectangle2D bounds = new Rectangle2D(startPoint2D, endPoint2D);
var startPoint2D = new Point2D(start.X, start.Y);
var endPoint2D = new Point2D(end.X, end.Y);
var bounds = new Rectangle2D(startPoint2D, endPoint2D);
string name = pickerState.Name;
string ns = pickerState.Namespace;
bool items = pickerState.Items;
bool statics = pickerState.Statics;
bool range = pickerState.Range;
sbyte min = pickerState.Min;
sbyte max = pickerState.Max;
var name = pickerState.Name;
var ns = pickerState.Namespace;
var items = pickerState.Items;
var statics = pickerState.Statics;
var range = pickerState.Range;
var min = pickerState.Min;
var max = pickerState.Max;
// Get center
Point3D center = new Point3D();
var center = new Point3D();
center.Z = 127;
int x1 = bounds.End.X;
int y1 = bounds.End.Y;
int x2 = bounds.Start.X;
int y2 = bounds.Start.Y;
var x1 = bounds.End.X;
var y1 = bounds.End.Y;
var x2 = bounds.Start.X;
var y2 = bounds.Start.Y;
Dictionary<Point2D, List<StaticTile>> tiles = new Dictionary<Point2D, List<StaticTile>>();
var tiles = new Dictionary<Point2D, List<StaticTile>>();
if (statics)
{
for (int x = start.X; x <= end.X; x++)
for (var x = start.X; x <= end.X; x++)
{
for (int y = start.Y; y <= end.Y; y++)
for (var y = start.Y; y <= end.Y; y++)
{
TileMatrix tileMatrix = map.Tiles;
var tileMatrix = map.Tiles;
List<StaticTile> list = [];
if (items)
{
foreach (Item item in map.GetItemsAt(x, y))
foreach (var item in map.GetItemsAt(x, y))
{
if (range && item.Z >= min && item.Z <= max)
{
@ -174,7 +174,7 @@ public class AddonGenerator
using var target = PooledRefList<Item>.Create();
foreach (Static s in map.GetItemsInBounds<Static>(bounds))
foreach (var s in map.GetItemsInBounds<Static>(bounds))
{
if (!range || s.Z >= min && s.Z <= max)
{
@ -189,7 +189,7 @@ public class AddonGenerator
}
// Get correct bounds
foreach (Item item in target)
foreach (var item in target)
{
if (item.Z < center.Z)
{
@ -202,11 +202,11 @@ public class AddonGenerator
y2 = Math.Max(y2, item.Y);
}
foreach (Point2D p in tiles.Keys)
foreach (var p in tiles.Keys)
{
List<StaticTile> list = tiles[p];
var list = tiles[p];
foreach (StaticTile t in list)
foreach (var t in list)
{
if (t.Z < center.Z)
{
@ -225,27 +225,27 @@ public class AddonGenerator
using var sb = ValueStringBuilder.Create();
foreach (Point2D p in tiles.Keys)
foreach (var p in tiles.Keys)
{
List<StaticTile> list = tiles[p];
var list = tiles[p];
int xOffset = p.X - center.X;
int yOffset = p.Y - center.Y;
var xOffset = p.X - center.X;
var yOffset = p.Y - center.Y;
foreach (StaticTile t in list)
foreach (var t in list)
{
int zOffset = t.Z - center.Z;
int id = t.ID - 16384;
var zOffset = t.Z - center.Z;
var id = t.ID - 16384;
sb.Append($" AddComponent(new AddonComponent({id}), {xOffset}, {yOffset}, {zOffset});\n");
}
}
foreach (Item item in target)
foreach (var item in target)
{
int xOffset = item.X - center.X;
int yOffset = item.Y - center.Y;
int zOffset = item.Z - center.Z;
var xOffset = item.X - center.X;
var yOffset = item.Y - center.Y;
var zOffset = item.Z - center.Z;
var light = (item.ItemData.Flags & TileFlag.LightSource) == TileFlag.LightSource ? item.Light : LightType.Empty;
var hue = item.Hue;
@ -275,13 +275,13 @@ public class AddonGenerator
sb.Append(" )\n");
}
string output = _template.Replace("{name}", name);
var output = _template.Replace("{name}", name);
output = output.Replace("{namespace}", ns);
output = output.Replace("{components}", sb.ToString());
var path = Path.Combine(_outputDirectory, $"{name}Addon.cs");
string folder = Path.GetDirectoryName(path);
var folder = Path.GetDirectoryName(path);
PathUtility.EnsureDirectory(folder);
using var writer = new StreamWriter(path, false);
@ -374,13 +374,13 @@ public class AddonGenerator
var fail = !_state.Items && !_state.Statics;
if (!sbyte.TryParse(info.GetTextEntry(2), out sbyte min))
if (!sbyte.TryParse(info.GetTextEntry(2), out var min))
{
min = sbyte.MinValue;
fail = true;
}
if (!sbyte.TryParse(info.GetTextEntry(3), out sbyte max))
if (!sbyte.TryParse(info.GetTextEntry(3), out var max))
{
max = sbyte.MaxValue;
fail = true;

View file

@ -42,7 +42,7 @@ namespace Server
return;
}
Point3D p = ip switch
var p = ip switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,

View file

@ -36,7 +36,7 @@ namespace Server.Commands.Generic
return true;
}
Mobile mob = obj switch
var mob = obj switch
{
Mobile m => m,
Item item => item.RootParent as Mobile,

View file

@ -551,7 +551,7 @@ namespace Server.Commands.Generic
return;
}
Point3D p = ip switch
var p = ip switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,

View file

@ -267,7 +267,7 @@ namespace Server.Commands.Generic
{
var inverse = false;
Type type = m_IgnoreCase ? typeof(InsensitiveStringHelpers) : typeof(OrdinalStringHelpers);
var type = m_IgnoreCase ? typeof(InsensitiveStringHelpers) : typeof(OrdinalStringHelpers);
string methodName;
switch (m_Operator)

View file

@ -15,7 +15,7 @@ namespace Server.Commands.Generic
{
if (e.Length >= 2)
{
Serial serial = (Serial)e.GetUInt32(0);
var serial = (Serial)e.GetUInt32(0);
object obj = null;

View file

@ -300,7 +300,7 @@ namespace Server.Commands
$"{m.AccessLevel} {CommandLogging.Format(m)} playing sound {index} (toAll={toAll})"
);
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
var buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
foreach (var state in m.GetClientsInRange(12))
{

View file

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

View file

@ -118,7 +118,7 @@ public static class CAGLoader
if (cagObj.Hue == null)
{
int hue = item.Hue & 0x7FFF;
var hue = item.Hue & 0x7FFF;
hue = (hue & 0x4000) != 0 ? 0 : hue;
cagObj.Hue = hue == 0 ? null : hue;
}
@ -133,7 +133,7 @@ public static class CAGLoader
if (cagObj.Hue == null)
{
int hue = m.Hue & 0x7FFF;
var hue = m.Hue & 0x7FFF;
hue = (hue & 0x4000) != 0 ? 0 : hue;
cagObj.Hue = hue == 0 ? null : hue;
}

View file

@ -65,7 +65,7 @@ public static class StaffAccess
}
var accessLevelArgument = e.GetString(0)?.Trim().ToLower();
AccessLevel newAccessLevel = AccessLevel.Player;
var newAccessLevel = AccessLevel.Player;
var validAccessLevel = !string.IsNullOrEmpty(accessLevelArgument) &&
_accessLevelByString.TryGetValue(accessLevelArgument, out newAccessLevel);

View file

@ -74,7 +74,7 @@ namespace Server.Commands
if (list.Count > 0)
{
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
var removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
for (var i = 0; i < list.Count; ++i)
{

View file

@ -53,11 +53,11 @@ namespace Server.Compression
var libarchiveFile = Path.Combine(tempDir, "libarchive.zip");
// This isn't called often so we don't need to optimize
using (HttpClient hc = new HttpClient())
using (var hc = new HttpClient())
{
var result = hc.Send(new HttpRequestMessage(HttpMethod.Get, new Uri(_libArchiveWindowsUrl)));
using var stream = result.Content.ReadAsStream();
using FileStream fs = new FileStream(libarchiveFile, FileMode.Create, FileAccess.Write, FileShare.None);
using var fs = new FileStream(libarchiveFile, FileMode.Create, FileAccess.Write, FileShare.None);
stream.CopyTo(fs);
}

View file

@ -301,8 +301,8 @@ public class AdvancedSearchGump : Gump
);
// Count the number of selected objects
int count = 0;
foreach (AdvancedSearchResult e in SearchResults)
var count = 0;
foreach (var e in SearchResults)
{
if (e.Selected)
{
@ -319,7 +319,7 @@ public class AdvancedSearchGump : Gump
var allDisplayedSelected = true;
for (int i = 0; i < MaxEntries; i++)
for (var i = 0; i < MaxEntries; i++)
{
var offset = SortDescending ? MaxEntries - 1 - i : i;
var index = offset + DisplayFrom;
@ -896,7 +896,7 @@ public class AdvancedSearchGump : Gump
var commandSpan = commandString.AsSpan().Trim();
string command = null;
string[] commandArgs = new string[commandSpan.Count(" ")];
var commandArgs = new string[commandSpan.Count(" ")];
var index = 0;
foreach (var part in commandSpan.Tokenize(' '))
@ -933,9 +933,9 @@ public class AdvancedSearchGump : Gump
return;
}
CommandEventArgs cmdEventArgs = new CommandEventArgs(from, command, commandString, commandArgs);
var cmdEventArgs = new CommandEventArgs(from, command, commandString, commandArgs);
bool flushToLog = false;
var flushToLog = false;
// execute the command on the objects in the list

View file

@ -65,7 +65,7 @@ public class AdvancedSearchThreadWorker
private static void Execute(object obj)
{
AdvancedSearchThreadWorker worker = (AdvancedSearchThreadWorker)obj;
var worker = (AdvancedSearchThreadWorker)obj;
var reader = worker._entities;
@ -73,7 +73,7 @@ public class AdvancedSearchThreadWorker
{
while (true)
{
bool pauseRequested = Volatile.Read(ref worker._pause);
var pauseRequested = Volatile.Read(ref worker._pause);
if (reader.TryDequeue(out var entity))
{
var result = worker.DoEntitySearch(entity);
@ -268,7 +268,7 @@ public class AdvancedSearchThreadWorker
// Keys don't have a backreference, so we just ignore them for now
if (entity is KeyRing keyring && keyring.Keys?.Count > 0)
{
foreach (Key k in keyring.Keys)
foreach (var k in keyring.Keys)
{
_ignoreQueue.Enqueue(k);
}
@ -278,7 +278,7 @@ public class AdvancedSearchThreadWorker
if (entity is BaseHouse house)
{
foreach (RelocatedEntity relEntity in house.RelocatedEntities)
foreach (var relEntity in house.RelocatedEntities)
{
if (relEntity.Entity is Item)
{
@ -286,9 +286,9 @@ public class AdvancedSearchThreadWorker
}
}
foreach (VendorInventory inventory in house.VendorInventories)
foreach (var inventory in house.VendorInventories)
{
foreach (Item subItem in inventory.Items)
foreach (var subItem in inventory.Items)
{
_ignoreQueue.Enqueue(subItem);
}
@ -298,16 +298,16 @@ public class AdvancedSearchThreadWorker
private static bool EvaluateRecursive(IEntity entity, ReadOnlySpan<char> span)
{
int atIndex = span.IndexOf('@');
int orIndex = span.IndexOf('|');
var atIndex = span.IndexOf('@');
var orIndex = span.IndexOf('|');
if (atIndex == -1 && orIndex == -1)
{
return EvaluateSingleExpression(entity, span);
}
bool result = atIndex != -1;
int splitIndex = result ? atIndex : orIndex;
var result = atIndex != -1;
var splitIndex = result ? atIndex : orIndex;
var left = EvaluateRecursive(entity, span.Slice(0, splitIndex));
var right = EvaluateRecursive(entity, span.Slice(splitIndex + 1));
@ -356,7 +356,7 @@ public class AdvancedSearchThreadWorker
}
var propertyValue = property.GetValue(entity);
bool result = AdvancedSearchUtilities.CompareValues(property.PropertyType, propertyValue, valuePart, operatorSpan);
var result = AdvancedSearchUtilities.CompareValues(property.PropertyType, propertyValue, valuePart, operatorSpan);
return negate ? !result : result;
}

View file

@ -151,7 +151,7 @@ public static class AdvancedSearchUtilities
ReadOnlySpan<char> operatorSpan
)
{
double epsilon = CalculateEpsilon(originalValue);
var epsilon = CalculateEpsilon(originalValue);
return operatorSpan switch
{
@ -167,7 +167,7 @@ public static class AdvancedSearchUtilities
public static double CalculateEpsilon(ReadOnlySpan<char> value)
{
int decimalPlace = value.IndexOf('.');
var decimalPlace = value.IndexOf('.');
if (decimalPlace == -1)
{
@ -253,7 +253,7 @@ public static class AdvancedSearchUtilities
// Special handling for boolean and hexadecimal values
if (typeof(T) == typeof(bool))
{
string val = valuePart.ToString().ToLower();
var val = valuePart.ToString().ToLower();
if (val is "true" or "1" or "enabled" or "on")
{
return (T)(object)true;

View file

@ -81,7 +81,7 @@ namespace Server.Engines.BulkOrders
public override void OnResponse(NetState sender, in RelayInfo info)
{
Mobile from = sender.Mobile;
var from = sender.Mobile;
if (info.ButtonID == 1) // Ok
{

View file

@ -89,7 +89,7 @@ namespace Server.Engines.BulkOrders
public override void OnResponse(NetState sender, in RelayInfo info)
{
Mobile from = sender.Mobile;
var from = sender.Mobile;
if (_deed.Deleted || !_deed.IsChildOf(from.Backpack))
{

View file

@ -68,7 +68,7 @@ namespace Server.Engines.BulkOrders
public override void OnResponse(NetState sender, in RelayInfo info)
{
Mobile from = sender.Mobile;
var from = sender.Mobile;
if (info.ButtonID == 1) // Ok
{

View file

@ -68,7 +68,7 @@ namespace Server.Engines.BulkOrders
public override void OnResponse(NetState sender, in RelayInfo info)
{
Mobile from = sender.Mobile;
var from = sender.Mobile;
if (_deed.Deleted || !_deed.IsChildOf(from.Backpack))
{

View file

@ -85,7 +85,7 @@ namespace Server.Engines.BulkOrders
var theirSkill = m.Skills.Blacksmith.Base;
int amountMax = theirSkill switch
var amountMax = theirSkill switch
{
>= 70.1 => Utility.RandomList(10, 15, 20, 20),
>= 50.1 => Utility.RandomList(10, 15, 15, 20),

View file

@ -83,7 +83,7 @@ namespace Server.Engines.BulkOrders
if (entries.Length > 0)
{
int amountMax = theirSkill switch
var amountMax = theirSkill switch
{
>= 70.1 => Utility.RandomList(10, 15, 20, 20),
>= 50.1 => Utility.RandomList(10, 15, 15, 20),

View file

@ -46,7 +46,7 @@ namespace Server.Engines.CannedEvil
return;
}
ChampionSpawn spawn = targ switch
var spawn = targ switch
{
ChampionSpawn championSpawn => championSpawn,
IdolOfTheChampion champion => champion.Spawn,

View file

@ -61,7 +61,7 @@ public partial class ChampionPlatform : BaseAddon
public void AddComponent(int id, int x, int y, int z)
{
AddonComponent ac = new AddonComponent(id) { Hue = 0x497 };
var ac = new AddonComponent(id) { Hue = 0x497 };
AddComponent(ac, x, y, z);
}

View file

@ -184,15 +184,15 @@ public partial class ChampionSpawn : Item
get => _level;
set
{
for (int i = _redSkulls.Count - 1; i >= value; --i)
for (var i = _redSkulls.Count - 1; i >= value; --i)
{
_redSkulls[i].Delete();
_redSkulls.RemoveAt(i);
}
for (int i = _redSkulls.Count; i < Math.Min(value, 16); ++i)
for (var i = _redSkulls.Count; i < Math.Min(value, 16); ++i)
{
Item skull = new Item(0x1854) { Hue = 0x26, Movable = false, Light = LightType.Circle150 };
var skull = new Item(0x1854) { Hue = 0x26, Movable = false, Light = LightType.Circle150 };
skull.MoveToWorld(GetRedSkullLocation(i), Map);
_redSkulls.Add(skull);
}
@ -235,8 +235,8 @@ public partial class ChampionSpawn : Item
_kills = value;
this.MarkDirty();
double n = _kills / (double)MaxKills;
int p = (int)(n * 100);
var n = _kills / (double)MaxKills;
var p = (int)(n * 100);
if (p < 90)
{
@ -292,15 +292,15 @@ public partial class ChampionSpawn : Item
public void SetWhiteSkullCount(int val)
{
for (int i = _whiteSkulls.Count - 1; i >= val; --i)
for (var i = _whiteSkulls.Count - 1; i >= val; --i)
{
_whiteSkulls[i].Delete();
_whiteSkulls.RemoveAt(i);
}
for (int i = _whiteSkulls.Count; i < val; ++i)
for (var i = _whiteSkulls.Count; i < val; ++i)
{
Item skull = new Item(0x1854)
var skull = new Item(0x1854)
{
Movable = false,
Light = LightType.Circle150
@ -531,11 +531,11 @@ public partial class ChampionSpawn : Item
return;
}
int kills = _kills;
var kills = _kills;
for (var i = 0; i < _creatures.Count; ++i)
{
Mobile m = _creatures[i];
var m = _creatures[i];
if (!m.Deleted)
{
@ -551,7 +551,7 @@ public partial class ChampionSpawn : Item
--i;
++_kills;
Mobile killer = m.FindMostRecentDamager(false);
var killer = m.FindMostRecentDamager(false);
RegisterDamageTo(m);
@ -565,13 +565,13 @@ public partial class ChampionSpawn : Item
continue;
}
int mobSubLevel = GetSubLevelfor(m) + 1;
var mobSubLevel = GetSubLevelfor(m) + 1;
if (mobSubLevel >= 0)
{
bool gainedPath = false;
var gainedPath = false;
int pointsToGain = mobSubLevel * 40;
var pointsToGain = mobSubLevel * 40;
if (VirtueSystem.Award(pm, VirtueName.Valor, pointsToGain, ref gainedPath))
{
@ -631,8 +631,8 @@ public partial class ChampionSpawn : Item
InvalidateProperties();
}
double n = _kills / (double)MaxKills;
int p = (int)(n * 100);
var n = _kills / (double)MaxKills;
var p = (int)(n * 100);
if (p >= 99)
{
@ -723,13 +723,13 @@ public partial class ChampionSpawn : Item
bc.Home = bc.Location;
bc.HomeMap = bc.Map;
Point2D xWall1 = new Point2D(_spawnArea.X, bc.Y);
Point2D xWall2 = new Point2D(_spawnArea.X + _spawnArea.Width, bc.Y);
Point2D yWall1 = new Point2D(bc.X, _spawnArea.Y);
Point2D yWall2 = new Point2D(bc.X, _spawnArea.Y + _spawnArea.Height);
var xWall1 = new Point2D(_spawnArea.X, bc.Y);
var xWall2 = new Point2D(_spawnArea.X + _spawnArea.Width, bc.Y);
var yWall1 = new Point2D(bc.X, _spawnArea.Y);
var yWall2 = new Point2D(bc.X, _spawnArea.Y + _spawnArea.Height);
double minXDist = Math.Min(bc.GetDistanceToSqrt(xWall1), bc.GetDistanceToSqrt(xWall2));
double minYDist = Math.Min(bc.GetDistanceToSqrt(yWall1), bc.GetDistanceToSqrt(yWall2));
var minXDist = Math.Min(bc.GetDistanceToSqrt(xWall1), bc.GetDistanceToSqrt(xWall2));
var minYDist = Math.Min(bc.GetDistanceToSqrt(yWall1), bc.GetDistanceToSqrt(yWall2));
bc.RangeHome = (int)Math.Min(minXDist, minYDist);
}
@ -752,14 +752,14 @@ public partial class ChampionSpawn : Item
while (_creatures.Count < MaxSpawn)
{
Mobile m = Spawn();
var m = Spawn();
if (m == null)
{
return;
}
Point3D loc = GetSpawnLocation();
var loc = GetSpawnLocation();
// Allow creatures to turn into Paragons at Ilshenar champions.
m.OnBeforeSpawn(loc, Map);
@ -782,13 +782,13 @@ public partial class ChampionSpawn : Item
bc.Home = bc.Location;
bc.HomeMap = bc.Map;
Point2D xWall1 = new Point2D(_spawnArea.X, bc.Y);
Point2D xWall2 = new Point2D(_spawnArea.X + _spawnArea.Width, bc.Y);
Point2D yWall1 = new Point2D(bc.X, _spawnArea.Y);
Point2D yWall2 = new Point2D(bc.X, _spawnArea.Y + _spawnArea.Height);
var xWall1 = new Point2D(_spawnArea.X, bc.Y);
var xWall2 = new Point2D(_spawnArea.X + _spawnArea.Width, bc.Y);
var yWall1 = new Point2D(bc.X, _spawnArea.Y);
var yWall2 = new Point2D(bc.X, _spawnArea.Y + _spawnArea.Height);
double minXDist = Math.Min(bc.GetDistanceToSqrt(xWall1), bc.GetDistanceToSqrt(xWall2));
double minYDist = Math.Min(bc.GetDistanceToSqrt(yWall1), bc.GetDistanceToSqrt(yWall2));
var minXDist = Math.Min(bc.GetDistanceToSqrt(xWall1), bc.GetDistanceToSqrt(xWall2));
var minYDist = Math.Min(bc.GetDistanceToSqrt(yWall1), bc.GetDistanceToSqrt(yWall2));
bc.RangeHome = (int)Math.Min(minXDist, minYDist);
}
@ -798,7 +798,7 @@ public partial class ChampionSpawn : Item
public Point3D GetSpawnLocation()
{
Map map = Map;
var map = Map;
if (map == null)
{
@ -806,12 +806,12 @@ public partial class ChampionSpawn : Item
}
// Try 20 times to find a spawnable location.
for (int i = 0; i < 20; i++)
for (var i = 0; i < 20; i++)
{
int x = Utility.Random(_spawnArea.X, _spawnArea.Width);
int y = Utility.Random(_spawnArea.Y, _spawnArea.Height);
var x = Utility.Random(_spawnArea.X, _spawnArea.Width);
var y = Utility.Random(_spawnArea.Y, _spawnArea.Height);
int z = Map.GetAverageZ(x, y);
var z = Map.GetAverageZ(x, y);
if (Map.CanSpawnMobile(new Point2D(x, y), z))
{
@ -828,21 +828,21 @@ public partial class ChampionSpawn : Item
public int GetSubLevel()
{
int level = Level;
var level = Level;
return level <= Level1 ? 0 : level <= Level2 ? 1 : level <= Level3 ? 2 : 3;
}
public int GetSubLevelfor (Mobile m)
{
Type[][] types = ChampionSpawnInfo.GetInfo(_type).SpawnTypes;
Type t = m.GetType();
var types = ChampionSpawnInfo.GetInfo(_type).SpawnTypes;
var t = m.GetType();
for (int i = 0; i < types.GetLength(0); i++)
for (var i = 0; i < types.GetLength(0); i++)
{
Type[] individualTypes = types[i];
var individualTypes = types[i];
for (int j = 0; j < individualTypes.Length; j++)
for (var j = 0; j < individualTypes.Length; j++)
{
if (t == individualTypes[j])
{
@ -856,9 +856,9 @@ public partial class ChampionSpawn : Item
public Mobile Spawn()
{
Type[][] types = ChampionSpawnInfo.GetInfo(_type).SpawnTypes;
var types = ChampionSpawnInfo.GetInfo(_type).SpawnTypes;
int v = GetSubLevel();
var v = GetSubLevel();
if (v >= 0 && v < types.Length)
{
@ -1032,7 +1032,7 @@ public partial class ChampionSpawn : Item
if (_whiteSkulls != null)
{
for (int i = 0; i < _whiteSkulls.Count; ++i)
for (var i = 0; i < _whiteSkulls.Count; ++i)
{
_whiteSkulls[i].Location = GetWhiteSkullLocation(i);
}
@ -1068,7 +1068,7 @@ public partial class ChampionSpawn : Item
if (_redSkulls != null)
{
for (int i = 0; i < _redSkulls.Count; ++i)
for (var i = 0; i < _redSkulls.Count; ++i)
{
_redSkulls[i].Map = Map;
}
@ -1076,7 +1076,7 @@ public partial class ChampionSpawn : Item
if (_whiteSkulls != null)
{
for (int i = 0; i < _whiteSkulls.Count; ++i)
for (var i = 0; i < _whiteSkulls.Count; ++i)
{
_whiteSkulls[i].Map = Map;
}
@ -1097,7 +1097,7 @@ public partial class ChampionSpawn : Item
if (_redSkulls != null)
{
for (int i = 0; i < _redSkulls.Count; ++i)
for (var i = 0; i < _redSkulls.Count; ++i)
{
_redSkulls[i].Delete();
}
@ -1107,7 +1107,7 @@ public partial class ChampionSpawn : Item
if (_whiteSkulls != null)
{
for (int i = 0; i < _whiteSkulls.Count; ++i)
for (var i = 0; i < _whiteSkulls.Count; ++i)
{
_whiteSkulls[i].Delete();
}
@ -1139,9 +1139,9 @@ public partial class ChampionSpawn : Item
{
if (_creatures != null)
{
for (int i = 0; i < _creatures.Count; ++i)
for (var i = 0; i < _creatures.Count; ++i)
{
Mobile mob = _creatures[i];
var mob = _creatures[i];
if (!mob.Player)
{
@ -1160,15 +1160,15 @@ public partial class ChampionSpawn : Item
return;
}
foreach (DamageEntry de in m.DamageEntries)
foreach (var de in m.DamageEntries)
{
if (de.HasExpired)
{
continue;
}
Mobile damager = de.Damager;
Mobile master = damager.GetDamageMaster(m);
var damager = de.Damager;
var master = damager.GetDamageMaster(m);
if (master != null)
{
@ -1205,9 +1205,9 @@ public partial class ChampionSpawn : Item
return;
}
int totalDamage = 0;
var totalDamage = 0;
Dictionary<Mobile, int> validEntries = new Dictionary<Mobile, int>();
var validEntries = new Dictionary<Mobile, int>();
foreach (var (key, value) in DamageEntries)
{
@ -1218,13 +1218,13 @@ public partial class ChampionSpawn : Item
}
}
bool artifactGiven = false;
var artifactGiven = false;
do
{
int randomDamage = Utility.RandomMinMax(1, totalDamage);
var randomDamage = Utility.RandomMinMax(1, totalDamage);
int checkDamage = 0;
var checkDamage = 0;
foreach (var (key, value) in validEntries)
{
@ -1260,7 +1260,7 @@ public partial class ChampionSpawn : Item
return false;
}
Container pack = to.Backpack;
var pack = to.Backpack;
if (pack?.TryDropItem(to, artifact, false) != true)
{
@ -1285,8 +1285,8 @@ public partial class ChampionSpawn : Item
_maxLevel = reader.ReadInt();
_activatedByValor = reader.ReadBool();
int entries = reader.ReadInt();
for (int i = 0; i < entries; ++i)
var entries = reader.ReadInt();
for (var i = 0; i < entries; ++i)
{
var m = reader.ReadEntity<Mobile>();
var damage = reader.ReadInt();

View file

@ -68,7 +68,7 @@ public static class ChampionGenerator
//We assume that all champion spawns are generated here.
using var spawns = PooledRefQueue<IEntity>.Create();
foreach (Item item in World.Items.Values)
foreach (var item in World.Items.Values)
{
if (item is ChampionSpawn spawn)
{
@ -89,9 +89,9 @@ public static class ChampionGenerator
private static void Process(ChampionEntry[] entries)
{
for (int i = 0; i < entries.Length; i++)
for (var i = 0; i < entries.Length; i++)
{
ChampionEntry entry = entries[i];
var entry = entries[i];
try
{

View file

@ -348,7 +348,7 @@ public static partial class CharacterCreation
}
case "samurai":
{
bool haotisAndTokunoAccessible =
var haotisAndTokunoAccessible =
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
@ -370,7 +370,7 @@ public static partial class CharacterCreation
}
case "ninja":
{
bool enimosAndTokunoAccessible =
var enimosAndTokunoAccessible =
(flags & ClientFlags.Tokuno) == ClientFlags.Tokuno &&
(flags & ClientFlags.Malas) == ClientFlags.Malas &&
availableMaps.Includes(MapSelectionFlags.Malas | MapSelectionFlags.Tokuno);
@ -993,7 +993,7 @@ public static partial class CharacterCreation
}
case SkillName.ArmsLore:
{
Item item = Utility.Random(3) switch
var item = Utility.Random(3) switch
{
0 => FencingWeapon(raceFlag),
1 => MacingWeapon(raceFlag),

View file

@ -134,7 +134,7 @@ namespace Server.Engines.ConPVP
return false;
}
string title = move switch
var title = move switch
{
NinjaMove => "Bushido",
SamuraiMove => "Ninjitsu",
@ -1898,7 +1898,7 @@ namespace Server.Engines.ConPVP
var rx = dx - dy;
var ry = dx + dy;
bool eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
var eastToWest = rx == 0 && ry >= 0 || rx >= 0 && ry == 0;
Effects.PlaySound(wall, Arena.Facet, 0x1F6);
@ -2043,7 +2043,7 @@ namespace Server.Engines.ConPVP
pack.DropItem(item);
// TODO: Use Layer instead of Type
int number = item switch
var number = item switch
{
BaseWeapon _ => 1062001, // You can no longer wield your ~1_WEAPON~
not BaseShield when item is BaseArmor or BaseClothing => 1062002, // You can no longer wear your ~1_ARMOR~

View file

@ -432,11 +432,11 @@ namespace Server.Engines.Craft
public static bool IsQuantityType(Type[][] types)
{
for (int i = 0; i < types.Length; ++i)
for (var i = 0; i < types.Length; ++i)
{
Type[] check = types[i];
var check = types[i];
for (int j = 0; j < check.Length; ++j)
for (var j = 0; j < check.Length; ++j)
{
if (typeof(IHasQuantity).IsAssignableFrom(check[j]))
{
@ -883,7 +883,7 @@ namespace Server.Engines.Craft
var minChance = craftSystem.GetChanceAtMin(this);
double chance = minChance + (valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - minChance);
var chance = minChance + (valMainSkill - minMainSkill) / (maxMainSkill - minMainSkill) * (1.0 - minChance);
if (from.Talisman is BaseTalisman talisman && talisman.Skill == craftSystem.MainSkill)
{

View file

@ -85,8 +85,8 @@ namespace Server.Engines.Craft
return EnhanceResult.BadResource;
}
int resHue = 0;
int maxAmount = 0;
var resHue = 0;
var maxAmount = 0;
var consumeRes = craftItem.ConsumeRes(
from,

View file

@ -502,7 +502,7 @@ public partial class LeverPuzzleController : Item
/* I cant find any better way to send "speech" using fonts other than default */
public static void POHMessage(Mobile from, int index)
{
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(Msgs[index])].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(Msgs[index])].InitializePacket();
foreach (var state in from.Map.GetClientsInRange(from.Location))
{

View file

@ -283,8 +283,8 @@ public abstract class Faction : IComparable<Faction>
public static bool IsNearType(Mobile mob, Type[] types, int range)
{
bool mobs = false;
bool items = false;
var mobs = false;
var items = false;
for (var i = 0; !(mobs && items) && i < types.Length; i++)
{
var type = types[i];

View file

@ -778,7 +778,7 @@ namespace Server.Factions
if (spell != null && m_Guard.HitsMax - m_Guard.Hits + 10 > Utility.Random(100))
{
Type type = spell switch
var type = spell switch
{
GreaterHealSpell _ => typeof(BaseHealPotion),
CureSpell _ => typeof(BaseCurePotion),

View file

@ -194,7 +194,7 @@ namespace Server.Engines.Harvest
public override bool CheckResources(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed)
{
Container pack = from.Backpack;
var pack = from.Backpack;
if (pack != null)
{

View file

@ -95,7 +95,7 @@ namespace Server.Engines.MLQuests.Mobiles
return;
}
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength("")].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength("")].InitializePacket();
foreach (var state in GetClientsInRange(12))
{

View file

@ -52,7 +52,7 @@ namespace Server.Engines.PartySystem
public void OnStamChanged(Mobile m)
{
Span<byte> p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength].InitializePacket();
var p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength].InitializePacket();
OutgoingMobilePackets.CreateMobileStam(p, m, true);
for (var i = 0; i < Members.Count; ++i)
@ -69,7 +69,7 @@ namespace Server.Engines.PartySystem
public void OnManaChanged(Mobile m)
{
Span<byte> p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength].InitializePacket();
var p = stackalloc byte[OutgoingMobilePackets.MobileAttributePacketLength].InitializePacket();
OutgoingMobilePackets.CreateMobileMana(p, m, true);
for (var i = 0; i < Members.Count; ++i)
@ -198,9 +198,9 @@ namespace Server.Engines.PartySystem
Members.Add(new PartyMemberInfo(m));
m.Party = this;
Span<byte> memberList =
var memberList =
stackalloc byte[PartyPackets.GetPartyMemberListPacketLength(Count)].InitializePacket();
Span<byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength].InitializePacket();
var attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength].InitializePacket();
for (var i = 0; i < Members.Count; ++i)
{
@ -230,7 +230,7 @@ namespace Server.Engines.PartySystem
return;
}
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(from.Name, "")]
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(from.Name, "")]
.InitializePacket();
var length = OutgoingMessagePackets.CreateMessageLocalizedAffix(
buffer,
@ -302,7 +302,7 @@ namespace Server.Engines.PartySystem
if (removed)
{
Span<byte> removeMember =
var removeMember =
stackalloc byte[PartyPackets.GetPartyRemoveMemberPacketLength(Count)].InitializePacket();
// Send empty party to the player removed
@ -386,7 +386,7 @@ namespace Server.Engines.PartySystem
public void SendToAll(int number, string args = "", int hue = 0x3B2)
{
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength(args)].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedLength(args)].InitializePacket();
var length = OutgoingMessagePackets.CreateMessageLocalized(
buffer,
@ -401,7 +401,7 @@ namespace Server.Engines.PartySystem
public void SendPublicMessage(Mobile from, string text)
{
Span<byte> textMessagePacket =
var textMessagePacket =
stackalloc byte[PartyPackets.GetPartyTextMessagePacketLength(text)].InitializePacket();
PartyPackets.CreatePartyTextMessage(textMessagePacket, from.Serial, text, true);
SendToAll(textMessagePacket);
@ -419,7 +419,7 @@ namespace Server.Engines.PartySystem
private void SendToStaffMessage(Mobile from, string text)
{
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
foreach (var ns in from.GetClientsInRange(8))
{
@ -458,7 +458,7 @@ namespace Server.Engines.PartySystem
return;
}
Span<byte> buffer =
var buffer =
stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(text)].InitializePacket();
OutgoingMessagePackets.CreateMessage(
buffer, Serial.MinusOne, -1, MessageType.Regular, 0x3B2,
@ -504,9 +504,9 @@ namespace Server.Engines.PartySystem
m_Mobile.SendLocalizedMessage(1005437); // You have rejoined the party.
m_Mobile.NetState.SendPartyMemberList(p);
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(m_Mobile.Name, "")]
var buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(m_Mobile.Name, "")]
.InitializePacket();
Span<byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength].InitializePacket();
var attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength].InitializePacket();
var ns = m_Mobile.NetState;

View file

@ -54,7 +54,7 @@ namespace Server.Engines.PartySystem
return;
}
Span<byte> buffer = stackalloc byte[GetPartyMemberListPacketLength(p.Count)].InitializePacket();
var buffer = stackalloc byte[GetPartyMemberListPacketLength(p.Count)].InitializePacket();
CreatePartyMemberList(buffer, p);
ns.Send(buffer);
@ -70,7 +70,7 @@ namespace Server.Engines.PartySystem
return;
}
Span<byte> buffer = stackalloc byte[GetPartyRemoveMemberPacketLength(p?.Count ?? 0)].InitializePacket();
var buffer = stackalloc byte[GetPartyRemoveMemberPacketLength(p?.Count ?? 0)].InitializePacket();
CreatePartyRemoveMember(buffer, m, p);
ns.Send(buffer);
@ -110,7 +110,7 @@ namespace Server.Engines.PartySystem
return;
}
Span<byte> buffer = stackalloc byte[GetPartyTextMessagePacketLength(text)].InitializePacket();
var buffer = stackalloc byte[GetPartyTextMessagePacketLength(text)].InitializePacket();
CreatePartyTextMessage(buffer, m, text, toAll);
ns.Send(buffer);

View file

@ -443,7 +443,7 @@ namespace Server.Engines.Plants
[OnEvent(nameof(PlayerMobile.PlayerLoginEvent))]
public static void OnLogin(PlayerMobile from)
{
Container cont = from.Backpack;
var cont = from.Backpack;
if (cont != null)
{
foreach (var plant in cont.FindItemsByType<PlantItem>())

View file

@ -36,7 +36,7 @@ public class ReportMurdererGump : StaticGump<ReportMurdererGump>
HashSet<Mobile> toGive = null;
// Guards won't take reports of the death of a thief!
bool notInThievesGuild = m.NpcGuild != NpcGuild.ThievesGuild;
var notInThievesGuild = m.NpcGuild != NpcGuild.ThievesGuild;
foreach (var ai in m.Aggressors)
{

View file

@ -154,7 +154,7 @@ public partial class EnchantedSextant : Item
}
}
int moonMsg = moongateDistance switch
var moonMsg = moongateDistance switch
{
double.MaxValue => 1048021, // The sextant fails to find a Moongate nearby.
> LongDistance => 1046449 + (int)from.GetDirectionTo(closestMoongate), // A moongate is * from here
@ -164,7 +164,7 @@ public partial class EnchantedSextant : Item
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, 0x482, 3, moonMsg);
int bankMsg = bankDistance switch
var bankMsg = bankDistance switch
{
double.MaxValue => 1048020, // The sextant fails to find a Bank nearby.
> LongDistance => 1046462 + (int)from.GetDirectionTo(closestBank), // A town is * from here

View file

@ -32,7 +32,7 @@ public class QuestOfferRegion : BaseRegion
{
try
{
QuestSystem qs = Quest.CreateInstance<QuestSystem>(player);
var qs = Quest.CreateInstance<QuestSystem>(player);
qs.SendOffer();
}
catch (Exception ex)

View file

@ -40,7 +40,7 @@ namespace Server.Engines.Quests.Naturalist
{
get
{
int count = 0;
var count = 0;
foreach (var area in m_Areas)
{
if (!area.Special)

View file

@ -42,8 +42,8 @@ public class ExportSpawnersCommand : BaseCommand
public override void ExecuteList(CommandEventArgs e, List<object> list)
{
string path = e.Arguments.Length == 0 ? string.Empty : e.Arguments[0].Trim();
string condition = e.Arguments.Length == 2 ? e.Arguments[1].Trim() : string.Empty;
var path = e.Arguments.Length == 0 ? string.Empty : e.Arguments[0].Trim();
var condition = e.Arguments.Length == 2 ? e.Arguments[1].Trim() : string.Empty;
if (string.IsNullOrEmpty(path))
{

View file

@ -117,10 +117,10 @@ public static class ImportSpawnersCommand
ref int totalFailures
)
{
XmlDocument doc = new XmlDocument();
var doc = new XmlDocument();
doc.Load(file.FullName);
XmlElement root = doc["spawners"];
var root = doc["spawners"];
if (root == null)
{
@ -132,15 +132,15 @@ public static class ImportSpawnersCommand
{
try
{
int count = int.Parse(Utility.GetText(node["count"], "1"));
int homeRange = int.Parse(Utility.GetText(node["homerange"], "4"));
var count = int.Parse(Utility.GetText(node["count"], "1"));
var homeRange = int.Parse(Utility.GetText(node["homerange"], "4"));
int walkingRange = int.Parse(Utility.GetText(node["walkingrange"], "-1"));
var walkingRange = int.Parse(Utility.GetText(node["walkingrange"], "-1"));
int team = int.Parse(Utility.GetText(node["team"], "0"));
var team = int.Parse(Utility.GetText(node["team"], "0"));
TimeSpan maxDelay = TimeSpan.Parse(Utility.GetText(node["maxdelay"], "10:00"));
TimeSpan minDelay = TimeSpan.Parse(Utility.GetText(node["mindelay"], "05:00"));
var maxDelay = TimeSpan.Parse(Utility.GetText(node["maxdelay"], "10:00"));
var minDelay = TimeSpan.Parse(Utility.GetText(node["mindelay"], "05:00"));
var creaturesNameNode = node["creaturesname"];
List<string> creatureNames = [];
if (creaturesNameNode != null)
@ -154,11 +154,11 @@ public static class ImportSpawnersCommand
}
}
string name = Utility.GetText(node["name"], "Spawner");
Point3D location = Point3D.Parse(Utility.GetText(node["location"], "Error"));
Map map = Map.Parse(Utility.GetText(node["map"], "Error"));
var name = Utility.GetText(node["name"], "Spawner");
var location = Point3D.Parse(Utility.GetText(node["location"], "Error"));
var map = Map.Parse(Utility.GetText(node["map"], "Error"));
Spawner spawner = new Spawner(count, minDelay, maxDelay, team, spawnedNames: creatureNames.ToArray());
var spawner = new Spawner(count, minDelay, maxDelay, team, spawnedNames: creatureNames.ToArray());
if (walkingRange >= 0)
{
spawner.WalkingRange = walkingRange;
@ -303,9 +303,9 @@ public static class ImportSpawnersCommand
{
var lines = File.ReadAllLines(file.FullName);
TimeSpan minTimeOverride = TimeSpan.MinValue;
TimeSpan maxTimeOverride = TimeSpan.MinValue;
int mapIdOverride = -1;
var minTimeOverride = TimeSpan.MinValue;
var maxTimeOverride = TimeSpan.MinValue;
var mapIdOverride = -1;
string spawnerIdOverride = null;
for (var i = 0; i < lines.Length; i++)

View file

@ -96,7 +96,7 @@ public class SpawnPropsGump : PropertiesGump
case 3: // Apply
{
using var propsBuilder = ValueStringBuilder.Create();
bool first = true;
var first = true;
foreach (var attr in MobileAttributes)
{
var prop = GetPropValue(m_Object, attr);

View file

@ -60,7 +60,7 @@ public class SpawnerControllerGump : GumpGrid
AddImageTiled(0, row1Y + 21, _main.Width, 3, 9357);
AddAlphaRegion(0, row1Y + 21, _main.Width, 3);
for (int i = 0; i < list.ColsCount - 1; i++)
for (var i = 0; i < list.ColsCount - 1; i++)
{
var x = list.Header.Cols[i].HEnd - 8;
var y = list.Header.Y + 10;
@ -159,7 +159,7 @@ public class SpawnerControllerGump : GumpGrid
continue;
}
bool enqueue = _search.Type switch
var enqueue = _search.Type switch
{
SpawnSearchType.Creature => SearchSpawnerCreatures(spawner, _search.SearchPattern),
SpawnSearchType.Coords => _mobile.InRange(spawner.Location, range),
@ -238,7 +238,7 @@ public class SpawnerControllerGump : GumpGrid
public void DrawSpawner(ListView list)
{
for (int i = 0; i < list.Items.Length; i++)
for (var i = 0; i < list.Items.Length; i++)
{
const int vCenter = 15;
const int perItem = 45;
@ -381,7 +381,7 @@ public class SpawnerControllerGump : GumpGrid
{
target.Entries?.Clear();
for (int i = 0; i < spawner.Entries.Count; i++)
for (var i = 0; i < spawner.Entries.Count; i++)
{
var item = spawner.Entries[i];
var targetEntry = target.AddEntry(item.SpawnedName, item.SpawnedProbability, item.SpawnedMaxCount);

View file

@ -160,7 +160,7 @@ public class SpawnerGump : Gump
var totalSpawned = 0;
var totalWeight = 0;
foreach (SpawnerEntry spawnerEntry in _spawner.Entries)
foreach (var spawnerEntry in _spawner.Entries)
{
totalSpawned += spawner.CountSpawns(spawnerEntry);
totalWeight += spawnerEntry.SpawnedProbability;

View file

@ -370,7 +370,7 @@ public partial class CharacterStatue : Mobile, IRewardItem
}
ProcessDelta();
Span<byte> animPacket = stackalloc byte[CharacterStatuePackets.StatueAnimationPacketLength].InitializePacket();
var animPacket = stackalloc byte[CharacterStatuePackets.StatueAnimationPacketLength].InitializePacket();
foreach (var state in Map.GetClientsInRange(Location))
{

View file

@ -52,7 +52,7 @@ namespace Server.Engines.VeteranRewards
return;
}
Span<byte> buffer = stackalloc byte[StatueAnimationPacketLength].InitializePacket();
var buffer = stackalloc byte[StatueAnimationPacketLength].InitializePacket();
CreateStatueAnimation(buffer, serial, status, anim, frame);
ns.Send(buffer);
}

View file

@ -75,7 +75,7 @@ public static class HonorVirtue
var duration = GetHonorDuration(pm);
var virtues = VirtueSystem.GetOrCreateVirtues(pm);
int usedPoints = virtues.Honor switch
var usedPoints = virtues.Honor switch
{
< 4399 => 400,
< 10599 => 600,

View file

@ -130,7 +130,7 @@ public static class SacrificeVirtue
}
else
{
int toGain = from.Fame switch
var toGain = from.Fame switch
{
< 5000 => 500,
< 10000 => 1000,

View file

@ -124,7 +124,7 @@ public class VirtueGump : Gump
value = 20000;
}
int vl = value switch
var vl = value switch
{
< 10000 => 0,
>= 20000 when index == 5 => 2,

View file

@ -119,7 +119,7 @@ public class VirtueSystem : GenericPersistence
return null;
}
ref VirtueContext context = ref CollectionsMarshal.GetValueRefOrAddDefault(_playerVirtues, from, out bool exists);
ref var context = ref CollectionsMarshal.GetValueRefOrAddDefault(_playerVirtues, from, out var exists);
if (!exists)
{
context = new VirtueContext();

View file

@ -43,7 +43,7 @@ public abstract class DynamicGump : BaseGump
writer.Write(X);
writer.Write(Y);
DynamicGumpBuilder gumpBuilder = new DynamicGumpBuilder();
var gumpBuilder = new DynamicGumpBuilder();
BuildLayout(ref gumpBuilder);
gumpBuilder.FinalizeLayout();

View file

@ -278,11 +278,11 @@ public ref struct DynamicGumpBuilder
}
var newSize = Math.Max(_stringBytesWritten + needed, _stringsBuffer.Length * 2);
byte[] poolArray = STArrayPool<byte>.Shared.Rent(newSize);
var poolArray = STArrayPool<byte>.Shared.Rent(newSize);
_stringsBuffer.AsSpan(0, _stringBytesWritten).CopyTo(poolArray);
byte[] toReturn = _stringsBuffer;
var toReturn = _stringsBuffer;
_stringsBuffer = poolArray;
if (toReturn != null && toReturn != _staticStringsBuffer)

View file

@ -584,7 +584,7 @@ public ref struct GumpLayoutBuilder
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void WriteValue<T>(T value, ReadOnlySpan<char> format = default) where T : IUtf8SpanFormattable
{
if (!value.TryFormat(_layoutBuffer.AsSpan(_bytesWritten), out int bytesWritten, format, null))
if (!value.TryFormat(_layoutBuffer.AsSpan(_bytesWritten), out var bytesWritten, format, null))
{
throw new InvalidOperationException($"Failed to format '{value}' with the given format '{format}'");
}
@ -616,11 +616,11 @@ public ref struct GumpLayoutBuilder
}
var newSize = Math.Max(_bytesWritten + count, _layoutBuffer.Length * 2);
byte[] poolArray = STArrayPool<byte>.Shared.Rent(newSize);
var poolArray = STArrayPool<byte>.Shared.Rent(newSize);
_layoutBuffer.AsSpan(0, _bytesWritten).CopyTo(poolArray);
byte[] toReturn = _layoutBuffer;
var toReturn = _layoutBuffer;
_layoutBuffer = poolArray;
if (toReturn != _staticLayoutBuffer)

View file

@ -51,11 +51,11 @@ public ref struct GumpStringsBuilder
}
var newSize = Math.Max(newLength, _stringsBuffer.Length * 2);
byte[] poolArray = STArrayPool<byte>.Shared.Rent(newSize);
var poolArray = STArrayPool<byte>.Shared.Rent(newSize);
_stringsBuffer.AsSpan(0, _stringBytesWritten).CopyTo(poolArray);
byte[] toReturn = _stringsBuffer;
var toReturn = _stringsBuffer;
_stringsBuffer = poolArray;
if (toReturn != _staticStringsBuffer)

View file

@ -95,10 +95,10 @@ public static partial class GumpSystem
return;
}
int switchByteCount = switchCount * 4;
var switchByteCount = switchCount * 4;
// Read all the integers
ReadOnlySpan<int> switchBlock =
var switchBlock =
MemoryMarshal.Cast<byte, int>(reader.Buffer.Slice(reader.Position, switchByteCount));
reader.Seek(switchByteCount, SeekOrigin.Current);

View file

@ -45,7 +45,7 @@ public static partial class GumpSystem
{
if (_gumps.TryGetValue(ns, out var gumps))
{
for (int i = 0; i < gumps.Count; i++)
for (var i = 0; i < gumps.Count; i++)
{
if (gumps[i] == gump)
{
@ -63,7 +63,7 @@ public static partial class GumpSystem
return new NetStateGumps(null, null);
}
ref List<BaseGump> list = ref CollectionsMarshal.GetValueRefOrAddDefault(_gumps, ns, out bool exists);
ref var list = ref CollectionsMarshal.GetValueRefOrAddDefault(_gumps, ns, out var exists);
if (!exists)
{

View file

@ -40,7 +40,7 @@ public class GumpGrid : Gump
private void InitColumn(string name, int column, int w, int x)
{
var width = w / column;
for (int i = 0; i < column; i++)
for (var i = 0; i < column; i++)
{
AddColumn(name, i * width + x, width);
}
@ -49,7 +49,7 @@ public class GumpGrid : Gump
private void InitRow(string name, int row, int h, int y)
{
var height = h / row;
for (int i = 0; i < row; i++)
for (var i = 0; i < row; i++)
{
AddRow(name, i * height + y, height);
}
@ -57,7 +57,7 @@ public class GumpGrid : Gump
private static Swap Exist(ref PooledRefList<Swap> list, int index)
{
for (int i = 0; i < list.Count; i++)
for (var i = 0; i < list.Count; i++)
{
var item = list[i];
if (item.Index == index)
@ -73,7 +73,7 @@ public class GumpGrid : Gump
{
var cropSize = 0;
for (int i = 0; i < column; i++)
for (var i = 0; i < column; i++)
{
if (sizes[i] == "*")
{
@ -96,7 +96,7 @@ public class GumpGrid : Gump
var cropHeight = CalculateCustom(row, height, sizes, ref list);
var Height = height - cropHeight;
var factor = row - list.Count;
for (int i = 0; i < row; i++)
for (var i = 0; i < row; i++)
{
var swap = Exist(ref list, i);
if (swap != null)
@ -137,7 +137,7 @@ public class GumpGrid : Gump
var Width = width - cropWidth;
var factor = column - list.Count;
for (int i = 0; i < column; i++)
for (var i = 0; i < column; i++)
{
var swap = Exist(ref list, i);
if (swap != null)
@ -300,7 +300,7 @@ public class GumpGrid : Gump
if (_grids.TryGetValue(name, out var grid))
{
var count = columnSpan == 0 ? column + 1 : row + columnSpan;
for (int i = column; i < count; i++)
for (var i = column; i < count; i++)
{
if (i >= grid.Columns.Count)
{
@ -317,7 +317,7 @@ public class GumpGrid : Gump
}
count = rowSpan == 0 ? row + 1 : row + rowSpan;
for (int i = row; i < count; i++)
for (var i = row; i < count; i++)
{
if (i >= grid.Rows.Count)
{
@ -423,7 +423,7 @@ public class GumpGrid : Gump
};
var length = x + marginX;
for (int col = 0; col < columns; col++)
for (var col = 0; col < columns; col++)
{
Header.Cols[col] = new Col();
Header.Cols[col].Width = ColWidth[col];
@ -433,7 +433,7 @@ public class GumpGrid : Gump
Items = new ListItem[itemsPerPageCount];
for (int i = 0; i < itemsPerPageCount; i++)
for (var i = 0; i < itemsPerPageCount; i++)
{
Items[i] = new ListItem
{
@ -470,11 +470,11 @@ public class GumpGrid : Gump
w = width > 0 ? width : w;
h = height > 0 ? height : h;
int[] colWidth = new int[createColumn];
var colWidth = new int[createColumn];
if (colSize == string.Empty)
{
for (int i = 0; i < createColumn; i++)
for (var i = 0; i < createColumn; i++)
{
colWidth[i] = w / createColumn;
}

View file

@ -43,7 +43,7 @@ public readonly ref struct NetStateGumps
return false;
}
for (int i = 0; i < _gumps.Count; i++)
for (var i = 0; i < _gumps.Count; i++)
{
if (_gumps[i] is T tGump)
{
@ -65,7 +65,7 @@ public readonly ref struct NetStateGumps
return null;
}
for (int i = 0; i < _gumps.Count; i++)
for (var i = 0; i < _gumps.Count; i++)
{
if (_gumps[i] is T tGump)
{
@ -87,9 +87,9 @@ public readonly ref struct NetStateGumps
if (singleton || gump.Singleton)
{
for (int i = 0; i < _gumps.Count; i++)
for (var i = 0; i < _gumps.Count; i++)
{
BaseGump old = _gumps[i];
var old = _gumps[i];
if (old.TypeID == gump.TypeID)
{

View file

@ -47,7 +47,7 @@ public readonly ref struct RelayInfo
public string GetTextEntry(int entryId)
{
int index = _textIds.IndexOf((ushort)entryId);
var index = _textIds.IndexOf((ushort)entryId);
return index == -1
? default
: TextEncoding.GetString(_textBlock[_textRanges[index]], TextEncoding.Unicode, true);

View file

@ -112,7 +112,7 @@ public abstract class StaticGump<TSelf> : BaseGump where TSelf : StaticGump<TSel
}
else
{
StaticGumpBuilder gumpBuilder = new StaticGumpBuilder();
var gumpBuilder = new StaticGumpBuilder();
BuildLayout(ref gumpBuilder);
gumpBuilder.FinalizeLayout();

View file

@ -389,11 +389,11 @@ public ref struct StaticGumpBuilder
}
var newSize = Math.Max(_stringBytesWritten + needed, _stringsBuffer.Length * 2);
byte[] poolArray = STArrayPool<byte>.Shared.Rent(newSize);
var poolArray = STArrayPool<byte>.Shared.Rent(newSize);
_stringsBuffer.AsSpan(0, _stringBytesWritten).CopyTo(poolArray);
byte[] toReturn = _stringsBuffer;
var toReturn = _stringsBuffer;
_stringsBuffer = poolArray;
if (toReturn != _staticStringsBuffer)

View file

@ -162,7 +162,7 @@ public class GoGump : Gump
public static void DisplayTo(Mobile from)
{
LocationTree tree = GoLocations.GetLocations(from.Map);
var tree = GoLocations.GetLocations(from.Map);
if (!tree.LastBranch.TryGetValue(from, out var branch))
{

View file

@ -50,7 +50,7 @@ namespace Server.Gumps
var g = m_List[i];
string name = g.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
var name = g.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
}
}

View file

@ -51,7 +51,7 @@ namespace Server.Gumps
var m = m_List[i];
string name = m.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
var name = m.Name?.Trim().DefaultIfNullOrEmpty("(empty)");
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
}
}

View file

@ -113,7 +113,7 @@ public partial class FirefliesDeed : Item
return;
}
int itemId = info.ButtonID switch
var itemId = info.ButtonID switch
{
(int)Buttons.East => 0x2332,
(int)Buttons.South => 0x2336,
@ -202,7 +202,7 @@ public partial class FirefliesDeed : Item
return;
}
foreach (Fireflies fireflies in Map.Malas.GetItemsAt<Fireflies>(p3d))
foreach (var fireflies in Map.Malas.GetItemsAt<Fireflies>(p3d))
{
if (fireflies.Z == p3d.Z)
{

View file

@ -91,7 +91,7 @@ namespace Server.Items
public override void SendWorldPacketTo(NetState ns, ReadOnlySpan<byte> world = default)
{
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var length = OutgoingItemPackets.CreateWorldItem(buffer, this);
// Use an itemid of a real container
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], (ushort)(_addon?.ItemID ?? 0x9AB));

View file

@ -72,7 +72,7 @@ namespace Server.Items
var rand = Utility.RandomDouble();
int message = rand switch
var message = rand switch
{
< 0.05 => 500752,
< 0.20 => 500753,

View file

@ -825,7 +825,7 @@ namespace Server.Items
public int ComputeStatReq(StatType type)
{
int v = type switch
var v = type switch
{
StatType.Str => StrRequirement,
StatType.Dex => DexRequirement,

View file

@ -224,7 +224,7 @@ namespace Server.Network
if (content)
{
maxLength += 2 + equipLength * 4; // We have an extra 4 from the thread serial
for (int i = 0; i < linesLength; i++)
for (var i = 0; i < linesLength; i++)
{
msg.Lines[i].UpdateLengthCounters(ref maxLength, ref longestTextLine, true);
}

View file

@ -231,8 +231,8 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
return;
}
int x = m.X;
int y = m.Y;
var x = m.X;
var y = m.Y;
CalcMoves.Offset(m.Direction, ref x, ref y);

View file

@ -69,7 +69,7 @@ public partial class FillableContent
public static FillableContentType Acquire(Point3D loc, Map map)
{
FillableContentType content = FillableContentType.None;
var content = FillableContentType.None;
if (map == null || map == Map.Internal)
{

View file

@ -155,7 +155,7 @@ public abstract partial class LockableContainer : TrappableContainer, ILockable,
var inaccessible = from.AccessLevel < AccessLevel.GameMaster;
int number = inaccessible
var number = inaccessible
? 501747 // It appears to be locked.
: 502502; // That is locked, but you open it with your godly powers.

View file

@ -71,7 +71,7 @@ public abstract partial class BaseBoard : Container, ISecurable
}
else
{
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
var buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
foreach (var state in GetClientsInRange(2))
{

View file

@ -465,7 +465,7 @@ namespace Server.Engines.Mahjong
return;
}
Span<byte> buffer = stackalloc byte[MahjongGeneralInfoPacketLength].InitializePacket();
var buffer = stackalloc byte[MahjongGeneralInfoPacketLength].InitializePacket();
CreateMahjongGeneralInfo(buffer, game);
ns.Send(buffer);
@ -508,7 +508,7 @@ namespace Server.Engines.Mahjong
return;
}
Span<byte> buffer = stackalloc byte[MahjongRelievePacketLength].InitializePacket();
var buffer = stackalloc byte[MahjongRelievePacketLength].InitializePacket();
CreateMahjongRelieve(buffer, game);
ns.Send(buffer);

View file

@ -187,7 +187,7 @@ public partial class MahjongPlayers
{
var removed = false;
Span<byte> relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
var relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
for (var i = 0; i < _players.Length; i++)
{
@ -543,7 +543,7 @@ public partial class MahjongPlayers
return;
}
Span<byte> generalInfo = stackalloc byte[MahjongPackets.MahjongGeneralInfoPacketLength].InitializePacket();
var generalInfo = stackalloc byte[MahjongPackets.MahjongGeneralInfoPacketLength].InitializePacket();
foreach (var mobile in mobiles)
{
@ -577,7 +577,7 @@ public partial class MahjongPlayers
return;
}
Span<byte> relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
var relievePacket = stackalloc byte[MahjongPackets.MahjongRelievePacketLength].InitializePacket();
foreach (var mobile in mobiles)
{

View file

@ -31,7 +31,7 @@ public partial class Blocker : Item
private void SendGMItem(NetState ns)
{
// GM Packet
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
int length;

View file

@ -64,7 +64,7 @@ public partial class ClockworkAssembly : Item
return;
}
double scalar = tinkerSkill switch
var scalar = tinkerSkill switch
{
>= 100.0 => 1.0,
>= 90.0 => 0.9,

View file

@ -41,7 +41,7 @@ public partial class LOSBlocker : Item
private void SendGMItem(NetState ns)
{
// GM Packet
Span<byte> buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
var buffer = stackalloc byte[OutgoingEntityPackets.MaxWorldEntityPacketLength].InitializePacket();
int length;

View file

@ -375,7 +375,7 @@ public class MoongateGump : Gump
}
}
int mapCount = filteredBySelectedMaps.Count;
var mapCount = filteredBySelectedMaps.Count;
_lists = new PMList[mapCount];
for (var i = 0; i < mapCount; i++)
{

View file

@ -180,7 +180,7 @@ public partial class BaseQuiver : Container, ICraftable, IAosItem
return false;
}
Item ammo = Ammo;
var ammo = Ammo;
return ammo?.Deleted == false && ammo.Amount + item.Amount <= _capacity;
}

View file

@ -124,7 +124,7 @@ public partial class TaxidermyKit : Item
from.SendLocalizedMessage(1042278);
from.SendLocalizedMessage(1042602); // You use your kit up making the trophy.
Mobile hunter = fish?.Fisher;
var hunter = fish?.Fisher;
var weight = (int)(fish?.Weight ?? 0);
fish?.Consume();

View file

@ -309,7 +309,7 @@ public partial class HouseRaffleStone : Item
var xLong = 0;
var yLat = 0;
int xMins = 0;
var xMins = 0;
var yMins = 0;
bool xEast = false, ySouth = false;

View file

@ -136,7 +136,7 @@ public partial class PowerScroll : SpecialScroll
_skills = new SkillName[totalSkills];
Array.Copy(_preAosSkills, 0, _skills, 0, _preAosSkills.Length);
int pos = 0;
var pos = 0;
if (Core.AOS)
{

View file

@ -328,7 +328,7 @@ public partial class BannerDeed : Item, IRewardItem
return;
}
Banner banner = new Banner(_itemId + (info.ButtonID == (int)Buttons.East ? 1 : 0));
var banner = new Banner(_itemId + (info.ButtonID == (int)Buttons.East ? 1 : 0));
_house.Addons.Add(banner);
banner.IsRewardItem = _banner.IsRewardItem;

View file

@ -198,7 +198,7 @@ public partial class CannonAddon : BaseAddon
for (var count = Utility.Random(3); count > 0; count--)
{
Point3D location = new Point3D(
var location = new Point3D(
target.X + Utility.RandomMinMax(-1, 1),
target.Y + Utility.RandomMinMax(-1, 1),
target.Z

View file

@ -30,7 +30,7 @@ namespace Server.Items
defender.Warmode = false;
}
ForceArrowInfo info = GetInfo(attacker, defender);
var info = GetInfo(attacker, defender);
if (info == null)
{
@ -55,7 +55,7 @@ namespace Server.Items
public static void BeginForceArrow(Mobile attacker, Mobile defender)
{
ForceArrowInfo info = new ForceArrowInfo(attacker, defender);
var info = new ForceArrowInfo(attacker, defender);
info.Timer = new ForceArrowTimer(info);
if (_table.TryGetValue(attacker, out var list))
@ -79,7 +79,7 @@ namespace Server.Items
return;
}
Mobile attacker = info.Attacker;
var attacker = info.Attacker;
if (_table.TryGetValue(attacker, out var list) && list.Remove(info) && list.Count == 0)
{
@ -93,7 +93,7 @@ namespace Server.Items
{
if (_table.TryGetValue(attacker, out var list))
{
foreach (ForceArrowInfo info in list)
foreach (var info in list)
{
if (info.Defender == defender)
{
@ -109,7 +109,7 @@ namespace Server.Items
{
if (_table.TryGetValue(attacker, out var list))
{
foreach (ForceArrowInfo info in list)
foreach (var info in list)
{
if (info.Defender == defender)
{

View file

@ -73,7 +73,7 @@ public class ForceOfNature : WeaponAbility
if (t.Hits % 12 == 0)
{
int duration = target.Skills[SkillName.MagicResist].Value >= 90.0 ? 1 : 2;
var duration = target.Skills[SkillName.MagicResist].Value >= 90.0 ? 1 : 2;
target.Paralyze(TimeSpan.FromSeconds(duration));
target.FixedEffect(0x376A, 9, 32);

View file

@ -37,7 +37,7 @@ namespace Server.Items
attacker.Skills.Ninjitsu.Value
) - 50.0) / 70.0 + 5));
bool didEffect = false;
var didEffect = false;
foreach (var m in attacker.GetMobilesInRange(1))
{

View file

@ -26,7 +26,7 @@ public class InfusedThrow : WeaponAbility
AOS.Damage(defender, attacker, 15, false, 0, 0, 0, 0, 0, 100);
IMount mount = defender.Mount;
var mount = defender.Mount;
if ((defender.Mounted || defender.Flying || AnimalForm.UnderTransformation(defender)) &&
!attacker.Mounted && !attacker.Flying && defender is not ChaosDragoon && defender is not ChaosDragoonElite)

View file

@ -17,7 +17,7 @@ namespace Server.Items
ClearCurrentAbility(attacker);
Map map = attacker.Map;
var map = attacker.Map;
if (map == null || attacker.Weapon is not BaseWeapon weapon || !CheckMana(attacker, true))
{
@ -25,7 +25,7 @@ namespace Server.Items
}
using var list = PooledRefList<Mobile>.Create();
foreach (Mobile m in worldLocation.Map.GetMobilesInRange(worldLocation.Location, 5))
foreach (var m in worldLocation.Map.GetMobilesInRange(worldLocation.Location, 5))
{
if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) &&
m is { Deleted: false, Alive: true } && attacker.CanSee(m) && attacker.CanBeHarmful(m) &&

View file

@ -20,7 +20,7 @@ public class MysticArc : WeaponAbility
return;
}
BaseThrown weapon = attacker.Weapon as BaseThrown;
var weapon = attacker.Weapon as BaseThrown;
if (weapon == null)
{
@ -28,7 +28,7 @@ public class MysticArc : WeaponAbility
}
using var queue = PooledRefQueue<Mobile>.Create();
foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange))
foreach (var m in attacker.GetMobilesInRange(weapon.MaxRange))
{
if (m == defender)
{

View file

@ -240,11 +240,11 @@ public abstract class WeaponAbility
}
var reqSecondarySkill = GetRequiredSecondarySkill(from);
SkillName secondarySkill = GetSecondarySkillName(from);
var secondarySkill = GetSecondarySkillName(from);
if (RequiresSecondarySkill(from) && from.Skills[secondarySkill].Base < reqSecondarySkill)
{
int loc = GetSkillLocalization(secondarySkill);
var loc = GetSkillLocalization(secondarySkill);
if (loc == 1060184)
{
@ -359,7 +359,7 @@ public abstract class WeaponAbility
return false;
}
string option = this switch
var option = this switch
{
ArmorIgnore _ => "Armor Ignore",
ArmorPierce _ => "Armor Pierce",

View file

@ -1633,7 +1633,7 @@ public abstract partial class BaseWeapon
{
var positionChance = Utility.RandomDouble();
Item armorItem = positionChance switch
var armorItem = positionChance switch
{
< 0.07 => defender.NeckArmor,
< 0.14 => defender.HandArmor,
@ -1666,7 +1666,7 @@ public abstract partial class BaseWeapon
var chance = Utility.RandomDouble();
Item armorItem = chance switch
var armorItem = chance switch
{
< 0.07 => defender.NeckArmor,
< 0.14 => defender.HandArmor,
@ -1685,7 +1685,7 @@ public abstract partial class BaseWeapon
if (virtualArmor > 0)
{
double scalar = chance switch
var scalar = chance switch
{
< 0.14 => 0.07,
< 0.28 => 0.14,

View file

@ -18,7 +18,7 @@ public abstract partial class BaseThrown : BaseRanged
{
get
{
int baseRange = MaxThrowRange;
var baseRange = MaxThrowRange;
return Parent is Mobile attacker
? baseRange - 3 + (attacker.Str - AosStrengthReq) / ((140 - AosStrengthReq) / 3)

Some files were not shown because too many files have changed in this diff Show more