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))
{

View file

@ -60,7 +60,7 @@ namespace Server.Items
// items info
[CommandProperty(AccessLevel.GameMaster)]
public int LiveCreatures{ get; private set; }
public int LiveCreatures { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int DeadCreatures
@ -136,7 +136,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public bool OptimalState => m_Food.State == (int)FoodState.Full && m_Water.State == (int)WaterState.Strong;
public List<int> Events{ get; private set; }
public List<int> Events { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool RewardAvailable
@ -178,8 +178,7 @@ namespace Server.Items
public virtual bool HasAccess(Mobile from) =>
from?.Deleted == false && (
from.AccessLevel >= AccessLevel.GameMaster ||
BaseHouse.FindHouseAt(this)?.IsCoOwner(from) == true
);
BaseHouse.FindHouseAt(this)?.IsCoOwner(from) == true);
public override bool OnDragDrop(Mobile from, Item dropped)
{
@ -451,38 +450,38 @@ namespace Server.Items
case 3:
case 2:
case 1:
{
DateTime next = reader.ReadDateTime();
{
DateTime next = reader.ReadDateTime();
if (next < DateTime.UtcNow)
next = DateTime.UtcNow;
if (next < DateTime.UtcNow)
next = DateTime.UtcNow;
m_Timer = Timer.DelayCall(next - DateTime.UtcNow, EvaluationInterval, Evaluate);
m_Timer = Timer.DelayCall(next - DateTime.UtcNow, EvaluationInterval, Evaluate);
goto case 0;
}
goto case 0;
}
case 0:
{
LiveCreatures = reader.ReadInt();
m_VacationLeft = reader.ReadInt();
{
LiveCreatures = reader.ReadInt();
m_VacationLeft = reader.ReadInt();
m_Food = new AquariumState();
m_Water = new AquariumState();
m_Food = new AquariumState();
m_Water = new AquariumState();
m_Food.Deserialize(reader);
m_Water.Deserialize(reader);
m_Food.Deserialize(reader);
m_Water.Deserialize(reader);
Events = new List<int>();
Events = new List<int>();
int count = reader.ReadInt();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
Events.Add(reader.ReadInt());
for (int i = 0; i < count; i++)
Events.Add(reader.ReadInt());
m_RewardAvailable = reader.ReadBool();
m_RewardAvailable = reader.ReadBool();
break;
}
break;
}
}
if (version < 2)
@ -511,8 +510,6 @@ namespace Server.Items
RecountLiveCreatures();
}
#region Members
public int FoodNumber()
{
if (m_Food.State == (int)FoodState.Full)
@ -526,10 +523,6 @@ namespace Server.Items
public int WaterNumber() => 1074242 + m_Water.State;
#endregion
#region Virtual members
public virtual void KillFish(int amount)
{
List<BaseFish> toKill = new List<BaseFish>();
@ -574,17 +567,15 @@ namespace Server.Items
// food events
if (
m_Food.Added < m_Food.Maintain && m_Food.State != (int)FoodState.Overfed &&
m_Food.State != (int)FoodState.Dead ||
m_Food.Added >= m_Food.Improve && m_Food.State == (int)FoodState.Full
)
(m_Food.Added < m_Food.Maintain && m_Food.State != (int)FoodState.Overfed &&
m_Food.State != (int)FoodState.Dead) ||
(m_Food.Added >= m_Food.Improve && m_Food.State == (int)FoodState.Full))
Events.Add(1074368); // The tank looks worse than it did yesterday.
if (
m_Food.Added >= m_Food.Improve && m_Food.State != (int)FoodState.Full &&
m_Food.State != (int)FoodState.Overfed ||
m_Food.Added < m_Food.Maintain && m_Food.State == (int)FoodState.Overfed
)
(m_Food.Added >= m_Food.Improve && m_Food.State != (int)FoodState.Full &&
m_Food.State != (int)FoodState.Overfed) ||
(m_Food.Added < m_Food.Maintain && m_Food.State == (int)FoodState.Overfed))
Events.Add(1074367); // The tank looks healthier today.
// water events
@ -613,41 +604,41 @@ namespace Server.Items
switch (Utility.Random(6))
{
case 0:
{
message = 1074371; // Brine shrimp have hatched overnight in the tank.
fish = new BrineShrimp();
break;
}
{
message = 1074371; // Brine shrimp have hatched overnight in the tank.
fish = new BrineShrimp();
break;
}
case 1:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new Coral();
break;
}
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new Coral();
break;
}
case 2:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new FullMoonFish();
break;
}
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new FullMoonFish();
break;
}
case 3:
{
message = 1074373; // A sea horse has hatched overnight in the tank.
fish = new SeaHorseFish();
break;
}
{
message = 1074373; // A sea horse has hatched overnight in the tank.
fish = new SeaHorseFish();
break;
}
case 4:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedFlakeFish();
break;
}
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedFlakeFish();
break;
}
case 5:
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedSosarianSwill();
break;
}
{
message = 1074365; // A new creature has hatched overnight in the tank.
fish = new StrippedSosarianSwill();
break;
}
}
if (Utility.RandomDouble() < 0.05)
@ -876,16 +867,12 @@ namespace Server.Items
return true;
}
#endregion
#region Static members
public static FishBowl GetEmptyBowl(Mobile from)
{
return from?.Backpack?.FindItemsByType<FishBowl>().Find(bowl => bowl.Empty);
}
private static Type[] m_Decorations =
private static readonly Type[] m_Decorations =
{
typeof(FishBones),
typeof(WaterloggedBoots),
@ -912,18 +899,14 @@ namespace Server.Items
return false;
}
public static int[] FishHues{ get; } =
public static int[] FishHues { get; } =
{
0x1C2, 0x1C3, 0x2A3, 0x47E, 0x51D
};
#endregion
#region Context entries
private class ExamineEntry : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public ExamineEntry(Aquarium aquarium) : base(6235, 2) // Examine Aquarium
=>
@ -940,7 +923,7 @@ namespace Server.Items
private class CollectRewardEntry : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public CollectRewardEntry(Aquarium aquarium) : base(6237, 2) // Collect Reward
=>
@ -957,7 +940,7 @@ namespace Server.Items
private class ViewEventEntry : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public ViewEventEntry(Aquarium aquarium) : base(6239, 2) // View events
=>
@ -980,7 +963,7 @@ namespace Server.Items
private class CancelVacationMode : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public CancelVacationMode(Aquarium aquarium) : base(6240, 2) // Cancel vacation mode
=>
@ -1000,7 +983,7 @@ namespace Server.Items
// GM context entries
private class GMAddFood : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public GMAddFood(Aquarium aquarium) : base(6231) // GM Add Food
=>
@ -1018,7 +1001,7 @@ namespace Server.Items
private class GMAddWater : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public GMAddWater(Aquarium aquarium) : base(6232) // GM Add Water
=>
@ -1036,7 +1019,7 @@ namespace Server.Items
private class GMForceEvaluate : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public GMForceEvaluate(Aquarium aquarium) : base(6233) // GM Force Evaluate
=>
@ -1053,7 +1036,7 @@ namespace Server.Items
private class GMOpen : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public GMOpen(Aquarium aquarium) : base(6234) // GM Open Container
=>
@ -1070,7 +1053,7 @@ namespace Server.Items
private class GMFill : ContextMenuEntry
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public GMFill(Aquarium aquarium) : base(6236) // GM Fill Food and Water
=>
@ -1086,8 +1069,6 @@ namespace Server.Items
m_Aquarium.InvalidateProperties();
}
}
#endregion
}
public class AquariumEastDeed : BaseAddonContainerDeed

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class AquariumGump : Gump
{
private Aquarium m_Aquarium;
private readonly Aquarium m_Aquarium;
public AquariumGump(Aquarium aquarium, bool edit) : base(100, 100)
{

View file

@ -40,13 +40,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int Maintain{ get; set; }
public int Maintain { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Improve{ get; set; }
public int Improve { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Added{ get; set; }
public int Added { get; set; }
public override string ToString() => "...";

View file

@ -133,7 +133,7 @@ namespace Server.Items
private class RemoveCreature : ContextMenuEntry
{
private FishBowl m_Bowl;
private readonly FishBowl m_Bowl;
public RemoveCreature(FishBowl bowl) : base(6242, 3) // Remove creature
=>

View file

@ -8,7 +8,7 @@ namespace Server.Items
Hue = 0x4F5;
ArmorAttributes.DurabilityBonus = 100;
HitPoints = MaxHitPoints =
255; //Cause the Durability bonus and such and the min/max hits as well as all other hits being whole #'s...
255; // Cause the Durability bonus and such and the min/max hits as well as all other hits being whole #'s...
Attributes.BonusStam = 8;
Attributes.AttackChance = 20;
}

View file

@ -19,7 +19,6 @@ namespace Server.Items
private int m_HitPoints;
private bool m_Identified;
/* Armor internals work differently now (Jun 19 2003)
*
* The attributes defined below default to -1.
@ -67,11 +66,10 @@ namespace Server.Items
SkillBonuses = new AosSkillBonuses(this);
}
public virtual bool AllowMaleWearer => true;
public virtual bool AllowFemaleWearer => true;
public abstract AMT MaterialType{ get; }
public abstract AMT MaterialType { get; }
public virtual int RevertArmorBase => ArmorBase;
public virtual int ArmorBase => 0;
@ -80,7 +78,6 @@ namespace Server.Items
public virtual AMA AosMedAllowance => DefMedAllowance;
public virtual AMA OldMedAllowance => DefMedAllowance;
public virtual int AosStrBonus => 0;
public virtual int AosDexBonus => 0;
public virtual int AosIntBonus => 0;
@ -88,7 +85,6 @@ namespace Server.Items
public virtual int AosDexReq => 0;
public virtual int AosIntReq => 0;
public virtual int OldStrBonus => 0;
public virtual int OldDexBonus => 0;
public virtual int OldIntBonus => 0;
@ -252,7 +248,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public bool PlayerConstructed{ get; set; }
public bool PlayerConstructed { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource
@ -291,7 +287,6 @@ namespace Server.Items
}
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Crafter
{
@ -303,7 +298,6 @@ namespace Server.Items
}
}
[CommandProperty(AccessLevel.GameMaster)]
public ArmorQuality Quality
{
@ -352,13 +346,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public AosAttributes Attributes{ get; private set; }
public AosAttributes Attributes { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosArmorAttributes ArmorAttributes{ get; private set; }
public AosArmorAttributes ArmorAttributes { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosSkillBonuses SkillBonuses{ get; private set; }
public AosSkillBonuses SkillBonuses { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int PhysicalBonus
@ -459,7 +453,7 @@ namespace Server.Items
}
}
public static double[] ArmorScalars{ get; set; } = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 };
public static double[] ArmorScalars { get; set; } = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 };
public virtual CraftResource DefaultResource => CraftResource.Iron;
@ -477,8 +471,6 @@ namespace Server.Items
}
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -499,8 +491,7 @@ namespace Server.Items
if (Quality == ArmorQuality.Exceptional)
{
if (!(Core.ML && this is BaseShield)
) // Guessed Core.ML removed exceptional resist bonuses from crafted shields
if (!(Core.ML && this is BaseShield)) // Guessed Core.ML removed exceptional resist bonuses from crafted shields
DistributeBonuses(tool is BaseRunicTool ? 6 :
Core.SE ? 15 : 14); // Not sure since when, but right now 15 points are added, not 14.
@ -538,8 +529,6 @@ namespace Server.Items
return quality;
}
#endregion
public bool Scissor(Mobile from, Scissors scissors)
{
if (!IsChildOf(from.Backpack))
@ -641,7 +630,7 @@ namespace Server.Items
if (absorbed < 2)
absorbed = 2;
if (25 > Utility.Random(100)) // 25% chance to lower durability
if (Utility.Random(100) < 25) // 25% chance to lower durability
{
if (Core.AOS && ArmorAttributes.SelfRepair > Utility.Random(10))
{
@ -1027,246 +1016,246 @@ namespace Server.Items
case 7:
case 6:
case 5:
{
SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Attributes))
Attributes = new AosAttributes(this, reader);
else
Attributes = new AosAttributes(this);
if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
ArmorAttributes = new AosArmorAttributes(this, reader);
else
ArmorAttributes = new AosArmorAttributes(this);
if (GetSaveFlag(flags, SaveFlag.PhysicalBonus))
m_PhysicalBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.FireBonus))
m_FireBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.ColdBonus))
m_ColdBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.PoisonBonus))
m_PoisonBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.EnergyBonus))
m_EnergyBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Identified))
m_Identified = version >= 7 || reader.ReadBool();
if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
m_MaxHitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.HitPoints))
m_HitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Crafter))
m_Crafter = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.Quality))
m_Quality = (ArmorQuality)reader.ReadEncodedInt();
else
m_Quality = ArmorQuality.Regular;
if (version == 5 && m_Quality == ArmorQuality.Low)
m_Quality = ArmorQuality.Regular;
if (GetSaveFlag(flags, SaveFlag.Durability))
{
m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();
SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();
if (m_Durability > ArmorDurabilityLevel.Indestructible)
m_Durability = ArmorDurabilityLevel.Durable;
if (GetSaveFlag(flags, SaveFlag.Attributes))
Attributes = new AosAttributes(this, reader);
else
Attributes = new AosAttributes(this);
if (GetSaveFlag(flags, SaveFlag.ArmorAttributes))
ArmorAttributes = new AosArmorAttributes(this, reader);
else
ArmorAttributes = new AosArmorAttributes(this);
if (GetSaveFlag(flags, SaveFlag.PhysicalBonus))
m_PhysicalBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.FireBonus))
m_FireBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.ColdBonus))
m_ColdBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.PoisonBonus))
m_PoisonBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.EnergyBonus))
m_EnergyBonus = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Identified))
m_Identified = version >= 7 || reader.ReadBool();
if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
m_MaxHitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.HitPoints))
m_HitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Crafter))
m_Crafter = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.Quality))
m_Quality = (ArmorQuality)reader.ReadEncodedInt();
else
m_Quality = ArmorQuality.Regular;
if (version == 5 && m_Quality == ArmorQuality.Low)
m_Quality = ArmorQuality.Regular;
if (GetSaveFlag(flags, SaveFlag.Durability))
{
m_Durability = (ArmorDurabilityLevel)reader.ReadEncodedInt();
if (m_Durability > ArmorDurabilityLevel.Indestructible)
m_Durability = ArmorDurabilityLevel.Durable;
}
if (GetSaveFlag(flags, SaveFlag.Protection))
{
m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
if (m_Protection > ArmorProtectionLevel.Invulnerability)
m_Protection = ArmorProtectionLevel.Defense;
}
if (GetSaveFlag(flags, SaveFlag.Resource))
m_Resource = (CraftResource)reader.ReadEncodedInt();
else
m_Resource = DefaultResource;
if (m_Resource == CraftResource.None)
m_Resource = DefaultResource;
if (GetSaveFlag(flags, SaveFlag.BaseArmor))
m_ArmorBase = reader.ReadEncodedInt();
else
m_ArmorBase = -1;
if (GetSaveFlag(flags, SaveFlag.StrBonus))
m_StrBonus = reader.ReadEncodedInt();
else
m_StrBonus = -1;
if (GetSaveFlag(flags, SaveFlag.DexBonus))
m_DexBonus = reader.ReadEncodedInt();
else
m_DexBonus = -1;
if (GetSaveFlag(flags, SaveFlag.IntBonus))
m_IntBonus = reader.ReadEncodedInt();
else
m_IntBonus = -1;
if (GetSaveFlag(flags, SaveFlag.StrReq))
m_StrReq = reader.ReadEncodedInt();
else
m_StrReq = -1;
if (GetSaveFlag(flags, SaveFlag.DexReq))
m_DexReq = reader.ReadEncodedInt();
else
m_DexReq = -1;
if (GetSaveFlag(flags, SaveFlag.IntReq))
m_IntReq = reader.ReadEncodedInt();
else
m_IntReq = -1;
if (GetSaveFlag(flags, SaveFlag.MedAllowance))
m_Meditate = (AMA)reader.ReadEncodedInt();
else
m_Meditate = (AMA)(-1);
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
SkillBonuses = new AosSkillBonuses(this, reader);
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
PlayerConstructed = true;
break;
}
if (GetSaveFlag(flags, SaveFlag.Protection))
{
m_Protection = (ArmorProtectionLevel)reader.ReadEncodedInt();
if (m_Protection > ArmorProtectionLevel.Invulnerability)
m_Protection = ArmorProtectionLevel.Defense;
}
if (GetSaveFlag(flags, SaveFlag.Resource))
m_Resource = (CraftResource)reader.ReadEncodedInt();
else
m_Resource = DefaultResource;
if (m_Resource == CraftResource.None)
m_Resource = DefaultResource;
if (GetSaveFlag(flags, SaveFlag.BaseArmor))
m_ArmorBase = reader.ReadEncodedInt();
else
m_ArmorBase = -1;
if (GetSaveFlag(flags, SaveFlag.StrBonus))
m_StrBonus = reader.ReadEncodedInt();
else
m_StrBonus = -1;
if (GetSaveFlag(flags, SaveFlag.DexBonus))
m_DexBonus = reader.ReadEncodedInt();
else
m_DexBonus = -1;
if (GetSaveFlag(flags, SaveFlag.IntBonus))
m_IntBonus = reader.ReadEncodedInt();
else
m_IntBonus = -1;
if (GetSaveFlag(flags, SaveFlag.StrReq))
m_StrReq = reader.ReadEncodedInt();
else
m_StrReq = -1;
if (GetSaveFlag(flags, SaveFlag.DexReq))
m_DexReq = reader.ReadEncodedInt();
else
m_DexReq = -1;
if (GetSaveFlag(flags, SaveFlag.IntReq))
m_IntReq = reader.ReadEncodedInt();
else
m_IntReq = -1;
if (GetSaveFlag(flags, SaveFlag.MedAllowance))
m_Meditate = (AMA)reader.ReadEncodedInt();
else
m_Meditate = (AMA)(-1);
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
SkillBonuses = new AosSkillBonuses(this, reader);
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
PlayerConstructed = true;
break;
}
case 4:
{
Attributes = new AosAttributes(this, reader);
ArmorAttributes = new AosArmorAttributes(this, reader);
goto case 3;
}
{
Attributes = new AosAttributes(this, reader);
ArmorAttributes = new AosArmorAttributes(this, reader);
goto case 3;
}
case 3:
{
m_PhysicalBonus = reader.ReadInt();
m_FireBonus = reader.ReadInt();
m_ColdBonus = reader.ReadInt();
m_PoisonBonus = reader.ReadInt();
m_EnergyBonus = reader.ReadInt();
goto case 2;
}
{
m_PhysicalBonus = reader.ReadInt();
m_FireBonus = reader.ReadInt();
m_ColdBonus = reader.ReadInt();
m_PoisonBonus = reader.ReadInt();
m_EnergyBonus = reader.ReadInt();
goto case 2;
}
case 2:
case 1:
{
m_Identified = reader.ReadBool();
goto case 0;
}
{
m_Identified = reader.ReadBool();
goto case 0;
}
case 0:
{
m_ArmorBase = reader.ReadInt();
m_MaxHitPoints = reader.ReadInt();
m_HitPoints = reader.ReadInt();
m_Crafter = reader.ReadMobile();
m_Quality = (ArmorQuality)reader.ReadInt();
m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
m_Protection = (ArmorProtectionLevel)reader.ReadInt();
AMT mat = (AMT)reader.ReadInt();
if (m_ArmorBase == RevertArmorBase)
m_ArmorBase = -1;
/*m_BodyPos = (ArmorBodyType)*/
reader.ReadInt();
if (version < 4)
{
Attributes = new AosAttributes(this);
ArmorAttributes = new AosArmorAttributes(this);
}
m_ArmorBase = reader.ReadInt();
m_MaxHitPoints = reader.ReadInt();
m_HitPoints = reader.ReadInt();
m_Crafter = reader.ReadMobile();
m_Quality = (ArmorQuality)reader.ReadInt();
m_Durability = (ArmorDurabilityLevel)reader.ReadInt();
m_Protection = (ArmorProtectionLevel)reader.ReadInt();
if (version < 3 && m_Quality == ArmorQuality.Exceptional)
DistributeBonuses(6);
AMT mat = (AMT)reader.ReadInt();
if (version >= 2)
{
m_Resource = (CraftResource)reader.ReadInt();
}
else
{
var info = reader.ReadInt() switch
if (m_ArmorBase == RevertArmorBase)
m_ArmorBase = -1;
/*m_BodyPos = (ArmorBodyType)*/
reader.ReadInt();
if (version < 4)
{
0 => OreInfo.Iron,
1 => OreInfo.DullCopper,
2 => OreInfo.ShadowIron,
3 => OreInfo.Copper,
4 => OreInfo.Bronze,
5 => OreInfo.Gold,
6 => OreInfo.Agapite,
7 => OreInfo.Verite,
8 => OreInfo.Valorite,
_ => OreInfo.Iron
};
Attributes = new AosAttributes(this);
ArmorAttributes = new AosArmorAttributes(this);
}
m_Resource = CraftResources.GetFromOreInfo(info, mat);
}
if (version < 3 && m_Quality == ArmorQuality.Exceptional)
DistributeBonuses(6);
m_StrBonus = reader.ReadInt();
m_DexBonus = reader.ReadInt();
m_IntBonus = reader.ReadInt();
m_StrReq = reader.ReadInt();
m_DexReq = reader.ReadInt();
m_IntReq = reader.ReadInt();
if (m_StrBonus == OldStrBonus)
m_StrBonus = -1;
if (m_DexBonus == OldDexBonus)
m_DexBonus = -1;
if (m_IntBonus == OldIntBonus)
m_IntBonus = -1;
if (m_StrReq == OldStrReq)
m_StrReq = -1;
if (m_DexReq == OldDexReq)
m_DexReq = -1;
if (m_IntReq == OldIntReq)
m_IntReq = -1;
m_Meditate = (AMA)reader.ReadInt();
if (m_Meditate == OldMedAllowance)
m_Meditate = (AMA)(-1);
if (m_Resource == CraftResource.None)
{
if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
m_Resource = CraftResource.RegularLeather;
else if (mat == ArmorMaterialType.Spined)
m_Resource = CraftResource.SpinedLeather;
else if (mat == ArmorMaterialType.Horned)
m_Resource = CraftResource.HornedLeather;
else if (mat == ArmorMaterialType.Barbed)
m_Resource = CraftResource.BarbedLeather;
if (version >= 2)
{
m_Resource = (CraftResource)reader.ReadInt();
}
else
m_Resource = CraftResource.Iron;
{
var info = reader.ReadInt() switch
{
0 => OreInfo.Iron,
1 => OreInfo.DullCopper,
2 => OreInfo.ShadowIron,
3 => OreInfo.Copper,
4 => OreInfo.Bronze,
5 => OreInfo.Gold,
6 => OreInfo.Agapite,
7 => OreInfo.Verite,
8 => OreInfo.Valorite,
_ => OreInfo.Iron
};
m_Resource = CraftResources.GetFromOreInfo(info, mat);
}
m_StrBonus = reader.ReadInt();
m_DexBonus = reader.ReadInt();
m_IntBonus = reader.ReadInt();
m_StrReq = reader.ReadInt();
m_DexReq = reader.ReadInt();
m_IntReq = reader.ReadInt();
if (m_StrBonus == OldStrBonus)
m_StrBonus = -1;
if (m_DexBonus == OldDexBonus)
m_DexBonus = -1;
if (m_IntBonus == OldIntBonus)
m_IntBonus = -1;
if (m_StrReq == OldStrReq)
m_StrReq = -1;
if (m_DexReq == OldDexReq)
m_DexReq = -1;
if (m_IntReq == OldIntReq)
m_IntReq = -1;
m_Meditate = (AMA)reader.ReadInt();
if (m_Meditate == OldMedAllowance)
m_Meditate = (AMA)(-1);
if (m_Resource == CraftResource.None)
{
if (mat == ArmorMaterialType.Studded || mat == ArmorMaterialType.Leather)
m_Resource = CraftResource.RegularLeather;
else if (mat == ArmorMaterialType.Spined)
m_Resource = CraftResource.SpinedLeather;
else if (mat == ArmorMaterialType.Horned)
m_Resource = CraftResource.HornedLeather;
else if (mat == ArmorMaterialType.Barbed)
m_Resource = CraftResource.BarbedLeather;
else
m_Resource = CraftResource.Iron;
}
if (m_MaxHitPoints == 0 && m_HitPoints == 0)
m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
break;
}
if (m_MaxHitPoints == 0 && m_HitPoints == 0)
m_HitPoints = m_MaxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
break;
}
}
SkillBonuses ??= new AosSkillBonuses(this);
@ -1501,13 +1490,9 @@ namespace Server.Items
if (m_Crafter != null)
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
#region Factions
if (m_FactionState != null)
list.Add(1041350); // faction item
#endregion
if (RequiredRace == Race.Elf)
list.Add(1075086); // Elves Only
@ -1599,7 +1584,7 @@ namespace Server.Items
if (Core.ML && (prop = Attributes.IncreasedKarmaLoss) != 0)
list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~%
base.AddResistanceProperties(list);
this.AddResistanceProperties(list);
if ((prop = GetDurabilityBonus()) > 0)
list.Add(1060410, prop.ToString()); // durability ~1_val~%
@ -1623,13 +1608,9 @@ namespace Server.Items
attrs.Add(new EquipInfoAttribute(1049643)); // cursed
}
#region Factions
if (m_FactionState != null)
attrs.Add(new EquipInfoAttribute(1041350)); // faction item
#endregion
if (m_Quality == ArmorQuality.Exceptional)
attrs.Add(new EquipInfoAttribute(1018305 - (int)m_Quality));
@ -1641,8 +1622,8 @@ namespace Server.Items
if (m_Protection > ArmorProtectionLevel.Regular && m_Protection <= ArmorProtectionLevel.Invulnerability)
attrs.Add(new EquipInfoAttribute(1038005 + (int)m_Protection));
}
else if (m_Durability != ArmorDurabilityLevel.Regular || m_Protection > ArmorProtectionLevel.Regular &&
m_Protection <= ArmorProtectionLevel.Invulnerability)
else if (m_Durability != ArmorDurabilityLevel.Regular || (m_Protection > ArmorProtectionLevel.Regular &&
m_Protection <= ArmorProtectionLevel.Invulnerability))
{
attrs.Add(new EquipInfoAttribute(1038000)); // Unidentified
}
@ -1698,8 +1679,6 @@ namespace Server.Items
PlayerConstructed = 0x01000000
}
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
@ -1715,7 +1694,5 @@ namespace Server.Items
LootType = m_FactionState == null ? LootType.Regular : LootType.Blessed;
}
}
#endregion
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073379; //Anthropomorphist Reading Glasses
public override int LabelNumber => 1073379; // Anthropomorphist Reading Glasses
public override int BasePhysicalResistance => 5;
public override int BaseFireResistance => 5;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073363; //Reading Glasses of the Arts
public override int LabelNumber => 1073363; // Reading Glasses of the Arts
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 8;

View file

@ -36,7 +36,7 @@ namespace Server.Items
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
[CommandProperty(AccessLevel.GameMaster)]
public AosWeaponAttributes WeaponAttributes{ get; private set; }
public AosWeaponAttributes WeaponAttributes { get; private set; }
public override void AppendChildNameProperties(ObjectPropertyList list)
{

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073380; //Folded Steel Reading Glasses
public override int LabelNumber => 1073380; // Folded Steel Reading Glasses
public override int BasePhysicalResistance => 20;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073378; //Light Of Way Reading Glasses
public override int LabelNumber => 1073378; // Light Of Way Reading Glasses
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073382; //Lyrical Reading Glasses
public override int LabelNumber => 1073382; // Lyrical Reading Glasses
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073381; //Mace And Shield Reading Glasses
public override int LabelNumber => 1073381; // Mace And Shield Reading Glasses
public override int BasePhysicalResistance => 25;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073364; //Maritime Reading Glasses
public override int LabelNumber => 1073364; // Maritime Reading Glasses
public override int BasePhysicalResistance => 3;
public override int BaseFireResistance => 4;

View file

@ -15,7 +15,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073377; //Necromantic Reading Glasses
public override int LabelNumber => 1073377; // Necromantic Reading Glasses
public override int BasePhysicalResistance => 0;
public override int BaseFireResistance => 0;

View file

@ -15,7 +15,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073376; //Poisoned Reading Glasses
public override int LabelNumber => 1073376; // Poisoned Reading Glasses
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 10;

View file

@ -13,7 +13,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073362; //Reading Glasses of the Trades
public override int LabelNumber => 1073362; // Reading Glasses of the Trades
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073373; //Treasures and Trinkets Reading Glasses
public override int LabelNumber => 1073373; // Treasures and Trinkets Reading Glasses
public override int BasePhysicalResistance => 10;
public override int BaseFireResistance => 10;

View file

@ -16,7 +16,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1073374; //Wizard's Crystal Reading Glasses
public override int LabelNumber => 1073374; // Wizard's Crystal Reading Glasses
public override int BasePhysicalResistance => 5;
public override int BaseFireResistance => 5;

View file

@ -57,23 +57,21 @@ namespace Server.Items
switch (version)
{
case 0:
{
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
}
break;
}
break;
}
}
}
#region Arcane Impl
private int m_MaxArcaneCharges, m_CurArcaneCharges;
[CommandProperty(AccessLevel.GameMaster)]
@ -137,7 +135,5 @@ namespace Server.Items
else if (ItemID == 0x317C)
ItemID = 0x2FC6;
}
#endregion
}
}

