Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -32,13 +32,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public TreasureLevel Level{ get; set; }
public TreasureLevel Level { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public short MaxSpawnTime{ get; set; } = 60;
public short MaxSpawnTime { get; set; } = 60;
[CommandProperty(AccessLevel.GameMaster)]
public short MinSpawnTime{ get; set; } = 10;
public short MinSpawnTime { get; set; } = 10;
[CommandProperty(AccessLevel.GameMaster)]
public override bool Locked
@ -97,12 +97,12 @@ namespace Server.Items
{
RequiredSkill = Level switch
{
TreasureLevel.Level1 => (LockLevel = 5),
TreasureLevel.Level2 => (LockLevel = 20),
TreasureLevel.Level3 => (LockLevel = 50),
TreasureLevel.Level4 => (LockLevel = 70),
TreasureLevel.Level5 => (LockLevel = 90),
TreasureLevel.Level6 => (LockLevel = 100),
TreasureLevel.Level1 => LockLevel = 5,
TreasureLevel.Level2 => LockLevel = 20,
TreasureLevel.Level3 => LockLevel = 50,
TreasureLevel.Level4 => LockLevel = 70,
TreasureLevel.Level5 => LockLevel = 90,
TreasureLevel.Level6 => LockLevel = 100,
_ => RequiredSkill
};
}
@ -178,7 +178,7 @@ namespace Server.Items
private class TreasureResetTimer : Timer
{
private BaseTreasureChest m_Chest;
private readonly BaseTreasureChest m_Chest;
public TreasureResetTimer(BaseTreasureChest chest) : base(
TimeSpan.FromMinutes(Utility.Random(chest.MinSpawnTime, chest.MaxSpawnTime)))

View file

@ -66,8 +66,8 @@ namespace Server.Items
if (house?.HasLockedDownItem(this) == true)
{
if (dropped is VendorRentalContract || dropped is Container container &&
container.FindItemByType<VendorRentalContract>() != null)
if (dropped is VendorRentalContract || (dropped is Container container &&
container.FindItemByType<VendorRentalContract>() != null))
{
from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
return false;
@ -101,8 +101,8 @@ namespace Server.Items
if (house?.HasLockedDownItem(this) == true)
{
if (item is VendorRentalContract || item is Container container &&
container.FindItemByType<VendorRentalContract>() != null)
if (item is VendorRentalContract || (item is Container container &&
container.FindItemByType<VendorRentalContract>() != null))
{
from.SendLocalizedMessage(1062492); // You cannot place a rental contract in a locked down container.
return false;
@ -153,7 +153,7 @@ namespace Server.Items
}
}
public class CreatureBackpack : Backpack //Used on BaseCreature
public class CreatureBackpack : Backpack // Used on BaseCreature
{
[Constructible]
public CreatureBackpack(string name)
@ -215,7 +215,7 @@ namespace Server.Items
}
}
public class StrongBackpack : Backpack //Used on Pack animals
public class StrongBackpack : Backpack // Used on Pack animals
{
[Constructible]
public StrongBackpack()
@ -233,7 +233,7 @@ namespace Server.Items
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight) => base.CheckHold(m, item, false, checkItems, plusItems, plusWeight);
public override bool CheckContentDisplay(Mobile from) =>
RootParent is BaseCreature creature && creature.Controlled && creature.ControlMaster == from ||
(RootParent is BaseCreature creature && creature.Controlled && creature.ControlMaster == from) ||
base.CheckContentDisplay(from);
public override void Serialize(IGenericWriter writer)

View file

@ -151,7 +151,7 @@ namespace Server.Items
RequiredSkill = difficulty;
}
if (IsTrappable && (m_Content.Level > 1 || 4 > Utility.Random(5)))
if (IsTrappable && (m_Content.Level > 1 || Utility.Random(5) < 4))
{
if (m_Content.Level > Utility.Random(5))
TrapType = TrapType.PoisonTrap;
@ -240,26 +240,26 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Content = FillableContent.Lookup((FillableContentType)reader.ReadInt());
goto case 0;
}
{
m_Content = FillableContent.Lookup((FillableContentType)reader.ReadInt());
goto case 0;
}
case 0:
{
if (reader.ReadBool())
{
m_NextRespawnTime = reader.ReadDeltaTime();
if (reader.ReadBool())
{
m_NextRespawnTime = reader.ReadDeltaTime();
TimeSpan delay = m_NextRespawnTime - DateTime.UtcNow;
m_RespawnTimer = Timer.DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Respawn);
}
else
{
CheckRespawn();
}
TimeSpan delay = m_NextRespawnTime - DateTime.UtcNow;
m_RespawnTimer = Timer.DelayCall(delay > TimeSpan.Zero ? delay : TimeSpan.Zero, Respawn);
}
else
{
CheckRespawn();
}
break;
}
break;
}
}
}
}
@ -621,7 +621,7 @@ namespace Server.Items
: base(weight, type) =>
Content = content;
public BeverageType Content{ get; }
public BeverageType Content { get; }
public override Item Construct()
{
@ -802,7 +802,7 @@ namespace Server.Items
new FillableEntry(8, typeof(SmithHammer)),
new FillableEntry(8, typeof(Tongs)),
new FillableEntry(8, typeof(SledgeHammer)),
//new FillableEntry( 8, typeof( IronOre ) ), TODO: Smaller ore
// new FillableEntry( 8, typeof( IronOre ) ), TODO: Smaller ore
new FillableEntry(8, typeof(IronIngot)),
new FillableEntry(1, typeof(IronWire)),
new FillableEntry(1, typeof(SilverWire)),
@ -893,10 +893,10 @@ namespace Server.Items
new FillableEntry(1, typeof(LightYarnUnraveled)),
new FillableEntry(1, typeof(SpoolOfThread)),
// Four different types
//new FillableEntry( 1, typeof( FoldedCloth ) ),
//new FillableEntry( 1, typeof( FoldedCloth ) ),
//new FillableEntry( 1, typeof( FoldedCloth ) ),
//new FillableEntry( 1, typeof( FoldedCloth ) ),
// new FillableEntry( 1, typeof( FoldedCloth ) ),
// new FillableEntry( 1, typeof( FoldedCloth ) ),
// new FillableEntry( 1, typeof( FoldedCloth ) ),
// new FillableEntry( 1, typeof( FoldedCloth ) ),
new FillableEntry(1, typeof(Dyes)),
new FillableEntry(2, typeof(Leather))
});
@ -926,8 +926,8 @@ namespace Server.Items
{
new FillableEntry(1, typeof(FishingPole)),
// Two different types
//new FillableEntry( 1, typeof( SmallFish ) ),
//new FillableEntry( 1, typeof( SmallFish ) ),
// new FillableEntry( 1, typeof( SmallFish ) ),
// new FillableEntry( 1, typeof( SmallFish ) ),
new FillableEntry(4, typeof(Fish))
});
@ -1163,7 +1163,7 @@ namespace Server.Items
new FillableEntry(2, typeof(Pickaxe)),
new FillableEntry(2, typeof(Shovel)),
new FillableEntry(2, typeof(IronIngot)),
//new FillableEntry( 2, typeof( IronOre ) ), TODO: Smaller Ore
// new FillableEntry( 2, typeof( IronOre ) ), TODO: Smaller Ore
new FillableEntry(1, typeof(ForgedMetal))
});
@ -1302,7 +1302,7 @@ namespace Server.Items
},
new[]
{
//new FillableEntry( 1, typeof( Wheat ) ),
// new FillableEntry( 1, typeof( Wheat ) ),
new FillableEntry(1, typeof(Carrot))
});
@ -1369,13 +1369,13 @@ namespace Server.Items
new[]
{
new FillableEntry(1, typeof(Lockpick)),
//new FillableEntry( 1, typeof( KeyRing ) ),
// new FillableEntry( 1, typeof( KeyRing ) ),
new FillableEntry(2, typeof(Clock)),
new FillableEntry(2, typeof(ClockParts)),
new FillableEntry(2, typeof(AxleGears)),
new FillableEntry(2, typeof(Gears)),
new FillableEntry(2, typeof(Hinge)),
//new FillableEntry( 1, typeof( ArrowShafts ) ),
// new FillableEntry( 1, typeof( ArrowShafts ) ),
new FillableEntry(2, typeof(Sextant)),
new FillableEntry(2, typeof(SextantParts)),
new FillableEntry(2, typeof(Axle)),
@ -1398,7 +1398,7 @@ namespace Server.Items
new FillableEntry(1, typeof(Bandage)),
new FillableEntry(1, typeof(MortarPestle)),
new FillableEntry(1, typeof(LesserHealPotion)),
//new FillableEntry( 1, typeof( Wheat ) ),
// new FillableEntry( 1, typeof( Wheat ) ),
new FillableEntry(1, typeof(Carrot))
});
@ -1416,7 +1416,7 @@ namespace Server.Items
private static Dictionary<Type, FillableContent> m_AcquireTable;
private static FillableContent[] m_ContentTypes =
private static readonly FillableContent[] m_ContentTypes =
{
Weaponsmith, Provisioner, Mage,
Alchemist, Armorer, ArtisanGuild,
@ -1432,8 +1432,8 @@ namespace Server.Items
Tinker, Veterinarian
};
private FillableEntry[] m_Entries;
private int m_Weight;
private readonly FillableEntry[] m_Entries;
private readonly int m_Weight;
public FillableContent(int level, Type[] vendors, FillableEntry[] entries)
{
@ -1445,9 +1445,9 @@ namespace Server.Items
m_Weight += entries[i].Weight;
}
public int Level{ get; }
public int Level { get; }
public Type[] Vendors{ get; }
public Type[] Vendors { get; }
public FillableContentType TypeID => Lookup(this);

