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

@ -151,10 +151,12 @@ namespace Server.Items
DateTime next = reader.ReadDateTime();
if (next < DateTime.UtcNow)
m_Timer = Timer.DelayCall(TimeSpan.Zero, RechargeTime, Recharge);
var now = DateTime.UtcNow;
if (next < now)
m_Timer = Timer.DelayCall(RechargeTime, Recharge);
else
m_Timer = Timer.DelayCall(next - DateTime.UtcNow, RechargeTime, Recharge);
m_Timer = Timer.DelayCall(next - now, RechargeTime, Recharge);
}
public void Recharge()

View file

@ -54,7 +54,7 @@ namespace Server.Items
{
from.Location = Location;
Timer.DelayCall(TimeSpan.FromSeconds(0.5), () => Activate(c, from));
Timer.DelayCall(TimeSpan.FromSeconds(0.5), Activate, c, from);
}
else
{
@ -161,4 +161,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -26,7 +26,7 @@ namespace Server.Items
from.Location = Location;
c.ItemID = 0x124A;
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, () => Activate(c, from));
Timer.DelayCall(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 3, Activate, c, from);
}
else
{
@ -82,16 +82,18 @@ namespace Server.Items
blood.MoveToWorld(new Point3D(x, y, z), c.Map);
}
if (from.Female)
from.PlaySound(Utility.RandomMinMax(0x150, 0x153));
else
from.PlaySound(Utility.RandomMinMax(0x15A, 0x15D));
from.PlaySound(from.Female ? Utility.RandomMinMax(0x150, 0x153) : Utility.RandomMinMax(0x15A, 0x15D));
from.LocalOverheadMessage(MessageType.Regular, 0,
501777); // Hmm... you suspect that if you used this again, it might hurt.
SpellHelper.Damage(TimeSpan.Zero, from, Utility.Dice(2, 10, 5));
Timer.DelayCall(TimeSpan.FromSeconds(1), () => c.ItemID = 0x1249);
Timer.DelayCall(TimeSpan.FromSeconds(1), Deactivate, c);
}
private void Deactivate(AddonComponent c)
{
c.ItemID = 0x1249;
}
}
@ -121,4 +123,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using Server.Multis;
@ -170,7 +169,7 @@ namespace Server.Items
}
}
Timer.DelayCall(TimeSpan.Zero, ValidatePlacement);
Timer.DelayCall(ValidatePlacement);
}
public void ValidatePlacement()

View file

@ -65,7 +65,7 @@ namespace Server.Items
Point3D p = new Point3D(Location);
if (SpellHelper.FindValidSpawnLocation(Map, ref p, true))
Timer.DelayCall(TimeSpan.FromSeconds(0), () => m.MoveToWorld(p, m.Map));
Timer.DelayCall(TimeSpan.FromSeconds(0), m.MoveToWorld, p, m.Map);
action = 21 + Utility.Random(2);
sound = m.Female ? 0x317 : 0x426;
@ -77,7 +77,7 @@ namespace Server.Items
}
if (action > 0)
Timer.DelayCall(TimeSpan.FromSeconds(0.4), from => BeginFall_Callback(from, action, sound), m);
Timer.DelayCall(TimeSpan.FromSeconds(0.4), BeginFall_Callback, m, action, sound);
}
private static void BeginFall_Callback(Mobile m, int action, int sound)
@ -107,4 +107,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -1,4 +1,3 @@
using System;
using Server.Gumps;
using Server.Multis;
using Server.Network;
@ -71,7 +70,7 @@ namespace Server.Items
int version = reader.ReadInt();
Timer.DelayCall(TimeSpan.Zero, FixMovingCrate);
Timer.DelayCall(FixMovingCrate);
}
private void FixMovingCrate()

View file

@ -15,7 +15,7 @@ namespace Server.Items
Movable = false;
Visible = itemID <= 1;
Timer.DelayCall(TimeSpan.Zero, Initialize);
Timer.DelayCall(Initialize);
}
public PlagueBeastOrgan(Serial serial) : base(serial)