View file

@ -56,23 +56,21 @@ namespace Server.Items
switch (version)
{
case 1:
{
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
}
break;
}
break;
}
}
}
#region Arcane Impl
private int m_MaxArcaneCharges, m_CurArcaneCharges;
[CommandProperty(AccessLevel.GameMaster)]
@ -136,7 +134,5 @@ namespace Server.Items
else if (ItemID == 0x13CE)
ItemID = 0x13C6;
}
#endregion
}
}

View file

@ -26,7 +26,6 @@ namespace Server.Items
public override ArmorMaterialType MaterialType => ArmorMaterialType.Leather;
public override CraftResource DefaultResource => CraftResource.RegularLeather;
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
public override void Serialize(IGenericWriter writer)

View file

@ -42,18 +42,18 @@ namespace Server.Items
switch (version)
{
case 1:
{
if (reader.ReadBool())
{
reader.ReadInt();
reader.ReadInt();
if (reader.ReadBool())
{
reader.ReadInt();
reader.ReadInt();
}
Weight = 2.0;
ItemID = 0x2792;
break;
}
Weight = 2.0;
ItemID = 0x2792;
break;
}
}
}
}

View file

@ -1,6 +1,6 @@
namespace Server.Items
{
//Is this a filler-type item? the clilocs don't match up and at a glacnce I can't find direct reference of it
// Is this a filler-type item? the clilocs don't match up and at a glacnce I can't find direct reference of it
[Flippable(0x2B6D, 0x3164)]
public class FemaleElvenPlateChest : BaseArmor
{

View file

@ -19,7 +19,7 @@ namespace Server.Items
if (Deleted || !from.CanSee(this))
return false;
base.ScissorHelper(from, new Bone(), Utility.RandomMinMax(10, 15));
this.ScissorHelper(from, new Bone(), Utility.RandomMinMax(10, 15));
return true;
}

View file

@ -28,10 +28,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public string PlayerName{ get; set; }
public string PlayerName { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public HeadType HeadType{ get; set; }
public HeadType HeadType { get; set; }
public override string DefaultName
{

View file

@ -19,7 +19,7 @@ namespace Server.Items
if (Deleted || !from.CanSee(this))
return false;
base.ScissorHelper(from, new Bone(), Utility.RandomMinMax(3, 5));
this.ScissorHelper(from, new Bone(), Utility.RandomMinMax(3, 5));
return true;
}

View file

@ -11,7 +11,7 @@ namespace Server.Items
{
public class BookPageInfo
{
public BookPageInfo() => Lines = new string[0];
public BookPageInfo() => Lines = Array.Empty<string>();
public BookPageInfo(params string[] lines) => Lines = lines;
@ -25,7 +25,7 @@ namespace Server.Items
Lines[i] = Utility.Intern(reader.ReadString());
}
public string[] Lines{ get; set; }
public string[] Lines { get; set; }
public void Serialize(IGenericWriter writer)
{
@ -100,12 +100,12 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Writable{ get; set; }
public bool Writable { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int PagesCount => Pages.Length;
public BookPageInfo[] Pages{ get; private set; }
public BookPageInfo[] Pages { get; private set; }
public virtual BookContent DefaultContent => null;
@ -116,8 +116,8 @@ namespace Server.Items
StringBuilder sb = new StringBuilder();
foreach (BookPageInfo bpi in Pages)
foreach (string line in bpi.Lines)
sb.AppendLine(line);
foreach (string line in bpi.Lines)
sb.AppendLine(line);
return sb.ToString();
}
@ -135,12 +135,8 @@ namespace Server.Items
}
}
#region ISecurable Members
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
#endregion
public SecureLevel Level { get; set; }
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
@ -168,7 +164,6 @@ namespace Server.Items
if (content?.IsMatch(Pages) != true)
flags |= SaveFlags.Content;
writer.Write(4); // version
writer.Write((int)Level);
@ -199,72 +194,72 @@ namespace Server.Items
switch (version)
{
case 4:
{
Level = (SecureLevel)reader.ReadInt();
goto case 3;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 3;
}
case 3:
case 2:
{
BookContent content = DefaultContent;
SaveFlags flags = (SaveFlags)reader.ReadByte();
if ((flags & SaveFlags.Title) != 0)
m_Title = Utility.Intern(reader.ReadString());
else if (content != null)
m_Title = content.Title;
if ((flags & SaveFlags.Author) != 0)
m_Author = reader.ReadString();
else if (content != null)
m_Author = content.Author;
Writable = (flags & SaveFlags.Writable) != 0;
if ((flags & SaveFlags.Content) != 0)
{
Pages = new BookPageInfo[reader.ReadEncodedInt()];
for (int i = 0; i < Pages.Length; ++i)
Pages[i] = new BookPageInfo(reader);
}
else
{
if (content != null)
Pages = content.Copy();
else
Pages = new BookPageInfo[0];
}
break;
}
case 1:
case 0:
{
m_Title = reader.ReadString();
m_Author = reader.ReadString();
Writable = reader.ReadBool();
if (version == 0 || reader.ReadBool())
{
Pages = new BookPageInfo[reader.ReadInt()];
for (int i = 0; i < Pages.Length; ++i)
Pages[i] = new BookPageInfo(reader);
}
else
{
BookContent content = DefaultContent;
if (content != null)
Pages = content.Copy();
else
Pages = new BookPageInfo[0];
}
SaveFlags flags = (SaveFlags)reader.ReadByte();
break;
}
if ((flags & SaveFlags.Title) != 0)
m_Title = Utility.Intern(reader.ReadString());
else if (content != null)
m_Title = content.Title;
if ((flags & SaveFlags.Author) != 0)
m_Author = reader.ReadString();
else if (content != null)
m_Author = content.Author;
Writable = (flags & SaveFlags.Writable) != 0;
if ((flags & SaveFlags.Content) != 0)
{
Pages = new BookPageInfo[reader.ReadEncodedInt()];
for (int i = 0; i < Pages.Length; ++i)
Pages[i] = new BookPageInfo(reader);
}
else
{
if (content != null)
Pages = content.Copy();
else
Pages = Array.Empty<BookPageInfo>();
}
break;
}
case 1:
case 0:
{
m_Title = reader.ReadString();
m_Author = reader.ReadString();
Writable = reader.ReadBool();
if (version == 0 || reader.ReadBool())
{
Pages = new BookPageInfo[reader.ReadInt()];
for (int i = 0; i < Pages.Length; ++i)
Pages[i] = new BookPageInfo(reader);
}
else
{
BookContent content = DefaultContent;
if (content != null)
Pages = content.Copy();
else
Pages = Array.Empty<BookPageInfo>();
}
break;
}
}
if (version < 3 && (Weight == 1 || Weight == 2))
@ -283,13 +278,13 @@ namespace Server.Items
{
base.GetProperties( list );
if ( m_Title?.Length > 0 )
if (m_Title?.Length > 0)
list.Add( 1060658, "Title\t{0}", m_Title ); // ~1_val~: ~2_val~
if ( m_Author?.Length > 0 )
if (m_Author?.Length > 0)
list.Add( 1060659, "Author\t{0}", m_Author ); // ~1_val~: ~2_val~
if ( m_Pages?.Length > 0 )
if (m_Pages?.Length > 0)
list.Add( 1060660, "Pages\t{0}", m_Pages.Length ); // ~1_val~: ~2_val~
}*/
@ -425,22 +420,22 @@ namespace Server.Items
{
EnsureCapacity(256);
m_Stream.Write(book.Serial);
m_Stream.Write((ushort)book.PagesCount);
Stream.Write(book.Serial);
Stream.Write((ushort)book.PagesCount);
for (int i = 0; i < book.PagesCount; ++i)
{
BookPageInfo page = book.Pages[i];
m_Stream.Write((ushort)(i + 1));
m_Stream.Write((ushort)page.Lines.Length);
Stream.Write((ushort)(i + 1));
Stream.Write((ushort)page.Lines.Length);
for (int j = 0; j < page.Lines.Length; ++j)
{
byte[] buffer = Utility.UTF8.GetBytes(page.Lines[j]);
m_Stream.Write(buffer, 0, buffer.Length);
m_Stream.Write((byte)0);
Stream.Write(buffer, 0, buffer.Length);
Stream.Write((byte)0);
}
}
}
@ -458,18 +453,18 @@ namespace Server.Items
EnsureCapacity(15 + titleBuffer.Length + authorBuffer.Length);
m_Stream.Write(book.Serial);
m_Stream.Write(true);
m_Stream.Write(book.Writable && from.InRange(book.GetWorldLocation(), 1));
m_Stream.Write((ushort)book.PagesCount);
Stream.Write(book.Serial);
Stream.Write(true);
Stream.Write(book.Writable && from.InRange(book.GetWorldLocation(), 1));
Stream.Write((ushort)book.PagesCount);
m_Stream.Write((ushort)(titleBuffer.Length + 1));
m_Stream.Write(titleBuffer, 0, titleBuffer.Length);
m_Stream.Write((byte)0); // terminate
Stream.Write((ushort)(titleBuffer.Length + 1));
Stream.Write(titleBuffer, 0, titleBuffer.Length);
Stream.Write((byte)0); // terminate
m_Stream.Write((ushort)(authorBuffer.Length + 1));
m_Stream.Write(authorBuffer, 0, authorBuffer.Length);
m_Stream.Write((byte)0); // terminate
Stream.Write((ushort)(authorBuffer.Length + 1));
Stream.Write(authorBuffer, 0, authorBuffer.Length);
Stream.Write((byte)0); // terminate
}
}
}

View file

@ -2,11 +2,9 @@ namespace Server.Items
{
public class BlackthornWelcomeBook : RedBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"A Welcome", "Lord Blackthorn",
new BookPageInfo
(
new BookPageInfo(
" Greetings to you,",
"new member of the",
"Trusted.",
@ -14,10 +12,8 @@ namespace Server.Items
"words because you",
"have been deemed",
"worthy to join the",
"ranks of"
),
new BookPageInfo
(
"ranks of"),
new BookPageInfo(
"Britannia's defenders.",
"Some will call you a",
"betrayer of mankind, I",
@ -25,10 +21,8 @@ namespace Server.Items
"misguided. I call you",
"a defender for Sosaria",
"needs saving from",
"itself."
),
new BookPageInfo
(
"itself."),
new BookPageInfo(
" The forces of order",
"once ruled our world.",
"Like a great",
@ -36,10 +30,8 @@ namespace Server.Items
"lives we lived under",
"the oppressive watch",
"of a king who",
"dictated our actions"
),
new BookPageInfo
(
"dictated our actions"),
new BookPageInfo(
"and passed judgment",
"on our character. He",
"suppressed our way of",
@ -47,10 +39,8 @@ namespace Server.Items
"freedom and the",
"ability to determine",
"who we are and what",
"we stand for. Even"
),
new BookPageInfo
(
"we stand for. Even"),
new BookPageInfo(
"today in the absence",
"of this man we still",
"see the symbol of his",
@ -58,10 +48,8 @@ namespace Server.Items
"personal guards patrol",
"the cities to",
"intimidate us, and we",
"feel his laws like a"
),
new BookPageInfo
(
"feel his laws like a"),
new BookPageInfo(
"vice on our lives.",
" You are here",
"because you choose to",
@ -69,10 +57,8 @@ namespace Server.Items
"Britannians you have",
"felt the oppression of",
"one man's ideas",
"weighing down upon"
),
new BookPageInfo
(
"weighing down upon"),
new BookPageInfo(
"you like chains. You",
"have felt the embrace",
"of fear, wondering if",
@ -80,10 +66,8 @@ namespace Server.Items
"for simply having",
"ideas not in harmony",
"with those forced upon",
"you. You have seen"
),
new BookPageInfo
(
"you. You have seen"),
new BookPageInfo(
"men fight and die for",
"the principles of a",
"zealot and wondered,",
@ -91,10 +75,8 @@ namespace Server.Items
"my principles should",
"they be opposed?'",
"You tire of living",
"under the shadow of"
),
new BookPageInfo
(
"under the shadow of"),
new BookPageInfo(
"dreams that do not",
"belong to you. And",
"most of all, you have",
@ -102,10 +84,8 @@ namespace Server.Items
"can do to live free.",
" Your journey to",
"freedom begins here.",
" I, like you, once"
),
new BookPageInfo
(
" I, like you, once"),
new BookPageInfo(
"desired my freedom",
"from the limits placed",
"on me. I watched in",
@ -113,10 +93,8 @@ namespace Server.Items
"became engrossed with",
"the preaching of",
"virtue and none of the",
"practice. I held my"
),
new BookPageInfo
(
"practice. I held my"),
new BookPageInfo(
"convictions in check,",
"fearful of the reaction",
"of men blinded by",
@ -124,10 +102,8 @@ namespace Server.Items
"myself to bury the",
"very ideology that",
"made me an individual.",
"I was fortunate that"
),
new BookPageInfo
(
"I was fortunate that"),
new BookPageInfo(
"a being of unique",
"power and",
"unimaginable",
@ -135,10 +111,8 @@ namespace Server.Items
"through to the true",
"person I was, the",
"person I was meant to",
"be. Exodus found"
),
new BookPageInfo
(
"be. Exodus found"),
new BookPageInfo(
"within me a man of",
"free will,",
"determination, and",
@ -146,10 +120,8 @@ namespace Server.Items
"the plight of",
"oppression forced on so",
"many Britannians.",
" Exodus has also"
),
new BookPageInfo
(
" Exodus has also"),
new BookPageInfo(
"chosen you because of",
"the strength of your",
"character.",
@ -157,10 +129,8 @@ namespace Server.Items
"who were once my",
"peers look upon me",
"and see a betrayer of",
"humanity. They"
),
new BookPageInfo
(
"humanity. They"),
new BookPageInfo(
"claim my newfound",
"form is unnatural and",
"wrong. Because they",
@ -168,10 +138,8 @@ namespace Server.Items
"me, they show fear.",
"They disapprove of",
"my choices and in",
"their ignorance see"
),
new BookPageInfo
(
"their ignorance see"),
new BookPageInfo(
"evil. Yet I hide my",
"true self no longer",
"from these men. My",
@ -179,10 +147,8 @@ namespace Server.Items
"personal morality have",
"been liberated in the",
"face of the oppression",
"that once consumed me."
),
new BookPageInfo
(
"that once consumed me."),
new BookPageInfo(
"Where they see a",
"man no longer human.",
"I see a man that has",
@ -190,10 +156,8 @@ namespace Server.Items
"humanity but has been",
"freed from it. This",
"is the power that has",
"been granted to me by"
),
new BookPageInfo
(
"been granted to me by"),
new BookPageInfo(
"Exodus. I have been",
"given my freedom. I",
"have been released",
@ -201,10 +165,8 @@ namespace Server.Items
" Exodus will give",
"you the power to",
"conquer your fears as",
"well."
),
new BookPageInfo
(
"well."),
new BookPageInfo(
" When your fear",
"of this world is gone,",
"then the world truly",
@ -212,10 +174,8 @@ namespace Server.Items
"way it never has",
"before. You, trusted",
"one, will soon be given",
"a gift. Your body,"
),
new BookPageInfo
(
"a gift. Your body,"),
new BookPageInfo(
"like mine, will be",
"enlightened and raised",
"to a level no mortal",
@ -223,10 +183,8 @@ namespace Server.Items
"to control your own",
"destiny will belong to",
"you for the first time",
"in your life."
),
new BookPageInfo
(
"in your life."),
new BookPageInfo(
" You will, at long",
"last, be cleansed of",
"fear.",
@ -234,10 +192,8 @@ namespace Server.Items
"power of Exodus",
"behind us, we shall",
"finally wage war on",
"the oppression that"
),
new BookPageInfo
(
"the oppression that"),
new BookPageInfo(
"once held us back",
"from our full",
"potential. We shall",
@ -245,10 +201,8 @@ namespace Server.Items
"reshape it in an image",
"of freedom for all of",
"us. Those who once",
"told you who you are"
),
new BookPageInfo
(
"told you who you are"),
new BookPageInfo(
"and how you should",
"live will no longer be",
"able to stand in the",
@ -256,14 +210,10 @@ namespace Server.Items
"Many say you will",
"be abandoning your",
"humanity but in truth,",
"you will be more than"
),
new BookPageInfo
(
"you will be more than"),
new BookPageInfo(
"human.",
" You will be freed."
)
);
" You will be freed."));
[Constructible]
public BlackthornWelcomeBook() : base(false) => Hue = 0x89B;

View file

@ -9,11 +9,11 @@ namespace Server.Items
Pages = pages;
}
public string Title{ get; }
public string Title { get; }
public string Author{ get; }
public string Author { get; }
public BookPageInfo[] Pages{ get; }
public BookPageInfo[] Pages { get; }
public BookPageInfo[] Copy()
{

View file

@ -2,11 +2,9 @@ namespace Server.Items
{
public class DrakovsJournal : BlueBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"Drakov's Journal", "Drakov",
new BookPageInfo
(
new BookPageInfo(
"My Master",
"",
"This journal was",
@ -14,18 +12,14 @@ namespace Server.Items
"our controllers. It",
"seems he has lost",
"faith in you. Know",
"that he has been"
),
new BookPageInfo
(
"that he has been"),
new BookPageInfo(
"dealth with and will",
"never again speak",
"ill of you or our",
"cause.",
" -Galzon"
),
new BookPageInfo
(
" -Galzon"),
new BookPageInfo(
"We have completted",
"construction of the",
"devices needed to",
@ -33,10 +27,8 @@ namespace Server.Items
"overseers and minions",
"as per the request of",
"the Master. The",
"gargoyles have been"
),
new BookPageInfo
(
"gargoyles have been"),
new BookPageInfo(
"most useful and their",
"knowledge of the",
"techniques for the",
@ -44,10 +36,8 @@ namespace Server.Items
"creatures will serve",
"us well.",
" -----",
"I am not one to"
),
new BookPageInfo
(
"I am not one to"),
new BookPageInfo(
"criticize the Master,",
"but I believe he may",
"have erred in his",
@ -55,10 +45,8 @@ namespace Server.Items
"the wingless ones.",
"Already our forces",
"are weakened by the",
"constant attacks of"
),
new BookPageInfo
(
"constant attacks of"),
new BookPageInfo(
"the humans Their",
"strength and",
"unquestioning",
@ -66,10 +54,8 @@ namespace Server.Items
"have made them very",
"useful in the fight",
"against the humans.",
"But the Master felt"
),
new BookPageInfo
(
"But the Master felt"),
new BookPageInfo(
"their presence to be",
"an annoyance and",
"a distraction to the",
@ -77,10 +63,8 @@ namespace Server.Items
"not difficult at all",
"to remove them from",
"this world. But now",
"I fear without more"
),
new BookPageInfo
(
"I fear without more"),
new BookPageInfo(
"allies, willing or",
"not, we stand",
"little chance of",
@ -88,15 +72,11 @@ namespace Server.Items
"humans from our",
"lands. Perhaps if",
"the Master had",
"shown a little"
),
new BookPageInfo
(
"shown a little"),
new BookPageInfo(
"mercy and forsight",
"we would not be",
"in such dire peril."
)
);
"in such dire peril."));
[Constructible]
public DrakovsJournal() : base(false)

View file

@ -2,11 +2,9 @@ namespace Server.Items
{
public class FropozJournal : RedBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"Journal", "Fropoz",
new BookPageInfo
(
new BookPageInfo(
"I have done as my",
"Master has",
"instructed me.",
@ -14,10 +12,8 @@ namespace Server.Items
"The painted humans",
"have been driven into",
"Britannia and are even",
"now wreaking havoc"
),
new BookPageInfo
(
"now wreaking havoc"),
new BookPageInfo(
"across the land,",
"providing us with the",
"distraction my Master",
@ -25,10 +21,8 @@ namespace Server.Items
"have provided them",
"with the masks",
"necessary to defeat",
"the orcs, thus"
),
new BookPageInfo
(
"the orcs, thus"),
new BookPageInfo(
"causing even more",
"distress for the people",
"of Britannia. The",
@ -36,10 +30,8 @@ namespace Server.Items
"are too busy dealing",
"with the orc hordes to",
"continue their",
"exploration of our"
),
new BookPageInfo
(
"exploration of our"),
new BookPageInfo(
"lands. We are",
"safe...for now.",
" ----",
@ -47,10 +39,8 @@ namespace Server.Items
"continue exactly as",
"planned. My Master",
"is pleased with my",
"work and we are"
),
new BookPageInfo
(
"work and we are"),
new BookPageInfo(
"closer to our goals than",
"ever before. The",
"gargoyles have proven",
@ -58,10 +48,8 @@ namespace Server.Items
"than we first",
"anticipated, but I",
"believe we can",
"subjugate them fully"
),
new BookPageInfo
(
"subjugate them fully"),
new BookPageInfo(
"given enough time. It's",
"unfortunate that we",
"did not discover their",
@ -69,10 +57,8 @@ namespace Server.Items
"Even now they",
"prepare our armies",
"for battle, but not",
"without resistance."
),
new BookPageInfo
(
"without resistance."),
new BookPageInfo(
"Now that some of",
"them know of the",
"other lands and of",
@ -80,10 +66,8 @@ namespace Server.Items
"double their efforts to",
"seek help. This",
"cannot be allowed.",
" -----"
),
new BookPageInfo
(
" -----"),
new BookPageInfo(
"Damn them!! The",
"humans proved",
"more resourcefull than",
@ -91,10 +75,8 @@ namespace Server.Items
"capable of. Already",
"their homes are free",
"of orcs and savages",
"and they once again"
),
new BookPageInfo
(
"and they once again"),
new BookPageInfo(
"are treading in our",
"lands. We may have to",
"move sooner than we",
@ -102,10 +84,8 @@ namespace Server.Items
"prepar my brethern",
"and our golems.",
"Hopefully, we can",
"buy our Master some"
),
new BookPageInfo
(
"buy our Master some"),
new BookPageInfo(
"more time before the",
"humans discover us.",
" -----",
@ -113,10 +93,8 @@ namespace Server.Items
"gargoyles whom have",
"evaded our capture",
"have opened the doors",
"to our land."
),
new BookPageInfo
(
"to our land."),
new BookPageInfo(
"They pray the",
"humans will help",
"them, despite the",
@ -124,22 +102,16 @@ namespace Server.Items
"cousins in Britannia. I",
"fear they are right.",
"I must go to warn",
"the MastKai Hohiro,"
),
new BookPageInfo
(
),
new BookPageInfo
(
"the MastKai Hohiro,"),
new BookPageInfo(),
new BookPageInfo(
"10.11.2001",
"first one to be here",
"",
"Congrats. I didn't really",
"care to log on earlier,",
"nor did I come straight",
"here. 2pm, Magus"
)
);
"here. 2pm, Magus"));
[Constructible]
public FropozJournal() : base(false)

View file

@ -2,11 +2,9 @@ namespace Server.Items
{
public class KaburJournal : RedBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"Journal", "Kabur",
new BookPageInfo
(
new BookPageInfo(
"The campaign to slaughter",
"the Meer goes well.",
"Although they seem to",
@ -14,10 +12,8 @@ namespace Server.Items
"ours at every turn, we",
"still defeat them in",
"combat. Spies of the",
"Meer have been found and"
),
new BookPageInfo
(
"Meer have been found and"),
new BookPageInfo(
"slain outside of the",
"fortress of ours. The",
"fools underestimate us.",
@ -25,10 +21,8 @@ namespace Server.Items
"Lord Exodus behind us.",
"Soon they will learn to",
"serve the Juka and I",
"shall carry the head of"
),
new BookPageInfo
(
"shall carry the head of"),
new BookPageInfo(
"the wench, Dasha, on a",
"spike for all the warriors",
"of ours to share triumph",
@ -36,10 +30,8 @@ namespace Server.Items
"",
"One of the warriors of",
"the Juka died today.",
"During the training"
),
new BookPageInfo
(
"During the training"),
new BookPageInfo(
"exercises of ours he",
"spoke out in favor of",
"the warriors of the",
@ -47,10 +39,8 @@ namespace Server.Items
"were indeed powerful and",
"would provide a challenge",
"to the Juka. A Juka in",
"fear is no Juka. I gave"
),
new BookPageInfo
(
"fear is no Juka. I gave"),
new BookPageInfo(
"him the death of a",
"coward, outside of battle.",
"",
@ -58,10 +48,8 @@ namespace Server.Items
"have been found around",
"the fortress of ours.",
"Many have been seen and",
"escaped the wrath of the"
),
new BookPageInfo
(
"escaped the wrath of the"),
new BookPageInfo(
"warriors of ours. Those",
"who have been captured",
"and tortured have",
@ -69,10 +57,8 @@ namespace Server.Items
"even when subjected to",
"the spells of the females.",
" I know the Meer must",
"have plans against us if"
),
new BookPageInfo
(
"have plans against us if"),
new BookPageInfo(
"they send so many spies.",
" I may send the troops",
"of the Juka to invade",
@ -80,10 +66,8 @@ namespace Server.Items
"warning.",
"",
"I have met Dasha in",
"battle this day. The"
),
new BookPageInfo
(
"battle this day. The"),
new BookPageInfo(
"efforts of hers to draw",
"me into a Black Duel",
"were foolish. Had we",
@ -91,10 +75,8 @@ namespace Server.Items
"the cave I would have",
"ended the life of hers",
"but I will have to wait",
"for another battle. Lord"
),
new BookPageInfo
(
"for another battle. Lord"),
new BookPageInfo(
"Exodus has ordered more",
"patrols around the",
"fortress of ours. If",
@ -102,10 +84,8 @@ namespace Server.Items
"the Meer will strike soon.",
"",
"More Meer stand outside",
"of the fortress of ours"
),
new BookPageInfo
(
"of the fortress of ours"),
new BookPageInfo(
"than I have ever seen at",
"once. They must seek",
"vengeance for the",
@ -113,10 +93,8 @@ namespace Server.Items
"forest. Many Juka stand",
"ready at the base of the",
"mountain to face the",
"forces of theirs but"
),
new BookPageInfo
(
"forces of theirs but"),
new BookPageInfo(
"today may be the final",
"battle. Exodus has",
"summoned me, I must",
@ -124,10 +102,8 @@ namespace Server.Items
"",
"Dusk has passed and the",
"Juka now live in a new",
"age, a later time. I have"
),
new BookPageInfo
(
"age, a later time. I have"),
new BookPageInfo(
"just returned from",
"exploring the new world",
"that surrounds the",
@ -135,10 +111,8 @@ namespace Server.Items
"During the attack of the",
"Meer the madman",
"Adranath tried to destroy",
"the fortress of ours"
),
new BookPageInfo
(
"the fortress of ours"),
new BookPageInfo(
"with great magic. At",
"once he was still and",
"light surrounded the",
@ -146,10 +120,8 @@ namespace Server.Items
"faded from view. When I",
"regained the senses of",
"mine I saw no sign of",
"the Meer but Dasha."
),
new BookPageInfo
(
"the Meer but Dasha."),
new BookPageInfo(
"She has not been found",
"since this new being,",
"Blackthorn, blasted her",
@ -157,10 +129,8 @@ namespace Server.Items
"fortress.",
"The forest was gone, now",
"replaced by grasslands.",
"In the far distance I"
),
new BookPageInfo
(
"In the far distance I"),
new BookPageInfo(
"could see humans that",
"had covered the bodies of",
"theirs in marks. Even",
@ -168,10 +138,8 @@ namespace Server.Items
"place. Exodus has",
"explained to me that the",
"Juka and the fortress of",
"ours have been pulled"
),
new BookPageInfo
(
"ours have been pulled"),
new BookPageInfo(
"forward in time. The",
"world we knew is now",
"thousands of years in the",
@ -179,20 +147,16 @@ namespace Server.Items
"he has has saved the",
"Juka from extinction. I",
"do not want to believe",
"him. I asked this"
),
new BookPageInfo
(
"him. I asked this"),
new BookPageInfo(
"stranger about the Meer,",
"but he tells me a new",
"enemy remains to be",
"destroyed. It seems the",
"enemies of ours have",
"passed away to dust like",
"the forest."
),
new BookPageInfo
(
"the forest."),
new BookPageInfo(
"I have spoken with other",
"Juka and I suspect I have",
"been told the truth. All",
@ -200,10 +164,8 @@ namespace Server.Items
"dreams. In the dreams",
"of ours the Meer invaded",
"the fortress of ours and",
"a great battle took place."
),
new BookPageInfo
(
"a great battle took place."),
new BookPageInfo(
" All the Juka and all the",
"Meer perished and the",
"fortress was destroyed",
@ -211,10 +173,8 @@ namespace Server.Items
"would not like to believe",
"that the Meer could ever",
"destroy us, but now it",
"seems we have seen a"
),
new BookPageInfo
(
"seems we have seen a"),
new BookPageInfo(
"vision of the fate of",
"ours now lost in time. I",
"must now wonder if the",
@ -222,9 +182,7 @@ namespace Server.Items
"battle with the Juka, how",
"did they die? And more",
"importantly, where is",
"Dasha?"
)
);
"Dasha?"));
[Constructible]
public KaburJournal() : base(false)

File diff suppressed because it is too large Load diff

View file

@ -2,20 +2,16 @@ namespace Server.Items
{
public class NewAquariumBook : BlueBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"Your New Aquarium", "Les Bilgewater",
new BookPageInfo
(
new BookPageInfo(
"Welcome to the",
"wonderful world",
"of aquarium ownership.",
"With a little time and",
"skill your aquarium can",
"become a work of art!"
),
new BookPageInfo
(
"become a work of art!"),
new BookPageInfo(
"Catching Fish:",
"You will need to",
"aquire a fishing net,",
@ -23,10 +19,8 @@ namespace Server.Items
"bowls, from your local",
"fisherman.",
"To use the net,",
"select it from your"
),
new BookPageInfo
(
"select it from your"),
new BookPageInfo(
"backpack, and cast it",
"into shallow water.",
"Then we wait.",
@ -34,19 +28,15 @@ namespace Server.Items
"happy to be in your",
"aquarium, they will",
"jump right into your",
"fish bowl when caught!"
),
new BookPageInfo
(
"fish bowl when caught!"),
new BookPageInfo(
"Just take them home",
"and pour them into",
"your aquarium, and",
"BING! You have a happy",
"new addition to your",
"collection!"
),
new BookPageInfo
(
"collection!"),
new BookPageInfo(
"Caring for our",
"Underwater Allies:",
"",
@ -54,10 +44,8 @@ namespace Server.Items
"water and food to",
"survive.",
" Our aquarium comes",
"with a status monitoring"
),
new BookPageInfo
(
"with a status monitoring"),
new BookPageInfo(
"aid. Must be Magic!",
" Just look at the",
"front of your aquarium",
@ -65,10 +53,8 @@ namespace Server.Items
"helpful and friendly",
"guide? It tells how much",
"food and water is",
"needed to maintain,"
),
new BookPageInfo
(
"needed to maintain,"),
new BookPageInfo(
"and improve the quality",
"of your tank.",
" You dont want to",
@ -76,10 +62,8 @@ namespace Server.Items
"very often. In fact,",
"you only want to feed",
"them every other day.",
"But, remember to keep"
),
new BookPageInfo
(
"But, remember to keep"),
new BookPageInfo(
"the water strong and",
"healthy, and add more",
"on a regular basis",
@ -87,18 +71,14 @@ namespace Server.Items
"a pretty, sparkely blue.",
"",
" Well, I hope you",
"get as much enjoyment,"
),
new BookPageInfo
(
"get as much enjoyment,"),
new BookPageInfo(
"collecting a beautiful",
"array of our fine, finned,",
"friends from the sea,",
"as I do!",
"",
"Happy Fishing!"
)
);
"Happy Fishing!"));
[Constructible]
public NewAquariumBook() : base(false) => Hue = 0;

View file

@ -2,11 +2,9 @@ namespace Server.Items
{
public class TranslatedGargoyleJournal : BlueBook
{
public static readonly BookContent Content = new BookContent
(
public static readonly BookContent Content = new BookContent(
"Translated Journal", "Velis",
new BookPageInfo
(
new BookPageInfo(
"This text has been",
"translated from a",
"gargoyle's journal",
@ -14,10 +12,8 @@ namespace Server.Items
"and subsequent",
"reeducation.",
"",
" -Velis"
),
new BookPageInfo
(
" -Velis"),
new BookPageInfo(
"I write this in the",
"hopes that someday a",
"soul of pure heart and",
@ -25,10 +21,8 @@ namespace Server.Items
"are not the evil beings",
"that our cousin",
"gargoyles have made",
"us out to be. We"
),
new BookPageInfo
(
"us out to be. We"),
new BookPageInfo(
"consider them",
"uncivilized and they",
"have no concept of the",
@ -36,10 +30,8 @@ namespace Server.Items
"who reads this, I beg",
"for your help in",
"saving my brethern",
"and preserving my"
),
new BookPageInfo
(
"and preserving my"),
new BookPageInfo(
"race. We stand at the",
"edge of destruction as",
"does the rest of the",
@ -47,10 +39,8 @@ namespace Server.Items
"written law that we",
"would not allow the",
"knowledge of our",
"civilization to spread"
),
new BookPageInfo
(
"civilization to spread"),
new BookPageInfo(
"into the world, no we",
"are left with little",
"choice...contact the",
@ -58,10 +48,8 @@ namespace Server.Items
"of finding help to save",
"it or becoming the",
"unwilling bringers of",
"its damnation."
),
new BookPageInfo
(
"its damnation."),
new BookPageInfo(
" I fear my capture is",
"certain, the",
"controllers grow ever",
@ -69,10 +57,8 @@ namespace Server.Items
"place and I know if",
"they discover me, my",
"fate will be as that of",
"my brothers."
),
new BookPageInfo
(
"my brothers."),
new BookPageInfo(
"Although we resisted",
"with all our strength",
"it is now clear that we",
@ -80,10 +66,8 @@ namespace Server.Items
"or our people will be",
"gone. And if our",
"oppressor achieves",
"his goals our race will"
),
new BookPageInfo
(
"his goals our race will"),
new BookPageInfo(
"surely be joined buy",
"others.",
" Those of us who",
@ -91,10 +75,8 @@ namespace Server.Items
"taken hope to open a",
"path from the outside",
"world into the city.",
"We believe we have"
),
new BookPageInfo
(
"We believe we have"),
new BookPageInfo(
"found weak areas in",
"the mountains that we",
"can successfully",
@ -102,26 +84,16 @@ namespace Server.Items
"our limited supplies.",
"We will have to work",
"quickly and the risk",
"of being discovered is"
),
new BookPageInfo
(
"of being discovered is"),
new BookPageInfo(
"great, but no choice",
"remains..."
),
new BookPageInfo
(
),
new BookPageInfo
(
),
new BookPageInfo
(
"remains..."),
new BookPageInfo(),
new BookPageInfo(),
new BookPageInfo(
"Kai Hohiro, 12pm.",
"10.11.2001",
"first one to be here"
)
);
"first one to be here"));
[Constructible]
public TranslatedGargoyleJournal() : base(false)

View file

@ -8,15 +8,15 @@ namespace Server.Items
* to do with piers. The three items here are basically
* permutations of the same "drop", or item that
* will be randomly selected when the item drops.
*
*
* It was either this, or make 2
* new classes named to reflect that they are rocks
* in water, or put them all in one class. Either
* is kind of senseless, so it is what it is.
*
*
*/
private static int[] m_itemids =
private static readonly int[] m_itemids =
{
0x3486, 0x348b, 0x3ae
};

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class Web : Item
{
private static int[] m_itemids =
private static readonly int[] m_itemids =
{
0x10d7, 0x10d8, 0x10dd
};

View file

@ -45,13 +45,13 @@ namespace Server.Items
switch (version)
{
case 0:
{
Resistances.Physical = 0;
Resistances.Fire = 0;
Resistances.Cold = 0;
Resistances.Energy = 0;
break;
}
{
Resistances.Physical = 0;
Resistances.Fire = 0;
Resistances.Cold = 0;
Resistances.Energy = 0;
break;
}
}
}
}

View file

@ -42,11 +42,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
Resistances.Poison = 0;
Resistances.Energy = 0;
break;
}
{
Resistances.Poison = 0;
Resistances.Energy = 0;
break;
}
}
}
}

View file

@ -42,10 +42,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
Resistances.Cold = 0;
break;
}
{
Resistances.Cold = 0;
break;
}
}
}
}

View file

@ -41,10 +41,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
Resistances.Physical = 0;
break;
}
{
Resistances.Physical = 0;
break;
}
}
}
}

View file

@ -17,9 +17,9 @@ namespace Server.Items
public interface IArcaneEquip
{
bool IsArcane{ get; }
int CurArcaneCharges{ get; set; }
int MaxArcaneCharges{ get; set; }
bool IsArcane { get; }
int CurArcaneCharges { get; set; }
int MaxArcaneCharges { get; set; }
}
public abstract class BaseClothing : Item, IDyable, IScissorable, IFactionItem, ICraftable, IWearableDurability
@ -86,7 +86,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public bool PlayerConstructed{ get; set; }
public bool PlayerConstructed { get; set; }
public virtual CraftResource DefaultResource => CraftResource.None;
@ -103,16 +103,16 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public AosAttributes Attributes{ get; private set; }
public AosAttributes Attributes { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosArmorAttributes ClothingAttributes{ get; private set; }
public AosArmorAttributes ClothingAttributes { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosSkillBonuses SkillBonuses{ get; private set; }
public AosSkillBonuses SkillBonuses { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosElementAttributes Resistances{ get; private set; }
public AosElementAttributes Resistances { get; private set; }
public virtual int BasePhysicalResistance => 0;
public virtual int BaseFireResistance => 0;
@ -141,8 +141,6 @@ namespace Server.Items
public virtual bool AllowFemaleWearer => true;
public virtual bool CanBeBlessed => true;
#region ICraftable Members
public virtual int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes,
BaseTool tool, CraftItem craftItem, int resHue)
{
@ -172,8 +170,6 @@ namespace Server.Items
return quality;
}
#endregion
public virtual bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
@ -273,7 +269,7 @@ namespace Server.Items
if (damageTaken < 0)
damageTaken = 0;
if (25 > Utility.Random(100)) // 25% chance to lower durability
if (Utility.Random(100) < 25) // 25% chance to lower durability
{
if (Core.AOS && ClothingAttributes.SelfRepair > Utility.Random(10))
{
@ -404,7 +400,7 @@ namespace Server.Items
{
int v;
//if ( type == StatType.Str )
// if (type == StatType.Str)
v = StrRequirement;
return AOS.Scale(v, 100 - GetLowerStatReq());
@ -600,13 +596,9 @@ namespace Server.Items
if (m_Crafter != null)
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
#region Factions
if (m_FactionState != null)
list.Add(1041350); // faction item
#endregion
if (m_Quality == ClothingQuality.Exceptional)
list.Add(1060636); // exceptional
@ -701,7 +693,7 @@ namespace Server.Items
if (Core.ML && (prop = Attributes.IncreasedKarmaLoss) != 0)
list.Add(1075210, prop.ToString()); // Increased Karma Loss ~1val~%
base.AddResistanceProperties(list);
this.AddResistanceProperties(list);
if ((prop = ClothingAttributes.DurabilityBonus) > 0)
list.Add(1060410, prop.ToString()); // durability ~1_val~%
@ -749,13 +741,9 @@ namespace Server.Items
attrs.Add(new EquipInfoAttribute(1049643)); // cursed
}
#region Factions
if (m_FactionState != null)
attrs.Add(new EquipInfoAttribute(1041350)); // faction item
#endregion
if (m_Quality == ClothingQuality.Exceptional)
attrs.Add(new EquipInfoAttribute(1018305 - (int)m_Quality));
}
@ -785,8 +773,6 @@ namespace Server.Items
InvalidateProperties();
}
#region Factions
private FactionItem m_FactionState;
public FactionItem FactionItemState
@ -803,10 +789,6 @@ namespace Server.Items
}
}
#endregion
#region Serialization
private static void SetSaveFlag(ref SaveFlag flags, SaveFlag toSet, bool setIf)
{
if (setIf)
@ -894,90 +876,90 @@ namespace Server.Items
switch (version)
{
case 5:
{
SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();
{
SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Resource))
m_Resource = (CraftResource)reader.ReadEncodedInt();
else
m_Resource = DefaultResource;
if (GetSaveFlag(flags, SaveFlag.Resource))
m_Resource = (CraftResource)reader.ReadEncodedInt();
else
m_Resource = DefaultResource;
if (GetSaveFlag(flags, SaveFlag.Attributes))
Attributes = new AosAttributes(this, reader);
else
Attributes = new AosAttributes(this);
if (GetSaveFlag(flags, SaveFlag.Attributes))
Attributes = new AosAttributes(this, reader);
else
Attributes = new AosAttributes(this);
if (GetSaveFlag(flags, SaveFlag.ClothingAttributes))
ClothingAttributes = new AosArmorAttributes(this, reader);
else
ClothingAttributes = new AosArmorAttributes(this);
if (GetSaveFlag(flags, SaveFlag.ClothingAttributes))
ClothingAttributes = new AosArmorAttributes(this, reader);
else
ClothingAttributes = new AosArmorAttributes(this);
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
SkillBonuses = new AosSkillBonuses(this, reader);
else
SkillBonuses = new AosSkillBonuses(this);
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
SkillBonuses = new AosSkillBonuses(this, reader);
else
SkillBonuses = new AosSkillBonuses(this);
if (GetSaveFlag(flags, SaveFlag.Resistances))
Resistances = new AosElementAttributes(this, reader);
else
Resistances = new AosElementAttributes(this);
if (GetSaveFlag(flags, SaveFlag.Resistances))
Resistances = new AosElementAttributes(this, reader);
else
Resistances = new AosElementAttributes(this);
if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
m_MaxHitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.MaxHitPoints))
m_MaxHitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.HitPoints))
m_HitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.HitPoints))
m_HitPoints = reader.ReadEncodedInt();
if (GetSaveFlag(flags, SaveFlag.Crafter))
m_Crafter = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.Crafter))
m_Crafter = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.Quality))
m_Quality = (ClothingQuality)reader.ReadEncodedInt();
else
m_Quality = ClothingQuality.Regular;
if (GetSaveFlag(flags, SaveFlag.Quality))
m_Quality = (ClothingQuality)reader.ReadEncodedInt();
else
m_Quality = ClothingQuality.Regular;
if (GetSaveFlag(flags, SaveFlag.StrReq))
m_StrReq = reader.ReadEncodedInt();
else
m_StrReq = -1;
if (GetSaveFlag(flags, SaveFlag.StrReq))
m_StrReq = reader.ReadEncodedInt();
else
m_StrReq = -1;
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
PlayerConstructed = true;
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
PlayerConstructed = true;
break;
}
break;
}
case 4:
{
m_Resource = (CraftResource)reader.ReadInt();
{
m_Resource = (CraftResource)reader.ReadInt();
goto case 3;
}
goto case 3;
}
case 3:
{
Attributes = new AosAttributes(this, reader);
ClothingAttributes = new AosArmorAttributes(this, reader);
SkillBonuses = new AosSkillBonuses(this, reader);
Resistances = new AosElementAttributes(this, reader);
{
Attributes = new AosAttributes(this, reader);
ClothingAttributes = new AosArmorAttributes(this, reader);
SkillBonuses = new AosSkillBonuses(this, reader);
Resistances = new AosElementAttributes(this, reader);
goto case 2;
}
goto case 2;
}
case 2:
{
PlayerConstructed = reader.ReadBool();
goto case 1;
}
{
PlayerConstructed = reader.ReadBool();
goto case 1;
}
case 1:
{
m_Crafter = reader.ReadMobile();
m_Quality = (ClothingQuality)reader.ReadInt();
break;
}
{
m_Crafter = reader.ReadMobile();
m_Quality = (ClothingQuality)reader.ReadInt();
break;
}
case 0:
{
m_Crafter = null;
m_Quality = ClothingQuality.Regular;
break;
}
{
m_Crafter = null;
m_Quality = ClothingQuality.Regular;
break;
}
}
if (version < 2)
@ -1006,7 +988,5 @@ namespace Server.Items
parent.CheckStatTimers();
}
}
#endregion
}
}

View file

@ -64,26 +64,24 @@ namespace Server.Items
switch (version)
{
case 1:
{
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
}
break;
}
break;
}
}
if (Weight == 4.0)
Weight = 5.0;
}
#region Arcane Impl
private int m_MaxArcaneCharges, m_CurArcaneCharges;
[CommandProperty(AccessLevel.GameMaster)]
@ -147,8 +145,6 @@ namespace Server.Items
else if (ItemID == 0x1530)
ItemID = 0x1515;
}
#endregion
}
[Flippable]
@ -194,7 +190,7 @@ namespace Server.Items
public override int BasePhysicalResistance => 3;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnAdded(IEntity parent)
{
@ -254,11 +250,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
}
if (Parent is Mobile mobile)

View file

@ -17,7 +17,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public bool IsShipwreckedItem{ get; set; }
public bool IsShipwreckedItem { get; set; }
public override void Serialize(IGenericWriter writer)
{
@ -37,10 +37,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsShipwreckedItem = reader.ReadBool();
break;
}
{
IsShipwreckedItem = reader.ReadBool();
break;
}
}
}
@ -67,7 +67,7 @@ namespace Server.Items
if (Quality == ClothingQuality.Exceptional)
DistributeBonuses(tool is BaseRunicTool ? 6 :
Core.SE ? 15 : 14); //BLAME OSI. (We can't confirm it's an OSI bug yet.)
Core.SE ? 15 : 14); // BLAME OSI. (We can't confirm it's an OSI bug yet.)
return base.OnCraft(quality, makersMark, from, craftSystem, typeRes, tool, craftItem, resHue);
}
@ -623,7 +623,7 @@ namespace Server.Items
int version = reader.ReadInt();
/*if ( Hue != 0x8A4 )
/*if (Hue != 0x8A4)
Hue = 0x8A4;*/
}
}
@ -631,7 +631,7 @@ namespace Server.Items
public class SavageMask : BaseHat
{
[Constructible]
public SavageMask() : this(GetRandomHue()) {}
public SavageMask() : this(GetRandomHue()) { }
[Constructible]
public SavageMask(int hue) : base(0x154B, hue) => Weight = 2.0;
@ -678,7 +678,7 @@ namespace Server.Items
int version = reader.ReadInt();
/*if ( Hue != 0 && (Hue < 2101 || Hue > 2130) )
/*if (Hue != 0 && (Hue < 2101 || Hue > 2130))
Hue = GetRandomHue();*/
}
}

View file

@ -80,7 +80,7 @@ namespace Server.Items
public class DeathRobe : Robe
{
private static TimeSpan m_DefaultDecayTime = TimeSpan.FromMinutes(1.0);
private static readonly TimeSpan m_DefaultDecayTime = TimeSpan.FromMinutes(1.0);
private DateTime m_DecayTime;
private Timer m_DecayTimer;
@ -165,22 +165,22 @@ namespace Server.Items
switch (version)
{
case 2:
{
if (reader.ReadBool())
{
m_DecayTime = reader.ReadDeltaTime();
BeginDecay(m_DecayTime - DateTime.UtcNow);
}
if (reader.ReadBool())
{
m_DecayTime = reader.ReadDeltaTime();
BeginDecay(m_DecayTime - DateTime.UtcNow);
}
break;
}
break;
}
case 1:
case 0:
{
if (Parent == null)
BeginDecay(m_DefaultDecayTime);
break;
}
{
if (Parent == null)
BeginDecay(m_DefaultDecayTime);
break;
}
}
if (version < 1 && Hue == 0)
@ -189,7 +189,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private DeathRobe m_Robe;
private readonly DeathRobe m_Robe;
public InternalTimer(DeathRobe c, TimeSpan delay) : base(delay)
{
@ -250,7 +250,7 @@ namespace Server.Items
public override int BasePhysicalResistance => 3;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnAdded(IEntity parent)
{
@ -310,11 +310,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
}
if (Parent is Mobile mobile)
@ -365,7 +365,7 @@ namespace Server.Items
public override int BasePhysicalResistance => 3;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnAdded(IEntity parent)
{
@ -425,11 +425,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
{
m_LabelNumber = reader.ReadInt();
IsRewardItem = reader.ReadBool();
break;
}
}
if (Parent is Mobile mobile)
@ -474,23 +474,21 @@ namespace Server.Items
switch (version)
{
case 1:
{
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
}
break;
}
break;
}
}
}
#region Arcane Impl
private int m_MaxArcaneCharges, m_CurArcaneCharges;
[CommandProperty(AccessLevel.GameMaster)]
@ -554,8 +552,6 @@ namespace Server.Items
else if (ItemID == 0x1F04)
ItemID = 0x1F03;
}
#endregion
}
public class MonkRobe : BaseOuterTorso

View file

@ -36,15 +36,15 @@ namespace Server.Items
{
case 2: break; // empty, resource removed
case 1:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
case 0:
{
m_Resource = DefaultResource;
break;
}
{
m_Resource = DefaultResource;
break;
}
}
}
}
@ -140,23 +140,21 @@ namespace Server.Items
switch (version)
{
case 1:
{
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (reader.ReadBool())
{
m_CurArcaneCharges = reader.ReadInt();
m_MaxArcaneCharges = reader.ReadInt();
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
if (Hue == 2118)
Hue = ArcaneGem.DefaultArcaneHue;
}
break;
}
break;
}
}
}
#region Arcane Impl
private int m_MaxArcaneCharges, m_CurArcaneCharges;
[CommandProperty(AccessLevel.GameMaster)]
@ -220,8 +218,6 @@ namespace Server.Items
else if (ItemID == 0x1712)
ItemID = 0x1711;
}
#endregion
}
[Flippable(0x170f, 0x1710)]

View file