View file

@ -51,7 +51,6 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2857, 0x2858)]
public class RedArmoire : BaseContainer
@ -316,7 +315,7 @@ namespace Server.Items
public class DynamicFurniture
{
private static Dictionary<Container, Timer> m_Table = new Dictionary<Container, Timer>();
private static readonly Dictionary<Container, Timer> m_Table = new Dictionary<Container, Timer>();
public static bool Open(Container c, Mobile m)
{
@ -370,8 +369,8 @@ namespace Server.Items
public class FurnitureTimer : Timer
{
private Container m_Container;
private Mobile m_Mobile;
private readonly Container m_Container;
private readonly Mobile m_Mobile;
public FurnitureTimer(Container c, Mobile m) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5))
{

View file

@ -17,12 +17,10 @@ namespace Server.Items
public override bool TrapOnOpen => !TrapOnLockpick;
[CommandProperty(AccessLevel.GameMaster)]
public bool TrapOnLockpick{ get; set; }
public bool TrapOnLockpick { get; set; }
public override bool DisplaysContent => !m_Locked;
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -61,8 +59,6 @@ namespace Server.Items
return 1;
}
#endregion
[CommandProperty(AccessLevel.GameMaster)]
public virtual bool Locked
{
@ -79,19 +75,19 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public uint KeyValue{ get; set; }
public uint KeyValue { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Picker{ get; set; }
public Mobile Picker { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int MaxLockLevel{ get; set; }
public int MaxLockLevel { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int LockLevel{ get; set; }
public int LockLevel { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int RequiredSkill{ get; set; }
public int RequiredSkill { get; set; }
public virtual void LockPick(Mobile from)
{
@ -101,12 +97,8 @@ namespace Server.Items
if (TrapOnLockpick && ExecuteTrap(from)) TrapOnLockpick = false;
}
#region IShipwreckedItem Members
[CommandProperty(AccessLevel.GameMaster)]
public bool IsShipwreckedItem{ get; set; }
#endregion
public bool IsShipwreckedItem { get; set; }
public override void Serialize(IGenericWriter writer)
{
@ -136,64 +128,64 @@ namespace Server.Items
switch (version)
{
case 6:
{
IsShipwreckedItem = reader.ReadBool();
goto case 5;
}
case 5:
{
TrapOnLockpick = reader.ReadBool();
goto case 4;
}
case 4:
{
RequiredSkill = reader.ReadInt();
goto case 3;
}
case 3:
{
MaxLockLevel = reader.ReadInt();
goto case 2;
}
case 2:
{
KeyValue = reader.ReadUInt();
goto case 1;
}
case 1:
{
LockLevel = reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 3)
MaxLockLevel = 100;
if (version < 4)
{
if (MaxLockLevel - LockLevel == 40)
{
RequiredSkill = LockLevel + 6;
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 39;
}
else
{
RequiredSkill = LockLevel;
}
IsShipwreckedItem = reader.ReadBool();
goto case 5;
}
case 5:
{
TrapOnLockpick = reader.ReadBool();
m_Locked = reader.ReadBool();
goto case 4;
}
case 4:
{
RequiredSkill = reader.ReadInt();
break;
}
goto case 3;
}
case 3:
{
MaxLockLevel = reader.ReadInt();
goto case 2;
}
case 2:
{
KeyValue = reader.ReadUInt();
goto case 1;
}
case 1:
{
LockLevel = reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 3)
MaxLockLevel = 100;
if (version < 4)
{
if (MaxLockLevel - LockLevel == 40)
{
RequiredSkill = LockLevel + 6;
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 39;
}
else
{
RequiredSkill = LockLevel;
}
}
m_Locked = reader.ReadBool();
break;
}
}
}
@ -320,7 +312,7 @@ namespace Server.Items
base.OnSingleClick(from);
if (IsShipwreckedItem)
LabelTo(from, 1041645); //recovered from a shipwreck
LabelTo(from, 1041645); // recovered from a shipwreck
}
}
}

View file

@ -43,10 +43,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Map TargetMap{ get; set; }
public Map TargetMap { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Target{ get; set; }
public Point3D Target { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Bone
@ -60,7 +60,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public string Description{ get; set; }
public string Description { get; set; }
public override bool IsDecoContainer => false;
@ -217,9 +217,9 @@ namespace Server.Items
Start();
}
public MarkContainer Container{ get; }
public MarkContainer Container { get; }
public DateTime RelockTime{ get; }
public DateTime RelockTime { get; }
protected override void OnTick()
{

View file

@ -3,12 +3,12 @@ namespace Server.Items
[Flippable]
public class ParagonChest : LockableContainer
{
private static int[] m_ItemIDs =
private static readonly int[] m_ItemIDs =
{
0x9AB, 0xE40, 0xE41, 0xE7C
};
private static int[] m_Hues =
private static readonly int[] m_Hues =
{
0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
0x966, 0x96D, 0x972, 0x973, 0x979

View file

@ -40,8 +40,6 @@ namespace Server.Items
}
}
#region Resmelt.cs
private bool Resmelt(Mobile from, Item item, CraftResource resource)
{
try
@ -80,9 +78,9 @@ namespace Server.Items
Type resourceType = info.ResourceTypes[0];
Item ingot = (Item)ActivatorUtil.CreateInstance(resourceType);
if (item is DragonBardingDeed || item is BaseArmor armor && armor.PlayerConstructed ||
item is BaseWeapon weapon && weapon.PlayerConstructed ||
item is BaseClothing clothing && clothing.PlayerConstructed)
if (item is DragonBardingDeed || (item is BaseArmor armor && armor.PlayerConstructed) ||
(item is BaseWeapon weapon && weapon.PlayerConstructed) ||
(item is BaseClothing clothing && clothing.PlayerConstructed))
{
double mining = from.Skills.Mining.Value;
if (mining > 100.0)
@ -123,22 +121,18 @@ namespace Server.Items
return false;
}
#endregion
#region Checks
private bool Resmeltables() //Where context menu checks for metal items and dragon barding deeds
private bool Resmeltables() // Where context menu checks for metal items and dragon barding deeds
{
foreach (Item i in Items)
return i?.Deleted == false && (
i is BaseWeapon weapon && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal ||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Metal ||
(i is BaseWeapon weapon && CraftResources.GetType(weapon.Resource) == CraftResourceType.Metal) ||
(i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Metal) ||
i is DragonBardingDeed);
return false;
}
private bool Scissorables() //Where context menu checks for Leather items and cloth items
private bool Scissorables() // Where context menu checks for Leather items and cloth items
{
foreach (Item i in Items)
{
@ -146,17 +140,13 @@ namespace Server.Items
continue;
if (i is BaseClothing || i is Cloth || i is BoltOfCloth || i is Hides || i is BonePile ||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Leather)
(i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Leather))
return true;
}
return false;
}
#endregion
#region Salvaging
private void SalvageIngots(Mobile from)
{
if (from.Backpack.FindItemsByType<BaseTool>().All(tool => tool.CraftSystem != DefBlacksmithy.CraftSystem))
@ -185,8 +175,8 @@ namespace Server.Items
if (item?.Deleted != false)
continue;
if (item is BaseArmor armor && Resmelt(from, armor, armor.Resource) ||
item is BaseWeapon weapon && Resmelt(from, weapon, weapon.Resource) ||
if ((item is BaseArmor armor && Resmelt(from, armor, armor.Resource)) ||
(item is BaseWeapon weapon && Resmelt(from, weapon, weapon.Resource)) ||
item is DragonBardingDeed)
salvaged++;
else
@ -253,13 +243,9 @@ namespace Server.Items
SalvageCloth(from);
}
#endregion
#region ContextMenuEntries
private class SalvageAllEntry : ContextMenuEntry
{
private SalvageBag m_Bag;
private readonly SalvageBag m_Bag;
public SalvageAllEntry(SalvageBag bag, bool enabled)
: base(6276)
@ -284,7 +270,7 @@ namespace Server.Items
private class SalvageIngotsEntry : ContextMenuEntry
{
private SalvageBag m_Bag;
private readonly SalvageBag m_Bag;
public SalvageIngotsEntry(SalvageBag bag, bool enabled)
: base(6277)
@ -309,7 +295,7 @@ namespace Server.Items
private class SalvageClothEntry : ContextMenuEntry
{
private SalvageBag m_Bag;
private readonly SalvageBag m_Bag;
public SalvageClothEntry(SalvageBag bag, bool enabled)
: base(6278)
@ -332,10 +318,6 @@ namespace Server.Items
}
}
#endregion
#region Serialization
public SalvageBag(Serial serial)
: base(serial)
{
@ -354,7 +336,5 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
#endregion
}
}

View file

@ -5,7 +5,7 @@ using Server.Multis;
namespace Server.Items
{
[Flippable(0xE80, 0x9A8)]
public class StrongBox : BaseContainer, IChopable
public class StrongBox : BaseContainer, IChoppable
{
private BaseHouse m_House;
private Mobile m_Owner;
@ -38,7 +38,7 @@ namespace Server.Items
public override int DefaultMaxWeight => 0;
public override bool Decays => m_House == null || m_Owner?.Deleted != false || !m_House.IsCoOwner(m_Owner);
public override bool Decays => m_House == null || m_Owner?.Deleted != false || !m_House.IsCoOwner(m_Owner);
public override TimeSpan DecayTime => TimeSpan.FromMinutes(30.0);
@ -67,12 +67,12 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Owner = reader.ReadMobile();
m_House = reader.ReadItem() as BaseHouse;
{
m_Owner = reader.ReadMobile();
m_House = reader.ReadItem() as BaseHouse;
break;
}
break;
}
}
Timer.DelayCall(TimeSpan.FromSeconds(1.0), Validate);
@ -113,7 +113,7 @@ namespace Server.Items
public override bool IsAccessibleTo(Mobile m) =>
m_Owner?.Deleted != false || m_House?.Deleted != false ||
m.AccessLevel >= AccessLevel.GameMaster ||
m == m_Owner && m_House.IsCoOwner(m) && base.IsAccessibleTo(m);
(m == m_Owner && m_House.IsCoOwner(m) && base.IsAccessibleTo(m));
private void Chop(Mobile from)
{

View file

@ -23,13 +23,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public TrapType TrapType{ get; set; }
public TrapType TrapType { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int TrapPower{ get; set; }
public int TrapPower { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int TrapLevel{ get; set; }
public int TrapLevel { get; set; }
public virtual bool TrapOnOpen => true;
@ -73,99 +73,99 @@ namespace Server.Items
switch (TrapType)
{
case TrapType.ExplosionTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
int damage;
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (TrapLevel > 0)
damage = Utility.RandomMinMax(10, 30) * TrapLevel;
else
damage = TrapPower;
if (from.InRange(loc, 3))
{
int damage;
AOS.Damage(from, damage, 0, 100, 0, 0, 0);
if (TrapLevel > 0)
damage = Utility.RandomMinMax(10, 30) * TrapLevel;
else
damage = TrapPower;
// Your skin blisters from the heat!
from.LocalOverheadMessage(MessageType.Regular, 0x2A, 503000);
AOS.Damage(from, damage, 0, 100, 0, 0, 0);
// Your skin blisters from the heat!
from.LocalOverheadMessage(MessageType.Regular, 0x2A, 503000);
}
Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
Effects.PlaySound(loc, facet, 0x307);
break;
}
Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
Effects.PlaySound(loc, facet, 0x307);
break;
}
case TrapType.MagicTrap:
{
if (from.InRange(loc, 1))
from.Damage(TrapPower);
//AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
{
if (from.InRange(loc, 1))
from.Damage(TrapPower);
// AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
Effects.PlaySound(loc, Map, 0x307);
Effects.PlaySound(loc, Map, 0x307);
Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);
Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);
break;
}
break;
}
case TrapType.DartTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
int damage;
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (TrapLevel > 0)
damage = Utility.RandomMinMax(5, 15) * TrapLevel;
else
damage = TrapPower;
if (from.InRange(loc, 3))
{
int damage;
AOS.Damage(from, damage, 100, 0, 0, 0, 0);
if (TrapLevel > 0)
damage = Utility.RandomMinMax(5, 15) * TrapLevel;
else
damage = TrapPower;
// A dart imbeds itself in your flesh!
from.LocalOverheadMessage(MessageType.Regular, 0x62, 502998);
AOS.Damage(from, damage, 100, 0, 0, 0, 0);
// A dart imbeds itself in your flesh!
from.LocalOverheadMessage(MessageType.Regular, 0x62, 502998);
}
Effects.PlaySound(loc, facet, 0x223);
break;
}
Effects.PlaySound(loc, facet, 0x223);
break;
}
case TrapType.PoisonTrap:
{
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (from.InRange(loc, 3))
{
Poison poison;
SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
if (TrapLevel > 0)
if (from.InRange(loc, 3))
{
poison = Poison.GetPoison(Math.Max(0, Math.Min(4, TrapLevel - 1)));
}
else
{
AOS.Damage(from, TrapPower, 0, 0, 0, 100, 0);
poison = Poison.Greater;
Poison poison;
if (TrapLevel > 0)
{
poison = Poison.GetPoison(Math.Max(0, Math.Min(4, TrapLevel - 1)));
}
else
{
AOS.Damage(from, TrapPower, 0, 0, 0, 100, 0);
poison = Poison.Greater;
}
from.ApplyPoison(from, poison);
// You are enveloped in a noxious green cloud!
from.LocalOverheadMessage(MessageType.Regular, 0x44, 503004);
}
from.ApplyPoison(from, poison);
Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
Effects.PlaySound(loc, facet, 0x231);
// You are enveloped in a noxious green cloud!
from.LocalOverheadMessage(MessageType.Regular, 0x44, 503004);
break;
}
Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
Effects.PlaySound(loc, facet, 0x231);
break;
}
}
TrapType = TrapType.None;
@ -204,20 +204,20 @@ namespace Server.Items
switch (version)
{
case 2:
{
TrapLevel = reader.ReadInt();
goto case 1;
}
{
TrapLevel = reader.ReadInt();
goto case 1;
}
case 1:
{
TrapPower = reader.ReadInt();
goto case 0;
}
{
TrapPower = reader.ReadInt();
goto case 0;
}
case 0:
{
TrapType = (TrapType)reader.ReadInt();
break;
}
{
TrapType = (TrapType)reader.ReadInt();
break;
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -43,7 +43,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -70,7 +70,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -40,7 +40,7 @@ namespace Server.Items
public override int LabelNumber => 3000541;
public static Type[] Artifacts{ get; } =
public static Type[] Artifacts { get; } =
{
typeof(CandelabraOfSouls), typeof(GoldBricks), typeof(PhillipsWoodenSteed),
typeof(ArcticDeathDealer), typeof(BlazeOfDeath), typeof(BurglarsBandana),
@ -52,18 +52,18 @@ namespace Server.Items
};
[CommandProperty(AccessLevel.GameMaster)]
public int Level{ get; set; }
public int Level { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner{ get; set; }
public Mobile Owner { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime DeleteTime{ get; private set; }
public DateTime DeleteTime { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Temporary{ get; set; }
public bool Temporary { get; set; }
public List<Mobile> Guardians{ get; private set; }
public List<Mobile> Guardians { get; private set; }
public override bool IsDecoContainer => false;
@ -174,10 +174,10 @@ namespace Server.Items
cont.LockLevel = cont.RequiredSkill - 10;
cont.MaxLockLevel = cont.RequiredSkill + 40;
//Publish 67 gold change
//if ( Core.SA )
// cont.DropItem( new Gold( level * 5000 ) );
//else
// Publish 67 gold change
// if (Core.SA)
// cont.DropItem( new Gold( level * 5000 ) );
// else
cont.DropItem(new Gold(level * 1000));
for (int i = 0; i < level * 5; ++i)
@ -353,7 +353,7 @@ namespace Server.Items
{
m_Lifted.Add(item);
if (0.1 >= Utility.RandomDouble()) // 10% chance to spawn a new monster
if (Utility.RandomDouble() <= 0.1) // 10% chance to spawn a new monster
TreasureMap.Spawn(Level, GetWorldLocation(), Map, from, false);
}
@ -396,29 +396,29 @@ namespace Server.Items
switch (version)
{
case 2:
{
Guardians = reader.ReadStrongMobileList();
Temporary = reader.ReadBool();
{
Guardians = reader.ReadStrongMobileList();
Temporary = reader.ReadBool();
goto case 1;
}
goto case 1;
}
case 1:
{
Owner = reader.ReadMobile();
{
Owner = reader.ReadMobile();
goto case 0;
}
goto case 0;
}
case 0:
{
Level = reader.ReadInt();
DeleteTime = reader.ReadDeltaTime();
m_Lifted = reader.ReadStrongItemList();
{
Level = reader.ReadInt();
DeleteTime = reader.ReadDeltaTime();
m_Lifted = reader.ReadStrongItemList();
if (version < 2)
Guardians = new List<Mobile>();
if (version < 2)
Guardians = new List<Mobile>();
break;
}
break;
}
}
if (!Temporary)
@ -469,8 +469,8 @@ namespace Server.Items
private class RemoveGump : Gump
{
private TreasureMapChest m_Chest;
private Mobile m_From;
private readonly TreasureMapChest m_Chest;
private readonly Mobile m_From;
public RemoveGump(Mobile from, TreasureMapChest chest) : base(15, 15)
{
@ -503,8 +503,8 @@ namespace Server.Items
private class RemoveEntry : ContextMenuEntry
{
private TreasureMapChest m_Chest;
private Mobile m_From;
private readonly TreasureMapChest m_Chest;
private readonly Mobile m_From;
public RemoveEntry(Mobile from, TreasureMapChest chest) : base(6149, 3)
{
@ -525,7 +525,7 @@ namespace Server.Items
private class DeleteTimer : Timer
{
private Item m_Item;
private readonly Item m_Item;
public DeleteTimer(Item item, DateTime time) : base(time - DateTime.UtcNow)
{