Cleanup & Fixes for .NET 5 (#309)

- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
This commit is contained in:
Kamron Batman 2020-11-15 10:03:50 -08:00 • committed by GitHub
parent 4ad8811df2
commit 525cda5413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
266 changed files with 1348 additions and 1800 deletions

View file

@ -181,8 +181,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset { get; set; }
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -26,8 +26,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset { get; set; }
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -78,10 +78,7 @@ namespace Server.Items
private ScoreEntry GetEntryFor(Mobile from)
{
if (m_Entries == null)
{
m_Entries = new Dictionary<Mobile, ScoreEntry>();
}
m_Entries ??= new Dictionary<Mobile, ScoreEntry>();
if (!m_Entries.TryGetValue(from, out var e))
{

View file

@ -44,8 +44,7 @@ namespace Server.Items
public virtual bool ShareHue => true;
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -20,8 +20,7 @@ namespace Server.Items
public override bool DisplayWeight => false;
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;
@ -33,8 +32,6 @@ namespace Server.Items
if (!Deleted && ShareHue && Components != null)
{
Hue = value;
foreach (var c in Components)
{
c.Hue = value;

View file

@ -140,14 +140,9 @@ namespace Server.Items
{
var components = Components;
var stageTable = m_StageTable;
for (var i = 0; i < components.Count; ++i)
{
if (!(components[i] is AddonComponent component))
{
continue;
}
var component = components[i];
var itemTable = FindItemTable(component.ItemID);

View file

@ -129,14 +129,9 @@ namespace Server.Items
{
var components = Components;
var stageTable = m_StageTable;
for (var i = 0; i < components.Count; ++i)
{
if (!(components[i] is AddonComponent component))
{
continue;
}
var component = components[i];
var itemTable = FindItemTable(component.ItemID);

View file

@ -187,8 +187,7 @@ namespace Server.Items
CommandSystem.Register("SHTelGen", AccessLevel.Administrator, SHTelGen_OnCommand);
}
[Usage("SHTelGen")]
[Description("Generates solen hives teleporters.")]
[Usage("SHTelGen"), Description("Generates solen hives teleporters.")]
public static void SHTelGen_OnCommand(CommandEventArgs e)
{
World.Broadcast(0x35, true, "Solen hives teleporters are being generated, please wait.");

View file

@ -471,8 +471,7 @@ namespace Server.Items
public virtual Race RequiredRace => null;
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -1,3 +1,5 @@
using System;
namespace Server.Items
{
public enum HeadType
@ -79,17 +81,17 @@ namespace Server.Items
if (format != null)
{
if (format.StartsWith("the head of "))
if (format.StartsWith("the head of ", StringComparison.Ordinal))
{
format = format.Substring("the head of ".Length);
format = format.Substring(14); // "the head of|..."
}
if (format.EndsWith(", taken in a duel"))
if (format.EndsWith(", taken in a duel", StringComparison.Ordinal))
{
format = format.Substring(0, format.Length - ", taken in a duel".Length);
HeadType = HeadType.Duel;
}
else if (format.EndsWith(", taken in a tournament"))
else if (format.EndsWith(", taken in a tournament", StringComparison.Ordinal))
{
format = format.Substring(0, format.Length - ", taken in a tournament".Length);
HeadType = HeadType.Tournament;

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class CrimsonCincture : HalfApron, ITokunoDyable
public class CrimsonCincture : HalfApron
{
[Constructible]
public CrimsonCincture()

View file

@ -5,7 +5,7 @@ using Server.Mobiles;
namespace Server.Items
{
public class Ankhs
public static class Ankhs
{
public const int ResurrectRange = 2;
public const int TitheRange = 2;
@ -130,8 +130,7 @@ namespace Server.Items
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;
@ -222,8 +221,7 @@ namespace Server.Items
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;
@ -319,8 +317,7 @@ namespace Server.Items
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;
@ -413,8 +410,7 @@ namespace Server.Items
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xB2D, 0xB2C)]
[Furniture, Flippable(0xB2D, 0xB2C)]
public class WoodenBench : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xB4F, 0xB4E, 0xB50, 0xB51)]
[Furniture, Flippable(0xB4F, 0xB4E, 0xB50, 0xB51)]
public class FancyWoodenChairCushion : Item
{
[Constructible]
@ -31,8 +30,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB53, 0xB52, 0xB54, 0xB55)]
[Furniture, Flippable(0xB53, 0xB52, 0xB54, 0xB55)]
public class WoodenChairCushion : Item
{
[Constructible]
@ -62,8 +60,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB57, 0xB56, 0xB59, 0xB58)]
[Furniture, Flippable(0xB57, 0xB56, 0xB59, 0xB58)]
public class WoodenChair : Item
{
[Constructible]
@ -93,8 +90,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB5B, 0xB5A, 0xB5C, 0xB5D)]
[Furniture, Flippable(0xB5B, 0xB5A, 0xB5C, 0xB5D)]
public class BambooChair : Item
{
[Constructible]
@ -124,8 +120,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x1218, 0x1219, 0x121A, 0x121B)]
[DynamicFliping, Flippable(0x1218, 0x1219, 0x121A, 0x121B)]
public class StoneChair : Item
{
[Constructible]
@ -150,8 +145,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x2DE3, 0x2DE4, 0x2DE5, 0x2DE6)]
[DynamicFliping, Flippable(0x2DE3, 0x2DE4, 0x2DE5, 0x2DE6)]
public class OrnateElvenChair : Item
{
[Constructible]
@ -176,8 +170,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x2DEB, 0x2DEC, 0x2DED, 0x2DEE)]
[DynamicFliping, Flippable(0x2DEB, 0x2DEC, 0x2DED, 0x2DEE)]
public class BigElvenChair : Item
{
[Constructible]
@ -204,8 +197,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x2DF5, 0x2DF6)]
[DynamicFliping, Flippable(0x2DF5, 0x2DF6)]
public class ElvenReadingChair : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xB32, 0xB33)]
[Furniture, Flippable(0xB32, 0xB33)]
public class Throne : Item
{
[Constructible]
@ -31,8 +30,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB2E, 0xB2F, 0xB31, 0xB30)]
[Furniture, Flippable(0xB2E, 0xB2F, 0xB31, 0xB30)]
public class WoodenThrone : Item
{
[Constructible]

View file

@ -135,8 +135,7 @@ namespace Server.Items
CommandSystem.Register("ChainLink", AccessLevel.GameMaster, ChainLink_OnCommand);
}
[Usage("Link")]
[Description("Links two targeted doors together.")]
[Usage("Link"), Description("Links two targeted doors together.")]
private static void Link_OnCommand(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, false, TargetFlags.None, Link_OnFirstTarget);
@ -172,8 +171,7 @@ namespace Server.Items
}
}
[Usage("ChainLink")]
[Description("Chain-links two or more targeted doors together.")]
[Usage("ChainLink"), Description("Chain-links two or more targeted doors together.")]
private static void ChainLink_OnCommand(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, false, TargetFlags.None, ChainLink_OnTarget, new List<BaseDoor>());

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xF65, 0xF67, 0xF69)]
[Furniture, Flippable(0xF65, 0xF67, 0xF69)]
public class Easel : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xEBB, 0xEBC)]
[Furniture, Flippable(0xEBB, 0xEBC)]
public class TallMusicStand : Item
{
[Constructible]
@ -31,8 +30,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xEB6, 0xEB8)]
[Furniture, Flippable(0xEB6, 0xEB8)]
public class ShortMusicStand : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0x24D0, 0x24D1, 0x24D2, 0x24D3, 0x24D4)]
[Furniture, Flippable(0x24D0, 0x24D1, 0x24D2, 0x24D3, 0x24D4)]
public class BambooScreen : Item
{
[Constructible]
@ -26,8 +25,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x24CB, 0x24CC, 0x24CD, 0x24CE, 0x24CF)]
[Furniture, Flippable(0x24CB, 0x24CC, 0x24CD, 0x24CE, 0x24CF)]
public class ShojiScreen : Item
{
[Constructible]

View file

@ -50,8 +50,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB90, 0xB7D)]
[Furniture, Flippable(0xB90, 0xB7D)]
public class LargeTable : Item
{
[Constructible]
@ -81,8 +80,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB35, 0xB34)]
[Furniture, Flippable(0xB35, 0xB34)]
public class Nightstand : Item
{
[Constructible]
@ -112,8 +110,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xB8F, 0xB7C)]
[Furniture, Flippable(0xB8F, 0xB7C)]
public class YewWoodTable : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0xB4A, 0xB49, 0xB4B, 0xB4C)]
[Furniture, Flippable(0xB4A, 0xB49, 0xB4B, 0xB4C)]
public class WritingTable : Item
{
[Constructible]

View file

@ -597,8 +597,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x9AA, 0xE7D)]
[Furniture, Flippable(0x9AA, 0xE7D)]
public class WoodenBox : LockableContainer
{
[Constructible]
@ -623,8 +622,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x9A9, 0xE7E)]
[Furniture, Flippable(0x9A9, 0xE7E)]
public class SmallCrate : LockableContainer
{
[Constructible]
@ -654,8 +652,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xE3F, 0xE3E)]
[Furniture, Flippable(0xE3F, 0xE3E)]
public class MediumCrate : LockableContainer
{
[Constructible]
@ -685,8 +682,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xE3D, 0xE3C)]
[Furniture, Flippable(0xE3D, 0xE3C)]
public class LargeCrate : LockableContainer
{
[Constructible]
@ -716,8 +712,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x9A8, 0xE80)]
[DynamicFliping, Flippable(0x9A8, 0xE80)]
public class MetalBox : LockableContainer
{
[Constructible]
@ -749,8 +744,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0x9AB, 0xE7C)]
[DynamicFliping, Flippable(0x9AB, 0xE7C)]
public class MetalChest : LockableContainer
{
[Constructible]
@ -782,8 +776,7 @@ namespace Server.Items
}
}
[DynamicFliping]
[Flippable(0xE41, 0xE40)]
[DynamicFliping, Flippable(0xE41, 0xE40)]
public class MetalGoldenChest : LockableContainer
{
[Constructible]
@ -815,8 +808,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xe43, 0xe42)]
[Furniture, Flippable(0xe43, 0xe42)]
public class WoodenChest : LockableContainer
{
[Constructible]
@ -846,8 +838,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x280B, 0x280C)]
[Furniture, Flippable(0x280B, 0x280C)]
public class PlainWoodenChest : LockableContainer
{
[Constructible]
@ -879,8 +870,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x280D, 0x280E)]
[Furniture, Flippable(0x280D, 0x280E)]
public class OrnateWoodenChest : LockableContainer
{
[Constructible]
@ -912,8 +902,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x280F, 0x2810)]
[Furniture, Flippable(0x280F, 0x2810)]
public class GildedWoodenChest : LockableContainer
{
[Constructible]
@ -945,8 +934,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2811, 0x2812)]
[Furniture, Flippable(0x2811, 0x2812)]
public class WoodenFootLocker : LockableContainer
{
[Constructible]
@ -981,8 +969,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2813, 0x2814)]
[Furniture, Flippable(0x2813, 0x2814)]
public class FinishedWoodenChest : LockableContainer
{
[Constructible]

View file

@ -792,9 +792,7 @@ namespace Server.Items
public static FillableContent ArtisanGuild = new FillableContent(
1,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(1, typeof(PaintsAndBrush)),
@ -1047,9 +1045,7 @@ namespace Server.Items
public static FillableContent Guard = new FillableContent(
3,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(12, Loot.ArmorTypes),
@ -1095,9 +1091,7 @@ namespace Server.Items
public static FillableContent Inn = new FillableContent(
1,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(1, typeof(Candle)),
@ -1223,9 +1217,7 @@ namespace Server.Items
public static FillableContent Mill = new FillableContent(
1,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(1, typeof(SackFlour))
@ -1250,9 +1242,7 @@ namespace Server.Items
public static FillableContent Observatory = new FillableContent(
1,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(2, typeof(Sextant)),
@ -1263,9 +1253,7 @@ namespace Server.Items
public static FillableContent Painter = new FillableContent(
1,
new Type[]
{
},
Array.Empty<Type>(),
new[]
{
new FillableEntry(1, typeof(PaintsAndBrush)),

View file

@ -3,8 +3,7 @@ using System.Collections.Generic;
namespace Server.Items
{
[Furniture]
[Flippable(0x2815, 0x2816)]
[Furniture, Flippable(0x2815, 0x2816)]
public class TallCabinet : BaseContainer
{
[Constructible]
@ -27,8 +26,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2817, 0x2818)]
[Furniture, Flippable(0x2817, 0x2818)]
public class ShortCabinet : BaseContainer
{
[Constructible]
@ -51,8 +49,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2857, 0x2858)]
[Furniture, Flippable(0x2857, 0x2858)]
public class RedArmoire : BaseContainer
{
[Constructible]
@ -75,8 +72,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x285D, 0x285E)]
[Furniture, Flippable(0x285D, 0x285E)]
public class CherryArmoire : BaseContainer
{
[Constructible]
@ -99,8 +95,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x285B, 0x285C)]
[Furniture, Flippable(0x285B, 0x285C)]
public class MapleArmoire : BaseContainer
{
[Constructible]
@ -123,8 +118,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2859, 0x285A)]
[Furniture, Flippable(0x2859, 0x285A)]
public class ElegantArmoire : BaseContainer
{
[Constructible]
@ -147,8 +141,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa97, 0xa99, 0xa98, 0xa9a, 0xa9b, 0xa9c)]
[Furniture, Flippable(0xa97, 0xa99, 0xa98, 0xa9a, 0xa9b, 0xa9c)]
public class FullBookcase : BaseContainer
{
[Constructible]
@ -171,8 +164,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa9d, 0xa9e)]
[Furniture, Flippable(0xa9d, 0xa9e)]
public class EmptyBookcase : BaseContainer
{
[Constructible]
@ -203,8 +195,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa2c, 0xa34)]
[Furniture, Flippable(0xa2c, 0xa34)]
public class Drawer : BaseContainer
{
[Constructible]
@ -227,8 +218,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa30, 0xa38)]
[Furniture, Flippable(0xa30, 0xa38)]
public class FancyDrawer : BaseContainer
{
[Constructible]
@ -251,8 +241,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa4f, 0xa53)]
[Furniture, Flippable(0xa4f, 0xa53)]
public class Armoire : BaseContainer
{
[Constructible]
@ -285,8 +274,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0xa4d, 0xa51)]
[Furniture, Flippable(0xa4d, 0xa51)]
public class FancyArmoire : BaseContainer
{
[Constructible]
@ -319,7 +307,7 @@ namespace Server.Items
}
}
public class DynamicFurniture
public static class DynamicFurniture
{
private static readonly Dictionary<Container, Timer> m_Table = new Dictionary<Container, Timer>();

View file

@ -97,8 +97,7 @@ namespace Server.Items
CommandSystem.Register("SecretLocGen", AccessLevel.Administrator, SecretLocGen_OnCommand);
}
[Usage("SecretLocGen")]
[Description("Generates mark containers to Malas secret locations.")]
[Usage("SecretLocGen"), Description("Generates mark containers to Malas secret locations.")]
public static void SecretLocGen_OnCommand(CommandEventArgs e)
{
CreateMalasPassage(951, 546, -70, 1006, 994, -70, false, false);

View file

@ -102,7 +102,7 @@ namespace Server.Items
from.LocalOverheadMessage(MessageType.Regular, 0x2A, 503000);
}
Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
Effects.SendLocationEffect(loc, facet, 0x36BD, 15);
Effects.PlaySound(loc, facet, 0x307);
break;

View file

@ -175,8 +175,7 @@ namespace Server.Items
CommandSystem.Register("RemoveStealArties", AccessLevel.Administrator, RemoveStealArties_OnCommand);
}
[Usage("GenStealArties")]
[Description("Generates the stealable artifacts spawner.")]
[Usage("GenStealArties"), Description("Generates the stealable artifacts spawner.")]
private static void GenStealArties_OnCommand(CommandEventArgs args)
{
var from = args.Mobile;
@ -191,8 +190,8 @@ namespace Server.Items
}
}
[Usage("RemoveStealArties")]
[Description("Removes the stealable artifacts spawner and every not yet stolen stealable artifacts.")]
[Usage("RemoveStealArties"),
Description("Removes the stealable artifacts spawner and every not yet stolen stealable artifacts.")]
private static void RemoveStealArties_OnCommand(CommandEventArgs args)
{
var from = args.Mobile;

View file

@ -3,21 +3,6 @@ using Server.Targeting;
namespace Server.Items
{
public class UtilityItem
{
public static int RandomChoice(int itemID1, int itemID2)
{
var iRet = Utility.Random(2) switch
{
0 => itemID1,
1 => itemID2,
_ => itemID1
};
return iRet;
}
}
// ********** Dough **********
public class Dough : Item
{
@ -230,7 +215,7 @@ namespace Server.Items
{
if (!Movable)
return;
from.Target = new InternalTarget( this );
}*/
@ -324,51 +309,51 @@ namespace Server.Items
{
Weight = 1.0;
}
public PitcherWater( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override void OnDoubleClick( Mobile from )
{
if (!Movable)
return;
from.Target = new InternalTarget( this );
}
private class InternalTarget : Target
{
private PitcherWater m_Item;
public InternalTarget( PitcherWater item ) : base( 1, false, TargetFlags.None )
{
m_Item = item;
}
protected override void OnTarget( Mobile from, object targeted )
{
if (m_Item.Deleted ) return;
if (targeted is BowlFlour)
{
m_Item.Delete();
((BowlFlour)targeted).Delete();
from.AddToBackpack( new Dough() );
from.AddToBackpack( new WoodenBowl() );
}

View file

@ -76,7 +76,7 @@ namespace Server.Items
ClearComponents(addon);
flipMethod.Invoke(addon, new object[2] { from, Directions[index] });
flipMethod.Invoke(addon, new object[] { from, Directions[index] });
if (result == AddonFitResult.Blocked)
{

View file

@ -3,15 +3,14 @@ using Server.Targeting;
namespace Server.Items
{
public class FlipCommandHandlers
public static class FlipCommandHandlers
{
public static void Initialize()
{
CommandSystem.Register("Flip", AccessLevel.GameMaster, Flip_OnCommand);
}
[Usage("Flip")]
[Description("Turns an item.")]
[Usage("Flip"), Description("Turns an item.")]
public static void Flip_OnCommand(CommandEventArgs e)
{
e.Mobile.Target = new FlipTarget();

View file

@ -114,8 +114,7 @@ namespace Server.Items
CommandSystem.Register("MoonGen", AccessLevel.Administrator, MoonGen_OnCommand);
}
[Usage("MoonGen")]
[Description("Generates public moongates. Removes all old moongates.")]
[Usage("MoonGen"), Description("Generates public moongates. Removes all old moongates.")]
public static void MoonGen_OnCommand(CommandEventArgs e)
{
DeleteAll();

View file

@ -260,14 +260,14 @@ namespace Server.Items
if (m_SourceEffect && sendEffect)
{
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
}
m.MoveToWorld(p, map);
if (m_DestEffect && sendEffect)
{
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10);
Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10);
}
if (m_SoundID > 0 && sendEffect)
@ -598,7 +598,7 @@ namespace Server.Items
{
isMatch = true;
}
else if (m_Substring != null && e.Speech.ToLower().IndexOf(m_Substring.ToLower(), StringComparison.Ordinal) >= 0)
else if (m_Substring != null && e.Speech.ToLower().Contains(m_Substring.ToLower(), StringComparison.Ordinal))
{
isMatch = true;
}

View file

@ -26,7 +26,7 @@ namespace Server.Items
public void Carve(Mobile from, Item item)
{
Effects.PlaySound(GetWorldLocation(), Map, 0x48F);
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0);
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x3728, 10);
if (Utility.RandomDouble() < 0.3)
{

View file

@ -2,8 +2,7 @@ using Server.Engines.Craft;
namespace Server.Items
{
[Flippable(0xFAF, 0xFB0)]
[Anvil]
[Flippable(0xFAF, 0xFB0), Anvil]
public class Anvil : Item
{
[Constructible]

View file

@ -226,8 +226,7 @@ namespace Server.Items
switch (Utility.Random(8))
{
default:
case 0:
default: // 0
x = -1;
y = -1;
break;

View file

@ -208,7 +208,7 @@ namespace Server.Items
Effects.PlaySound(loc, map, 0x307);
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
Effects.SendLocationEffect(loc, map, 0x36B0, 9);
var alchemyBonus = 0;
if (direct)

View file

@ -5,7 +5,6 @@ using Server.Engines.Craft;
using Server.Gumps;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
namespace Server.Items
{

View file

@ -259,8 +259,7 @@ namespace Server.Items
CommandSystem.Register("AllSpells", AccessLevel.GameMaster, AllSpells_OnCommand);
}
[Usage("AllSpells")]
[Description("Completely fills a targeted spellbook with scrolls.")]
[Usage("AllSpells"), Description("Completely fills a targeted spellbook with scrolls.")]
private static void AllSpells_OnCommand(CommandEventArgs e)
{
e.Mobile.BeginTarget(-1, false, TargetFlags.None, AllSpells_OnTarget);

View file

@ -6,7 +6,7 @@ using Server.Mobiles;
namespace Server.Items
{
[Flippable(0x2790, 0x27DB)]
public class LeatherNinjaBelt : BaseWaist, IDyable, INinjaWeapon
public class LeatherNinjaBelt : BaseWaist, INinjaWeapon
{
private Poison m_Poison;
private int m_PoisonCharges;

View file

@ -39,7 +39,7 @@ namespace Server.Items
void AttackAnimation(Mobile from, Mobile to);
}
public class NinjaWeapon
public static class NinjaWeapon
{
private const int MaxUses = 10;

View file

@ -283,7 +283,7 @@ namespace Server.Items
}
}
public class DisguiseTimers
public static class DisguiseTimers
{
public static Dictionary<Mobile, Timer> Timers { get; } = new Dictionary<Mobile, Timer>();

View file

@ -132,14 +132,7 @@ namespace Server.Items
percent = v;
}
var scaledBy = Math.Abs(high - low) + 1;
if (scaledBy != 0)
{
scaledBy = 10000 / scaledBy;
}
percent *= 10000 + scaledBy;
percent *= 10000 + 10000 / Math.Abs(high - low) + 1;
return low + (high - low) * percent / 1000001;
}
@ -497,7 +490,7 @@ namespace Server.Items
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison, totalDamage );
weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage;
* */

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class DupresShield : BaseShield, ITokunoDyable
public class DupresShield : BaseShield
{
[Constructible]
public DupresShield() : base(0x2B01)

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class OssianGrimoire : NecromancerSpellbook, ITokunoDyable
public class OssianGrimoire : NecromancerSpellbook
{
[Constructible]
public OssianGrimoire()

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class QuiverOfInfinity : BaseQuiver, ITokunoDyable
public class QuiverOfInfinity : BaseQuiver
{
[Constructible]
public QuiverOfInfinity() : base(0x2B02)

View file

@ -12,7 +12,7 @@ namespace Server.Items
Reptalon = 1075202
}
public class BaseFormTalisman : Item, ITokunoDyable
public class BaseFormTalisman : Item
{
public BaseFormTalisman() : base(0x2F59)
{

View file

@ -2,8 +2,7 @@ using Server.Engines.Craft;
namespace Server.Items
{
[Anvil]
[Flippable(0xFAF, 0xFB0)]
[Anvil, Flippable(0xFAF, 0xFB0)]
public class ColoredAnvil : Item
{
[Constructible]

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class JesterHatofChuckles : BaseHat, ITokunoDyable
public class JesterHatofChuckles : BaseHat
{
[Constructible]
public JesterHatofChuckles() : this(Utility.RandomList(0x13e, 0x03, 0x172, 0x3f))

View file

@ -114,7 +114,7 @@ namespace Server.Items
var location = Location;
location.Z += 10;
Effects.SendLocationEffect(location, Map, 0x3709, 10, 10, 0x356, 0);
Effects.SendLocationEffect(location, Map, 0x3709, 10, 10, 0x356);
Effects.PlaySound(location, Map, 0x32E);
if (Items.Count > 0)

View file

@ -2,10 +2,6 @@
namespace Server.Items
{
public interface ITokunoDyable
{
}
public class HeritageToken : Item
{
[Constructible]

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0x232A, 0x232B)]
[Furniture, Flippable(0x232A, 0x232B)]
public class GiftBox : BaseContainer
{
[Constructible]

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
public class GiftBoxHues
public static class GiftBoxHues
{
/* there's possibly a couple more, but this is what we could verify on OSI */

View file

@ -1,7 +1,6 @@
namespace Server.Items
{
[Furniture]
[Flippable(0x2bd9, 0x2bda)]
[Furniture, Flippable(0x2bd9, 0x2bda)]
public class GreenStocking : BaseContainer
{
[Constructible]
@ -29,8 +28,7 @@ namespace Server.Items
}
}
[Furniture]
[Flippable(0x2bdb, 0x2bdc)]
[Furniture, Flippable(0x2bdb, 0x2bdc)]
public class RedStocking : BaseContainer
{
[Constructible]

View file

@ -1,3 +1,4 @@
using System;
using Server.Engines.VeteranRewards;
using Server.Gumps;
using Server.Multis;
@ -82,7 +83,7 @@ namespace Server.Items
/* Efreet */ new MonsterStatuetteInfo(1080521, 0x2590, 0x300),
/* Slime */ new MonsterStatuetteInfo(1015246, 0x20E8, 456),
/* PlagueBeast */ new MonsterStatuetteInfo(1029747, 0x2613, 0x1BF),
/* RedDeath */ new MonsterStatuetteInfo(1094932, 0x2617, new int[] { }),
/* RedDeath */ new MonsterStatuetteInfo(1094932, 0x2617, Array.Empty<int>()),
/* Spider */ new MonsterStatuetteInfo(1029668, 0x25C4, 1170),
/* OphidianArchMage */ new MonsterStatuetteInfo(1029641, 0x25A9, 639),
/* OphidianWarrior */ new MonsterStatuetteInfo(1029645, 0x25AD, 634),

View file

@ -2,7 +2,7 @@ using Server.Network;
namespace Server
{
public class MessageHelper
public static class MessageHelper
{
public static void SendLocalizedMessageTo(Item from, Mobile to, int number, int hue)
{

View file

@ -331,8 +331,7 @@ namespace Server.Items
CommandSystem.Register("RandomTalisman", AccessLevel.GameMaster, RandomTalisman_OnCommand);
}
[Usage("RandomTalisman <count>")]
[Description("Generates random talismans in your backpack.")]
[Usage("RandomTalisman <count>"), Description("Generates random talismans in your backpack.")]
public static void RandomTalisman_OnCommand(CommandEventArgs e)
{
var m = e.Mobile;

View file

@ -61,7 +61,7 @@ namespace Server.Items
public bool IsEmpty => Type == null;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsItem => Type?.Namespace.Equals("Server.Items") == true;
public bool IsItem => Type?.Namespace == "Server.Items";
public override string ToString() => Type?.Name ?? "None";
@ -89,7 +89,7 @@ namespace Server.Items
if (GetSaveFlag(flags, SaveFlag.Type))
{
writer.Write(Type.FullName);
writer.Write(Type!.FullName);
}
if (GetSaveFlag(flags, SaveFlag.Name))

View file

@ -71,7 +71,7 @@ namespace Server.Items
return;
}
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) - 2, 16, 3, GetEffectHue(), 0);
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) - 2, 16, 3, GetEffectHue());
Effects.PlaySound(Location, Map, 0x231);
from.ApplyPoison(from, Poison);

View file

@ -26,7 +26,7 @@ namespace Server.Items
return;
}
Effects.SendLocationEffect(Location, Map, 0x1D99, 48, 2, GetEffectHue(), 0);
Effects.SendLocationEffect(Location, Map, 0x1D99, 48, 2, GetEffectHue());
if (from.Alive && CheckRange(from.Location, 0))
{

View file

@ -64,7 +64,7 @@ namespace Server.Items
return;
}
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 6, 3, GetEffectHue(), 0);
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 6, 3, GetEffectHue());
Effects.PlaySound(Location, Map, 0x21C);
SpellHelper.Damage(TimeSpan.FromTicks(1), from, from, Utility.RandomMinMax(5, 15));

View file

@ -107,7 +107,7 @@ namespace Server.Items
return;
}
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 18, 3, GetEffectHue(), 0);
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 18, 3, GetEffectHue());
Effects.PlaySound(Location, Map, 0x22C);
foreach (var mob in GetMobilesInRange(0))
@ -132,7 +132,7 @@ namespace Server.Items
public virtual void OnSpikeRetracted()
{
Extended = false;
Effects.SendLocationEffect(Location, Map, GetExtendedID(Type) - 1, 6, 3, GetEffectHue(), 0);
Effects.SendLocationEffect(Location, Map, GetExtendedID(Type) - 1, 6, 3, GetEffectHue());
}
public override void Serialize(IGenericWriter writer)

View file

@ -21,7 +21,7 @@ namespace Server.Items
ManaDraining
}
public abstract class BaseWand : BaseBashing, ITokunoDyable
public abstract class BaseWand : BaseBashing
{
private int m_Charges;

View file

@ -1,9 +0,0 @@
namespace Server.Items
{
public class RandomWand
{
public static BaseWand CreateWand() => CreateRandomWand();
public static BaseWand CreateRandomWand() => Loot.RandomWand();
}
}

View file

@ -123,8 +123,7 @@ namespace Server.Items
public virtual int VirtualDamageBonus => 0;
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
[Hue, CommandProperty(AccessLevel.GameMaster)]
public override int Hue
{
get => base.Hue;
@ -1919,7 +1918,7 @@ namespace Server.Items
{
pois = 100;
}
else if (type == 4)
else
{
nrgy = 100;
}
@ -4145,14 +4144,12 @@ namespace Server.Items
m_MaxRange = 1; // default
}
if (version < 5)
{
m_Resource = CraftResource.Iron;
Attributes = new AosAttributes(this);
WeaponAttributes = new AosWeaponAttributes(this);
AosElementDamages = new AosElementAttributes(this);
SkillBonuses = new AosSkillBonuses(this);
}
// version < 5
m_Resource = CraftResource.Iron;
Attributes = new AosAttributes(this);
WeaponAttributes = new AosWeaponAttributes(this);
AosElementDamages = new AosElementAttributes(this);
SkillBonuses = new AosSkillBonuses(this);
m_MinDamage = reader.ReadInt();
m_MaxDamage = reader.ReadInt();

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace Server.Items
{
public class HitLower
public static class HitLower
{
public static readonly TimeSpan AttackEffectDuration = TimeSpan.FromSeconds(10.0);
public static readonly TimeSpan DefenseEffectDuration = TimeSpan.FromSeconds(8.0);

View file

@ -80,9 +80,7 @@ namespace Server.Items
new Entity(Serial.Zero, endLoc, map),
0x36E4,
5,
0,
false,
false
0
);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), FinishLaunch, endLoc, map);