chore: Use var everywhere (#2294)
This commit is contained in:
parent
0b34cc4417
commit
ebaf104935
267 changed files with 873 additions and 873 deletions
|
|
@ -203,7 +203,7 @@ public static class AntiMacroSystem
|
|||
_antiMacroTable ??= new Dictionary<Mobile, PlayerAntiMacro>();
|
||||
|
||||
// Hot path so use optimized code
|
||||
ref PlayerAntiMacro antiMacro = ref CollectionsMarshal.GetValueRefOrAddDefault(_antiMacroTable, pm, out var exists);
|
||||
ref var antiMacro = ref CollectionsMarshal.GetValueRefOrAddDefault(_antiMacroTable, pm, out var exists);
|
||||
if (!exists)
|
||||
{
|
||||
antiMacro = new PlayerAntiMacro();
|
||||
|
|
@ -241,8 +241,8 @@ public static class AntiMacroSystem
|
|||
var now = Core.Now;
|
||||
|
||||
// Potential hot path, so use optimized code
|
||||
ref CountAndTimeStamp _countTimeStamp =
|
||||
ref CollectionsMarshal.GetValueRefOrAddDefault(_antiMacroTracking, (skill, obj), out bool exists);
|
||||
ref var _countTimeStamp =
|
||||
ref CollectionsMarshal.GetValueRefOrAddDefault(_antiMacroTracking, (skill, obj), out var exists);
|
||||
|
||||
_countTimeStamp._count++;
|
||||
|
||||
|
|
|
|||
|
|
@ -165,8 +165,8 @@ namespace Server.SkillHandlers
|
|||
const int SkillCooldown = 10000; // 10s
|
||||
|
||||
// Calculate how much time has passed since the targeter was opened
|
||||
int ticksSinceTargeter = (int)(Core.TickCount - (_from.NextSkillTime - TargeterCooldown));
|
||||
int remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
var ticksSinceTargeter = (int)(Core.TickCount - (_from.NextSkillTime - TargeterCooldown));
|
||||
var remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
_from.NextSkillTime = Core.TickCount + remainingCooldown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.SkillHandlers
|
|||
{
|
||||
var foundAnyone = false;
|
||||
|
||||
Point3D p = targ switch
|
||||
var p = targ switch
|
||||
{
|
||||
Mobile mobile => mobile.Location,
|
||||
Item item => item.Location,
|
||||
|
|
@ -118,8 +118,8 @@ namespace Server.SkillHandlers
|
|||
const int SkillCooldown = 10000; // 10s
|
||||
|
||||
// Calculate how much time has passed since the targeter was opened
|
||||
int ticksSinceTargeter = (int)(Core.TickCount - (src.NextSkillTime - TargeterCooldown));
|
||||
int remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
var ticksSinceTargeter = (int)(Core.TickCount - (src.NextSkillTime - TargeterCooldown));
|
||||
var remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
src.NextSkillTime = Core.TickCount + remainingCooldown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace Server.SkillHandlers
|
|||
if (c.Looters.Count > 0)
|
||||
{
|
||||
var sb = ValueStringBuilder.Create(128);
|
||||
int i = 0;
|
||||
var i = 0;
|
||||
foreach (var looter in c.Looters)
|
||||
{
|
||||
if (i == c.Looters.Count - 1)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public static class ItemIdentification
|
|||
return;
|
||||
}
|
||||
|
||||
bool identified = false;
|
||||
var identified = false;
|
||||
|
||||
if (o is Item item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -414,8 +414,8 @@ public static class Stealing
|
|||
const int SkillCooldown = 10000; // 10s
|
||||
|
||||
// Calculate how much time has passed since the targeter was opened
|
||||
int ticksSinceTargeter = (int)(Core.TickCount - (from.NextSkillTime - TargeterCooldown));
|
||||
int remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
var ticksSinceTargeter = (int)(Core.TickCount - (from.NextSkillTime - TargeterCooldown));
|
||||
var remainingCooldown = Math.Max(0, SkillCooldown - ticksSinceTargeter);
|
||||
from.NextSkillTime = Core.TickCount + remainingCooldown;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue