Code cleanup (#188)
This commit is contained in:
parent
df53c16620
commit
010fd9402a
185 changed files with 1052 additions and 1271 deletions
|
|
@ -44,7 +44,7 @@ namespace Server.Items
|
|||
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,
|
||||
BaseTool tool, CraftItem craftItem, int resHue)
|
||||
{
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class JackOLantern : BaseAddon
|
||||
|
|
@ -15,18 +13,18 @@ namespace Server.Items
|
|||
{
|
||||
AddComponent(new AddonComponent(5703), 0, 0, +0);
|
||||
|
||||
int hue = 1161;
|
||||
const int hue = 1161;
|
||||
// ( 1 > Utility.Random( 5 ) ? 2118 : 1161 );
|
||||
|
||||
if (!south)
|
||||
{
|
||||
AddComponent(GetComponent(3178, 0000), 0, 0, -1);
|
||||
AddComponent(GetComponent(3178, 0), 0, 0, -1);
|
||||
AddComponent(GetComponent(3883, hue), 0, 0, +1);
|
||||
AddComponent(GetComponent(3862, hue), 0, 0, +0);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddComponent(GetComponent(3179, 0000), 0, 0, +0);
|
||||
AddComponent(GetComponent(3179, 0), 0, 0, +0);
|
||||
AddComponent(GetComponent(3885, hue), 0, 0, -1);
|
||||
AddComponent(GetComponent(3871, hue), 0, 0, +0);
|
||||
}
|
||||
|
|
@ -39,15 +37,12 @@ namespace Server.Items
|
|||
|
||||
public override bool ShareHue => false;
|
||||
|
||||
private AddonComponent GetComponent(int itemID, int hue)
|
||||
{
|
||||
AddonComponent ac = new AddonComponent(itemID);
|
||||
|
||||
ac.Hue = hue;
|
||||
ac.Name = "jack-o-lantern";
|
||||
|
||||
return ac;
|
||||
}
|
||||
private static AddonComponent GetComponent(int itemID, int hue) =>
|
||||
new AddonComponent(itemID)
|
||||
{
|
||||
Hue = hue,
|
||||
Name = "jack-o-lantern"
|
||||
};
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
|
|
@ -62,21 +57,31 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadByte();
|
||||
|
||||
if (version == 0)
|
||||
Timer.DelayCall(TimeSpan.Zero, () =>
|
||||
{
|
||||
for (int i = 0; i < Components.Count; ++i)
|
||||
if (Components[i] is AddonComponent ac && ac.Hue == 2118)
|
||||
ac.Hue = 1161;
|
||||
});
|
||||
|
||||
if (version <= 1)
|
||||
Timer.DelayCall(TimeSpan.Zero, () =>
|
||||
Timer.DelayCall(Fix, version);
|
||||
}
|
||||
|
||||
private void Fix(int version)
|
||||
{
|
||||
for (int i = 0; i < Components.Count; ++i)
|
||||
{
|
||||
var ac = Components[i];
|
||||
switch (version)
|
||||
{
|
||||
for (int i = 0; i < Components.Count; ++i)
|
||||
if (Components[i] is AddonComponent ac)
|
||||
ac.Name = "jack-o-lantern";
|
||||
});
|
||||
case 1:
|
||||
{
|
||||
ac.Name = "jack-o-lantern";
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if (ac.Hue == 2118)
|
||||
ac.Hue = 1161;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Items
|
|||
SendLocalizedMessageTo(from, 500803); // You feel as though you've slept for days!
|
||||
}
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromHours(2.0), () => ReleaseUseLock_Callback(from, random));
|
||||
Timer.DelayCall(TimeSpan.FromHours(2.0), ReleaseUseLock_Callback, from, random);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -168,4 +168,4 @@ namespace Server.Items
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ namespace Server.Items
|
|||
fish = new StrippedFlakeFish();
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
default: // 5
|
||||
{
|
||||
message = 1074365; // A new creature has hatched overnight in the tank.
|
||||
fish = new StrippedSosarianSwill();
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum WaterState
|
||||
|
|
@ -27,16 +29,7 @@ namespace Server.Items
|
|||
public int State
|
||||
{
|
||||
get => m_State;
|
||||
set
|
||||
{
|
||||
m_State = value;
|
||||
|
||||
if (m_State < 0)
|
||||
m_State = 0;
|
||||
|
||||
if (m_State > 4)
|
||||
m_State = 4;
|
||||
}
|
||||
set => m_State = Math.Clamp(value, 0, 4);
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
|
|
@ -70,4 +63,4 @@ namespace Server.Items
|
|||
Added = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ namespace Server.Items
|
|||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
PlayerConstructed = true;
|
||||
|
|
@ -547,12 +547,12 @@ namespace Server.Items
|
|||
|
||||
CraftItem item = system.CraftItems.SearchFor(GetType());
|
||||
|
||||
if (item?.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2)
|
||||
if (item?.Resources.Count == 1 && item.Resources[0].Amount >= 2)
|
||||
try
|
||||
{
|
||||
Item res = (Item)ActivatorUtil.CreateInstance(CraftResources.GetInfo(m_Resource).ResourceTypes[0]);
|
||||
|
||||
ScissorHelper(from, res, PlayerConstructed ? item.Resources.GetAt(0).Amount / 2 : 1);
|
||||
ScissorHelper(from, res, PlayerConstructed ? item.Resources[0].Amount / 2 : 1);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
|
|
@ -623,9 +623,8 @@ namespace Server.Items
|
|||
double halfar = ArmorRating / 2.0;
|
||||
int absorbed = (int)(halfar + halfar * Utility.RandomDouble());
|
||||
|
||||
damageTaken -= absorbed;
|
||||
if (damageTaken < 0)
|
||||
damageTaken = 0;
|
||||
// Don't go below zero
|
||||
damageTaken = Math.Min(absorbed, damageTaken);
|
||||
|
||||
if (absorbed < 2)
|
||||
absorbed = 2;
|
||||
|
|
@ -1584,7 +1583,7 @@ namespace Server.Items
|
|||
if (Core.ML && (prop = Attributes.IncreasedKarmaLoss) != 0)
|
||||
list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~%
|
||||
|
||||
this.AddResistanceProperties(list);
|
||||
AddResistanceProperties(list);
|
||||
|
||||
if ((prop = GetDurabilityBonus()) > 0)
|
||||
list.Add(1060410, prop.ToString()); // durability ~1_val~%
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Items
|
|||
if (Deleted || !from.CanSee(this))
|
||||
return false;
|
||||
|
||||
this.ScissorHelper(from, new Bone(), Utility.RandomMinMax(10, 15));
|
||||
ScissorHelper(from, new Bone(), Utility.RandomMinMax(10, 15));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Items
|
|||
if (Deleted || !from.CanSee(this))
|
||||
return false;
|
||||
|
||||
this.ScissorHelper(from, new Bone(), Utility.RandomMinMax(3, 5));
|
||||
ScissorHelper(from, new Bone(), Utility.RandomMinMax(3, 5));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Items
|
|||
get => m_Level;
|
||||
set
|
||||
{
|
||||
m_Level = Math.Max(Math.Min(2, value), 0);
|
||||
m_Level = Math.Clamp(value, 0, 2);
|
||||
Attributes.BonusInt = 2 + m_Level;
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
|
@ -52,4 +52,4 @@ namespace Server.Items
|
|||
Level = Attributes.BonusInt - 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ namespace Server.Items
|
|||
|
||||
if (DefaultResource != CraftResource.None)
|
||||
{
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
}
|
||||
|
|
@ -200,16 +200,16 @@ namespace Server.Items
|
|||
|
||||
CraftItem item = system.CraftItems.SearchFor(GetType());
|
||||
|
||||
if (item?.Resources.Count == 1 && item.Resources.GetAt(0).Amount >= 2)
|
||||
if (item?.Resources.Count == 1 && item.Resources[0].Amount >= 2)
|
||||
try
|
||||
{
|
||||
CraftResourceInfo info = CraftResources.GetInfo(m_Resource);
|
||||
|
||||
Type resourceType = info.ResourceTypes?[0] ?? item.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = info.ResourceTypes?[0] ?? item.Resources[0].ItemType;
|
||||
|
||||
Item res = (Item)ActivatorUtil.CreateInstance(resourceType);
|
||||
|
||||
ScissorHelper(from, res, PlayerConstructed ? item.Resources.GetAt(0).Amount / 2 : 1);
|
||||
ScissorHelper(from, res, PlayerConstructed ? item.Resources[0].Amount / 2 : 1);
|
||||
|
||||
res.LootType = LootType.Regular;
|
||||
|
||||
|
|
@ -262,12 +262,10 @@ namespace Server.Items
|
|||
|
||||
public virtual int OnHit(BaseWeapon weapon, int damageTaken)
|
||||
{
|
||||
int Absorbed = Utility.RandomMinMax(1, 4);
|
||||
int absorbed = Utility.RandomMinMax(1, 4);
|
||||
|
||||
damageTaken -= Absorbed;
|
||||
|
||||
if (damageTaken < 0)
|
||||
damageTaken = 0;
|
||||
// Don't go below zero
|
||||
damageTaken = Math.Min(absorbed, damageTaken);
|
||||
|
||||
if (Utility.Random(100) < 25) // 25% chance to lower durability
|
||||
{
|
||||
|
|
@ -280,7 +278,7 @@ namespace Server.Items
|
|||
int wear;
|
||||
|
||||
if (weapon.Type == WeaponType.Bashing)
|
||||
wear = Absorbed / 2;
|
||||
wear = absorbed / 2;
|
||||
else
|
||||
wear = Utility.Random(2);
|
||||
|
||||
|
|
@ -338,13 +336,8 @@ namespace Server.Items
|
|||
InvalidateProperties();
|
||||
}
|
||||
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
|
||||
{
|
||||
if (!Ethic.CheckTrade(from, to, newOwner, this))
|
||||
return false;
|
||||
|
||||
return base.AllowSecureTrade(from, to, newOwner, accepted);
|
||||
}
|
||||
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted) =>
|
||||
Ethic.CheckTrade(from, to, newOwner, this) && base.AllowSecureTrade(from, to, newOwner, accepted);
|
||||
|
||||
public override bool CanEquip(Mobile from)
|
||||
{
|
||||
|
|
@ -406,14 +399,13 @@ namespace Server.Items
|
|||
return AOS.Scale(v, 100 - GetLowerStatReq());
|
||||
}
|
||||
|
||||
public int ComputeStatBonus(StatType type)
|
||||
{
|
||||
if (type == StatType.Str)
|
||||
return BaseStrBonus + Attributes.BonusStr;
|
||||
if (type == StatType.Dex)
|
||||
return BaseDexBonus + Attributes.BonusDex;
|
||||
return BaseIntBonus + Attributes.BonusInt;
|
||||
}
|
||||
public int ComputeStatBonus(StatType type) =>
|
||||
type switch
|
||||
{
|
||||
StatType.Str => BaseStrBonus + Attributes.BonusStr,
|
||||
StatType.Dex => BaseDexBonus + Attributes.BonusDex,
|
||||
_ => BaseIntBonus + Attributes.BonusInt
|
||||
};
|
||||
|
||||
public virtual void AddStatBonuses(Mobile parent)
|
||||
{
|
||||
|
|
@ -533,26 +525,19 @@ namespace Server.Items
|
|||
clothing.ClothingAttributes = new AosArmorAttributes(newItem, ClothingAttributes);
|
||||
}
|
||||
|
||||
public override bool AllowEquippedCast(Mobile from)
|
||||
{
|
||||
if (base.AllowEquippedCast(from))
|
||||
return true;
|
||||
|
||||
return Attributes.SpellChanneling != 0;
|
||||
}
|
||||
public override bool AllowEquippedCast(Mobile from) => base.AllowEquippedCast(from) || Attributes.SpellChanneling != 0;
|
||||
|
||||
public override bool CheckPropertyConflict(Mobile m)
|
||||
{
|
||||
if (base.CheckPropertyConflict(m))
|
||||
return true;
|
||||
|
||||
if (Layer == Layer.Pants)
|
||||
return m.FindItemOnLayer(Layer.InnerLegs) != null;
|
||||
|
||||
if (Layer == Layer.Shirt)
|
||||
return m.FindItemOnLayer(Layer.InnerTorso) != null;
|
||||
|
||||
return false;
|
||||
return Layer switch
|
||||
{
|
||||
Layer.Pants => m.FindItemOnLayer(Layer.InnerLegs) != null,
|
||||
Layer.Shirt => m.FindItemOnLayer(Layer.InnerTorso) != null,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
private string GetNameString() => Name ?? $"#{LabelNumber}";
|
||||
|
|
@ -693,7 +678,7 @@ namespace Server.Items
|
|||
if (Core.ML && (prop = Attributes.IncreasedKarmaLoss) != 0)
|
||||
list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~%
|
||||
|
||||
this.AddResistanceProperties(list);
|
||||
AddResistanceProperties(list);
|
||||
|
||||
if ((prop = ClothingAttributes.DurabilityBonus) > 0)
|
||||
list.Add(1060410, prop.ToString()); // durability ~1_val~%
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
|
||||
if (version == 0 && m_Content == null)
|
||||
Timer.DelayCall(TimeSpan.Zero, AcquireContent);
|
||||
Timer.DelayCall(AcquireContent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace Server.Items
|
|||
if (craftItem == null || craftItem.Resources.Count == 0)
|
||||
return false;
|
||||
|
||||
CraftRes craftResource = craftItem.Resources.GetAt(0);
|
||||
CraftRes craftResource = craftItem.Resources[0];
|
||||
|
||||
if (craftResource.Amount < 2)
|
||||
return false; // Not enough metal to resmelt
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Server.Items
|
|||
if (makersMark)
|
||||
Crafter = from;
|
||||
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Gumps;
|
||||
|
|
@ -143,7 +142,7 @@ namespace Server.Items
|
|||
m_BeforeChangeover = true;
|
||||
|
||||
if (Guild.NewGuildSystem && m_BeforeChangeover)
|
||||
Timer.DelayCall(TimeSpan.Zero, AddToHouse);
|
||||
Timer.DelayCall(AddToHouse);
|
||||
|
||||
if (!Guild.NewGuildSystem && Guild == null)
|
||||
Delete();
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ namespace Server.Items
|
|||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
Resource = CraftResources.GetFromType(resourceType);
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ namespace Server.Items
|
|||
|
||||
if (craftItem.Resources.Count > 1)
|
||||
{
|
||||
resourceType = craftItem.Resources.GetAt(1).ItemType;
|
||||
resourceType = craftItem.Resources[1].ItemType;
|
||||
|
||||
if (resourceType == typeof(StarSapphire))
|
||||
GemType = GemType.StarSapphire;
|
||||
|
|
@ -302,7 +302,7 @@ namespace Server.Items
|
|||
if (Core.ML && (prop = Attributes.IncreasedKarmaLoss) != 0)
|
||||
list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~%
|
||||
|
||||
this.AddResistanceProperties(list);
|
||||
AddResistanceProperties(list);
|
||||
|
||||
if (m_HitPoints >= 0 && m_MaxHitPoints > 0)
|
||||
list.Add(1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints); // durability ~1_val~ / ~2_val~
|
||||
|
|
|
|||
|
|
@ -160,15 +160,8 @@ namespace Server.Items
|
|||
|
||||
public virtual void Validate(ref int x, ref int y)
|
||||
{
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
else if (x >= Width)
|
||||
x = Width - 1;
|
||||
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
else if (y >= Height)
|
||||
y = Height - 1;
|
||||
x = Math.Clamp(x, 0, Width - 1);
|
||||
y = Math.Clamp(y, 0, Height - 1);
|
||||
}
|
||||
|
||||
public virtual bool ValidateEdit(Mobile from) => m_Editable && Validate(from);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Items
|
|||
|
||||
to.Damage(1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.0), () => from.EndAction<Bola>());
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.0), from.EndAction<Bola>);
|
||||
}
|
||||
|
||||
private static bool HasFreeHands(Mobile from)
|
||||
|
|
@ -191,7 +191,7 @@ namespace Server.Items
|
|||
from.Animate(11, 5, 1, true, false, 0);
|
||||
from.MovingEffect(to, 0x26AC, 10, 0, false, false);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), () => FinishThrow(from, to));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.5), FinishThrow, from, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if (remainder == 0)
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
|
||||
m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[^1]));
|
||||
else
|
||||
m_Unstackables.Add(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,19 @@ namespace Server.Items
|
|||
Effects.PlaySound(loc, map, 0x225);
|
||||
}
|
||||
|
||||
private void SummonCreatureToWorld(BaseCreature bc, Point3D spawnLoc, Map map)
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = SpawnRange;
|
||||
bc.FightMode = FightMode.Closest;
|
||||
|
||||
bc.MoveToWorld(spawnLoc, map);
|
||||
|
||||
DoEffect(spawnLoc, map);
|
||||
|
||||
bc.ForceReacquire();
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (Utility.InRange(from.Location, Location, 2))
|
||||
|
|
@ -146,18 +159,7 @@ namespace Server.Items
|
|||
|
||||
DoEffect(spawnLoc, map);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = SpawnRange;
|
||||
bc.FightMode = FightMode.Closest;
|
||||
|
||||
bc.MoveToWorld(spawnLoc, map);
|
||||
|
||||
DoEffect(spawnLoc, map);
|
||||
|
||||
bc.ForceReacquire();
|
||||
});
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1), SummonCreatureToWorld, bc, spawnLoc, map);
|
||||
|
||||
NextSpawn = DateTime.UtcNow + NextSpawnDelay;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ namespace Server.Items
|
|||
|
||||
Effects.SendMovingEffect(from, to, ItemID, 7, 0, false, false, Hue);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => FirebombReposition_OnTick(p, Map));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), FirebombReposition_OnTick, p, Map);
|
||||
Internalize();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -118,7 +117,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, Refresh);
|
||||
Timer.DelayCall(Refresh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Items
|
|||
if (Deleted || !from.CanSee(this))
|
||||
return false;
|
||||
|
||||
this.ScissorHelper(from, new Bandage(), 1);
|
||||
ScissorHelper(from, new Bandage(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ namespace Server.Items
|
|||
hues[n.X, n.Y] = NodeHue.Blue;
|
||||
}
|
||||
|
||||
Node lastNode = path[path.Length - 1];
|
||||
Node lastNode = path[^1];
|
||||
hues[lastNode.X, lastNode.Y] = NodeHue.Red;
|
||||
|
||||
for (int i = 0; i < sideLength; i++)
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ namespace Server.Items
|
|||
m.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber, null,
|
||||
""));
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => m.EndAction(this));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), m.EndAction, this);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@ namespace Server.Items
|
|||
list[i].Broadcast(triggerer);
|
||||
}
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, InternalCallback);
|
||||
Timer.DelayCall(StopBroadcasting);
|
||||
}
|
||||
|
||||
private void InternalCallback()
|
||||
private void StopBroadcasting()
|
||||
{
|
||||
m_Broadcasting = false;
|
||||
}
|
||||
|
|
@ -207,4 +207,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Items
|
|||
|
||||
public void Carve(Mobile from, Item item)
|
||||
{
|
||||
this.ScissorHelper(from, new RawFishSteak(), Math.Max(16, (int)Weight) / 4, false);
|
||||
ScissorHelper(from, new RawFishSteak(), Math.Max(16, (int)Weight) / 4, false);
|
||||
}
|
||||
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Items
|
|||
|
||||
public void Carve(Mobile from, Item item)
|
||||
{
|
||||
this.ScissorHelper(from, new RawFishSteak(), 4);
|
||||
ScissorHelper(from, new RawFishSteak(), 4);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace Server.Items
|
|||
{
|
||||
if (Deleted || !from.CanSee(this)) return false;
|
||||
|
||||
this.ScissorHelper(from, new Cloth(), 50);
|
||||
ScissorHelper(from, new Cloth(), 50);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Items
|
|||
{
|
||||
if (Deleted || !from.CanSee(this)) return false;
|
||||
|
||||
this.ScissorHelper(from, new Bandage(), 1);
|
||||
ScissorHelper(from, new Bandage(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ScissorHelper(from, new Leather(), 1);
|
||||
ScissorHelper(from, new Leather(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ScissorHelper(from, new SpinedLeather(), 1);
|
||||
ScissorHelper(from, new SpinedLeather(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ScissorHelper(from, new HornedLeather(), 1);
|
||||
ScissorHelper(from, new HornedLeather(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -247,7 +247,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
this.ScissorHelper(from, new BarbedLeather(), 1);
|
||||
ScissorHelper(from, new BarbedLeather(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Server.Items
|
|||
{
|
||||
if (Deleted || !from.CanSee(this)) return false;
|
||||
|
||||
this.ScissorHelper(from, new Bandage(), 1);
|
||||
ScissorHelper(from, new Bandage(), 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -475,13 +475,13 @@ namespace Server.Items
|
|||
SkillBonuses.Serialize(writer);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Protection))
|
||||
m_Protection.Serialize(writer);
|
||||
Protection.Serialize(writer);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Killer))
|
||||
m_Killer.Serialize(writer);
|
||||
Killer.Serialize(writer);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Summoner))
|
||||
m_Summoner.Serialize(writer);
|
||||
Summoner.Serialize(writer);
|
||||
|
||||
if (GetSaveFlag(flags, SaveFlag.Removal))
|
||||
writer.WriteEncodedInt((int)m_Removal);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -44,8 +46,7 @@ namespace Server.Items
|
|||
--weapon.PoisonCharges;
|
||||
|
||||
// Infectious strike special move now uses poisoning skill to help determine potency
|
||||
int maxLevel = attacker.Skills.Poisoning.Fixed / 200;
|
||||
if (maxLevel < 0) maxLevel = 0;
|
||||
int maxLevel = Math.Max(attacker.Skills.Poisoning.Fixed / 200, 0);
|
||||
if (p.Level > maxLevel) p = Poison.GetPoison(maxLevel);
|
||||
|
||||
if (attacker.Skills.Poisoning.Value / 100.0 > Utility.RandomDouble())
|
||||
|
|
@ -72,4 +73,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Server.Items
|
|||
|
||||
PlayerConstructed = true;
|
||||
|
||||
Type resourceType = typeRes ?? craftItem.Resources.GetAt(0).ItemType;
|
||||
Type resourceType = typeRes ?? craftItem.Resources[0].ItemType;
|
||||
|
||||
if (Core.AOS)
|
||||
{
|
||||
|
|
@ -824,10 +824,7 @@ namespace Server.Items
|
|||
if (shield != null)
|
||||
{
|
||||
// As per OSI, no genitive effect from the Racial stuffs, ie, 120 parry and '0' bushido with humans
|
||||
chance = (parry - bushidoNonRacial) / 400.0;
|
||||
|
||||
if (chance < 0) // chance shouldn't go below 0
|
||||
chance = 0;
|
||||
chance = Math.Max((parry - bushidoNonRacial) / 400.0, 0);
|
||||
|
||||
// Parry/Bushido over 100 grants a 5% bonus.
|
||||
if (parry >= 100.0 || bushido >= 100.0)
|
||||
|
|
@ -2067,7 +2064,7 @@ namespace Server.Items
|
|||
list.Add(entry.Title);
|
||||
}
|
||||
|
||||
this.AddResistanceProperties(list);
|
||||
AddResistanceProperties(list);
|
||||
|
||||
int prop;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,10 +73,10 @@ namespace Server.Items
|
|||
Effects.SendMovingEffect(new Entity(Serial.Zero, startLoc, map), new Entity(Serial.Zero, endLoc, map),
|
||||
0x36E4, 5, 0, false, false);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => FinishLaunch(endLoc, map));
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), FinishLaunch, endLoc, map);
|
||||
}
|
||||
|
||||
private void FinishLaunch(Point3D endLoc, Map map)
|
||||
private static void FinishLaunch(Point3D endLoc, Map map)
|
||||
{
|
||||
int hue = Utility.Random(40);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue