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

@ -98,17 +98,17 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
break;
}
{
m_LabelNumber = reader.ReadInt();
break;
}
}
}
}
public class AddonComponent : Item, IChopable
public class AddonComponent : Item, IChoppable
{
private static LightEntry[] m_Entries =
private static readonly LightEntry[] m_Entries =
{
new LightEntry(LightType.WestSmall, 1122, 1123, 1124, 1141, 1142, 1143, 1144, 1145, 1146, 2347, 2359, 2360, 2361,
2362, 2363, 2364, 2387, 2388, 2389, 2390, 2391, 2392),
@ -130,10 +130,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public BaseAddon Addon{ get; set; }
public BaseAddon Addon { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
[Hue]
[CommandProperty(AccessLevel.GameMaster)]
@ -204,16 +204,16 @@ namespace Server.Items
{
case 1:
case 0:
{
Addon = reader.ReadItem() as BaseAddon;
Offset = reader.ReadPoint3D();
{
Addon = reader.ReadItem() as BaseAddon;
Offset = reader.ReadPoint3D();
Addon?.OnComponentLoaded(this);
Addon?.OnComponentLoaded(this);
ApplyLightTo(this);
ApplyLightTo(this);
break;
}
break;
}
}
if (version < 1 && Weight == 0)
@ -246,8 +246,8 @@ namespace Server.Items
private class LightEntry
{
public int[] m_ItemIDs;
public LightType m_Light;
public readonly int[] m_ItemIDs;
public readonly LightType m_Light;
public LightEntry(LightType light, params int[] itemIDs)
{

View file

@ -3,7 +3,7 @@ using Server.ContextMenus;
namespace Server.Items
{
public class AddonContainerComponent : Item, IChopable
public class AddonContainerComponent : Item, IChoppable
{
[Constructible]
public AddonContainerComponent(int itemID) : base(itemID)
@ -21,10 +21,10 @@ namespace Server.Items
public virtual Point3D WallPosition => Point3D.Zero;
[CommandProperty(AccessLevel.GameMaster)]
public BaseAddonContainer Addon{ get; set; }
public BaseAddonContainer Addon { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
[Hue]
[CommandProperty(AccessLevel.GameMaster)]

View file

@ -4,29 +4,29 @@ using Server.Network;
namespace Server.Items
{
[FlippableAttribute( 0x100A/*East*/, 0x100B/*South*/ )]
[FlippableAttribute(0x100A/*East*/, 0x100B/*South*/)]
public class ArcheryButte : AddonComponent
{
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public double MinSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public double MaxSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public DateTime LastUse { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public bool FacingEast
{
get => ItemID == 0x100A;
set => ItemID = value ? 0x100A : 0x100B;
}
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public int Arrows { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
[CommandProperty(AccessLevel.GameMaster)]
public int Bolts { get; set; }
[Constructible]
@ -36,27 +36,27 @@ namespace Server.Items
MaxSkill = +25.0;
}
public ArcheryButte( Serial serial ) : base( serial )
public ArcheryButte(Serial serial) : base(serial)
{
}
public override void OnDoubleClick( Mobile from )
public override void OnDoubleClick(Mobile from)
{
if ( (Arrows > 0 || Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) )
Gather( from );
if ((Arrows > 0 || Bolts > 0) && from.InRange(GetWorldLocation(), 1))
Gather(from);
else
Fire( from );
Fire(from);
}
public void Gather( Mobile from )
public void Gather(Mobile from)
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500592 ); // You gather the arrows and bolts.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500592); // You gather the arrows and bolts.
if ( Arrows > 0 )
from.AddToBackpack( new Arrow( Arrows ) );
if (Arrows > 0)
from.AddToBackpack(new Arrow(Arrows));
if ( Bolts > 0 )
from.AddToBackpack( new Bolt( Bolts ) );
if (Bolts > 0)
from.AddToBackpack(new Bolt(Bolts));
Arrows = 0;
Bolts = 0;
@ -64,7 +64,7 @@ namespace Server.Items
m_Entries = null;
}
private static TimeSpan UseDelay = TimeSpan.FromSeconds( 2.0 );
private static readonly TimeSpan UseDelay = TimeSpan.FromSeconds(2.0);
private class ScoreEntry
{
@ -72,7 +72,7 @@ namespace Server.Items
public int Count { get; set; }
public void Record( int score )
public void Record(int score)
{
Total += score;
Count += 1;
@ -81,9 +81,9 @@ namespace Server.Items
private Dictionary<Mobile, ScoreEntry> m_Entries;
private ScoreEntry GetEntryFor( Mobile from )
private ScoreEntry GetEntryFor(Mobile from)
{
if ( m_Entries == null )
if (m_Entries == null)
m_Entries = new Dictionary<Mobile, ScoreEntry>();
if (!m_Entries.TryGetValue(from, out ScoreEntry e))
@ -92,105 +92,105 @@ namespace Server.Items
return e;
}
public void Fire( Mobile from )
public void Fire(Mobile from)
{
if ( !(from.Weapon is BaseRanged bow) )
if (!(from.Weapon is BaseRanged bow))
{
SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this.
SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this.
return;
}
if ( DateTime.UtcNow < LastUse + UseDelay )
if (DateTime.UtcNow < LastUse + UseDelay)
return;
Point3D worldLoc = GetWorldLocation();
if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y )
if (FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y)
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500596 ); // You would do better to stand in front of the archery butte.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500596); // You would do better to stand in front of the archery butte.
return;
}
if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X )
if (FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X)
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500597 ); // You aren't properly lined up with the archery butte to get an accurate shot.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500597); // You aren't properly lined up with the archery butte to get an accurate shot.
return;
}
if ( !from.InRange( worldLoc, 6 ) )
if (!from.InRange(worldLoc, 6))
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500598 ); // You are too far away from the archery butte to get an accurate shot.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500598); // You are too far away from the archery butte to get an accurate shot.
return;
}
if ( from.InRange( worldLoc, 4 ) )
if (from.InRange(worldLoc, 4))
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500599 ); // You are too close to the target.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599); // You are too close to the target.
return;
}
Container pack = from.Backpack;
Type ammoType = bow.AmmoType;
bool isArrow = ammoType == typeof( Arrow );
bool isBolt = ammoType == typeof( Bolt );
bool isArrow = ammoType == typeof(Arrow);
bool isBolt = ammoType == typeof(Bolt);
bool isKnown = isArrow || isBolt;
if (pack?.ConsumeTotal( ammoType ) != true)
if (pack?.ConsumeTotal(ammoType) != true)
{
if ( isArrow )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500594 ); // You do not have any arrows with which to practice.
else if ( isBolt )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500595 ); // You do not have any crossbow bolts with which to practice.
if (isArrow)
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500594); // You do not have any arrows with which to practice.
else if (isBolt)
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500595); // You do not have any crossbow bolts with which to practice.
else
SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this.
SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on this.
return;
}
LastUse = DateTime.UtcNow;
from.Direction = from.GetDirectionTo( GetWorldLocation() );
bow.PlaySwingAnimation( from );
from.MovingEffect( this, bow.EffectID, 18, 1, false, false );
from.Direction = from.GetDirectionTo(GetWorldLocation());
bow.PlaySwingAnimation(from);
from.MovingEffect(this, bow.EffectID, 18, 1, false, false);
ScoreEntry se = GetEntryFor( from );
ScoreEntry se = GetEntryFor(from);
if ( !from.CheckSkill( bow.Skill, MinSkill, MaxSkill ) )
if (!from.CheckSkill(bow.Skill, MinSkill, MaxSkill))
{
from.PlaySound( bow.MissSound );
from.PlaySound(bow.MissSound);
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether.
PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.
se.Record( 0 );
se.Record(0);
if ( se.Count == 1 )
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() );
if (se.Count == 1)
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
else
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
return;
}
Effects.PlaySound( Location, Map, 0x2B1 );
Effects.PlaySound(Location, Map, 0x2B1);
double rand = Utility.RandomDouble();
int area, score, splitScore;
if ( 0.10 > rand )
if (rand < 0.10)
{
area = 0; // bullseye
score = 50;
splitScore = 100;
}
else if ( 0.25 > rand )
else if (rand < 0.25)
{
area = 1; // inner ring
score = 10;
splitScore = 20;
}
else if ( 0.50 > rand )
else if (rand < 0.50)
{
area = 2; // middle ring
score = 5;
@ -205,64 +205,64 @@ namespace Server.Items
bool split = isKnown && (Arrows + Bolts) * 0.02 > Utility.RandomDouble();
if ( split )
if (split)
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + area,
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010027 + area,
$"{from.Name}\t{(isArrow ? "arrow" : "bolt")}");
}
else
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name );
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name);
if ( isArrow )
if (isArrow)
++Arrows;
else if ( isBolt )
else if (isBolt)
++Bolts;
}
se.Record( split ? splitScore : score );
se.Record(split ? splitScore : score);
if ( se.Count == 1 )
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() );
if (se.Count == 1)
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
else
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, $"{se.Total}\t{se.Count}");
}
public override void Serialize(IGenericWriter writer )
public override void Serialize(IGenericWriter writer)
{
base.Serialize( writer );
base.Serialize(writer);
writer.Write( 0 );
writer.Write(0);
writer.Write( MinSkill );
writer.Write( MaxSkill );
writer.Write( Arrows );
writer.Write( Bolts );
writer.Write(MinSkill);
writer.Write(MaxSkill);
writer.Write(Arrows);
writer.Write(Bolts);
}
public override void Deserialize( IGenericReader reader )
public override void Deserialize(IGenericReader reader)
{
base.Deserialize( reader );
base.Deserialize(reader);
int version = reader.ReadInt();
switch ( version )
switch (version)
{
case 0:
{
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
Arrows = reader.ReadInt();
Bolts = reader.ReadInt();
if ( MinSkill == 0.0 && MaxSkill == 30.0 )
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
Arrows = reader.ReadInt();
Bolts = reader.ReadInt();
break;
}
if (MinSkill == 0.0 && MaxSkill == 30.0)
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;
}
}
}
}
@ -274,23 +274,23 @@ namespace Server.Items
[Constructible]
public ArcheryButteAddon()
{
AddComponent( new ArcheryButte(), 0, 0, 0 );
AddComponent(new ArcheryButte(), 0, 0, 0);
}
public ArcheryButteAddon( Serial serial ) : base( serial )
public ArcheryButteAddon(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer )
public override void Serialize(IGenericWriter writer)
{
base.Serialize( writer );
base.Serialize(writer);
writer.Write( 0 ); // version
writer.Write(0); // version
}
public override void Deserialize( IGenericReader reader )
public override void Deserialize(IGenericReader reader)
{
base.Deserialize( reader );
base.Deserialize(reader);
int version = reader.ReadInt();
}
@ -306,20 +306,20 @@ namespace Server.Items
{
}
public ArcheryButteDeed( Serial serial ) : base( serial )
public ArcheryButteDeed(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer )
public override void Serialize(IGenericWriter writer)
{
base.Serialize( writer );
base.Serialize(writer);
writer.Write( 0 ); // version
writer.Write(0); // version
}
public override void Deserialize( IGenericReader reader )
public override void Deserialize(IGenericReader reader)
{
base.Deserialize( reader );
base.Deserialize(reader);
int version = reader.ReadInt();
}

View file

@ -14,7 +14,7 @@ namespace Server.Items
[Constructible]
public BallotBox() : base(0x9A8)
{
Topic = new string[0];
Topic = Array.Empty<string>();
Yes = new List<Mobile>();
No = new List<Mobile>();
}
@ -25,15 +25,15 @@ namespace Server.Items
public override int LabelNumber => 1041006; // a ballot box
public string[] Topic{ get; private set; }
public string[] Topic { get; private set; }
public List<Mobile> Yes{ get; private set; }
public List<Mobile> Yes { get; private set; }
public List<Mobile> No{ get; private set; }
public List<Mobile> No { get; private set; }
public void ClearTopic()
{
Topic = new string[0];
Topic = Array.Empty<string>();
ClearVotes();
}
@ -120,7 +120,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private BallotBox m_Box;
private readonly BallotBox m_Box;
public InternalGump(BallotBox box, bool isOwner) : base(110, 70)
{
@ -199,74 +199,74 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1: // change topic
{
if (isOwner)
{
m_Box.ClearTopic();
if (isOwner)
{
m_Box.ClearTopic();
from.SendLocalizedMessage(500370, "",
0x35); // Enter a line of text for your ballot, and hit ENTER. Hit ESC after the last line is entered.
from.Prompt = new TopicPrompt(m_Box);
from.SendLocalizedMessage(500370, "",
0x35); // Enter a line of text for your ballot, and hit ENTER. Hit ESC after the last line is entered.
from.Prompt = new TopicPrompt(m_Box);
}
break;
}
break;
}
case 2: // reset votes
{
if (isOwner)
{
m_Box.ClearVotes();
from.SendLocalizedMessage(500371); // Votes zeroed out.
}
if (isOwner)
{
m_Box.ClearVotes();
from.SendLocalizedMessage(500371); // Votes zeroed out.
}
goto default;
}
goto default;
}
case 3: // aye
{
if (!isOwner)
{
if (m_Box.HasVoted(from))
if (!isOwner)
{
from.SendLocalizedMessage(500374); // You have already voted on this ballot.
if (m_Box.HasVoted(from))
{
from.SendLocalizedMessage(500374); // You have already voted on this ballot.
}
else
{
m_Box.Yes.Add(from);
from.SendLocalizedMessage(500373); // Your vote has been registered.
}
}
else
{
m_Box.Yes.Add(from);
from.SendLocalizedMessage(500373); // Your vote has been registered.
}
}
goto default;
}
goto default;
}
case 4: // nay
{
if (!isOwner)
{
if (m_Box.HasVoted(from))
if (!isOwner)
{
from.SendLocalizedMessage(500374); // You have already voted on this ballot.
if (m_Box.HasVoted(from))
{
from.SendLocalizedMessage(500374); // You have already voted on this ballot.
}
else
{
m_Box.No.Add(from);
from.SendLocalizedMessage(500373); // Your vote has been registered.
}
}
else
{
m_Box.No.Add(from);
from.SendLocalizedMessage(500373); // Your vote has been registered.
}
}
goto default;
}
goto default;
}
default:
{
from.SendGump(new InternalGump(m_Box, isOwner));
break;
}
{
from.SendGump(new InternalGump(m_Box, isOwner));
break;
}
}
}
}
private class TopicPrompt : Prompt
{
private BallotBox m_Box;
private readonly BallotBox m_Box;
public TopicPrompt(BallotBox box) => m_Box = box;

View file

@ -15,12 +15,12 @@ namespace Server.Items
public interface IAddon
{
Item Deed{ get; }
Item Deed { get; }
bool CouldFit(IPoint3D p, Map map);
}
public abstract class BaseAddon : Item, IChopable, IAddon
public abstract class BaseAddon : Item, IChoppable, IAddon
{
public BaseAddon() : base(1)
{
@ -38,7 +38,7 @@ namespace Server.Items
public virtual BaseAddonDeed Deed => null;
public List<AddonComponent> Components{ get; private set; }
public List<AddonComponent> Components { get; private set; }
public virtual bool ShareHue => true;
@ -155,7 +155,7 @@ namespace Server.Items
if (Utility.InRange(doorLoc, addonLoc, 1) &&
(addonLoc.Z == doorLoc.Z ||
addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z))
(addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z)))
return AddonFitResult.DoorTooClose;
}
}
@ -237,18 +237,16 @@ namespace Server.Items
{
case 1:
case 0:
{
Components = reader.ReadStrongItemList<AddonComponent>();
break;
}
{
Components = reader.ReadStrongItemList<AddonComponent>();
break;
}
}
if (version < 1 && Weight == 0)
Weight = -1;
}
#region Mondain's Legacy
private CraftResource m_Resource;
[CommandProperty(AccessLevel.GameMaster)]
@ -266,7 +264,5 @@ namespace Server.Items
}
}
}
#endregion
}
}

View file

@ -3,7 +3,7 @@ using Server.Multis;
namespace Server.Items
{
public abstract class BaseAddonContainer : BaseContainer, IChopable, IAddon
public abstract class BaseAddonContainer : BaseContainer, IChoppable, IAddon
{
private CraftResource m_Resource;
@ -64,7 +64,7 @@ namespace Server.Items
public virtual Point3D WallPosition => Point3D.Zero;
public virtual BaseAddonContainerDeed Deed => null;
public List<AddonContainerComponent> Components{ get; private set; }
public List<AddonContainerComponent> Components { get; private set; }
Item IAddon.Deed => Deed;
@ -269,7 +269,7 @@ namespace Server.Items
if (Utility.InRange(doorLoc, addonLoc, 1) &&
(addonLoc.Z == doorLoc.Z ||
addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z))
(addonLoc.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLoc.Z)))
return AddonFitResult.DoorTooClose;
}
@ -277,7 +277,7 @@ namespace Server.Items
addonHeight = ItemData.CalcHeight;
if (Utility.InRange(doorLoc, addonLo, 1) &&
(addonLo.Z == doorLoc.Z || addonLo.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLo.Z))
(addonLo.Z == doorLoc.Z || (addonLo.Z + addonHeight > doorLoc.Z && doorLoc.Z + doorHeight > addonLo.Z)))
return AddonFitResult.DoorTooClose;
}
}

View file

@ -23,7 +23,7 @@ namespace Server.Items
{
}
public abstract BaseAddonContainer Addon{ get; }
public abstract BaseAddonContainer Addon { get; }
[CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource
@ -41,8 +41,6 @@ namespace Server.Items
}
}
#region ICraftable
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,
BaseTool tool, CraftItem craftItem, int resHue)
{
@ -58,8 +56,6 @@ namespace Server.Items
return quality;
}
#endregion
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
@ -101,7 +97,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private BaseAddonContainerDeed m_Deed;
private readonly BaseAddonContainerDeed m_Deed;
public InternalTarget(BaseAddonContainerDeed deed) : base(-1, true, TargetFlags.None)
{

View file

@ -19,7 +19,7 @@ namespace Server.Items
{
}
public abstract BaseAddon Addon{ get; }
public abstract BaseAddon Addon { get; }
public override void Serialize(IGenericWriter writer)
{
@ -48,7 +48,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private BaseAddonDeed m_Deed;
private readonly BaseAddonDeed m_Deed;
public InternalTarget(BaseAddonDeed deed) : base(-1, true, TargetFlags.None)
{
@ -103,8 +103,6 @@ namespace Server.Items
}
}
#region Mondain's Legacy
private CraftResource m_Resource;
[CommandProperty(AccessLevel.GameMaster)]
@ -122,7 +120,5 @@ namespace Server.Items
}
}
}
#endregion
}
}

View file

@ -84,10 +84,10 @@ namespace Server.Items
private class SpinTimer : Timer
{
private SpinCallback m_Callback;
private Mobile m_From;
private int m_Hue;
private ElvenSpinningwheelEastAddon m_Wheel;
private readonly SpinCallback m_Callback;
private readonly Mobile m_From;
private readonly int m_Hue;
private readonly ElvenSpinningwheelEastAddon m_Wheel;
public SpinTimer(ElvenSpinningwheelEastAddon wheel, SpinCallback callback, Mobile from, int hue) : base(
TimeSpan.FromSeconds(3.0))

View file

@ -86,10 +86,10 @@ namespace Server.Items
private class SpinTimer : Timer
{
private SpinCallback m_Callback;
private Mobile m_From;
private int m_Hue;
private ElvenSpinningwheelSouthAddon m_Wheel;
private readonly SpinCallback m_Callback;
private readonly Mobile m_From;
private readonly int m_Hue;
private readonly ElvenSpinningwheelSouthAddon m_Wheel;
public SpinTimer(ElvenSpinningwheelSouthAddon wheel, SpinCallback callback, Mobile from, int hue) : base(
TimeSpan.FromSeconds(3.0))

View file

@ -6,8 +6,8 @@ namespace Server.Items
{
public interface IFlourMill
{
int MaxFlour{ get; }
int CurFlour{ get; set; }
int MaxFlour { get; }
int CurFlour { get; set; }
}
public enum FlourMillStage
@ -19,7 +19,7 @@ namespace Server.Items
public class FlourMillEastAddon : BaseAddon, IFlourMill
{
private static int[][] m_StageTable =
private static readonly int[][] m_StageTable =
{
new[] { 0x1920, 0x1921, 0x1925 },
new[] { 0x1922, 0x1923, 0x1926 },
@ -87,7 +87,6 @@ namespace Server.Items
{
SackFlour flour = new SackFlour { ItemID = Utility.RandomBool() ? 4153 : 4165 };
if (from.PlaceInBackpack(flour))
{
m_Flour = 0;
@ -172,10 +171,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Flour = reader.ReadInt();
break;
}
{
m_Flour = reader.ReadInt();
break;
}
}
UpdateStage();

View file

@ -6,7 +6,7 @@ namespace Server.Items
{
public class FlourMillSouthAddon : BaseAddon, IFlourMill
{
private static int[][] m_StageTable =
private static readonly int[][] m_StageTable =
{
new[] { 0x192C, 0x192D, 0x1931 },
new[] { 0x192E, 0x192F, 0x1932 },
@ -160,10 +160,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Flour = reader.ReadInt();
break;
}
{
m_Flour = reader.ReadInt();
break;
}
}
UpdateStage();

View file

@ -6,7 +6,7 @@ namespace Server.Items
{
[Constructible]
public JackOLantern()
: this(1 > Utility.Random(2))
: this(Utility.Random(2) < 1)
{
}
@ -16,7 +16,7 @@ namespace Server.Items
AddComponent(new AddonComponent(5703), 0, 0, +0);
int hue = 1161;
//( 1 > Utility.Random( 5 ) ? 2118 : 1161 );
// ( 1 > Utility.Random( 5 ) ? 2118 : 1161 );
if (!south)
{
@ -63,7 +63,7 @@ namespace Server.Items
int version = reader.ReadByte();
if (version == 0)
Timer.DelayCall(TimeSpan.Zero, delegate
Timer.DelayCall(TimeSpan.Zero, () =>
{
for (int i = 0; i < Components.Count; ++i)
if (Components[i] is AddonComponent ac && ac.Hue == 2118)
@ -71,7 +71,7 @@ namespace Server.Items
});
if (version <= 1)
Timer.DelayCall(TimeSpan.Zero, delegate
Timer.DelayCall(TimeSpan.Zero, () =>
{
for (int i = 0; i < Components.Count; ++i)
if (Components[i] is AddonComponent ac)
@ -79,4 +79,4 @@ namespace Server.Items
});
}
}
}
}

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public interface ILoom
{
int Phase{ get; set; }
int Phase { get; set; }
}
public class LoomEastAddon : BaseAddon, ILoom
@ -20,7 +20,7 @@ namespace Server.Items
public override BaseAddonDeed Deed => new LoomEastDeed();
public int Phase{ get; set; }
public int Phase { get; set; }
public override void Serialize(IGenericWriter writer)
{
@ -40,10 +40,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
Phase = reader.ReadInt();
break;
}
{
Phase = reader.ReadInt();
break;
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Items
public override BaseAddonDeed Deed => new LoomSouthDeed();
public int Phase{ get; set; }
public int Phase { get; set; }
public override void Serialize(IGenericWriter writer)
{
@ -35,10 +35,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
Phase = reader.ReadInt();
break;
}
{
Phase = reader.ReadInt();
break;
}
}
}
}

View file

@ -18,10 +18,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public double MinSkill{ get; set; }
public double MinSkill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double MaxSkill{ get; set; }
public double MaxSkill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Swinging => m_Timer != null;
@ -106,18 +106,18 @@ namespace Server.Items
switch (version)
{
case 0:
{
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
if (MinSkill == 0.0 && MaxSkill == 30.0)
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
break;
}
if (MinSkill == 0.0 && MaxSkill == 30.0)
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;
}
}
UpdateItemID();
@ -125,7 +125,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private PickpocketDip m_Dip;
private readonly PickpocketDip m_Dip;
public InternalTimer(PickpocketDip dip) : base(TimeSpan.FromSeconds(3.0))
{

View file

@ -42,7 +42,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Point3D TeleOffset{ get; set; }
public Point3D TeleOffset { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D TelePoint
@ -164,15 +164,15 @@ namespace Server.Items
public SHTeleporter(Serial serial) : base(serial) => m_Changing = false;
[CommandProperty(AccessLevel.GameMaster)]
public bool External{ get; private set; }
public bool External { get; private set; }
public SHTeleComponent UpTele{ get; private set; }
public SHTeleComponent UpTele { get; private set; }
public SHTeleComponent RightTele{ get; private set; }
public SHTeleComponent RightTele { get; private set; }
public SHTeleComponent DownTele{ get; private set; }
public SHTeleComponent DownTele { get; private set; }
public SHTeleComponent LeftTele{ get; private set; }
public SHTeleComponent LeftTele { get; private set; }
public override bool ShareHue => false;

View file

@ -49,7 +49,6 @@ namespace Server.Items
}
}
public class SolenAntHole : BaseAddon
{
private List<Mobile> m_Spawned;
@ -90,7 +89,7 @@ namespace Server.Items
for (int i = 0; i < count; i++)
SpawnAnt();
if (0.05 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.05)
SpawnAnt(new Beetle());
}
}

View file

@ -6,7 +6,7 @@ namespace Server.Items
public interface ISpinningWheel
{
bool Spinning{ get; }
bool Spinning { get; }
void BeginSpin(SpinCallback callback, Mobile from, int hue);
}
@ -94,10 +94,10 @@ namespace Server.Items
private class SpinTimer : Timer
{
private SpinCallback m_Callback;
private Mobile m_From;
private int m_Hue;
private SpinningwheelEastAddon m_Wheel;
private readonly SpinCallback m_Callback;
private readonly Mobile m_From;
private readonly int m_Hue;
private readonly SpinningwheelEastAddon m_Wheel;
public SpinTimer(SpinningwheelEastAddon wheel, SpinCallback callback, Mobile from, int hue) : base(
TimeSpan.FromSeconds(3.0))

View file

@ -86,10 +86,10 @@ namespace Server.Items
private class SpinTimer : Timer
{
private SpinCallback m_Callback;
private Mobile m_From;
private int m_Hue;
private SpinningwheelSouthAddon m_Wheel;
private readonly SpinCallback m_Callback;
private readonly Mobile m_From;
private readonly int m_Hue;
private readonly SpinningwheelSouthAddon m_Wheel;
public SpinTimer(SpinningwheelSouthAddon wheel, SpinCallback callback, Mobile from, int hue) : base(
TimeSpan.FromSeconds(3.0))

View file

@ -19,10 +19,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public double MinSkill{ get; set; }
public double MinSkill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double MaxSkill{ get; set; }
public double MaxSkill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Swinging => m_Timer != null;
@ -105,18 +105,18 @@ namespace Server.Items
switch (version)
{
case 0:
{
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
if (MinSkill == 0.0 && MaxSkill == 30.0)
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
break;
}
if (MinSkill == 0.0 && MaxSkill == 30.0)
{
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;
}
}
UpdateItemID();
@ -125,7 +125,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private bool m_Delay = true;
private TrainingDummy m_Dummy;
private readonly TrainingDummy m_Dummy;
public InternalTimer(TrainingDummy dummy) : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(2.75))
{