Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -66,13 +66,6 @@ namespace Server.Items
int version = reader.ReadInt();
}
public void Explode_Callback(object state)
{
object[] states = (object[])state;
Explode((Mobile)states[0], (Point3D)states[1], (Map)states[2]);
}
public virtual void Explode(Mobile from, Point3D loc, Map map)
{
if (Deleted || map == null)
@ -129,9 +122,8 @@ namespace Server.Items
else
to = new Entity(Serial.Zero, new Point3D(p), from.Map);
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0);
Timer.DelayCall(TimeSpan.FromSeconds(1.5), new TimerStateCallback(Potion.Explode_Callback),
new object[] { from, new Point3D(p), from.Map });
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue);
Timer.DelayCall(TimeSpan.FromSeconds(1.5), () => Potion.Explode(from, new Point3D(p), from.Map));
}
}
@ -292,33 +284,28 @@ namespace Server.Items
#region Delay
private static Hashtable m_Delay = new Hashtable();
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
public static void AddDelay(Mobile m)
{
if (m_Delay[m] is Timer timer)
timer.Stop();
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(30), new TimerStateCallback(EndDelay_Callback), m);
m_Delay[m]?.Stop();
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(30), EndDelay, m);
}
public static int GetDelay(Mobile m)
{
if (m_Delay[m] is Timer timer && timer.Next > DateTime.UtcNow)
Timer timer = m_Delay[m];
if (timer?.Next > DateTime.UtcNow)
return (int)(timer.Next - DateTime.UtcNow).TotalSeconds;
return 0;
}
private static void EndDelay_Callback(object obj)
{
if (obj is Mobile mobile)
EndDelay(mobile);
}
public static void EndDelay(Mobile m)
{
if (m_Delay[m] is Timer timer)
Timer timer = m_Delay[m];
if (timer != null)
{
timer.Stop();
m_Delay.Remove(m);
@ -327,4 +314,4 @@ namespace Server.Items
#endregion
}
}
}