@ -44,8 +44,8 @@ namespace Server.Items
private class ResurrectEntry : ContextMenuEntry
{
private Item m_Item;
private Mobile m_Mobile;
private readonly Item m_Item;
private readonly Mobile m_Mobile;
public ResurrectEntry(Mobile mobile, Item item) : base(6195, ResurrectRange)
{
@ -63,7 +63,7 @@ namespace Server.Items
private class LockKarmaEntry : ContextMenuEntry
{
private PlayerMobile m_Mobile;
private readonly PlayerMobile m_Mobile;
public LockKarmaEntry(PlayerMobile mobile) : base(mobile.KarmaLocked ? 6197 : 6196, LockRange) => m_Mobile = mobile;
@ -81,7 +81,7 @@ namespace Server.Items
private class TitheEntry : ContextMenuEntry
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public TitheEntry(Mobile mobile) : base(6198, TitheRange)
{

View file

@ -7,7 +7,7 @@ namespace Server.Items
{
public abstract class BaseDoor : Item, ILockable, ITelekinesisable
{
private static Point3D[] m_Offsets =
private static readonly Point3D[] m_Offsets =
{
new Point3D(-1, 1, 0),
new Point3D(1, 1, 0),
@ -74,19 +74,19 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int OpenedID{ get; set; }
public int OpenedID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int ClosedID{ get; set; }
public int ClosedID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int OpenedSound{ get; set; }
public int OpenedSound { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int ClosedSound{ get; set; }
public int ClosedSound { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Offset{ get; set; }
public Point3D Offset { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public BaseDoor Link
@ -104,10 +104,10 @@ namespace Server.Items
public virtual bool UseChainedFunctionality => false;
[CommandProperty(AccessLevel.GameMaster)]
public bool Locked{ get; set; }
public bool Locked { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public uint KeyValue{ get; set; }
public uint KeyValue { get; set; }
public void OnTelekinesis(Mobile from)
{
@ -376,7 +376,7 @@ namespace Server.Items
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
502502); // That is locked, but you open it with your godly powers.
//from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 502502, "", "" ) ); // That is locked, but you open it with your godly powers.
// from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 502502, "", "" ) ); // That is locked, but you open it with your godly powers.
}
else if (Key.ContainsKey(from.Backpack, KeyValue))
{
@ -470,30 +470,30 @@ namespace Server.Items
switch (version)
{
case 0:
{
KeyValue = reader.ReadUInt();
m_Open = reader.ReadBool();
Locked = reader.ReadBool();
OpenedID = reader.ReadInt();
ClosedID = reader.ReadInt();
OpenedSound = reader.ReadInt();
ClosedSound = reader.ReadInt();
Offset = reader.ReadPoint3D();
m_Link = reader.ReadItem() as BaseDoor;
{
KeyValue = reader.ReadUInt();
m_Open = reader.ReadBool();
Locked = reader.ReadBool();
OpenedID = reader.ReadInt();
ClosedID = reader.ReadInt();
OpenedSound = reader.ReadInt();
ClosedSound = reader.ReadInt();
Offset = reader.ReadPoint3D();
m_Link = reader.ReadItem() as BaseDoor;
m_Timer = new InternalTimer(this);
m_Timer = new InternalTimer(this);
if (m_Open)
m_Timer.Start();
if (m_Open)
m_Timer.Start();
break;
}
break;
}
}
}
private class InternalTimer : Timer
{
private BaseDoor m_Door;
private readonly BaseDoor m_Door;
public InternalTimer(BaseDoor door) : base(TimeSpan.FromSeconds(20.0), TimeSpan.FromSeconds(10.0))
{

View file

@ -11,7 +11,7 @@ namespace Server.Items
SouthCCW,
NorthCW,
//Sliding Doors
// Sliding Doors
SouthSW,
SouthSE,
WestSS,

View file

@ -102,10 +102,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public DoorFacing Facing{ get; set; }
public DoorFacing Facing { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
@ -182,18 +182,18 @@ namespace Server.Items
switch (version)
{
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if (version < 1)
Level = SecureLevel.Anyone;
{
if (version < 1)
Level = SecureLevel.Anyone;
Facing = (DoorFacing)reader.ReadInt();
break;
}
Facing = (DoorFacing)reader.ReadInt();
break;
}
}
}
@ -239,7 +239,7 @@ namespace Server.Items
h = bs;
break;
//No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until further information gained
// No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until further information gained
default: return false;
}

View file

@ -45,10 +45,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
break;
}
{
m_LabelNumber = reader.ReadInt();
break;
}
}
}
}

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)
{

View file

@ -8,7 +8,7 @@ namespace Server.Items
{
}
public abstract int ArtifactRarity{ get; }
public abstract int ArtifactRarity { get; }
public override bool ForceShowProperties => true;
@ -42,7 +42,7 @@ namespace Server.Items
{
}
public abstract int ArtifactRarity{ get; }
public abstract int ArtifactRarity { get; }
public override bool ForceShowProperties => true;

View file

@ -1,7 +1,5 @@
namespace Server.Items
{
#region BackpackArtifact
public class BackpackArtifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -30,10 +28,6 @@ namespace Server.Items
}
}
#endregion
#region BloodyWaterArtifact
public class BloodyWaterArtifact : BaseDecorationArtifact
{
[Constructible]
@ -62,10 +56,6 @@ namespace Server.Items
}
}
#endregion
#region BooksWestArtifact
public class BooksWestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -94,10 +84,6 @@ namespace Server.Items
}
}
#endregion
#region BooksNorthArtifact
public class BooksNorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -126,10 +112,6 @@ namespace Server.Items
}
}
#endregion
#region BooksFaceDownArtifact
public class BooksFaceDownArtifact : BaseDecorationArtifact
{
[Constructible]
@ -158,10 +140,6 @@ namespace Server.Items
}
}
#endregion
#region BottleArtifact
public class BottleArtifact : BaseDecorationArtifact
{
[Constructible]
@ -190,10 +168,6 @@ namespace Server.Items
}
}
#endregion
#region BrazierArtifact
public class BrazierArtifact : BaseDecorationArtifact
{
[Constructible]
@ -220,10 +194,6 @@ namespace Server.Items
}
}
#endregion
#region CocoonArtifact
public class CocoonArtifact : BaseDecorationArtifact
{
[Constructible]
@ -252,10 +222,6 @@ namespace Server.Items
}
}
#endregion
#region DamagedBooksArtifact
public class DamagedBooksArtifact : BaseDecorationArtifact
{
[Constructible]
@ -284,10 +250,6 @@ namespace Server.Items
}
}
#endregion
#region EggCaseArtifact
public class EggCaseArtifact : BaseDecorationArtifact
{
[Constructible]
@ -316,10 +278,6 @@ namespace Server.Items
}
}
#endregion
#region GruesomeStandardArtifact
public class GruesomeStandardArtifact : BaseDecorationArtifact
{
[Constructible]
@ -348,10 +306,6 @@ namespace Server.Items
}
}
#endregion
#region LampPostArtifact
public class LampPostArtifact : BaseDecorationArtifact
{
[Constructible]
@ -378,10 +332,6 @@ namespace Server.Items
}
}
#endregion
#region LeatherTunicArtifact
public class LeatherTunicArtifact : BaseDecorationArtifact
{
[Constructible]
@ -410,10 +360,6 @@ namespace Server.Items
}
}
#endregion
#region RockArtifact
public class RockArtifact : BaseDecorationArtifact
{
[Constructible]
@ -442,10 +388,6 @@ namespace Server.Items
}
}
#endregion
#region RuinedPaintingArtifact
public class RuinedPaintingArtifact : BaseDecorationArtifact
{
[Constructible]
@ -474,10 +416,6 @@ namespace Server.Items
}
}
#endregion
#region SaddleArtifact
public class SaddleArtifact : BaseDecorationArtifact
{
[Constructible]
@ -506,10 +444,6 @@ namespace Server.Items
}
}
#endregion
#region SkinnedDeerArtifact
public class SkinnedDeerArtifact : BaseDecorationArtifact
{
[Constructible]
@ -538,10 +472,6 @@ namespace Server.Items
}
}
#endregion
#region SkinnedGoatArtifact
public class SkinnedGoatArtifact : BaseDecorationArtifact
{
[Constructible]
@ -570,10 +500,6 @@ namespace Server.Items
}
}
#endregion
#region SkullCandleArtifact
public class SkullCandleArtifact : BaseDecorationArtifact
{
[Constructible]
@ -600,10 +526,6 @@ namespace Server.Items
}
}
#endregion
#region StretchedHideArtifact
public class StretchedHideArtifact : BaseDecorationArtifact
{
[Constructible]
@ -632,10 +554,6 @@ namespace Server.Items
}
}
#endregion
#region StuddedLeggingsArtifact
public class StuddedLeggingsArtifact : BaseDecorationArtifact
{
[Constructible]
@ -664,10 +582,6 @@ namespace Server.Items
}
}
#endregion
#region StuddedTunicArtifact
public class StuddedTunicArtifact : BaseDecorationArtifact
{
[Constructible]
@ -696,10 +610,6 @@ namespace Server.Items
}
}
#endregion
#region TarotCardsArtifact
public class TarotCardsArtifact : BaseDecorationArtifact
{
[Constructible]
@ -727,6 +637,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
#endregion
}

View file

@ -2,8 +2,6 @@ using Server.Network;
namespace Server.Items
{
#region Basket1Artifact
public class Basket1Artifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -32,10 +30,6 @@ namespace Server.Items
}
}
#endregion
#region Basket2Artifact
public class Basket2Artifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -64,10 +58,6 @@ namespace Server.Items
}
}
#endregion
#region Basket3WestArtifact
public class Basket3WestArtifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -96,10 +86,6 @@ namespace Server.Items
}
}
#endregion
#region Basket3NorthArtifact
public class Basket3NorthArtifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -128,10 +114,6 @@ namespace Server.Items
}
}
#endregion
#region Basket4Artifact
public class Basket4Artifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -160,10 +142,6 @@ namespace Server.Items
}
}
#endregion
#region Basket5WestArtifact
public class Basket5WestArtifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -192,10 +170,6 @@ namespace Server.Items
}
}
#endregion
#region Basket5NorthArtifact
public class Basket5NorthArtifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -224,10 +198,6 @@ namespace Server.Items
}
}
#endregion
#region Basket6Artifact
public class Basket6Artifact : BaseDecorationContainerArtifact
{
[Constructible]
@ -256,10 +226,6 @@ namespace Server.Items
}
}
#endregion
#region BowlArtifact
public class BowlArtifact : BaseDecorationArtifact
{
[Constructible]
@ -288,10 +254,6 @@ namespace Server.Items
}
}
#endregion
#region BowlsVerticalArtifact
public class BowlsVerticalArtifact : BaseDecorationArtifact
{
[Constructible]
@ -320,10 +282,6 @@ namespace Server.Items
}
}
#endregion
#region BowlsHorizontalArtifact
public class BowlsHorizontalArtifact : BaseDecorationArtifact
{
[Constructible]
@ -352,10 +310,6 @@ namespace Server.Items
}
}
#endregion
#region CupsArtifact
public class CupsArtifact : BaseDecorationArtifact
{
[Constructible]
@ -384,10 +338,6 @@ namespace Server.Items
}
}
#endregion
#region FanWestArtifact
public class FanWestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -416,10 +366,6 @@ namespace Server.Items
}
}
#endregion
#region FanNorthArtifact
public class FanNorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -448,10 +394,6 @@ namespace Server.Items
}
}
#endregion
#region TripleFanWestArtifact
public class TripleFanWestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -480,10 +422,6 @@ namespace Server.Items
}
}
#endregion
#region TripleFanNorthArtifact
public class TripleFanNorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -512,10 +450,6 @@ namespace Server.Items
}
}
#endregion
#region FlowersArtifact
public class FlowersArtifact : BaseDecorationArtifact
{
[Constructible]
@ -544,10 +478,6 @@ namespace Server.Items
}
}
#endregion
#region Painting1WestArtifact
public class Painting1WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -576,10 +506,6 @@ namespace Server.Items
}
}
#endregion
#region Painting1NorthArtifact
public class Painting1NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -608,10 +534,6 @@ namespace Server.Items
}
}
#endregion
#region Painting2WestArtifact
public class Painting2WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -640,10 +562,6 @@ namespace Server.Items
}
}
#endregion
#region Painting2NorthArtifact
public class Painting2NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -672,10 +590,6 @@ namespace Server.Items
}
}
#endregion
#region Painting3Artifact
public class Painting3Artifact : BaseDecorationArtifact
{
[Constructible]
@ -704,10 +618,6 @@ namespace Server.Items
}
}
#endregion
#region Painting4WestArtifact
public class Painting4WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -736,10 +646,6 @@ namespace Server.Items
}
}
#endregion
#region Painting4NorthArtifact
public class Painting4NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -768,10 +674,6 @@ namespace Server.Items
}
}
#endregion
#region Painting5WestArtifact
public class Painting5WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -800,10 +702,6 @@ namespace Server.Items
}
}
#endregion
#region Painting5NorthArtifact
public class Painting5NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -832,10 +730,6 @@ namespace Server.Items
}
}
#endregion
#region Painting6WestArtifact
public class Painting6WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -864,10 +758,6 @@ namespace Server.Items
}
}
#endregion
#region Painting6NorthArtifact
public class Painting6NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -896,10 +786,6 @@ namespace Server.Items
}
}
#endregion
#region SakeArtifact
public class SakeArtifact : BaseDecorationArtifact
{
[Constructible]
@ -928,10 +814,6 @@ namespace Server.Items
}
}
#endregion
#region Sculpture1Artifact
public class Sculpture1Artifact : BaseDecorationArtifact
{
[Constructible]
@ -960,10 +842,6 @@ namespace Server.Items
}
}
#endregion
#region Sculpture2Artifact
public class Sculpture2Artifact : BaseDecorationArtifact
{
[Constructible]
@ -992,10 +870,6 @@ namespace Server.Items
}
}
#endregion
#region DolphinLeftArtifact
public class DolphinLeftArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1024,10 +898,6 @@ namespace Server.Items
}
}
#endregion
#region DolphinRightArtifact
public class DolphinRightArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1056,10 +926,6 @@ namespace Server.Items
}
}
#endregion
#region ManStatuetteSouthArtifact
public class ManStatuetteSouthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1088,10 +954,6 @@ namespace Server.Items
}
}
#endregion
#region ManStatuetteEastArtifact
public class ManStatuetteEastArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1120,10 +982,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay1WestArtifact
public class SwordDisplay1WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1152,10 +1010,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay1NorthArtifact
public class SwordDisplay1NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1184,10 +1038,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay2WestArtifact
public class SwordDisplay2WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1216,10 +1066,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay2NorthArtifact
public class SwordDisplay2NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1248,10 +1094,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay3SouthArtifact
public class SwordDisplay3SouthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1280,10 +1122,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay3EastArtifact
public class SwordDisplay3EastArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1312,10 +1150,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay4WestArtifact
public class SwordDisplay4WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1344,10 +1178,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay4NorthArtifact
public class SwordDisplay4NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1376,10 +1206,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay5WestArtifact
public class SwordDisplay5WestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1408,10 +1234,6 @@ namespace Server.Items
}
}
#endregion
#region SwordDisplay5NorthArtifact
public class SwordDisplay5NorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1440,10 +1262,6 @@ namespace Server.Items
}
}
#endregion
#region TeapotWestArtifact
public class TeapotWestArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1472,10 +1290,6 @@ namespace Server.Items
}
}
#endregion
#region TeapotNorthArtifact
public class TeapotNorthArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1504,10 +1318,6 @@ namespace Server.Items
}
}
#endregion
#region TowerLanternArtifact
public class TowerLanternArtifact : BaseDecorationArtifact
{
[Constructible]
@ -1565,10 +1375,6 @@ namespace Server.Items
}
}
#endregion
#region Urn1Artifact
public class Urn1Artifact : BaseDecorationArtifact
{
[Constructible]
@ -1597,10 +1403,6 @@ namespace Server.Items
}
}
#endregion
#region Urn2Artifact
public class Urn2Artifact : BaseDecorationArtifact
{
[Constructible]
@ -1629,10 +1431,6 @@ namespace Server.Items
}
}
#endregion
#region ZenRock1Artifact
public class ZenRock1Artifact : BaseDecorationArtifact
{
[Constructible]
@ -1661,10 +1459,6 @@ namespace Server.Items
}
}
#endregion
#region ZenRock2Artifact
public class ZenRock2Artifact : BaseDecorationArtifact
{
[Constructible]
@ -1693,10 +1487,6 @@ namespace Server.Items
}
}
#endregion
#region ZenRock3Artifact
public class ZenRock3Artifact : BaseDecorationArtifact
{
[Constructible]
@ -1724,6 +1514,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
#endregion
}

View file

@ -1,6 +1,6 @@
using Server.Utilities;
using System;
using System.Collections.Generic;
using Server.Utilities;
namespace Server.Items
{
@ -27,7 +27,7 @@ namespace Server.Items
public StealableArtifactsSpawner(Serial serial) : base(serial) => Instance = this;
public static StealableEntry[] Entries{ get; } =
public static StealableEntry[] Entries { get; } =
{
// Doom - Artifact rarity 1
new StealableEntry(Map.Malas, new Point3D(317, 56, -1), 72, 108, typeof(RockArtifact)),
@ -151,19 +151,18 @@ namespace Server.Items
}
}
public static StealableArtifactsSpawner Instance{ get; private set; }
public static StealableArtifactsSpawner Instance { get; private set; }
public override string DefaultName => "Stealable Artifacts Spawner - Internal";
private static int GetLampPostHue()
{
if (0.9 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.9)
return 0;
return Utility.RandomList(0x455, 0x47E, 0x482, 0x486, 0x48F, 0x4F2, 0x58C, 0x66C);
}
public static void Initialize()
{
CommandSystem.Register("GenStealArties", AccessLevel.Administrator, GenStealArties_OnCommand);
@ -303,17 +302,17 @@ namespace Server.Items
Hue = hue;
}
public Map Map{ get; }
public Map Map { get; }
public Point3D Location{ get; }
public Point3D Location { get; }
public int MinDelay{ get; }
public int MinDelay { get; }
public int MaxDelay{ get; }
public int MaxDelay { get; }
public Type Type{ get; }
public Type Type { get; }
public int Hue{ get; }
public int Hue { get; }
public Item CreateInstance()
{
@ -329,7 +328,6 @@ namespace Server.Items
}
}
public class StealableInstance
{
private Item m_Item;
@ -345,7 +343,7 @@ namespace Server.Items
Entry = entry;
}
public StealableEntry Entry{ get; }
public StealableEntry Entry { get; }
public Item Item
{
@ -371,7 +369,7 @@ namespace Server.Items
}
}
public DateTime NextRespawn{ get; set; }
public DateTime NextRespawn { get; set; }
public void CheckRespawn()
{

View file

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

View file

@ -4,7 +4,7 @@ namespace Server.Items
{
public class ClothingBlessTarget : Target // Create our targeting class (which we derive from the base target class)
{
private ClothingBlessDeed m_Deed;
private readonly ClothingBlessDeed m_Deed;
public ClothingBlessTarget(ClothingBlessDeed deed) : base(1, false, TargetFlags.None) => m_Deed = deed;
@ -21,8 +21,7 @@ namespace Server.Items
return;
}
if (item.LootType == LootType.Blessed || item.BlessedFor == from || Mobile.InsuranceEnabled && item.Insured
) // Check if its already newbied (blessed)
if (item.LootType == LootType.Blessed || item.BlessedFor == from || (Mobile.InsuranceEnabled && item.Insured)) // Check if its already newbied (blessed)
{
from.SendLocalizedMessage(1045113); // That item is already blessed
}

View file

@ -4,8 +4,8 @@ namespace Server.Items
{
public interface ICommodity /* added IsDeedable prop so expansion-based deedables can determine true/false */
{
int DescriptionNumber{ get; }
bool IsDeedable{ get; }
int DescriptionNumber { get; }
bool IsDeedable { get; }
}
public class CommodityDeed : Item
@ -26,7 +26,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Item Commodity{ get; private set; }
public Item Commodity { get; private set; }
public override int LabelNumber => Commodity == null ? 1047016 : 1047017;
@ -66,10 +66,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
if (Commodity != null) Hue = 0x592;
break;
}
{
if (Commodity != null) Hue = 0x592;
break;
}
}
}
@ -182,7 +182,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private CommodityDeed m_Deed;
private readonly CommodityDeed m_Deed;
public InternalTarget(CommodityDeed deed) : base(3, false, TargetFlags.None) => m_Deed = deed;
@ -203,8 +203,8 @@ namespace Server.Items
CommodityDeedBox cox = CommodityDeedBox.Find(m_Deed);
// Veteran Rewards mods
if (box != null && m_Deed.IsChildOf(box) && item.IsChildOf(box) ||
cox?.IsSecure != true && item.IsChildOf(cox))
if ((box != null && m_Deed.IsChildOf(box) && item.IsChildOf(box)) ||
(cox?.IsSecure != true && item.IsChildOf(cox)))
{
if (m_Deed.SetCommodity(item))
{

View file

@ -54,8 +54,6 @@ namespace Server.Items
}
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -76,8 +74,6 @@ namespace Server.Items
return quality;
}
#endregion
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
@ -153,16 +149,16 @@ namespace Server.Items
{
case 1:
case 0:
{
m_Exceptional = reader.ReadBool();
m_Crafter = reader.ReadMobile();
{
m_Exceptional = reader.ReadBool();
m_Crafter = reader.ReadMobile();
if (version < 1)
reader.ReadInt();
if (version < 1)
reader.ReadInt();
m_Resource = (CraftResource)reader.ReadInt();
break;
}
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
}
}

View file

@ -42,7 +42,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private int[][] ElvenArray =
private readonly int[][] ElvenArray =
{
new[] { 0 },
new[] { 1011064, 1011064, 0, 0, 0, 0 }, // bald
@ -56,10 +56,10 @@ namespace Server.Items
new[] { 1074393, 1074390, 0x2fd0, 0x2fcd, 0xedde, 0xc6cb } // buns, long
};
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
private int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
private readonly int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
{
new[] { 0 },
new[] { 1011064, 1011064, 0, 0, 0, 0 }, // bald
@ -73,11 +73,11 @@ namespace Server.Items
new[] { 1011050, 1011050, 0x204A, 0x204A, 0xED29, 0xED29 }, // Topknot
new[] { 1011396, 1011396, 0x2047, 0x2047, 0xed25, 0xc618 } // Curly
};
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
private int[][] LayoutArray =
private readonly int[][] LayoutArray =
{
new[] { 0 }, /* padding: its more efficient than code to ++ the index/buttonid */
new[] { 425, 280, 342, 295, 000, 000, 310, 292 },
@ -92,8 +92,8 @@ namespace Server.Items
new[] { 235, 280, 150, 295, 168, 245, 118, 292 } // slot 10, Curly - N/A for elfs.
};
private HairRestylingDeed m_Deed;
private Mobile m_From;
private readonly HairRestylingDeed m_Deed;
private readonly Mobile m_From;
public InternalGump(Mobile from, HairRestylingDeed deed) : base(50, 50)
{

View file

@ -91,11 +91,12 @@ namespace Server.Items
Point3D loc = new Point3D(p);
if (p is StaticTarget target)
/* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
loc.Z -= TileData.ItemTable[target.ItemID]
.CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
.CalcHeight;
if (ValidatePlacement(from, loc))
EndPlace(from, type, loc);
@ -117,8 +118,8 @@ namespace Server.Items
public class HolidayTreeChoiceGump : Gump
{
private HolidayTreeDeed m_Deed;
private Mobile m_From;
private readonly HolidayTreeDeed m_Deed;
private readonly Mobile m_From;
public HolidayTreeChoiceGump(Mobile from, HolidayTreeDeed deed) : base(200, 200)
{
@ -145,15 +146,15 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Classic);
break;
}
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Classic);
break;
}
case 2:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Modern);
break;
}
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Modern);
break;
}
}
}
}

View file

@ -45,7 +45,7 @@ namespace Server.Items
public class NameChangeDeedGump : Gump
{
private Item m_Sender;
private readonly Item m_Sender;
public NameChangeDeedGump(Item sender) : base(50, 50)
{
@ -99,7 +99,6 @@ namespace Server.Items
string newName = nameEntry?.Text.Trim();
if (!NameVerification.Validate(newName, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote))
{
m.SendMessage("That name is unacceptable.");

View file

@ -18,7 +18,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner{ get; set; }
public Mobile Owner { get; set; }
public override int LabelNumber => 1062094; // a young player ticket
@ -49,10 +49,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
Owner = reader.ReadMobile();
break;
}
{
Owner = reader.ReadMobile();
break;
}
}
if (Name == "a young player ticket")
@ -78,7 +78,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private NewPlayerTicket m_Ticket;
private readonly NewPlayerTicket m_Ticket;
public InternalTarget(NewPlayerTicket ticket) : base(2, false, TargetFlags.None) => m_Ticket = ticket;
@ -115,8 +115,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private Mobile m_From;
private NewPlayerTicket m_Ticket;
private readonly Mobile m_From;
private readonly NewPlayerTicket m_Ticket;
public InternalGump(Mobile from, NewPlayerTicket ticket) : base(50, 50)
{

View file

@ -42,10 +42,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int Price{ get; set; }
public int Price { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool LandlordRenew{ get; set; }
public bool LandlordRenew { get; set; }
public Mobile Offeree
{
@ -223,7 +223,7 @@ namespace Server.Items
private class ContractOptionEntry : ContextMenuEntry
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public ContractOptionEntry(VendorRentalContract contract) : base(6209) => m_Contract = contract;
@ -241,7 +241,7 @@ namespace Server.Items
private class RentTarget : Target
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public RentTarget(VendorRentalContract contract) : base(-1, false, TargetFlags.None) => m_Contract = contract;
@ -318,7 +318,7 @@ namespace Server.Items
private class OfferExpireTimer : Timer
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public OfferExpireTimer(VendorRentalContract contract) : base(TimeSpan.FromSeconds(30.0))
{

View file

@ -6,7 +6,7 @@ namespace Server.Items
public static int ShortBeard = 0x203f;
public static int Goatee = 0x2040;
public static int Mustache = 0x2041;
public static int MediumShortBeard = 0x204B;
public static int MediumLongBeard = 0x204C;
public static int Vandyke = 0x204D;

View file

@ -3,29 +3,29 @@ namespace Server.Items
public static class Hair
{
// Human
public static int Long = 0x203C;
public static int Shor = 0x203B;
public static int PonyTail = 0x203D;
public static readonly int Long = 0x203C;
public static readonly int Shor = 0x203B;
public static readonly int PonyTail = 0x203D;
public static readonly int Mohawk = 0x2044;
public static readonly int Pageboy = 0x2045;
public static readonly int Bun = 0x2046; // Female Only
public static readonly int Afro = 0x2047;
public static readonly int Receding = 0x2048; // Male Only
public static readonly int TwoPigTails = 0x2049;
public static readonly int Krisna = 0x204A;
public static int Mohawk = 0x2044;
public static int Pageboy = 0x2045;
public static int Bun = 0x2046; // Female Only
public static int Afro = 0x2047;
public static int Receding = 0x2048; // Male Only
public static int TwoPigTails = 0x2049;
public static int Krisna = 0x204A;
// Elf
public static int MidLongElf = 0x2FBF; // Male Only
public static int LongFeather = 0x2FC0;
public static int ShortElf = 0x2FC1;
public static int Mullet = 0x2FC2;
public static int Flower = 0x2FCC; // Female only
public static int LongElf = 0x2FCD; // Male Only
public static int Knob = 0x2FCE;
public static int Braided = 0x2FCF;
public static int BunElf = 0x2FD0; // Female Only
public static int Spiked = 0x2FD1;
public static readonly int MidLongElf = 0x2FBF; // Male Only
public static readonly int LongFeather = 0x2FC0;
public static readonly int ShortElf = 0x2FC1;
public static readonly int Mullet = 0x2FC2;
public static readonly int Flower = 0x2FCC; // Female only
public static readonly int LongElf = 0x2FCD; // Male Only
public static readonly int Knob = 0x2FCE;
public static readonly int Braided = 0x2FCF;
public static readonly int BunElf = 0x2FD0; // Female Only
public static readonly int Spiked = 0x2FD1;
}
}
}

Some files were not shown because too many files have changed in this diff Show more