Code cleanup (#188)
This commit is contained in:
parent
df53c16620
commit
010fd9402a
185 changed files with 1052 additions and 1271 deletions
|
|
@ -291,7 +291,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, FixMovingCrate);
|
||||
Timer.DelayCall(FixMovingCrate);
|
||||
}
|
||||
|
||||
private void FixMovingCrate()
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ScissorHelper(from, item, 1, false);
|
||||
ScissorHelper(from, item, 1, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (version < 1)
|
||||
Timer.DelayCall(TimeSpan.Zero, UpdateWeight);
|
||||
Timer.DelayCall(UpdateWeight);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace Server.Items
|
|||
to = new Entity(Serial.Zero, 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));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.5), Potion.Explode, from, new Point3D(p), from.Map);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace Server.Items
|
|||
|
||||
Geometry.Circle2D(loc, map, Radius, BlastEffect, 270, 90);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), () => CircleEffect2(loc, map));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), CircleEffect2, loc, map);
|
||||
|
||||
foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
|
||||
if (mobile is BaseCreature mon)
|
||||
|
|
@ -121,7 +121,7 @@ namespace Server.Items
|
|||
to = new Entity(Serial.Zero, 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));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), Potion.Explode, from, new Point3D(p), from.Map);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ namespace Server.Items
|
|||
if (Potion.Amount > 1) Mobile.LiftItemDupe(Potion, 1);
|
||||
|
||||
Potion.Internalize();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => Potion.Reposition_OnTick(from, new Point3D(p), map));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), Potion.Reposition_OnTick, from, new Point3D(p), map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Server.Items
|
|||
get => m_SkillLevel;
|
||||
set
|
||||
{
|
||||
m_SkillLevel = Math.Max(Math.Min(value, 120.0), 0);
|
||||
m_SkillLevel = Math.Clamp(value, 0, 120.0);
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (m_UsesRemaining != oldUses)
|
||||
Timer.DelayCall(TimeSpan.Zero, InvalidateProperties);
|
||||
Timer.DelayCall(InvalidateProperties);
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Server.Items
|
|||
ConsumeUse(weapon);
|
||||
|
||||
if (CombatCheck(from, target))
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), OnHit, from, target, weapon);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.5), ResetUsing, from);
|
||||
}
|
||||
|
|
@ -86,12 +86,15 @@ namespace Server.Items
|
|||
{
|
||||
if (weapon.UsesRemaining > 0)
|
||||
{
|
||||
INinjaAmmo ammo = ActivatorUtil.CreateInstance(weapon.AmmoType, weapon.UsesRemaining) as INinjaAmmo;
|
||||
Item ammo = ActivatorUtil.CreateInstance(weapon.AmmoType, weapon.UsesRemaining) as Item;
|
||||
|
||||
ammo.Poison = weapon.Poison;
|
||||
ammo.PoisonCharges = weapon.PoisonCharges;
|
||||
if (ammo is INinjaAmmo ninaAmmo)
|
||||
{
|
||||
ninaAmmo.Poison = weapon.Poison;
|
||||
ninaAmmo.PoisonCharges = weapon.PoisonCharges;
|
||||
}
|
||||
|
||||
from.AddToBackpack((Item)ammo);
|
||||
from.AddToBackpack(ammo);
|
||||
|
||||
weapon.UsesRemaining = 0;
|
||||
weapon.PoisonCharges = 0;
|
||||
|
|
@ -254,9 +257,7 @@ namespace Server.Items
|
|||
|
||||
private static void OnTarget(Mobile from, object targeted, INinjaWeapon weapon)
|
||||
{
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if (WeaponIsValid(weapon, from))
|
||||
if (from is PlayerMobile player && WeaponIsValid(weapon, from))
|
||||
{
|
||||
if (targeted is Mobile mobile)
|
||||
Shoot(player, mobile, weapon);
|
||||
|
|
@ -267,12 +268,8 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
private static bool WeaponIsValid(INinjaWeapon weapon, Mobile from)
|
||||
{
|
||||
Item item = weapon as Item;
|
||||
|
||||
return !item.Deleted && item.RootParent == from;
|
||||
}
|
||||
private static bool WeaponIsValid(INinjaWeapon weapon, Mobile from) =>
|
||||
weapon is Item item && !item.Deleted && item.RootParent == from;
|
||||
|
||||
public class LoadEntry : ContextMenuEntry
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue