Modernization Fixes & Updates to Default Values (#3)
This commit is contained in:
parent
445eddff68
commit
dcf64091b1
768 changed files with 10507 additions and 14196 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,13 +67,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)
|
||||
|
|
@ -91,7 +84,7 @@ namespace Server.Items
|
|||
|
||||
Geometry.Circle2D(loc, map, Radius, BlastEffect, 270, 90);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), new TimerStateCallback(CircleEffect2), new object[] { loc, map });
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), () => CircleEffect2(loc, map));
|
||||
|
||||
foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
|
||||
if (mobile is BaseCreature mon)
|
||||
|
|
@ -134,9 +127,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.0), 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.0), () => Potion.Explode(from, new Point3D(p), from.Map));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -148,44 +140,36 @@ namespace Server.Items
|
|||
Effects.SendLocationEffect(p, map, 0x376A, 4, 9);
|
||||
}
|
||||
|
||||
public void CircleEffect2(object state)
|
||||
public void CircleEffect2(Point3D p, Map m)
|
||||
{
|
||||
object[] states = (object[])state;
|
||||
|
||||
Geometry.Circle2D((Point3D)states[0], (Map)states[1], Radius, BlastEffect, 90, 270);
|
||||
Geometry.Circle2D(p, m, Radius, BlastEffect, 90, 270);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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(60), new TimerStateCallback(EndDelay_Callback), m);
|
||||
m_Delay[m]?.Stop();
|
||||
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(60), 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);
|
||||
|
|
@ -194,4 +178,4 @@ namespace Server.Items
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,24 +91,22 @@ namespace Server.Items
|
|||
{
|
||||
from.SendLocalizedMessage(500236); // You should throw it now!
|
||||
|
||||
int timer = 3;
|
||||
|
||||
if (Core.ML)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5,
|
||||
new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 3.6 seconds explosion delay
|
||||
() => Detonate_OnTick(from, timer--)); // 3.6 seconds explosion delay
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4,
|
||||
new TimerStateCallback(Detonate_OnTick), new object[] { from, 3 }); // 2.6 seconds explosion delay
|
||||
() => Detonate_OnTick(from, timer--)); // 2.6 seconds explosion delay
|
||||
}
|
||||
}
|
||||
|
||||
private void Detonate_OnTick(object state)
|
||||
private void Detonate_OnTick(Mobile from, int timer)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
int timer = (int)states[1];
|
||||
|
||||
object parent = FindParent(from);
|
||||
|
||||
if (timer == 0)
|
||||
|
|
@ -140,23 +138,14 @@ namespace Server.Items
|
|||
item.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
else if (parent is Mobile mobile)
|
||||
mobile.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
|
||||
states[1] = timer - 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void Reposition_OnTick(object state)
|
||||
private void Reposition_OnTick(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
object[] states = (object[])state;
|
||||
Mobile from = (Mobile)states[0];
|
||||
IPoint3D p = (IPoint3D)states[1];
|
||||
Map map = (Map)states[2];
|
||||
|
||||
Point3D loc = new Point3D(p);
|
||||
|
||||
if (InstantExplosion)
|
||||
Explode(from, true, loc, map);
|
||||
else
|
||||
|
|
@ -189,7 +178,7 @@ namespace Server.Items
|
|||
if (direct)
|
||||
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
|
||||
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInRange(loc, ExplosionRange, LeveledExplosion, true);
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInRange(loc, ExplosionRange, LeveledExplosion);
|
||||
List<IEntity> toExplode = new List<IEntity>();
|
||||
|
||||
int toDamage = 0;
|
||||
|
|
@ -274,13 +263,12 @@ namespace Server.Items
|
|||
to = m;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect(from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0);
|
||||
Effects.SendMovingEffect(from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue);
|
||||
|
||||
if (Potion.Amount > 1) Mobile.LiftItemDupe(Potion, 1);
|
||||
|
||||
Potion.Internalize();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback(Potion.Reposition_OnTick),
|
||||
new object[] { from, p, map });
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => Potion.Reposition_OnTick(from, new Point3D(p), map));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Server.Items
|
|||
}
|
||||
else
|
||||
{
|
||||
if (from.BeginAction(typeof(BaseHealPotion)))
|
||||
if (from.BeginAction<BaseHealPotion>())
|
||||
{
|
||||
DoHeal(from);
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ namespace Server.Items
|
|||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Delay), new TimerStateCallback(ReleaseHealLock), from);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Delay), from.EndAction<BaseHealPotion>);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -75,10 +75,5 @@ namespace Server.Items
|
|||
1049547); // You decide against drinking this potion, as you are already at full health.
|
||||
}
|
||||
}
|
||||
|
||||
private static void ReleaseHealLock(object state)
|
||||
{
|
||||
((Mobile)state).EndAction(typeof(BaseHealPotion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class InvisibilityPotion : BasePotion
|
||||
{
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
|
||||
[Constructible]
|
||||
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility)
|
||||
|
|
@ -34,16 +35,10 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
Consume();
|
||||
m_Table[from] = Timer.DelayCall(TimeSpan.FromSeconds(2), new TimerStateCallback(Hide_Callback), from);
|
||||
m_Table[from] = Timer.DelayCall(TimeSpan.FromSeconds(2), Hide, from);
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
|
||||
private static void Hide_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
Hide(mobile);
|
||||
}
|
||||
|
||||
public static void Hide(Mobile m)
|
||||
{
|
||||
Effects.SendLocationParticles(
|
||||
|
|
@ -57,13 +52,7 @@ namespace Server.Items
|
|||
|
||||
RemoveTimer(m);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), new TimerStateCallback(EndHide_Callback), m);
|
||||
}
|
||||
|
||||
private static void EndHide_Callback(object obj)
|
||||
{
|
||||
if (obj is Mobile mobile)
|
||||
EndHide(mobile);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), EndHide, m);
|
||||
}
|
||||
|
||||
public static void EndHide(Mobile m)
|
||||
|
|
@ -79,11 +68,11 @@ namespace Server.Items
|
|||
|
||||
public static void RemoveTimer(Mobile m)
|
||||
{
|
||||
Timer t = (Timer)m_Table[m];
|
||||
Timer timer = m_Table[m];
|
||||
|
||||
if (t != null)
|
||||
if (timer != null)
|
||||
{
|
||||
t.Stop();
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
}
|
||||
|
|
@ -108,4 +97,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace Server.Items
|
|||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.BeginAction(typeof(LightCycle)))
|
||||
if (from.BeginAction<LightCycle>())
|
||||
{
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue