Code cleanup (#188)

This commit is contained in:
Kamron Batman 2020-08-01 08:40:06 -07:00 • committed by GitHub
parent df53c16620
commit 010fd9402a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
185 changed files with 1052 additions and 1271 deletions

View file

@ -531,7 +531,7 @@ namespace Server.Mobiles
EventSink.EquipMacro += EquipMacro;
EventSink.UnequipMacro += UnequipMacro;
if (Core.SE) Timer.DelayCall(TimeSpan.Zero, CheckPets);
if (Core.SE) Timer.DelayCall(CheckPets);
}
private static void TargetedSkillUse(Mobile from, IEntity target, int skillId)
@ -685,7 +685,7 @@ namespace Server.Mobiles
m_LastPersonalLight = personal;
ns.Send(GlobalLightLevel.Instantiate(global));
ns.Send(new PersonalLightLevel(this.Serial, personal));
ns.Send(new PersonalLightLevel(Serial, personal));
}
public override int GetMinResistance(ResistanceType type)
@ -733,7 +733,8 @@ namespace Server.Mobiles
notice =
"The server is currently under lockdown. You do not have sufficient access level to connect.";
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => from.NetState?.Dispose());
if (from.NetState != null)
Timer.DelayCall(TimeSpan.FromSeconds(1.0), from.NetState.Dispose);
}
else if (from.AccessLevel >= AccessLevel.Administrator)
{
@ -762,7 +763,7 @@ namespace Server.Mobiles
return;
m_NoDeltaRecursion = true;
Timer.DelayCall(TimeSpan.Zero, ValidateEquipment_Sandbox);
Timer.DelayCall(ValidateEquipment_Sandbox);
}
private void ValidateEquipment_Sandbox()
@ -981,7 +982,7 @@ namespace Server.Mobiles
DisguiseTimers.StartTimer(m);
Timer.DelayCall(TimeSpan.Zero, SpecialMove.ClearAllMoves, m);
Timer.DelayCall(SpecialMove.ClearAllMoves, m);
}
private static void EventSink_Disconnected(Mobile from)
@ -2592,7 +2593,7 @@ namespace Server.Mobiles
public virtual void CheckedAnimate(int action, int frameCount, int repeatCount, bool forward, bool repeat, int delay)
{
if (!Mounted)
this.Animate(action, frameCount, repeatCount, forward, repeat, delay);
Animate(action, frameCount, repeatCount, forward, repeat, delay);
}
public override bool CanSee(Item item) => DesignContext?.Foundation.IsHiddenToCustomizer(item) != true && base.CanSee(item);
@ -2739,7 +2740,7 @@ namespace Server.Mobiles
if (pet.Map != Map)
{
pet.PlaySound(pet.GetAngerSound());
Timer.DelayCall(TimeSpan.Zero, pet.Delete);
Timer.DelayCall(pet.Delete);
}
continue;
@ -4351,15 +4352,12 @@ namespace Server.Mobiles
{
m_Values ??= new TitleInfo[ChampionSpawnInfo.Table.Length];
if (value < 0)
value = 0;
if (index < 0 || index >= m_Values.Length)
return;
m_Values[index] ??= new TitleInfo();
m_Values[index].Value = value;
m_Values[index].Value = Math.Max(value, 0);
}
public void Award(int index, int value)
@ -4385,10 +4383,7 @@ namespace Server.Mobiles
int before = m_Values[index].Value;
if (m_Values[index].Value - value < 0)
m_Values[index].Value = 0;
else
m_Values[index].Value -= value;
m_Values[index].Value -= Math.Min(value, m_Values[index].Value);
if (before != m_Values[index].Value)
m_Values[index].LastDecay = DateTime.UtcNow;