Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -105,22 +105,11 @@ namespace Server.Items
public class AddonComponent : Item, IChopable
{
private Point3D m_Offset;
private BaseAddon m_Addon;
[CommandProperty( AccessLevel.GameMaster )]
public BaseAddon Addon { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public BaseAddon Addon
{
get => m_Addon;
set => m_Addon = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Offset
{
get => m_Offset;
set => m_Offset = value;
}
public Point3D Offset { get; set; }
[Hue, CommandProperty( AccessLevel.GameMaster )]
public override int Hue
@ -130,8 +119,8 @@ namespace Server.Items
{
base.Hue = value;
if ( m_Addon != null && m_Addon.ShareHue )
m_Addon.Hue = value;
if ( Addon != null && Addon.ShareHue )
Addon.Hue = value;
}
}
@ -151,34 +140,34 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
m_Addon?.OnComponentUsed( this, from );
Addon?.OnComponentUsed( this, from );
}
public void OnChop( Mobile from )
{
if ( m_Addon != null && from.InRange( GetWorldLocation(), 3 ) )
m_Addon.OnChop( from );
if ( Addon != null && from.InRange( GetWorldLocation(), 3 ) )
Addon.OnChop( from );
else
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
public override void OnLocationChange( Point3D old )
{
if ( m_Addon != null )
m_Addon.Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z );
if ( Addon != null )
Addon.Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z );
}
public override void OnMapChange()
{
if ( m_Addon != null )
m_Addon.Map = Map;
if ( Addon != null )
Addon.Map = Map;
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Addon?.Delete();
Addon?.Delete();
}
public override void Serialize( GenericWriter writer )
@ -187,8 +176,8 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( m_Addon );
writer.Write( m_Offset );
writer.Write( Addon );
writer.Write( Offset );
}
public override void Deserialize( GenericReader reader )
@ -202,10 +191,10 @@ namespace Server.Items
case 1:
case 0:
{
m_Addon = reader.ReadItem() as BaseAddon;
m_Offset = reader.ReadPoint3D();
Addon = reader.ReadItem() as BaseAddon;
Offset = reader.ReadPoint3D();
m_Addon?.OnComponentLoaded( this );
Addon?.OnComponentLoaded( this );
ApplyLightTo( this );

View file

@ -8,22 +8,11 @@ namespace Server.Items
public virtual bool NeedsWall => false;
public virtual Point3D WallPosition => Point3D.Zero;
private Point3D m_Offset;
private BaseAddonContainer m_Addon;
[CommandProperty( AccessLevel.GameMaster )]
public BaseAddonContainer Addon { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public BaseAddonContainer Addon
{
get => m_Addon;
set => m_Addon = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Offset
{
get => m_Offset;
set => m_Offset = value;
}
public Point3D Offset { get; set; }
[Hue, CommandProperty( AccessLevel.GameMaster )]
public override int Hue
@ -33,8 +22,8 @@ namespace Server.Items
{
base.Hue = value;
if ( m_Addon != null && m_Addon.ShareHue )
m_Addon.Hue = value;
if ( Addon != null && Addon.ShareHue )
Addon.Hue = value;
}
}
@ -60,31 +49,31 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
m_Addon?.OnComponentUsed( this, from );
Addon?.OnComponentUsed( this, from );
}
public override void OnLocationChange( Point3D old )
{
if ( m_Addon != null )
m_Addon.Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z );
if ( Addon != null )
Addon.Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z );
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
m_Addon?.GetContextMenuEntries( from, list );
Addon?.GetContextMenuEntries( from, list );
}
public override void OnMapChange()
{
if ( m_Addon != null )
m_Addon.Map = Map;
if ( Addon != null )
Addon.Map = Map;
}
public override void OnAfterDelete()
{
base.OnAfterDelete();
m_Addon?.Delete();
Addon?.Delete();
}
public override void Serialize( GenericWriter writer )
@ -93,8 +82,8 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( m_Addon );
writer.Write( m_Offset );
writer.Write( Addon );
writer.Write( Offset );
}
public override void Deserialize( GenericReader reader )
@ -103,18 +92,18 @@ namespace Server.Items
int version = reader.ReadInt();
m_Addon = reader.ReadItem() as BaseAddonContainer;
m_Offset = reader.ReadPoint3D();
Addon = reader.ReadItem() as BaseAddonContainer;
Offset = reader.ReadPoint3D();
m_Addon?.OnComponentLoaded( this );
Addon?.OnComponentLoaded( this );
AddonComponent.ApplyLightTo( this );
}
public virtual void OnChop( Mobile from )
{
if ( m_Addon != null && from.InRange( GetWorldLocation(), 3 ) )
m_Addon.OnChop( from );
if ( Addon != null && from.InRange( GetWorldLocation(), 3 ) )
Addon.OnChop( from );
else
from.SendLocalizedMessage( 500446 ); // That is too far away.
}

View file

@ -7,33 +7,14 @@ namespace Server.Items
[FlippableAttribute( 0x100A/*East*/, 0x100B/*South*/ )]
public class ArcheryButte : AddonComponent
{
private double m_MinSkill;
private double m_MaxSkill;
private int m_Arrows, m_Bolts;
private DateTime m_LastUse;
[CommandProperty( AccessLevel.GameMaster )]
public double MinSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public double MinSkill
{
get => m_MinSkill;
set => m_MinSkill = value;
}
public double MaxSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public double MaxSkill
{
get => m_MaxSkill;
set => m_MaxSkill = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime LastUse
{
get => m_LastUse;
set => m_LastUse = value;
}
public DateTime LastUse { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool FacingEast
@ -43,18 +24,10 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int Arrows
{
get => m_Arrows;
set => m_Arrows = value;
}
public int Arrows { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Bolts
{
get => m_Bolts;
set => m_Bolts = value;
}
public int Bolts { get; set; }
[Constructible]
public ArcheryButte() : this( 0x100A )
@ -63,8 +36,8 @@ namespace Server.Items
public ArcheryButte( int itemID ) : base( itemID )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
public ArcheryButte( Serial serial ) : base( serial )
@ -73,7 +46,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( (m_Arrows > 0 || m_Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) )
if ( (Arrows > 0 || Bolts > 0) && from.InRange( GetWorldLocation(), 1 ) )
Gather( from );
else
Fire( from );
@ -83,14 +56,14 @@ namespace Server.Items
{
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500592 ); // You gather the arrows and bolts.
if ( m_Arrows > 0 )
from.AddToBackpack( new Arrow( m_Arrows ) );
if ( Arrows > 0 )
from.AddToBackpack( new Arrow( Arrows ) );
if ( m_Bolts > 0 )
from.AddToBackpack( new Bolt( m_Bolts ) );
if ( Bolts > 0 )
from.AddToBackpack( new Bolt( Bolts ) );
m_Arrows = 0;
m_Bolts = 0;
Arrows = 0;
Bolts = 0;
m_Entries = null;
}
@ -99,20 +72,14 @@ namespace Server.Items
private class ScoreEntry
{
private int m_Total;
private int m_Count;
public int Total { get; set; }
public int Total{ get => m_Total;
set => m_Total = value;
}
public int Count{ get => m_Count;
set => m_Count = value;
}
public int Count { get; set; }
public void Record( int score )
{
m_Total += score;
m_Count += 1;
Total += score;
Count += 1;
}
public ScoreEntry()
@ -143,7 +110,7 @@ namespace Server.Items
return;
}
if ( DateTime.UtcNow < (m_LastUse + UseDelay) )
if ( DateTime.UtcNow < (LastUse + UseDelay) )
return;
Point3D worldLoc = GetWorldLocation();
@ -191,7 +158,7 @@ namespace Server.Items
return;
}
m_LastUse = DateTime.UtcNow;
LastUse = DateTime.UtcNow;
from.Direction = from.GetDirectionTo( GetWorldLocation() );
bow.PlaySwingAnimation( from );
@ -199,7 +166,7 @@ namespace Server.Items
ScoreEntry se = GetEntryFor( from );
if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) )
if ( !from.CheckSkill( bow.Skill, MinSkill, MaxSkill ) )
{
from.PlaySound( bow.MissSound );
@ -246,7 +213,7 @@ namespace Server.Items
splitScore = 5;
}
bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() );
bool split = ( isKnown && ((Arrows + Bolts) * 0.02) > Utility.RandomDouble() );
if ( split )
{
@ -258,9 +225,9 @@ namespace Server.Items
PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name );
if ( isArrow )
++m_Arrows;
++Arrows;
else if ( isBolt )
++m_Bolts;
++Bolts;
}
se.Record( split ? splitScore : score );
@ -277,10 +244,10 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( m_MinSkill );
writer.Write( m_MaxSkill );
writer.Write( m_Arrows );
writer.Write( m_Bolts );
writer.Write( MinSkill );
writer.Write( MaxSkill );
writer.Write( Arrows );
writer.Write( Bolts );
}
public override void Deserialize( GenericReader reader )
@ -293,15 +260,15 @@ namespace Server.Items
{
case 0:
{
m_MinSkill = reader.ReadDouble();
m_MaxSkill = reader.ReadDouble();
m_Arrows = reader.ReadInt();
m_Bolts = reader.ReadInt();
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
Arrows = reader.ReadInt();
Bolts = reader.ReadInt();
if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 )
if ( MinSkill == 0.0 && MaxSkill == 30.0 )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;

View file

@ -13,22 +13,18 @@ namespace Server.Items
public override int LabelNumber => 1041006; // a ballot box
private string[] m_Topic;
private List<Mobile> m_Yes;
private List<Mobile> m_No;
public string[] Topic { get; private set; }
public string[] Topic => m_Topic;
public List<Mobile> Yes { get; private set; }
public List<Mobile> Yes => m_Yes;
public List<Mobile> No => m_No;
public List<Mobile> No { get; private set; }
[Constructible]
public BallotBox() : base( 0x9A8 )
{
m_Topic = new string[0];
m_Yes = new List<Mobile>();
m_No = new List<Mobile>();
Topic = new string[0];
Yes = new List<Mobile>();
No = new List<Mobile>();
}
public BallotBox( Serial serial ) : base( serial )
@ -37,21 +33,21 @@ namespace Server.Items
public void ClearTopic()
{
m_Topic = new string[0];
Topic = new string[0];
ClearVotes();
}
public void AddLineToTopic( string line )
{
if ( m_Topic.Length >= MaxTopicLines )
if ( Topic.Length >= MaxTopicLines )
return;
string[] newTopic = new string[m_Topic.Length + 1];
m_Topic.CopyTo( newTopic, 0 );
newTopic[m_Topic.Length] = line;
string[] newTopic = new string[Topic.Length + 1];
Topic.CopyTo( newTopic, 0 );
newTopic[Topic.Length] = line;
m_Topic = newTopic;
Topic = newTopic;
ClearVotes();
}
@ -296,13 +292,13 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt( m_Topic.Length );
writer.WriteEncodedInt( Topic.Length );
for ( int i = 0; i < m_Topic.Length; i++ )
writer.Write( (string) m_Topic[i] );
for ( int i = 0; i < Topic.Length; i++ )
writer.Write( (string) Topic[i] );
writer.Write( m_Yes, true );
writer.Write( m_No, true );
writer.Write( Yes, true );
writer.Write( No, true );
}
public override void Deserialize( GenericReader reader )
@ -311,13 +307,13 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Topic = new string[reader.ReadEncodedInt()];
Topic = new string[reader.ReadEncodedInt()];
for ( int i = 0; i < m_Topic.Length; i++ )
m_Topic[i] = reader.ReadString();
for ( int i = 0; i < Topic.Length; i++ )
Topic[i] = reader.ReadString();
m_Yes = reader.ReadStrongMobileList();
m_No = reader.ReadStrongMobileList();
Yes = reader.ReadStrongMobileList();
No = reader.ReadStrongMobileList();
}
}

View file

@ -42,14 +42,13 @@ namespace Server.Items
}
}
#endregion
private List<AddonComponent> m_Components;
public void AddComponent( AddonComponent c, int x, int y, int z )
{
if ( Deleted )
return;
m_Components.Add( c );
Components.Add( c );
c.Addon = this;
c.Offset = new Point3D( x, y, z );
@ -61,7 +60,7 @@ namespace Server.Items
Movable = false;
Visible = false;
m_Components = new List<AddonComponent>();
Components = new List<AddonComponent>();
}
public virtual bool RetainDeedHue => false;
@ -79,9 +78,9 @@ namespace Server.Items
if ( RetainDeedHue )
{
for ( int i = 0; hue == 0 && i < m_Components.Count; ++i )
for ( int i = 0; hue == 0 && i < Components.Count; ++i )
{
AddonComponent c = m_Components[i];
AddonComponent c = Components[i];
if ( c.Hue != 0 )
hue = c.Hue;
@ -108,7 +107,7 @@ namespace Server.Items
Item IAddon.Deed => Deed;
public List<AddonComponent> Components => m_Components;
public List<AddonComponent> Components { get; private set; }
public BaseAddon( Serial serial ) : base( serial )
{
@ -125,7 +124,7 @@ namespace Server.Items
if ( Deleted )
return AddonFitResult.Blocked;
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
{
Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
@ -152,7 +151,7 @@ namespace Server.Items
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
{
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
int addonHeight = c.ItemData.CalcHeight;
@ -207,7 +206,7 @@ namespace Server.Items
if ( Deleted )
return;
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
c.Location = new Point3D( X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z );
}
@ -216,7 +215,7 @@ namespace Server.Items
if ( Deleted )
return;
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
c.Map = Map;
}
@ -224,7 +223,7 @@ namespace Server.Items
{
base.OnAfterDelete();
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
c.Delete();
}
@ -240,9 +239,9 @@ namespace Server.Items
{
base.Hue = value;
if ( !Deleted && ShareHue && m_Components != null )
if ( !Deleted && ShareHue && Components != null )
{
foreach ( AddonComponent c in m_Components )
foreach ( AddonComponent c in Components )
c.Hue = value;
}
}
@ -255,7 +254,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.WriteItemList<AddonComponent>( m_Components );
writer.WriteItemList<AddonComponent>( Components );
}
public override void Deserialize( GenericReader reader )
@ -269,7 +268,7 @@ namespace Server.Items
case 1:
case 0:
{
m_Components = reader.ReadStrongItemList<AddonComponent>();
Components = reader.ReadStrongItemList<AddonComponent>();
break;
}
}

View file

@ -18,11 +18,11 @@ namespace Server.Items
{
base.Hue = value;
if ( !Deleted && ShareHue && m_Components != null )
if ( !Deleted && ShareHue && Components != null )
{
Hue = value;
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
c.Hue = value;
}
}
@ -55,15 +55,13 @@ namespace Server.Items
public virtual Point3D WallPosition => Point3D.Zero;
public virtual BaseAddonContainerDeed Deed => null;
private List<AddonContainerComponent> m_Components;
public List<AddonContainerComponent> Components => m_Components;
public List<AddonContainerComponent> Components { get; private set; }
public BaseAddonContainer( int itemID ) : base( itemID )
{
AddonComponent.ApplyLightTo( this );
m_Components = new List<AddonContainerComponent>();
Components = new List<AddonContainerComponent>();
}
public BaseAddonContainer( Serial serial ) : base( serial )
@ -77,7 +75,7 @@ namespace Server.Items
if ( Deleted )
return;
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
c.Location = new Point3D( X + c.Offset.X, Y + c.Offset.Y, Z + c.Offset.Z );
}
@ -88,7 +86,7 @@ namespace Server.Items
if ( Deleted )
return;
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
c.Map = Map;
}
@ -113,7 +111,7 @@ namespace Server.Items
{
base.OnAfterDelete();
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
c.Delete();
}
@ -123,7 +121,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.WriteItemList<AddonContainerComponent>( m_Components );
writer.WriteItemList<AddonContainerComponent>( Components );
writer.Write( (int) m_Resource );
}
@ -133,7 +131,7 @@ namespace Server.Items
int version = reader.ReadInt();
m_Components = reader.ReadStrongItemList<AddonContainerComponent>();
Components = reader.ReadStrongItemList<AddonContainerComponent>();
m_Resource = (CraftResource) reader.ReadInt();
AddonComponent.ApplyLightTo( this );
@ -150,7 +148,7 @@ namespace Server.Items
if ( Deleted )
return;
m_Components.Add( c );
Components.Add( c );
c.Addon = this;
c.Offset = new Point3D( x, y, z );
@ -162,7 +160,7 @@ namespace Server.Items
if ( Deleted )
return AddonFitResult.Blocked;
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
{
Point3D p3D = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
@ -209,7 +207,7 @@ namespace Server.Items
Point3D doorLoc = door.GetWorldLocation();
int doorHeight = door.ItemData.CalcHeight;
foreach ( AddonContainerComponent c in m_Components )
foreach ( AddonContainerComponent c in Components )
{
Point3D addonLoc = new Point3D( p.X + c.Offset.X, p.Y + c.Offset.Y, p.Z + c.Offset.Z );
int addonHeight = c.ItemData.CalcHeight;
@ -251,9 +249,9 @@ namespace Server.Items
if ( RetainDeedHue )
{
for ( int i = 0; hue == 0 && i < m_Components.Count; ++i )
for ( int i = 0; hue == 0 && i < Components.Count; ++i )
{
AddonContainerComponent c = m_Components[ i ];
AddonContainerComponent c = Components[ i ];
if ( c.Hue != 0 )
hue = c.Hue;

View file

@ -9,11 +9,7 @@ namespace Server.Items
{
public override BaseAddonDeed Deed => new LoomEastDeed();
private int m_Phase;
public int Phase{ get => m_Phase;
set => m_Phase = value;
}
public int Phase { get; set; }
[Constructible]
public LoomEastAddon()
@ -32,7 +28,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (int) m_Phase );
writer.Write( (int) Phase );
}
public override void Deserialize( GenericReader reader )
@ -45,7 +41,7 @@ namespace Server.Items
{
case 1:
{
m_Phase = reader.ReadInt();
Phase = reader.ReadInt();
break;
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Items
{
public override BaseAddonDeed Deed => new LoomSouthDeed();
private int m_Phase;
public int Phase{ get => m_Phase;
set => m_Phase = value;
}
public int Phase { get; set; }
[Constructible]
public LoomSouthAddon()
@ -27,7 +23,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (int) m_Phase );
writer.Write( (int) Phase );
}
public override void Deserialize( GenericReader reader )
@ -40,7 +36,7 @@ namespace Server.Items
{
case 1:
{
m_Phase = reader.ReadInt();
Phase = reader.ReadInt();
break;
}
}

View file

@ -5,32 +5,21 @@ namespace Server.Items
[Flippable( 0x1EC0, 0x1EC3 )]
public class PickpocketDip : AddonComponent
{
private double m_MinSkill;
private double m_MaxSkill;
private Timer m_Timer;
[CommandProperty( AccessLevel.GameMaster )]
public double MinSkill
{
get => m_MinSkill;
set => m_MinSkill = value;
}
public double MinSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public double MaxSkill
{
get => m_MaxSkill;
set => m_MaxSkill = value;
}
public double MaxSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Swinging => ( m_Timer != null );
public PickpocketDip( int itemID ) : base( itemID )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
public void UpdateItemID()
@ -65,7 +54,7 @@ namespace Server.Items
Effects.PlaySound( GetWorldLocation(), Map, 0x4F );
if ( from.CheckSkill( SkillName.Stealing, m_MinSkill, m_MaxSkill ) )
if ( from.CheckSkill( SkillName.Stealing, MinSkill, MaxSkill ) )
{
SendLocalizedMessageTo( from, 501834 ); // You successfully avoid disturbing the dip while searching it.
}
@ -85,7 +74,7 @@ namespace Server.Items
SendLocalizedMessageTo( from, 501816 ); // You are too far away to do that.
else if ( Swinging )
SendLocalizedMessageTo( from, 501815 ); // You have to wait until it stops swinging.
else if ( from.Skills[SkillName.Stealing].Base >= m_MaxSkill )
else if ( from.Skills[SkillName.Stealing].Base >= MaxSkill )
SendLocalizedMessageTo( from, 501830 ); // Your ability to steal cannot improve any further by simply practicing on a dummy.
else if ( from.Mounted )
SendLocalizedMessageTo( from, 501829 ); // You can't practice on this while on a mount.
@ -103,8 +92,8 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( m_MinSkill );
writer.Write( m_MaxSkill );
writer.Write( MinSkill );
writer.Write( MaxSkill );
}
public override void Deserialize( GenericReader reader )
@ -117,13 +106,13 @@ namespace Server.Items
{
case 0:
{
m_MinSkill = reader.ReadDouble();
m_MaxSkill = reader.ReadDouble();
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 )
if ( MinSkill == 0.0 && MaxSkill == 30.0 )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;

View file

@ -7,7 +7,6 @@ namespace Server.Items
{
private bool m_Active;
private SHTeleComponent m_TeleDest;
private Point3D m_TeleOffset;
[CommandProperty( AccessLevel.GameMaster )]
public bool Active
@ -23,17 +22,13 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Point3D TeleOffset
{
get => m_TeleOffset;
set => m_TeleOffset = value;
}
public Point3D TeleOffset { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D TelePoint
{
get => new Point3D( Location.X + TeleOffset.X, Location.Y + TeleOffset.Y, Location.Z + TeleOffset.Z );
set => m_TeleOffset = new Point3D( value.X - Location.X, value.Y - Location.Y, value.Z - Location.Z );
set => TeleOffset = new Point3D( value.X - Location.X, value.Y - Location.Y, value.Z - Location.Z );
}
[CommandProperty( AccessLevel.GameMaster )]
@ -68,7 +63,7 @@ namespace Server.Items
Hue = 1;
m_Active = true;
m_TeleOffset = offset;
TeleOffset = offset;
}
public SHTeleComponent( Serial serial ) : base( serial )
@ -108,7 +103,7 @@ namespace Server.Items
writer.Write( m_Active );
writer.Write( m_TeleDest );
writer.Write( m_TeleOffset );
writer.Write( TeleOffset );
}
public override void Deserialize( GenericReader reader )
@ -119,7 +114,7 @@ namespace Server.Items
m_Active = reader.ReadBool();
m_TeleDest = reader.ReadItem() as SHTeleComponent;
m_TeleOffset = reader.ReadPoint3D();
TeleOffset = reader.ReadPoint3D();
}
}
@ -276,22 +271,18 @@ namespace Server.Items
}
}
private bool m_External;
private SHTeleComponent m_UpTele;
private SHTeleComponent m_RightTele;
private SHTeleComponent m_DownTele;
private SHTeleComponent m_LeftTele;
private bool m_Changing;
[CommandProperty( AccessLevel.GameMaster )]
public bool External => m_External;
public bool External { get; private set; }
public SHTeleComponent UpTele => m_UpTele;
public SHTeleComponent RightTele => m_RightTele;
public SHTeleComponent DownTele => m_DownTele;
public SHTeleComponent LeftTele => m_LeftTele;
public SHTeleComponent UpTele { get; private set; }
public SHTeleComponent RightTele { get; private set; }
public SHTeleComponent DownTele { get; private set; }
public SHTeleComponent LeftTele { get; private set; }
[Constructible]
public SHTeleporter() : this( true )
@ -302,7 +293,7 @@ namespace Server.Items
public SHTeleporter( bool external )
{
m_Changing = false;
m_External = external;
External = external;
if ( external )
{
@ -325,20 +316,20 @@ namespace Server.Items
}
Point3D upOS = external ? new Point3D( -1, 0, 0 ) : new Point3D( -2, -1, 0 );
m_UpTele = new SHTeleComponent( external ? 0x1775 : 0x495, upOS );
AddComponent( m_UpTele, 0, 0, 0 );
UpTele = new SHTeleComponent( external ? 0x1775 : 0x495, upOS );
AddComponent( UpTele, 0, 0, 0 );
Point3D rightOS = external ? new Point3D( -2, 0, 0 ) : new Point3D( 2, -1, 0 );
m_RightTele = new SHTeleComponent( external ? 0x1775 : 0x495, rightOS );
AddComponent( m_RightTele, 1, 0, 0 );
RightTele = new SHTeleComponent( external ? 0x1775 : 0x495, rightOS );
AddComponent( RightTele, 1, 0, 0 );
Point3D downOS = external ? new Point3D( -2, -1, 0 ) : new Point3D( 2, 2, 0 );
m_DownTele = new SHTeleComponent( external ? 0x1776 : 0x495, downOS );
AddComponent( m_DownTele, 1, 1, 0 );
DownTele = new SHTeleComponent( external ? 0x1776 : 0x495, downOS );
AddComponent( DownTele, 1, 1, 0 );
Point3D leftOS = external ? new Point3D( -1, -1, 0 ) : new Point3D( -1, 2, 0 );
m_LeftTele = new SHTeleComponent( external ? 0x1775 : 0x495, leftOS );
AddComponent( m_LeftTele, 0, 1, 0 );
LeftTele = new SHTeleComponent( external ? 0x1775 : 0x495, leftOS );
AddComponent( LeftTele, 0, 1, 0 );
}
public SHTeleporter( Serial serial ) : base( serial )
@ -355,10 +346,10 @@ namespace Server.Items
m_Changing = true;
m_UpTele.Active = active;
m_RightTele.Active = active;
m_DownTele.Active = active;
m_LeftTele.Active = active;
UpTele.Active = active;
RightTele.Active = active;
DownTele.Active = active;
LeftTele.Active = active;
m_Changing = false;
}
@ -372,19 +363,19 @@ namespace Server.Items
if ( !(dest?.Addon is SHTeleporter) )
{
m_UpTele.TeleDest = dest;
m_RightTele.TeleDest = dest;
m_DownTele.TeleDest = dest;
m_LeftTele.TeleDest = dest;
UpTele.TeleDest = dest;
RightTele.TeleDest = dest;
DownTele.TeleDest = dest;
LeftTele.TeleDest = dest;
}
else
{
SHTeleporter destAddon = (SHTeleporter)dest.Addon;
m_UpTele.TeleDest = destAddon.UpTele;
m_RightTele.TeleDest = destAddon.RightTele;
m_DownTele.TeleDest = destAddon.DownTele;
m_LeftTele.TeleDest = destAddon.LeftTele;
UpTele.TeleDest = destAddon.UpTele;
RightTele.TeleDest = destAddon.RightTele;
DownTele.TeleDest = destAddon.DownTele;
LeftTele.TeleDest = destAddon.LeftTele;
}
m_Changing = false;
@ -399,17 +390,17 @@ namespace Server.Items
if ( destAddon != null )
{
m_UpTele.TeleDest = destAddon.UpTele;
m_RightTele.TeleDest = destAddon.RightTele;
m_DownTele.TeleDest = destAddon.DownTele;
m_LeftTele.TeleDest = destAddon.LeftTele;
UpTele.TeleDest = destAddon.UpTele;
RightTele.TeleDest = destAddon.RightTele;
DownTele.TeleDest = destAddon.DownTele;
LeftTele.TeleDest = destAddon.LeftTele;
}
else
{
m_UpTele.TeleDest = null;
m_RightTele.TeleDest = null;
m_DownTele.TeleDest = null;
m_LeftTele.TeleDest = null;
UpTele.TeleDest = null;
RightTele.TeleDest = null;
DownTele.TeleDest = null;
LeftTele.TeleDest = null;
}
m_Changing = false;
@ -421,12 +412,12 @@ namespace Server.Items
writer.Write( (int)0 ); // version
writer.Write( m_External );
writer.Write( External );
writer.Write( m_UpTele );
writer.Write( m_RightTele );
writer.Write( m_DownTele );
writer.Write( m_LeftTele );
writer.Write( UpTele );
writer.Write( RightTele );
writer.Write( DownTele );
writer.Write( LeftTele );
}
public override void Deserialize( GenericReader reader )
@ -435,12 +426,12 @@ namespace Server.Items
int version = reader.ReadInt();
m_External = reader.ReadBool();
External = reader.ReadBool();
m_UpTele = (SHTeleComponent)reader.ReadItem();
m_RightTele = (SHTeleComponent)reader.ReadItem();
m_DownTele = (SHTeleComponent)reader.ReadItem();
m_LeftTele = (SHTeleComponent)reader.ReadItem();
UpTele = (SHTeleComponent)reader.ReadItem();
RightTele = (SHTeleComponent)reader.ReadItem();
DownTele = (SHTeleComponent)reader.ReadItem();
LeftTele = (SHTeleComponent)reader.ReadItem();
}
}
}

View file

@ -5,24 +5,13 @@ namespace Server.Items
[Flippable( 0x1070, 0x1074 )]
public class TrainingDummy : AddonComponent
{
private double m_MinSkill;
private double m_MaxSkill;
private Timer m_Timer;
[CommandProperty( AccessLevel.GameMaster )]
public double MinSkill
{
get => m_MinSkill;
set => m_MinSkill = value;
}
public double MinSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public double MaxSkill
{
get => m_MaxSkill;
set => m_MaxSkill = value;
}
public double MaxSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Swinging => ( m_Timer != null );
@ -35,8 +24,8 @@ namespace Server.Items
[Constructible]
public TrainingDummy( int itemID ) : base( itemID )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
public void UpdateItemID()
@ -76,7 +65,7 @@ namespace Server.Items
from.Direction = from.GetDirectionTo( GetWorldLocation() );
weapon.PlaySwingAnimation( from );
from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill );
from.CheckSkill( weapon.Skill, MinSkill, MaxSkill );
}
public override void OnDoubleClick( Mobile from )
@ -89,7 +78,7 @@ namespace Server.Items
SendLocalizedMessageTo( from, 501816 ); // You are too far away to do that.
else if ( Swinging )
SendLocalizedMessageTo( from, 501815 ); // You have to wait until it stops swinging.
else if ( from.Skills[weapon.Skill].Base >= m_MaxSkill )
else if ( from.Skills[weapon.Skill].Base >= MaxSkill )
SendLocalizedMessageTo( from, 501828 ); // Your skill cannot improve any further by simply practicing with a dummy.
else if ( from.Mounted )
SendLocalizedMessageTo( from, 501829 ); // You can't practice on this while on a mount.
@ -107,8 +96,8 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( m_MinSkill );
writer.Write( m_MaxSkill );
writer.Write( MinSkill );
writer.Write( MaxSkill );
}
public override void Deserialize( GenericReader reader )
@ -121,13 +110,13 @@ namespace Server.Items
{
case 0:
{
m_MinSkill = reader.ReadDouble();
m_MaxSkill = reader.ReadDouble();
MinSkill = reader.ReadDouble();
MaxSkill = reader.ReadDouble();
if ( m_MinSkill == 0.0 && m_MaxSkill == 30.0 )
if ( MinSkill == 0.0 && MaxSkill == 30.0 )
{
m_MinSkill = -25.0;
m_MaxSkill = +25.0;
MinSkill = -25.0;
MaxSkill = +25.0;
}
break;

View file

@ -11,10 +11,9 @@ namespace Server.Items
public static readonly TimeSpan EvaluationInterval = TimeSpan.FromDays( 1 );
// items info
private int m_LiveCreatures;
[CommandProperty( AccessLevel.GameMaster )]
public int LiveCreatures => m_LiveCreatures;
public int LiveCreatures { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DeadCreatures
@ -88,11 +87,10 @@ namespace Server.Items
public bool OptimalState => ( m_Food.State == (int) FoodState.Full && m_Water.State == (int) WaterState.Strong );
// events
private List<int> m_Events;
private bool m_RewardAvailable;
private bool m_EvaluateDay;
public List<int> Events => m_Events;
public List<int> Events { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool RewardAvailable
@ -139,7 +137,7 @@ namespace Server.Items
m_Water.Maintain = Utility.RandomMinMax( 1, 3 );
m_Events = new List<int>();
Events = new List<int>();
m_Timer = Timer.DelayCall( EvaluationInterval, EvaluationInterval, Evaluate );
}
@ -293,21 +291,21 @@ namespace Server.Items
if ( m_VacationLeft > 0 )
LabelTo( from, 1074430, m_VacationLeft.ToString() ); // Vacation days left: ~1_DAYS
if ( m_Events.Count > 0 )
LabelTo( from, 1074426, m_Events.Count.ToString() ); // ~1_NUM~ event(s) to view!
if ( Events.Count > 0 )
LabelTo( from, 1074426, Events.Count.ToString() ); // ~1_NUM~ event(s) to view!
if ( m_RewardAvailable )
LabelTo( from, 1074362 ); // A reward is available!
LabelTo( from, 1074247, $"{m_LiveCreatures}\t{MaxLiveCreatures}"); // Live Creatures: ~1_NUM~ / ~2_MAX~
LabelTo( from, 1074247, $"{LiveCreatures}\t{MaxLiveCreatures}"); // Live Creatures: ~1_NUM~ / ~2_MAX~
if ( DeadCreatures > 0 )
LabelTo( from, 1074248, DeadCreatures.ToString() ); // Dead Creatures: ~1_NUM~
int decorations = Items.Count - m_LiveCreatures - DeadCreatures;
int decorations = Items.Count - LiveCreatures - DeadCreatures;
if ( decorations > 0 )
LabelTo( from, 1074249, (Items.Count - m_LiveCreatures - DeadCreatures).ToString() ); // Decorations: ~1_NUM~
LabelTo( from, 1074249, (Items.Count - LiveCreatures - DeadCreatures).ToString() ); // Decorations: ~1_NUM~
LabelTo( from, 1074250, "#" + FoodNumber() ); // Food state: ~1_STATE~
LabelTo( from, 1074251, "#" + WaterNumber() ); // Water state: ~1_STATE~
@ -334,20 +332,20 @@ namespace Server.Items
if ( m_VacationLeft > 0 )
list.Add( 1074430, m_VacationLeft.ToString() ); // Vacation days left: ~1_DAYS
if ( m_Events.Count > 0 )
list.Add( 1074426, m_Events.Count.ToString() ); // ~1_NUM~ event(s) to view!
if ( Events.Count > 0 )
list.Add( 1074426, Events.Count.ToString() ); // ~1_NUM~ event(s) to view!
if ( m_RewardAvailable )
list.Add( 1074362 ); // A reward is available!
list.Add( 1074247, "{0}\t{1}", m_LiveCreatures, MaxLiveCreatures ); // Live Creatures: ~1_NUM~ / ~2_MAX~
list.Add( 1074247, "{0}\t{1}", LiveCreatures, MaxLiveCreatures ); // Live Creatures: ~1_NUM~ / ~2_MAX~
int dead = DeadCreatures;
if ( dead > 0 )
list.Add( 1074248, dead.ToString() ); // Dead Creatures: ~1_NUM~
int decorations = Items.Count - m_LiveCreatures - dead;
int decorations = Items.Count - LiveCreatures - dead;
if ( decorations > 0 )
list.Add( 1074249, decorations.ToString() ); // Decorations: ~1_NUM~
@ -383,7 +381,7 @@ namespace Server.Items
if ( m_RewardAvailable )
list.Add( new CollectRewardEntry( this ) );
if ( m_Events.Count > 0 )
if ( Events.Count > 0 )
list.Add( new ViewEventEntry( this ) );
if ( m_VacationLeft > 0 )
@ -414,16 +412,16 @@ namespace Server.Items
writer.Write( DateTime.UtcNow + EvaluationInterval );
// version 0
writer.Write( (int) m_LiveCreatures );
writer.Write( (int) LiveCreatures );
writer.Write( (int) m_VacationLeft );
m_Food.Serialize( writer );
m_Water.Serialize( writer );
writer.Write( (int) m_Events.Count );
writer.Write( (int) Events.Count );
for ( int i = 0; i < m_Events.Count; i ++ )
writer.Write( (int) m_Events[ i ] );
for ( int i = 0; i < Events.Count; i ++ )
writer.Write( (int) Events[ i ] );
writer.Write( (bool) m_RewardAvailable );
}
@ -451,7 +449,7 @@ namespace Server.Items
}
case 0:
{
m_LiveCreatures = reader.ReadInt();
LiveCreatures = reader.ReadInt();
m_VacationLeft = reader.ReadInt();
m_Food = new AquariumState();
@ -460,12 +458,12 @@ namespace Server.Items
m_Food.Deserialize( reader );
m_Water.Deserialize( reader );
m_Events = new List<int>();
Events = new List<int>();
int count = reader.ReadInt();
for ( int i = 0; i < count; i ++ )
m_Events.Add( reader.ReadInt() );
Events.Add( reader.ReadInt() );
m_RewardAvailable = reader.ReadBool();
@ -485,13 +483,13 @@ namespace Server.Items
private void RecountLiveCreatures()
{
m_LiveCreatures = 0;
LiveCreatures = 0;
List<BaseFish> fish = FindItemsByType<BaseFish>();
foreach ( BaseFish f in fish )
{
if ( !f.Dead )
++m_LiveCreatures;
++LiveCreatures;
}
}
@ -543,12 +541,12 @@ namespace Server.Items
toKill.RemoveAt( kill );
amount -= 1;
m_LiveCreatures -= 1;
LiveCreatures -= 1;
if ( m_LiveCreatures < 0 )
m_LiveCreatures = 0;
if ( LiveCreatures < 0 )
LiveCreatures = 0;
m_Events.Add( 1074366 ); // An unfortunate accident has left a creature floating upside-down. It is starting to smell.
Events.Add( 1074366 ); // An unfortunate accident has left a creature floating upside-down. It is starting to smell.
}
}
@ -561,41 +559,41 @@ namespace Server.Items
else if ( m_EvaluateDay )
{
// reset events
m_Events = new List<int>();
Events = new List<int>();
// 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_Events.Add( 1074368 ); // The tank looks worse than it did yesterday.
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_Events.Add( 1074367 ); // The tank looks healthier today.
Events.Add( 1074367 ); // The tank looks healthier today.
// water events
if ( m_Water.Added < m_Water.Maintain && m_Water.State != (int) WaterState.Dead )
m_Events.Add( 1074370 ); // This tank can use more water.
Events.Add( 1074370 ); // This tank can use more water.
if ( m_Water.Added >= m_Water.Improve && m_Water.State != (int) WaterState.Strong )
m_Events.Add( 1074369 ); // The water looks clearer today.
Events.Add( 1074369 ); // The water looks clearer today.
UpdateFoodState();
UpdateWaterState();
// reward
if ( m_LiveCreatures > 0 )
if ( LiveCreatures > 0 )
m_RewardAvailable = true;
}
else
{
// new fish
if ( OptimalState && m_LiveCreatures < MaxLiveCreatures )
if ( OptimalState && LiveCreatures < MaxLiveCreatures )
{
if ( Utility.RandomDouble() < 0.005 * m_LiveCreatures )
if ( Utility.RandomDouble() < 0.005 * LiveCreatures )
{
BaseFish fish = null;
int message = 0;
@ -641,26 +639,26 @@ namespace Server.Items
}
if ( Utility.RandomDouble() < 0.05 )
fish.Hue = m_FishHues[ Utility.Random( m_FishHues.Length ) ];
fish.Hue = FishHues[ Utility.Random( FishHues.Length ) ];
else if ( Utility.RandomDouble() < 0.5 )
fish.Hue = Utility.RandomMinMax( 0x100, 0x3E5 );
if ( AddFish( fish ) )
m_Events.Add( message );
Events.Add( message );
else
fish.Delete();
}
}
// kill fish *grins*
if ( m_LiveCreatures < MaxLiveCreatures )
if ( LiveCreatures < MaxLiveCreatures )
{
if ( Utility.RandomDouble() < 0.01 )
KillFish( 1 );
}
else
{
KillFish( m_LiveCreatures - MaxLiveCreatures );
KillFish( LiveCreatures - MaxLiveCreatures );
}
}
@ -673,7 +671,7 @@ namespace Server.Items
if ( !m_RewardAvailable )
return;
int max = (int) ( ( (double) m_LiveCreatures / 30 ) * m_Decorations.Length );
int max = (int) ( ( (double) LiveCreatures / 30 ) * m_Decorations.Length );
int random = ( max <= 0 ) ? 0 : Utility.Random( max );
@ -778,7 +776,7 @@ namespace Server.Items
}
if ( !fish.Dead )
m_LiveCreatures -= 1;
LiveCreatures -= 1;
}
else
{
@ -819,7 +817,7 @@ namespace Server.Items
if ( fish == null )
return false;
if ( IsFull || m_LiveCreatures >= MaxLiveCreatures || fish.Dead )
if ( IsFull || LiveCreatures >= MaxLiveCreatures || fish.Dead )
{
from?.SendLocalizedMessage( 1073633 ); // The aquarium can not hold the creature.
@ -829,7 +827,7 @@ namespace Server.Items
AddItem( fish );
fish.StopTimer();
m_LiveCreatures += 1;
LiveCreatures += 1;
from?.SendLocalizedMessage( 1073632, $"#{fish.LabelNumber}"); // You add the following creature to your aquarium: ~1_FISH~
@ -920,12 +918,11 @@ namespace Server.Items
return false;
}
private static int[] m_FishHues = {
public static int[] FishHues { get; } =
{
0x1C2, 0x1C3, 0x2A3, 0x47E, 0x51D
};
public static int[] FishHues => m_FishHues;
#endregion
#region Context entries

View file

@ -22,9 +22,6 @@ namespace Server.Items
public class AquariumState
{
private int m_State;
private int m_Maintain;
private int m_Improve;
private int m_Added;
[CommandProperty( AccessLevel.GameMaster )]
public int State
@ -43,25 +40,13 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int Maintain
{
get => m_Maintain;
set => m_Maintain = value;
}
public int Maintain { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Improve
{
get => m_Improve;
set => m_Improve = value;
}
public int Improve { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Added
{
get => m_Added;
set => m_Added = value;
}
public int Added { get; set; }
public AquariumState()
{
@ -77,9 +62,9 @@ namespace Server.Items
writer.Write( 0 ); // version
writer.Write( m_State );
writer.Write( m_Maintain );
writer.Write( m_Improve );
writer.Write( m_Added );
writer.Write( Maintain );
writer.Write( Improve );
writer.Write( Added );
}
public virtual void Deserialize( GenericReader reader )
@ -87,9 +72,9 @@ namespace Server.Items
int version = reader.ReadInt();
m_State = reader.ReadInt();
m_Maintain = reader.ReadInt();
m_Improve = reader.ReadInt();
m_Added = reader.ReadInt();
Maintain = reader.ReadInt();
Improve = reader.ReadInt();
Added = reader.ReadInt();
}
}
}

View file

@ -54,7 +54,7 @@ namespace Server.Items
private ArmorDurabilityLevel m_Durability;
private ArmorProtectionLevel m_Protection;
private CraftResource m_Resource;
private bool m_Identified, m_PlayerConstructed;
private bool m_Identified;
private int m_PhysicalBonus, m_FireBonus, m_ColdBonus, m_PoisonBonus, m_EnergyBonus;
private AosAttributes m_AosAttributes;
@ -213,11 +213,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public bool PlayerConstructed
{
get => m_PlayerConstructed;
set => m_PlayerConstructed = value;
}
public bool PlayerConstructed { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public CraftResource Resource
@ -252,8 +248,8 @@ namespace Server.Items
{
int pos = (int)BodyPosition;
if ( pos >= 0 && pos < m_ArmorScalars.Length )
return m_ArmorScalars[pos];
if ( pos >= 0 && pos < ArmorScalars.Length )
return ArmorScalars[pos];
return 1.0;
}
@ -548,7 +544,7 @@ namespace Server.Items
{
Item res = (Item)Activator.CreateInstance( CraftResources.GetInfo( m_Resource ).ResourceTypes[0] );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
ScissorHelper( from, res, PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
return true;
}
catch
@ -560,13 +556,7 @@ namespace Server.Items
return false;
}
private static double[] m_ArmorScalars = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 };
public static double[] ArmorScalars
{
get => m_ArmorScalars;
set => m_ArmorScalars = value;
}
public static double[] ArmorScalars { get; set; } = { 0.07, 0.07, 0.14, 0.15, 0.22, 0.35 };
public static void ValidateMobile( Mobile m )
{
@ -734,7 +724,7 @@ namespace Server.Items
SetSaveFlag( ref flags, SaveFlag.IntReq, m_IntReq != -1 );
SetSaveFlag( ref flags, SaveFlag.MedAllowance, m_Meditate != (AMA)(-1) );
SetSaveFlag( ref flags, SaveFlag.SkillBonuses, !m_AosSkillBonuses.IsEmpty );
SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false );
SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, PlayerConstructed != false );
writer.WriteEncodedInt( (int) flags );
@ -935,7 +925,7 @@ namespace Server.Items
m_AosSkillBonuses = new AosSkillBonuses( this, reader );
if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
m_PlayerConstructed = true;
PlayerConstructed = true;
break;
}
@ -1091,7 +1081,7 @@ namespace Server.Items
m?.CheckStatTimers();
if ( version < 7 )
m_PlayerConstructed = true; // we don't know, so, assume it's crafted
PlayerConstructed = true; // we don't know, so, assume it's crafted
}
public virtual CraftResource DefaultResource => CraftResource.Iron;

View file

@ -11,40 +11,29 @@ namespace Server.Items
public class Head : Item
{
private string m_PlayerName;
private HeadType m_HeadType;
[CommandProperty( AccessLevel.GameMaster )]
public string PlayerName { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public string PlayerName
{
get => m_PlayerName;
set => m_PlayerName = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public HeadType HeadType
{
get => m_HeadType;
set => m_HeadType = value;
}
public HeadType HeadType { get; set; }
public override string DefaultName
{
get
{
if ( m_PlayerName == null )
if ( PlayerName == null )
return base.DefaultName;
switch ( m_HeadType )
switch ( HeadType )
{
default:
return $"the head of {m_PlayerName}";
return $"the head of {PlayerName}";
case HeadType.Duel:
return $"the head of {m_PlayerName}, taken in a duel";
return $"the head of {PlayerName}, taken in a duel";
case HeadType.Tournament:
return $"the head of {m_PlayerName}, taken in a tournament";
return $"the head of {PlayerName}, taken in a tournament";
}
}
}
@ -65,8 +54,8 @@ namespace Server.Items
public Head( HeadType headType, string playerName )
: base( 0x1DA0 )
{
m_HeadType = headType;
m_PlayerName = playerName;
HeadType = headType;
PlayerName = playerName;
}
public Head( Serial serial )
@ -80,8 +69,8 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (string) m_PlayerName );
writer.WriteEncodedInt( (int) m_HeadType );
writer.Write( (string) PlayerName );
writer.WriteEncodedInt( (int) HeadType );
}
public override void Deserialize( GenericReader reader )
@ -93,8 +82,8 @@ namespace Server.Items
switch ( version )
{
case 1:
m_PlayerName = reader.ReadString();
m_HeadType = (HeadType) reader.ReadEncodedInt();
PlayerName = reader.ReadString();
HeadType = (HeadType) reader.ReadEncodedInt();
break;
case 0:
@ -108,16 +97,16 @@ namespace Server.Items
if ( format.EndsWith( ", taken in a duel" ) )
{
format = format.Substring( 0, format.Length - ", taken in a duel".Length );
m_HeadType = HeadType.Duel;
HeadType = HeadType.Duel;
}
else if ( format.EndsWith( ", taken in a tournament" ) )
{
format = format.Substring( 0, format.Length - ", taken in a tournament".Length );
m_HeadType = HeadType.Tournament;
HeadType = HeadType.Tournament;
}
}
m_PlayerName = format;
PlayerName = format;
Name = null;
break;

View file

@ -11,40 +11,34 @@ namespace Server.Items
{
public class BookPageInfo
{
private string[] m_Lines;
public string[] Lines
{
get => m_Lines;
set => m_Lines = value;
}
public string[] Lines { get; set; }
public BookPageInfo()
{
m_Lines = new string[0];
Lines = new string[0];
}
public BookPageInfo( params string[] lines )
{
m_Lines = lines;
Lines = lines;
}
public BookPageInfo( GenericReader reader )
{
int length = reader.ReadInt();
m_Lines = new string[length];
Lines = new string[length];
for ( int i = 0; i < m_Lines.Length; ++i )
m_Lines[i] = Utility.Intern( reader.ReadString() );
for ( int i = 0; i < Lines.Length; ++i )
Lines[i] = Utility.Intern( reader.ReadString() );
}
public void Serialize( GenericWriter writer )
{
writer.Write( m_Lines.Length );
writer.Write( Lines.Length );
for ( int i = 0; i < m_Lines.Length; ++i )
writer.Write( m_Lines[i] );
for ( int i = 0; i < Lines.Length; ++i )
writer.Write( Lines[i] );
}
}
@ -52,9 +46,6 @@ namespace Server.Items
{
private string m_Title;
private string m_Author;
private BookPageInfo[] m_Pages;
private bool m_Writable;
private SecureLevel m_SecureLevel;
[CommandProperty( AccessLevel.GameMaster )]
public string Title
@ -71,16 +62,12 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Writable
{
get => m_Writable;
set => m_Writable = value;
}
public bool Writable { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int PagesCount => m_Pages.Length;
public int PagesCount => Pages.Length;
public BookPageInfo[] Pages => m_Pages;
public BookPageInfo[] Pages { get; private set; }
[Constructible]
public BaseBook( int itemID ) : this( itemID, 20, true )
@ -97,39 +84,39 @@ namespace Server.Items
{
m_Title = title;
m_Author = author;
m_Writable = writable;
Writable = writable;
BookContent content = DefaultContent;
if ( content == null )
{
m_Pages = new BookPageInfo[pageCount];
Pages = new BookPageInfo[pageCount];
for ( int i = 0; i < m_Pages.Length; ++i )
m_Pages[i] = new BookPageInfo();
for ( int i = 0; i < Pages.Length; ++i )
Pages[i] = new BookPageInfo();
}
else
{
m_Pages = content.Copy();
Pages = content.Copy();
}
}
// Intended for defined books only
public BaseBook( int itemID, bool writable ) : base( itemID )
{
m_Writable = writable;
Writable = writable;
BookContent content = DefaultContent;
if ( content == null )
{
m_Pages = new BookPageInfo[0];
Pages = new BookPageInfo[0];
}
else
{
m_Title = content.Title;
m_Author = content.Author;
m_Pages = content.Copy();
Pages = content.Copy();
}
}
@ -169,17 +156,17 @@ namespace Server.Items
if ( m_Author != content?.Author )
flags |= SaveFlags.Author;
if ( m_Writable )
if ( Writable )
flags |= SaveFlags.Writable;
if ( content == null || !content.IsMatch( m_Pages ) )
if ( content == null || !content.IsMatch( Pages ) )
flags |= SaveFlags.Content;
writer.Write( (int) 4 ); // version
writer.Write( (int)m_SecureLevel );
writer.Write( (int)Level );
writer.Write( (byte) flags );
@ -191,10 +178,10 @@ namespace Server.Items
if ( (flags & SaveFlags.Content) != 0 )
{
writer.WriteEncodedInt( m_Pages.Length );
writer.WriteEncodedInt( Pages.Length );
for ( int i = 0; i < m_Pages.Length; ++i )
m_Pages[i].Serialize( writer );
for ( int i = 0; i < Pages.Length; ++i )
Pages[i].Serialize( writer );
}
}
@ -208,7 +195,7 @@ namespace Server.Items
{
case 4:
{
m_SecureLevel = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 3;
}
case 3:
@ -228,21 +215,21 @@ namespace Server.Items
else if ( content != null )
m_Author = content.Author;
m_Writable = ( flags & SaveFlags.Writable ) != 0;
Writable = ( flags & SaveFlags.Writable ) != 0;
if ( (flags & SaveFlags.Content) != 0 )
{
m_Pages = new BookPageInfo[reader.ReadEncodedInt()];
Pages = new BookPageInfo[reader.ReadEncodedInt()];
for ( int i = 0; i < m_Pages.Length; ++i )
m_Pages[i] = new BookPageInfo( reader );
for ( int i = 0; i < Pages.Length; ++i )
Pages[i] = new BookPageInfo( reader );
}
else
{
if ( content != null )
m_Pages = content.Copy();
Pages = content.Copy();
else
m_Pages = new BookPageInfo[0];
Pages = new BookPageInfo[0];
}
break;
@ -252,23 +239,23 @@ namespace Server.Items
{
m_Title = reader.ReadString();
m_Author = reader.ReadString();
m_Writable = reader.ReadBool();
Writable = reader.ReadBool();
if ( version == 0 || reader.ReadBool() )
{
m_Pages = new BookPageInfo[reader.ReadInt()];
Pages = new BookPageInfo[reader.ReadInt()];
for ( int i = 0; i < m_Pages.Length; ++i )
m_Pages[i] = new BookPageInfo( reader );
for ( int i = 0; i < Pages.Length; ++i )
Pages[i] = new BookPageInfo( reader );
}
else
{
BookContent content = DefaultContent;
if ( content != null )
m_Pages = content.Copy();
Pages = content.Copy();
else
m_Pages = new BookPageInfo[0];
Pages = new BookPageInfo[0];
}
break;
@ -304,12 +291,12 @@ namespace Server.Items
public override void OnSingleClick ( Mobile from )
{
LabelTo( from, "{0} by {1}", m_Title, m_Author );
LabelTo( from, "[{0} pages]", m_Pages.Length );
LabelTo( from, "[{0} pages]", Pages.Length );
}
public override void OnDoubleClick ( Mobile from )
{
if ( m_Title == null && m_Author == null && m_Writable == true )
if ( m_Title == null && m_Author == null && Writable == true )
{
Title = "a book";
Author = from.Name;
@ -325,7 +312,7 @@ namespace Server.Items
{
StringBuilder sb = new StringBuilder();
foreach( BookPageInfo bpi in m_Pages )
foreach( BookPageInfo bpi in Pages )
{
foreach( string line in bpi.Lines )
{
@ -343,7 +330,7 @@ namespace Server.Items
{
List<string> lines = new List<string>();
foreach( BookPageInfo bpi in m_Pages )
foreach( BookPageInfo bpi in Pages )
{
lines.AddRange( bpi.Lines );
}
@ -449,11 +436,7 @@ namespace Server.Items
#region ISecurable Members
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_SecureLevel;
set => m_SecureLevel = value;
}
public SecureLevel Level { get; set; }
#endregion
}

View file

@ -2,41 +2,37 @@ namespace Server.Items
{
public class BookContent
{
private string m_Title;
private string m_Author;
public string Title { get; }
private BookPageInfo[] m_Pages;
public string Author { get; }
public string Title => m_Title;
public string Author => m_Author;
public BookPageInfo[] Pages => m_Pages;
public BookPageInfo[] Pages { get; }
public BookContent( string title, string author, params BookPageInfo[] pages )
{
m_Title = title;
m_Author = author;
m_Pages = pages;
Title = title;
Author = author;
Pages = pages;
}
public BookPageInfo[] Copy()
{
BookPageInfo[] copy = new BookPageInfo[m_Pages.Length];
BookPageInfo[] copy = new BookPageInfo[Pages.Length];
for ( int i = 0; i < copy.Length; ++i )
copy[i] = new BookPageInfo( m_Pages[i].Lines );
copy[i] = new BookPageInfo( Pages[i].Lines );
return copy;
}
public bool IsMatch( BookPageInfo[] cmp )
{
if ( cmp.Length != m_Pages.Length )
if ( cmp.Length != Pages.Length )
return false;
for ( int i = 0; i < cmp.Length; ++i )
{
string[] a = m_Pages[i].Lines;
string[] a = Pages[i].Lines;
string[] b = cmp[i].Lines;
if ( a.Length != b.Length )

View file

@ -46,7 +46,6 @@ namespace Server.Items
private int m_HitPoints;
private Mobile m_Crafter;
private ClothingQuality m_Quality;
private bool m_PlayerConstructed;
protected CraftResource m_Resource;
private int m_StrReq = -1;
@ -104,11 +103,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public bool PlayerConstructed
{
get => m_PlayerConstructed;
set => m_PlayerConstructed = value;
}
public bool PlayerConstructed { get; set; }
public virtual CraftResource DefaultResource => CraftResource.None;
@ -744,7 +739,7 @@ namespace Server.Items
SetSaveFlag( ref flags, SaveFlag.Resistances, !m_AosResistances.IsEmpty );
SetSaveFlag( ref flags, SaveFlag.MaxHitPoints, m_MaxHitPoints != 0 );
SetSaveFlag( ref flags, SaveFlag.HitPoints, m_HitPoints != 0 );
SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, m_PlayerConstructed != false );
SetSaveFlag( ref flags, SaveFlag.PlayerConstructed, PlayerConstructed != false );
SetSaveFlag( ref flags, SaveFlag.Crafter, m_Crafter != null );
SetSaveFlag( ref flags, SaveFlag.Quality, m_Quality != ClothingQuality.Regular );
SetSaveFlag( ref flags, SaveFlag.StrReq, m_StrReq != -1 );
@ -839,7 +834,7 @@ namespace Server.Items
m_StrReq = -1;
if ( GetSaveFlag( flags, SaveFlag.PlayerConstructed ) )
m_PlayerConstructed = true;
PlayerConstructed = true;
break;
}
@ -860,7 +855,7 @@ namespace Server.Items
}
case 2:
{
m_PlayerConstructed = reader.ReadBool();
PlayerConstructed = reader.ReadBool();
goto case 1;
}
case 1:
@ -878,7 +873,7 @@ namespace Server.Items
}
if ( version < 2 )
m_PlayerConstructed = true; // we don't know, so, assume it's crafted
PlayerConstructed = true; // we don't know, so, assume it's crafted
if ( version < 3 )
{
@ -951,7 +946,7 @@ namespace Server.Items
Item res = (Item)Activator.CreateInstance( resourceType );
ScissorHelper( from, res, m_PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
ScissorHelper( from, res, PlayerConstructed ? (item.Resources.GetAt( 0 ).Amount / 2) : 1 );
res.LootType = LootType.Regular;

View file

@ -156,14 +156,9 @@ namespace Server.Items
public class RewardCloak : BaseCloak, IRewardItem
{
private int m_LabelNumber;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Number
@ -211,7 +206,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward
}
@ -220,7 +215,7 @@ namespace Server.Items
if ( !base.CanEquip( m ) )
return false;
return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
}
[Constructible]
@ -253,7 +248,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (int) m_LabelNumber );
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -267,7 +262,7 @@ namespace Server.Items
case 0:
{
m_LabelNumber = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -7,14 +7,8 @@ namespace Server.Items
{
public abstract class BaseHat : BaseClothing, IShipwreckedItem
{
private bool m_IsShipwreckedItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsShipwreckedItem
{
get => m_IsShipwreckedItem;
set => m_IsShipwreckedItem = value;
}
public bool IsShipwreckedItem { get; set; }
public BaseHat( int itemID ) : this( itemID, 0 )
{
@ -34,7 +28,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( m_IsShipwreckedItem );
writer.Write( IsShipwreckedItem );
}
public override void Deserialize( GenericReader reader )
@ -47,7 +41,7 @@ namespace Server.Items
{
case 1:
{
m_IsShipwreckedItem = reader.ReadBool();
IsShipwreckedItem = reader.ReadBool();
break;
}
}
@ -57,7 +51,7 @@ namespace Server.Items
{
base.AddEquipInfoAttributes( from, attrs );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
attrs.Add( new EquipInfoAttribute( 1041645 ) ); // recovered from a shipwreck
}
@ -65,7 +59,7 @@ namespace Server.Items
{
base.AddNameProperties( list );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
list.Add( 1041645 ); // recovered from a shipwreck
}

View file

@ -231,14 +231,9 @@ namespace Server.Items
public class RewardRobe : BaseOuterTorso, IRewardItem
{
private int m_LabelNumber;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Number
@ -286,7 +281,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward
}
@ -295,7 +290,7 @@ namespace Server.Items
if ( !base.CanEquip( m ) )
return false;
return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
}
[Constructible]
@ -328,7 +323,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (int) m_LabelNumber );
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -342,7 +337,7 @@ namespace Server.Items
case 0:
{
m_LabelNumber = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}
@ -356,14 +351,9 @@ namespace Server.Items
public class RewardDress : BaseOuterTorso, IRewardItem
{
private int m_LabelNumber;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Number
@ -411,7 +401,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( m_IsRewardItem )
if ( IsRewardItem )
list.Add( RewardSystem.GetRewardYearLabel( this, new object[]{ Hue, m_LabelNumber } ) ); // X Year Veteran Reward
}
@ -420,7 +410,7 @@ namespace Server.Items
if ( !base.CanEquip( m ) )
return false;
return !m_IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
return !IsRewardItem || RewardSystem.CheckIsUsableBy( m, this, new object[]{ Hue, m_LabelNumber } );
}
[Constructible]
@ -453,7 +443,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (int) m_LabelNumber );
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -467,7 +457,7 @@ namespace Server.Items
case 0:
{
m_LabelNumber = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -8,12 +8,8 @@ namespace Server.Items
{
public abstract class BaseDoor : Item, ILockable, ITelekinesisable
{
private bool m_Open, m_Locked;
private int m_OpenedID, m_OpenedSound;
private int m_ClosedID, m_ClosedSound;
private Point3D m_Offset;
private bool m_Open;
private BaseDoor m_Link;
private uint m_KeyValue;
private Timer m_Timer;
@ -195,18 +191,10 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Locked
{
get => m_Locked;
set => m_Locked = value;
}
public bool Locked { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public uint KeyValue
{
get => m_KeyValue;
set => m_KeyValue = value;
}
public uint KeyValue { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Open
@ -218,14 +206,14 @@ namespace Server.Items
{
m_Open = value;
ItemID = m_Open ? m_OpenedID : m_ClosedID;
ItemID = m_Open ? OpenedID : ClosedID;
if ( m_Open )
Location = new Point3D( X + m_Offset.X, Y + m_Offset.Y, Z + m_Offset.Z );
Location = new Point3D( X + Offset.X, Y + Offset.Y, Z + Offset.Z );
else
Location = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z );
Location = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z );
Effects.PlaySound( this, Map, m_Open ? m_OpenedSound : m_ClosedSound );
Effects.PlaySound( this, Map, m_Open ? OpenedSound : ClosedSound );
if ( m_Open )
m_Timer.Start();
@ -245,7 +233,7 @@ namespace Server.Items
if ( map == null )
return false;
Point3D p = new Point3D( X - m_Offset.X, Y - m_Offset.Y, Z - m_Offset.Z );
Point3D p = new Point3D( X - Offset.X, Y - Offset.Y, Z - Offset.Z );
return CheckFit( map, p, 16 );
}
@ -299,39 +287,19 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int OpenedID
{
get => m_OpenedID;
set => m_OpenedID = value;
}
public int OpenedID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ClosedID
{
get => m_ClosedID;
set => m_ClosedID = value;
}
public int ClosedID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int OpenedSound
{
get => m_OpenedSound;
set => m_OpenedSound = value;
}
public int OpenedSound { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ClosedSound
{
get => m_ClosedSound;
set => m_ClosedSound = value;
}
public int ClosedSound { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Offset
{
get => m_Offset;
set => m_Offset = value;
}
public Point3D Offset { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public BaseDoor Link
@ -397,7 +365,7 @@ namespace Server.Items
public virtual void Use( Mobile from )
{
if ( m_Locked && !m_Open && UseLocks() )
if ( Locked && !m_Open && UseLocks() )
{
if ( from.AccessLevel >= AccessLevel.GameMaster )
{
@ -469,11 +437,11 @@ namespace Server.Items
public BaseDoor( int closedID, int openedID, int openedSound, int closedSound, Point3D offset ) : base( closedID )
{
m_OpenedID = openedID;
m_ClosedID = closedID;
m_OpenedSound = openedSound;
m_ClosedSound = closedSound;
m_Offset = offset;
OpenedID = openedID;
ClosedID = closedID;
OpenedSound = openedSound;
ClosedSound = closedSound;
Offset = offset;
m_Timer = new InternalTimer( this );
@ -490,15 +458,15 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( m_KeyValue );
writer.Write( KeyValue );
writer.Write( m_Open );
writer.Write( m_Locked );
writer.Write( m_OpenedID );
writer.Write( m_ClosedID );
writer.Write( m_OpenedSound );
writer.Write( m_ClosedSound );
writer.Write( m_Offset );
writer.Write( Locked );
writer.Write( OpenedID );
writer.Write( ClosedID );
writer.Write( OpenedSound );
writer.Write( ClosedSound );
writer.Write( Offset );
writer.Write( m_Link );
}
@ -512,14 +480,14 @@ namespace Server.Items
{
case 0:
{
m_KeyValue = reader.ReadUInt();
KeyValue = reader.ReadUInt();
m_Open = reader.ReadBool();
m_Locked = reader.ReadBool();
m_OpenedID = reader.ReadInt();
m_ClosedID = reader.ReadInt();
m_OpenedSound = reader.ReadInt();
m_ClosedSound = reader.ReadInt();
m_Offset = reader.ReadPoint3D();
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 );

View file

@ -92,22 +92,11 @@ namespace Server.Items
public abstract class BaseHouseDoor : BaseDoor, ISecurable
{
private DoorFacing m_Facing;
private SecureLevel m_Level;
[CommandProperty( AccessLevel.GameMaster )]
public DoorFacing Facing { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public DoorFacing Facing
{
get => m_Facing;
set => m_Facing = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_Level;
set => m_Level = value;
}
public SecureLevel Level { get; set; }
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
@ -117,8 +106,8 @@ namespace Server.Items
public BaseHouseDoor( DoorFacing facing, int closedID, int openedID, int openedSound, int closedSound, Point3D offset ) : base( closedID, openedID, openedSound, closedSound, offset )
{
m_Facing = facing;
m_Level = SecureLevel.Anyone;
Facing = facing;
Level = SecureLevel.Anyone;
}
public BaseHouse FindHouse()
@ -146,7 +135,7 @@ namespace Server.Items
if ( house.Public ? house.IsBanned( m ) : !house.HasAccess( m ) )
return false;
return house.HasSecureAccess( m, m_Level );
return house.HasSecureAccess( m, Level );
}
public override void OnOpened( Mobile from )
@ -185,9 +174,9 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (int) m_Level );
writer.Write( (int) Level );
writer.Write( (int) m_Facing );
writer.Write( (int) Facing );
}
public override void Deserialize( GenericReader reader )
@ -200,15 +189,15 @@ namespace Server.Items
{
case 1:
{
m_Level = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if ( version < 1 )
m_Level = SecureLevel.Anyone;
Level = SecureLevel.Anyone;
m_Facing = (DoorFacing)reader.ReadInt();
Facing = (DoorFacing)reader.ReadInt();
break;
}
}
@ -222,7 +211,7 @@ namespace Server.Items
const int bs = r*2+1;
const int ss = r+1;
switch ( m_Facing )
switch ( Facing )
{
case DoorFacing.WestCW:
case DoorFacing.EastCCW: x = -r; y = -r; w = bs; h = ss; break;

View file

@ -4,31 +4,16 @@ namespace Server.Items
{
public class BaseTreasureChest : LockableContainer
{
private TreasureLevel m_TreasureLevel;
private short m_MaxSpawnTime = 60;
private short m_MinSpawnTime = 10;
private TreasureResetTimer m_ResetTimer;
[CommandProperty( AccessLevel.GameMaster )]
public TreasureLevel Level
{
get => m_TreasureLevel;
set => m_TreasureLevel = value;
}
public TreasureLevel Level { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public short MaxSpawnTime
{
get => m_MaxSpawnTime;
set => m_MaxSpawnTime = value;
}
public short MaxSpawnTime { get; set; } = 60;
[CommandProperty( AccessLevel.GameMaster )]
public short MinSpawnTime
{
get => m_MinSpawnTime;
set => m_MinSpawnTime = value;
}
public short MinSpawnTime { get; set; } = 10;
[CommandProperty( AccessLevel.GameMaster )]
public override bool Locked {
@ -51,7 +36,7 @@ namespace Server.Items
public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID )
{
m_TreasureLevel = level;
Level = level;
Locked = true;
Movable = false;
@ -79,9 +64,9 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( (byte) m_TreasureLevel );
writer.Write( m_MinSpawnTime );
writer.Write( m_MaxSpawnTime );
writer.Write( (byte) Level );
writer.Write( MinSpawnTime );
writer.Write( MaxSpawnTime );
}
public override void Deserialize( GenericReader reader )
@ -90,9 +75,9 @@ namespace Server.Items
int version = reader.ReadInt();
m_TreasureLevel = (TreasureLevel)reader.ReadByte();
m_MinSpawnTime = reader.ReadShort();
m_MaxSpawnTime = reader.ReadShort();
Level = (TreasureLevel)reader.ReadByte();
MinSpawnTime = reader.ReadShort();
MaxSpawnTime = reader.ReadShort();
if ( !Locked )
StartResetTimer();
@ -100,7 +85,7 @@ namespace Server.Items
protected virtual void SetLockLevel()
{
switch( m_TreasureLevel )
switch( Level )
{
case TreasureLevel.Level1:
RequiredSkill = LockLevel = 5;
@ -133,7 +118,7 @@ namespace Server.Items
if ( m_ResetTimer == null )
m_ResetTimer = new TreasureResetTimer( this );
else
m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime ));
m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( MinSpawnTime, MaxSpawnTime ));
m_ResetTimer.Start();
}
@ -143,7 +128,7 @@ namespace Server.Items
int MinGold = 1;
int MaxGold = 2;
switch( m_TreasureLevel )
switch( Level )
{
case TreasureLevel.Level1:
MinGold = 100;

View file

@ -629,9 +629,7 @@ namespace Server.Items
public class FillableBvrge : FillableEntry
{
private BeverageType m_Content;
public BeverageType Content => m_Content;
public BeverageType Content { get; }
public FillableBvrge( Type type, BeverageType content )
: this( 1, type, content )
@ -641,7 +639,7 @@ namespace Server.Items
public FillableBvrge( int weight, Type type, BeverageType content )
: base( weight, type )
{
m_Content = content;
Content = content;
}
public override Item Construct()
@ -652,11 +650,11 @@ namespace Server.Items
if ( m_Types[ index ] == typeof( BeverageBottle ) )
{
item = new BeverageBottle( m_Content );
item = new BeverageBottle( Content );
}
else if ( m_Types[ index ] == typeof( Jug ) )
{
item = new Jug( m_Content );
item = new Jug( Content );
}
else
{
@ -664,7 +662,7 @@ namespace Server.Items
if ( item is BaseBeverage bev )
{
bev.Content = m_Content;
bev.Content = Content;
bev.Quantity = bev.MaxQuantity;
}
}
@ -692,21 +690,19 @@ namespace Server.Items
public class FillableContent
{
private int m_Level;
private Type[] m_Vendors;
private FillableEntry[] m_Entries;
private int m_Weight;
public int Level => m_Level;
public Type[] Vendors => m_Vendors;
public int Level { get; }
public Type[] Vendors { get; }
public FillableContentType TypeID => Lookup( this );
public FillableContent( int level, Type[] vendors, FillableEntry[] entries )
{
m_Level = level;
m_Vendors = vendors;
Level = level;
Vendors = vendors;
m_Entries = entries;
for( int i = 0; i < entries.Length; ++i )
@ -1498,8 +1494,8 @@ namespace Server.Items
{
FillableContent fill = m_ContentTypes[ i ];
for( int j = 0; j < fill.m_Vendors.Length; ++j )
m_AcquireTable[ fill.m_Vendors[ j ] ] = fill;
for( int j = 0; j < fill.Vendors.Length; ++j )
m_AcquireTable[ fill.Vendors[ j ] ] = fill;
}
}

View file

@ -7,38 +7,18 @@ namespace Server.Items
public abstract class LockableContainer : TrappableContainer, ILockable, ILockpickable, ICraftable, IShipwreckedItem
{
private bool m_Locked;
private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill;
private uint m_KeyValue;
private Mobile m_Picker;
private bool m_TrapOnLockpick;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Picker
{
get => m_Picker;
set => m_Picker = value;
}
public Mobile Picker { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int MaxLockLevel
{
get => m_MaxLockLevel;
set => m_MaxLockLevel = value;
}
public int MaxLockLevel { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int LockLevel
{
get => m_LockLevel;
set => m_LockLevel = value;
}
public int LockLevel { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int RequiredSkill
{
get => m_RequiredSkill;
set => m_RequiredSkill = value;
}
public int RequiredSkill { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public virtual bool Locked
@ -49,27 +29,19 @@ namespace Server.Items
m_Locked = value;
if ( m_Locked )
m_Picker = null;
Picker = null;
InvalidateProperties();
}
}
[CommandProperty( AccessLevel.GameMaster )]
public uint KeyValue
{
get => m_KeyValue;
set => m_KeyValue = value;
}
public uint KeyValue { get; set; }
public override bool TrapOnOpen => !m_TrapOnLockpick;
public override bool TrapOnOpen => !TrapOnLockpick;
[CommandProperty( AccessLevel.GameMaster )]
public bool TrapOnLockpick
{
get => m_TrapOnLockpick;
set => m_TrapOnLockpick = value;
}
public bool TrapOnLockpick { get; set; }
public override void Serialize( GenericWriter writer )
{
@ -77,16 +49,16 @@ namespace Server.Items
writer.Write( (int) 6 ); // version
writer.Write( m_IsShipwreckedItem );
writer.Write( IsShipwreckedItem );
writer.Write( (bool) m_TrapOnLockpick );
writer.Write( (bool) TrapOnLockpick );
writer.Write( (int) m_RequiredSkill );
writer.Write( (int) RequiredSkill );
writer.Write( (int) m_MaxLockLevel );
writer.Write( (int) MaxLockLevel );
writer.Write( m_KeyValue );
writer.Write( (int) m_LockLevel );
writer.Write( KeyValue );
writer.Write( (int) LockLevel );
writer.Write( (bool) m_Locked );
}
@ -100,56 +72,56 @@ namespace Server.Items
{
case 6:
{
m_IsShipwreckedItem = reader.ReadBool();
IsShipwreckedItem = reader.ReadBool();
goto case 5;
}
case 5:
{
m_TrapOnLockpick = reader.ReadBool();
TrapOnLockpick = reader.ReadBool();
goto case 4;
}
case 4:
{
m_RequiredSkill = reader.ReadInt();
RequiredSkill = reader.ReadInt();
goto case 3;
}
case 3:
{
m_MaxLockLevel = reader.ReadInt();
MaxLockLevel = reader.ReadInt();
goto case 2;
}
case 2:
{
m_KeyValue = reader.ReadUInt();
KeyValue = reader.ReadUInt();
goto case 1;
}
case 1:
{
m_LockLevel = reader.ReadInt();
LockLevel = reader.ReadInt();
goto case 0;
}
case 0:
{
if ( version < 3 )
m_MaxLockLevel = 100;
MaxLockLevel = 100;
if ( version < 4 )
{
if ( (m_MaxLockLevel - m_LockLevel) == 40 )
if ( (MaxLockLevel - LockLevel) == 40 )
{
m_RequiredSkill = m_LockLevel + 6;
m_LockLevel = m_RequiredSkill - 10;
m_MaxLockLevel = m_RequiredSkill + 39;
RequiredSkill = LockLevel + 6;
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 39;
}
else
{
m_RequiredSkill = m_LockLevel;
RequiredSkill = LockLevel;
}
}
@ -162,7 +134,7 @@ namespace Server.Items
public LockableContainer( int itemID ) : base( itemID )
{
m_MaxLockLevel = 100;
MaxLockLevel = 100;
}
public LockableContainer( Serial serial ) : base( serial )
@ -298,7 +270,7 @@ namespace Server.Items
{
base.AddNameProperties( list );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
list.Add( 1041645 ); // recovered from a shipwreck
}
@ -306,7 +278,7 @@ namespace Server.Items
{
base.OnSingleClick( from );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
LabelTo( from, 1041645 ); //recovered from a shipwreck
}
@ -353,14 +325,9 @@ namespace Server.Items
#region IShipwreckedItem Members
private bool m_IsShipwreckedItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsShipwreckedItem
{
get => m_IsShipwreckedItem;
set => m_IsShipwreckedItem = value;
}
public bool IsShipwreckedItem { get; set; }
#endregion
}

View file

@ -61,9 +61,6 @@ namespace Server.Items
private bool m_AutoLock;
private InternalTimer m_RelockTimer;
private Map m_TargetMap;
private Point3D m_Target;
private string m_Description;
[CommandProperty( AccessLevel.GameMaster )]
public bool AutoLock
@ -81,14 +78,10 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Map TargetMap { get => m_TargetMap;
set => m_TargetMap = value;
}
public Map TargetMap { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Target { get => m_Target;
set => m_Target = value;
}
public Point3D Target { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Bone
@ -102,9 +95,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public string Description { get => m_Description;
set => m_Description = value;
}
public string Description { get; set; }
public override bool IsDecoContainer => false;
@ -164,11 +155,9 @@ namespace Server.Items
private class InternalTimer : Timer
{
private MarkContainer m_Container;
private DateTime m_RelockTime;
public MarkContainer Container { get; }
public MarkContainer Container => m_Container;
public DateTime RelockTime => m_RelockTime;
public DateTime RelockTime { get; }
public InternalTimer( MarkContainer container ) : this( container, TimeSpan.FromMinutes( 5.0 ) )
{
@ -176,16 +165,16 @@ namespace Server.Items
public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay )
{
m_Container = container;
m_RelockTime = DateTime.UtcNow + delay;
Container = container;
RelockTime = DateTime.UtcNow + delay;
Start();
}
protected override void OnTick()
{
m_Container.Locked = true;
m_Container.LockLevel = -255;
Container.Locked = true;
Container.LockLevel = -255;
}
}
@ -194,9 +183,9 @@ namespace Server.Items
if ( TargetMap != null )
{
rune.Marked = true;
rune.TargetMap = m_TargetMap;
rune.Target = m_Target;
rune.Description = m_Description;
rune.TargetMap = TargetMap;
rune.Target = Target;
rune.Description = Description;
rune.House = null;
}
}
@ -234,9 +223,9 @@ namespace Server.Items
if ( !Locked && m_AutoLock )
writer.WriteDeltaTime( m_RelockTimer.RelockTime );
writer.Write( m_TargetMap );
writer.Write( m_Target );
writer.Write( m_Description );
writer.Write( TargetMap );
writer.Write( Target );
writer.Write( Description );
}
public override void Deserialize( GenericReader reader )
@ -250,9 +239,9 @@ namespace Server.Items
if ( !Locked && m_AutoLock )
m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.UtcNow );
m_TargetMap = reader.ReadMap();
m_Target = reader.ReadPoint3D();
m_Description = reader.ReadString();
TargetMap = reader.ReadMap();
Target = reader.ReadPoint3D();
Description = reader.ReadString();
}
}
}

View file

@ -13,30 +13,14 @@ namespace Server.Items
public abstract class TrappableContainer : BaseContainer, ITelekinesisable
{
private TrapType m_TrapType;
private int m_TrapPower;
private int m_TrapLevel;
[CommandProperty( AccessLevel.GameMaster )]
public TrapType TrapType { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TrapType TrapType
{
get => m_TrapType;
set => m_TrapType = value;
}
public int TrapPower { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int TrapPower
{
get => m_TrapPower;
set => m_TrapPower = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public int TrapLevel
{
get => m_TrapLevel;
set => m_TrapLevel = value;
}
public int TrapLevel { get; set; }
public virtual bool TrapOnOpen => true;
@ -66,7 +50,7 @@ namespace Server.Items
public virtual bool ExecuteTrap( Mobile from )
{
if ( m_TrapType != TrapType.None )
if ( TrapType != TrapType.None )
{
Point3D loc = GetWorldLocation();
Map facet = Map;
@ -77,7 +61,7 @@ namespace Server.Items
return false;
}
switch ( m_TrapType )
switch ( TrapType )
{
case TrapType.ExplosionTrap:
{
@ -87,10 +71,10 @@ namespace Server.Items
{
int damage;
if ( m_TrapLevel > 0 )
damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
if ( TrapLevel > 0 )
damage = Utility.RandomMinMax( 10, 30 ) * TrapLevel;
else
damage = m_TrapPower;
damage = TrapPower;
AOS.Damage( from, damage, 0, 100, 0, 0, 0 );
@ -106,7 +90,7 @@ namespace Server.Items
case TrapType.MagicTrap:
{
if ( from.InRange( loc, 1 ) )
from.Damage( m_TrapPower );
from.Damage( TrapPower );
//AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
Effects.PlaySound( loc, Map, 0x307 );
@ -129,10 +113,10 @@ namespace Server.Items
{
int damage;
if ( m_TrapLevel > 0 )
damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
if ( TrapLevel > 0 )
damage = Utility.RandomMinMax( 5, 15 ) * TrapLevel;
else
damage = m_TrapPower;
damage = TrapPower;
AOS.Damage( from, damage, 100, 0, 0, 0, 0 );
@ -152,13 +136,13 @@ namespace Server.Items
{
Poison poison;
if ( m_TrapLevel > 0 )
if ( TrapLevel > 0 )
{
poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, TrapLevel - 1 ) ) );
}
else
{
AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
AOS.Damage( from, TrapPower, 0, 0, 0, 100, 0 );
poison = Poison.Greater;
}
@ -175,9 +159,9 @@ namespace Server.Items
}
}
m_TrapType = TrapType.None;
m_TrapPower = 0;
m_TrapLevel = 0;
TrapType = TrapType.None;
TrapPower = 0;
TrapLevel = 0;
return true;
}
@ -207,10 +191,10 @@ namespace Server.Items
writer.Write( (int) 2 ); // version
writer.Write( (int) m_TrapLevel );
writer.Write( (int) TrapLevel );
writer.Write( (int) m_TrapPower );
writer.Write( (int) m_TrapType );
writer.Write( (int) TrapPower );
writer.Write( (int) TrapType );
}
public override void Deserialize( GenericReader reader )
@ -223,17 +207,17 @@ namespace Server.Items
{
case 2:
{
m_TrapLevel = reader.ReadInt();
TrapLevel = reader.ReadInt();
goto case 1;
}
case 1:
{
m_TrapPower = reader.ReadInt();
TrapPower = reader.ReadInt();
goto case 0;
}
case 0:
{
m_TrapType = (TrapType)reader.ReadInt();
TrapType = (TrapType)reader.ReadInt();
break;
}
}

View file

@ -11,9 +11,8 @@ namespace Server.Items
{
public override int LabelNumber => 3000541;
public static Type[] Artifacts => m_Artifacts;
private static Type[] m_Artifacts = {
public static Type[] Artifacts { get; } =
{
typeof( CandelabraOfSouls ), typeof( GoldBricks ), typeof( PhillipsWoodenSteed ),
typeof( ArcticDeathDealer ), typeof( BlazeOfDeath ), typeof( BurglarsBandana ),
typeof( CavortingClub ), typeof( DreadPirateHat ),
@ -23,33 +22,21 @@ namespace Server.Items
typeof( ColdBlood ), typeof( AlchemistsBauble )
};
private int m_Level;
private DateTime m_DeleteTime;
private Timer m_Timer;
private Mobile m_Owner;
private bool m_Temporary;
private List<Mobile> m_Guardians;
[CommandProperty( AccessLevel.GameMaster )]
public int Level{ get => m_Level;
set => m_Level = value;
}
public int Level { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner{ get => m_Owner;
set => m_Owner = value;
}
public Mobile Owner { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime DeleteTime => m_DeleteTime;
public DateTime DeleteTime { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Temporary{ get => m_Temporary;
set => m_Temporary = value;
}
public bool Temporary { get; set; }
public List<Mobile> Guardians => m_Guardians;
public List<Mobile> Guardians { get; private set; }
[Constructible]
public TreasureMapChest( int level ) : this( null, level, false )
@ -58,14 +45,14 @@ namespace Server.Items
public TreasureMapChest( Mobile owner, int level, bool temporary ) : base( 0xE40 )
{
m_Owner = owner;
m_Level = level;
m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 );
Owner = owner;
Level = level;
DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 );
m_Temporary = temporary;
m_Guardians = new List<Mobile>();
Temporary = temporary;
Guardians = new List<Mobile>();
m_Timer = new DeleteTimer( this, m_DeleteTime );
m_Timer = new DeleteTimer( this, DeleteTime );
m_Timer.Start();
Fill( this, level );
@ -278,7 +265,7 @@ namespace Server.Items
}
if ( level == 6 && Core.AOS )
cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) );
cont.DropItem( (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] ) );
}
public override bool CheckLocked( Mobile from )
@ -308,13 +295,13 @@ namespace Server.Items
private bool CheckLoot( Mobile m, bool criminalAction )
{
if ( m_Temporary )
if ( Temporary )
return false;
if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner )
if ( m.AccessLevel >= AccessLevel.GameMaster || Owner == null || m == Owner )
return true;
Party p = Party.Get( m_Owner );
Party p = Party.Get( Owner );
if ( p != null && p.Contains( m ) )
return true;
@ -358,7 +345,7 @@ namespace Server.Items
m_Lifted.Add( item );
if ( 0.1 >= Utility.RandomDouble() ) // 10% chance to spawn a new monster
TreasureMap.Spawn( m_Level, GetWorldLocation(), Map, from, false );
TreasureMap.Spawn( Level, GetWorldLocation(), Map, from, false );
}
base.OnItemLifted( from, item );
@ -385,13 +372,13 @@ namespace Server.Items
writer.Write( (int) 2 ); // version
writer.Write( m_Guardians, true );
writer.Write( (bool) m_Temporary );
writer.Write( Guardians, true );
writer.Write( (bool) Temporary );
writer.Write( m_Owner );
writer.Write( Owner );
writer.Write( (int) m_Level );
writer.WriteDeltaTime( m_DeleteTime );
writer.Write( (int) Level );
writer.WriteDeltaTime( DeleteTime );
writer.Write( m_Lifted, true );
}
@ -405,33 +392,33 @@ namespace Server.Items
{
case 2:
{
m_Guardians = reader.ReadStrongMobileList();
m_Temporary = reader.ReadBool();
Guardians = reader.ReadStrongMobileList();
Temporary = reader.ReadBool();
goto case 1;
}
case 1:
{
m_Owner = reader.ReadMobile();
Owner = reader.ReadMobile();
goto case 0;
}
case 0:
{
m_Level = reader.ReadInt();
m_DeleteTime = reader.ReadDeltaTime();
Level = reader.ReadInt();
DeleteTime = reader.ReadDeltaTime();
m_Lifted = reader.ReadStrongItemList();
if ( version < 2 )
m_Guardians = new List<Mobile>();
Guardians = new List<Mobile>();
break;
}
}
if ( !m_Temporary )
if ( !Temporary )
{
m_Timer = new DeleteTimer( this, m_DeleteTime );
m_Timer = new DeleteTimer( this, DeleteTime );
m_Timer.Start();
}
else
@ -468,7 +455,7 @@ namespace Server.Items
public void EndRemove( Mobile from )
{
if ( Deleted || from != m_Owner || !from.InRange( GetWorldLocation(), 3 ) )
if ( Deleted || from != Owner || !from.InRange( GetWorldLocation(), 3 ) )
return;
from.SendLocalizedMessage( 1048124, "", 0x8A5 ); // The old, rusted chest crumbles when you hit it.

View file

@ -8,19 +8,17 @@ namespace Server.Items
{
public class StealableEntry
{
private Map m_Map;
private Point3D m_Location;
private int m_MinDelay;
private int m_MaxDelay;
private Type m_Type;
private int m_Hue;
public Map Map { get; }
public Map Map => m_Map;
public Point3D Location => m_Location;
public int MinDelay => m_MinDelay;
public int MaxDelay => m_MaxDelay;
public Type Type => m_Type;
public int Hue => m_Hue;
public Point3D Location { get; }
public int MinDelay { get; }
public int MaxDelay { get; }
public Type Type { get; }
public int Hue { get; }
public StealableEntry( Map map, Point3D location, int minDelay, int maxDelay, Type type ) : this( map, location, minDelay, maxDelay, type, 0 )
{
@ -28,20 +26,20 @@ namespace Server.Items
public StealableEntry( Map map, Point3D location, int minDelay, int maxDelay, Type type, int hue )
{
m_Map = map;
m_Location = location;
m_MinDelay = minDelay;
m_MaxDelay = maxDelay;
m_Type = type;
m_Hue = hue;
Map = map;
Location = location;
MinDelay = minDelay;
MaxDelay = maxDelay;
Type = type;
Hue = hue;
}
public Item CreateInstance()
{
Item item = (Item) Activator.CreateInstance( m_Type );
Item item = (Item) Activator.CreateInstance( Type );
if ( m_Hue > 0 )
item.Hue = m_Hue;
if ( Hue > 0 )
item.Hue = Hue;
item.Movable = false;
item.MoveToWorld( Location, Map );
@ -50,114 +48,113 @@ namespace Server.Items
}
}
private static StealableEntry[] m_Entries = {
// Doom - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 317, 56, -1 ), 72, 108, typeof( RockArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 360, 31, 8 ), 72, 108, typeof( SkullCandleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 369, 372, -1 ), 72, 108, typeof( BottleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 378, 372, 0 ), 72, 108, typeof( DamagedBooksArtifact ) ),
// Doom - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 432, 16, -1 ), 144, 216, typeof( StretchedHideArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 489, 9, 0 ), 144, 216, typeof( BrazierArtifact ) ),
// Doom - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 471, 96, -1 ), 288, 432, typeof( LampPostArtifact ), GetLampPostHue() ),
new StealableEntry( Map.Malas, new Point3D( 421, 198, 2 ), 288, 432, typeof( BooksNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 431, 189, -1 ), 288, 432, typeof( BooksWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 435, 196, -1 ), 288, 432, typeof( BooksFaceDownArtifact ) ),
// Doom - Artifact rarity 5
new StealableEntry( Map.Malas, new Point3D( 447, 9, 8 ), 1152, 1728, typeof( StuddedLeggingsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 1152, 1728, typeof( EggCaseArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 347, 44, 4 ), 1152, 1728, typeof( SkinnedGoatArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 497, 57, -1 ), 1152, 1728, typeof( GruesomeStandardArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 381, 375, 11 ), 1152, 1728, typeof( BloodyWaterArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 489, 369, 2 ), 1152, 1728, typeof( TarotCardsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 497, 369, 5 ), 1152, 1728, typeof( BackpackArtifact ) ),
// Doom - Artifact rarity 7
new StealableEntry( Map.Malas, new Point3D( 475, 23, 4 ), 4608, 6912, typeof( StuddedTunicArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 4608, 6912, typeof( CocoonArtifact ) ),
// Doom - Artifact rarity 8
new StealableEntry( Map.Malas, new Point3D( 354, 36, -1 ), 9216, 13824, typeof( SkinnedDeerArtifact ) ),
// Doom - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 433, 11, -1 ), 18432, 27648, typeof( SaddleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 403, 31, 4 ), 18432, 27648, typeof( LeatherTunicArtifact ) ),
// Doom - Artifact rarity 10
new StealableEntry( Map.Malas, new Point3D( 257, 70, -2 ), 36864, 55296, typeof( ZyronicClaw ) ),
new StealableEntry( Map.Malas, new Point3D( 354, 176, 7 ), 36864, 55296, typeof( TitansHammer ) ),
new StealableEntry( Map.Malas, new Point3D( 369, 389, -1 ), 36864, 55296, typeof( BladeOfTheRighteous ) ),
new StealableEntry( Map.Malas, new Point3D( 467, 92, 4 ), 36864, 55296, typeof( InquisitorsResolution ) ),
// Doom - Artifact rarity 12
new StealableEntry( Map.Malas, new Point3D( 487, 364, -1 ), 147456, 221184, typeof( RuinedPaintingArtifact ) ),
public static StealableEntry[] Entries { get; } =
{
// Doom - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 317, 56, -1 ), 72, 108, typeof( RockArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 360, 31, 8 ), 72, 108, typeof( SkullCandleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 369, 372, -1 ), 72, 108, typeof( BottleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 378, 372, 0 ), 72, 108, typeof( DamagedBooksArtifact ) ),
// Doom - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 432, 16, -1 ), 144, 216, typeof( StretchedHideArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 489, 9, 0 ), 144, 216, typeof( BrazierArtifact ) ),
// Doom - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 471, 96, -1 ), 288, 432, typeof( LampPostArtifact ), GetLampPostHue() ),
new StealableEntry( Map.Malas, new Point3D( 421, 198, 2 ), 288, 432, typeof( BooksNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 431, 189, -1 ), 288, 432, typeof( BooksWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 435, 196, -1 ), 288, 432, typeof( BooksFaceDownArtifact ) ),
// Doom - Artifact rarity 5
new StealableEntry( Map.Malas, new Point3D( 447, 9, 8 ), 1152, 1728, typeof( StuddedLeggingsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 1152, 1728, typeof( EggCaseArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 347, 44, 4 ), 1152, 1728, typeof( SkinnedGoatArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 497, 57, -1 ), 1152, 1728, typeof( GruesomeStandardArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 381, 375, 11 ), 1152, 1728, typeof( BloodyWaterArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 489, 369, 2 ), 1152, 1728, typeof( TarotCardsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 497, 369, 5 ), 1152, 1728, typeof( BackpackArtifact ) ),
// Doom - Artifact rarity 7
new StealableEntry( Map.Malas, new Point3D( 475, 23, 4 ), 4608, 6912, typeof( StuddedTunicArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 423, 28, 0 ), 4608, 6912, typeof( CocoonArtifact ) ),
// Doom - Artifact rarity 8
new StealableEntry( Map.Malas, new Point3D( 354, 36, -1 ), 9216, 13824, typeof( SkinnedDeerArtifact ) ),
// Doom - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 433, 11, -1 ), 18432, 27648, typeof( SaddleArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 403, 31, 4 ), 18432, 27648, typeof( LeatherTunicArtifact ) ),
// Doom - Artifact rarity 10
new StealableEntry( Map.Malas, new Point3D( 257, 70, -2 ), 36864, 55296, typeof( ZyronicClaw ) ),
new StealableEntry( Map.Malas, new Point3D( 354, 176, 7 ), 36864, 55296, typeof( TitansHammer ) ),
new StealableEntry( Map.Malas, new Point3D( 369, 389, -1 ), 36864, 55296, typeof( BladeOfTheRighteous ) ),
new StealableEntry( Map.Malas, new Point3D( 467, 92, 4 ), 36864, 55296, typeof( InquisitorsResolution ) ),
// Doom - Artifact rarity 12
new StealableEntry( Map.Malas, new Point3D( 487, 364, -1 ), 147456, 221184, typeof( RuinedPaintingArtifact ) ),
// Yomotsu Mines - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 18, 110, -1 ), 72, 108, typeof( Basket1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 66, 114, -1 ), 72, 108, typeof( Basket2Artifact ) ),
// Yomotsu Mines - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 63, 12, 11 ), 144, 216, typeof( Basket4Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 5, 29, -1 ), 144, 216, typeof( Basket5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 30, 81, 3 ), 144, 216, typeof( Basket5WestArtifact ) ),
// Yomotsu Mines - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 115, 7, -1 ), 288, 432, typeof( Urn1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 85, 13, -1 ), 288, 432, typeof( Urn2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 110, 53, -1 ), 288, 432, typeof( Sculpture1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 108, 37, -1 ), 288, 432, typeof( Sculpture2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 121, 14, -1 ), 288, 432, typeof( TeapotNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 121, 115, -1 ), 288, 432, typeof( TeapotWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 84, 40, -1 ), 288, 432, typeof( TowerLanternArtifact ) ),
// Yomotsu Mines - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 94, 7, -1 ), 18432, 27648, typeof( ManStatuetteSouthArtifact ) ),
// Yomotsu Mines - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 18, 110, -1 ), 72, 108, typeof( Basket1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 66, 114, -1 ), 72, 108, typeof( Basket2Artifact ) ),
// Yomotsu Mines - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 63, 12, 11 ), 144, 216, typeof( Basket4Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 5, 29, -1 ), 144, 216, typeof( Basket5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 30, 81, 3 ), 144, 216, typeof( Basket5WestArtifact ) ),
// Yomotsu Mines - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 115, 7, -1 ), 288, 432, typeof( Urn1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 85, 13, -1 ), 288, 432, typeof( Urn2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 110, 53, -1 ), 288, 432, typeof( Sculpture1Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 108, 37, -1 ), 288, 432, typeof( Sculpture2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 121, 14, -1 ), 288, 432, typeof( TeapotNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 121, 115, -1 ), 288, 432, typeof( TeapotWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 84, 40, -1 ), 288, 432, typeof( TowerLanternArtifact ) ),
// Yomotsu Mines - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 94, 7, -1 ), 18432, 27648, typeof( ManStatuetteSouthArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 113, 640, -2 ), 72, 108, typeof( Basket3NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 102, 355, -1 ), 72, 108, typeof( Basket3WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 99, 370, -1 ), 144, 216, typeof( Basket6Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 100, 357, -1 ), 144, 216, typeof( ZenRock1Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 73, 473, -1 ), 288, 432, typeof( FanNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 99, 372, -1 ), 288, 432, typeof( FanWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 92, 326, -1 ), 288, 432, typeof( BowlsVerticalArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 97, 470, -1 ), 288, 432, typeof( ZenRock2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 103, 691, -1 ), 288, 432, typeof( ZenRock3Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 4
new StealableEntry( Map.Malas, new Point3D( 103, 336, 4 ), 576, 864, typeof( Painting1NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 59, 381, 4 ), 576, 864, typeof( Painting1WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 84, 401, 2 ), 576, 864, typeof( Painting2NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 59, 392, 2 ), 576, 864, typeof( Painting2WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 483, -1 ), 576, 864, typeof( TripleFanNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 50, 475, -1 ), 576, 864, typeof( TripleFanWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 460, -1 ), 576, 864, typeof( BowlArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 90, 502, -1 ), 576, 864, typeof( CupsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 688, -1 ), 576, 864, typeof( BowlsHorizontalArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 112, 676, -1 ), 576, 864, typeof( SakeArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 5
new StealableEntry( Map.Malas, new Point3D( 135, 614, -1 ), 1152, 1728, typeof( SwordDisplay1NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 50, 482, -1 ), 1152, 1728, typeof( SwordDisplay1WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 119, 672, -1 ), 1152, 1728, typeof( Painting3Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 6
new StealableEntry( Map.Malas, new Point3D( 90, 326, -1 ), 2304, 3456, typeof( Painting4NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 99, 354, -1 ), 2304, 3456, typeof( Painting4WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 179, 652, -1 ), 2304, 3456, typeof( SwordDisplay2NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 118, 627, -1 ), 2304, 3456, typeof( SwordDisplay2WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 7
new StealableEntry( Map.Malas, new Point3D( 90, 483, -1 ), 4608, 6912, typeof( FlowersArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 8
new StealableEntry( Map.Malas, new Point3D( 71, 562, -1 ), 9216, 13824, typeof( DolphinLeftArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 102, 677, -1 ), 9216, 13824, typeof( DolphinRightArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 61, 499, 0 ), 9216, 13824, typeof( SwordDisplay3SouthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 182, 669, -1 ), 9216, 13824, typeof( SwordDisplay3EastArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 162, 647, -1 ), 9216, 13824, typeof( SwordDisplay4WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 124, 624, 0 ), 9216, 13824, typeof( Painting5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 146, 649, 2 ), 9216, 13824, typeof( Painting5WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 100, 488, -1 ), 18432, 27648, typeof( SwordDisplay4NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 175, 606, 0 ), 18432, 27648, typeof( SwordDisplay5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 157, 608, -1 ), 18432, 27648, typeof( SwordDisplay5WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 187, 643, 1 ), 18432, 27648, typeof( Painting6NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 146, 623, 1 ), 18432, 27648, typeof( Painting6WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 178, 629, -1 ), 18432, 27648, typeof( ManStatuetteEastArtifact ) )
};
public static StealableEntry[] Entries => m_Entries;
// Fan Dancer's Dojo - Artifact rarity 1
new StealableEntry( Map.Malas, new Point3D( 113, 640, -2 ), 72, 108, typeof( Basket3NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 102, 355, -1 ), 72, 108, typeof( Basket3WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 2
new StealableEntry( Map.Malas, new Point3D( 99, 370, -1 ), 144, 216, typeof( Basket6Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 100, 357, -1 ), 144, 216, typeof( ZenRock1Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 3
new StealableEntry( Map.Malas, new Point3D( 73, 473, -1 ), 288, 432, typeof( FanNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 99, 372, -1 ), 288, 432, typeof( FanWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 92, 326, -1 ), 288, 432, typeof( BowlsVerticalArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 97, 470, -1 ), 288, 432, typeof( ZenRock2Artifact ) ),
new StealableEntry( Map.Malas, new Point3D( 103, 691, -1 ), 288, 432, typeof( ZenRock3Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 4
new StealableEntry( Map.Malas, new Point3D( 103, 336, 4 ), 576, 864, typeof( Painting1NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 59, 381, 4 ), 576, 864, typeof( Painting1WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 84, 401, 2 ), 576, 864, typeof( Painting2NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 59, 392, 2 ), 576, 864, typeof( Painting2WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 483, -1 ), 576, 864, typeof( TripleFanNorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 50, 475, -1 ), 576, 864, typeof( TripleFanWestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 460, -1 ), 576, 864, typeof( BowlArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 90, 502, -1 ), 576, 864, typeof( CupsArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 107, 688, -1 ), 576, 864, typeof( BowlsHorizontalArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 112, 676, -1 ), 576, 864, typeof( SakeArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 5
new StealableEntry( Map.Malas, new Point3D( 135, 614, -1 ), 1152, 1728, typeof( SwordDisplay1NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 50, 482, -1 ), 1152, 1728, typeof( SwordDisplay1WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 119, 672, -1 ), 1152, 1728, typeof( Painting3Artifact ) ),
// Fan Dancer's Dojo - Artifact rarity 6
new StealableEntry( Map.Malas, new Point3D( 90, 326, -1 ), 2304, 3456, typeof( Painting4NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 99, 354, -1 ), 2304, 3456, typeof( Painting4WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 179, 652, -1 ), 2304, 3456, typeof( SwordDisplay2NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 118, 627, -1 ), 2304, 3456, typeof( SwordDisplay2WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 7
new StealableEntry( Map.Malas, new Point3D( 90, 483, -1 ), 4608, 6912, typeof( FlowersArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 8
new StealableEntry( Map.Malas, new Point3D( 71, 562, -1 ), 9216, 13824, typeof( DolphinLeftArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 102, 677, -1 ), 9216, 13824, typeof( DolphinRightArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 61, 499, 0 ), 9216, 13824, typeof( SwordDisplay3SouthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 182, 669, -1 ), 9216, 13824, typeof( SwordDisplay3EastArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 162, 647, -1 ), 9216, 13824, typeof( SwordDisplay4WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 124, 624, 0 ), 9216, 13824, typeof( Painting5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 146, 649, 2 ), 9216, 13824, typeof( Painting5WestArtifact ) ),
// Fan Dancer's Dojo - Artifact rarity 9
new StealableEntry( Map.Malas, new Point3D( 100, 488, -1 ), 18432, 27648, typeof( SwordDisplay4NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 175, 606, 0 ), 18432, 27648, typeof( SwordDisplay5NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 157, 608, -1 ), 18432, 27648, typeof( SwordDisplay5WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 187, 643, 1 ), 18432, 27648, typeof( Painting6NorthArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 146, 623, 1 ), 18432, 27648, typeof( Painting6WestArtifact ) ),
new StealableEntry( Map.Malas, new Point3D( 178, 629, -1 ), 18432, 27648, typeof( ManStatuetteEastArtifact ) )
};
private static Type[] m_TypesOfEntries;
public static Type[] TypesOfEntires
@ -166,19 +163,17 @@ namespace Server.Items
{
if ( m_TypesOfEntries == null )
{
m_TypesOfEntries = new Type[m_Entries.Length];
m_TypesOfEntries = new Type[Entries.Length];
for( int i = 0; i < m_Entries.Length; i++ )
m_TypesOfEntries[i] = m_Entries[i].Type;
for( int i = 0; i < Entries.Length; i++ )
m_TypesOfEntries[i] = Entries[i].Type;
}
return m_TypesOfEntries;
}
}
private static StealableArtifactsSpawner m_Instance;
public static StealableArtifactsSpawner Instance => m_Instance;
public static StealableArtifactsSpawner Instance { get; private set; }
private static int GetLampPostHue()
{
@ -221,20 +216,20 @@ namespace Server.Items
public static bool Create()
{
if ( m_Instance != null && !m_Instance.Deleted )
if ( Instance != null && !Instance.Deleted )
return false;
m_Instance = new StealableArtifactsSpawner();
Instance = new StealableArtifactsSpawner();
return true;
}
public static bool Remove()
{
if ( m_Instance == null )
if ( Instance == null )
return false;
m_Instance.Delete();
m_Instance = null;
Instance.Delete();
Instance = null;
return true;
}
@ -246,11 +241,9 @@ namespace Server.Items
public class StealableInstance
{
private StealableEntry m_Entry;
private Item m_Item;
private DateTime m_NextRespawn;
public StealableEntry Entry => m_Entry;
public StealableEntry Entry { get; }
public Item Item
{
@ -276,11 +269,7 @@ namespace Server.Items
}
}
public DateTime NextRespawn
{
get => m_NextRespawn;
set => m_NextRespawn = value;
}
public DateTime NextRespawn { get; set; }
public StealableInstance( StealableEntry entry ) : this( entry, null, DateTime.UtcNow )
{
@ -289,8 +278,8 @@ namespace Server.Items
public StealableInstance( StealableEntry entry, Item item, DateTime nextRespawn )
{
m_Item = item;
m_NextRespawn = nextRespawn;
m_Entry = entry;
NextRespawn = nextRespawn;
Entry = entry;
}
public void CheckRespawn()
@ -315,12 +304,12 @@ namespace Server.Items
{
Movable = false;
m_Artifacts = new StealableInstance[m_Entries.Length];
m_Table = new Hashtable( m_Entries.Length );
m_Artifacts = new StealableInstance[Entries.Length];
m_Table = new Hashtable( Entries.Length );
for ( int i = 0; i < m_Entries.Length; i++ )
for ( int i = 0; i < Entries.Length; i++ )
{
m_Artifacts[i] = new StealableInstance( m_Entries[i] );
m_Artifacts[i] = new StealableInstance( Entries[i] );
}
m_RespawnTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( 15.0 ), CheckRespawn );
@ -341,7 +330,7 @@ namespace Server.Items
si.Item?.Delete();
}
m_Instance = null;
Instance = null;
}
public void CheckRespawn()
@ -354,7 +343,7 @@ namespace Server.Items
public StealableArtifactsSpawner( Serial serial ) : base( serial )
{
m_Instance = this;
Instance = this;
}
public override void Serialize( GenericWriter writer )
@ -380,8 +369,8 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Artifacts = new StealableInstance[m_Entries.Length];
m_Table = new Hashtable( m_Entries.Length );
m_Artifacts = new StealableInstance[Entries.Length];
m_Table = new Hashtable( Entries.Length );
int length = reader.ReadEncodedInt();
@ -392,7 +381,7 @@ namespace Server.Items
if ( i < m_Artifacts.Length )
{
StealableInstance si = new StealableInstance( m_Entries[i], item, nextRespawn );
StealableInstance si = new StealableInstance( Entries[i], item, nextRespawn );
m_Artifacts[i] = si;
if ( si.Item != null )
@ -400,9 +389,9 @@ namespace Server.Items
}
}
for ( int i = length; i < m_Entries.Length; i++ )
for ( int i = length; i < Entries.Length; i++ )
{
m_Artifacts[i] = new StealableInstance( m_Entries[i] );
m_Artifacts[i] = new StealableInstance( Entries[i] );
}
m_RespawnTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromMinutes( 15.0 ), CheckRespawn );

View file

@ -11,19 +11,17 @@ namespace Server.Items
public class CommodityDeed : Item
{
private Item m_Commodity;
[CommandProperty( AccessLevel.GameMaster )]
public Item Commodity => m_Commodity;
public Item Commodity { get; private set; }
public bool SetCommodity( Item item )
{
InvalidateProperties();
if ( m_Commodity == null && (item as ICommodity)?.IsDeedable == true )
if ( Commodity == null && (item as ICommodity)?.IsDeedable == true )
{
m_Commodity = item;
m_Commodity.Internalize();
Commodity = item;
Commodity.Internalize();
InvalidateProperties();
return true;
@ -38,7 +36,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( m_Commodity );
writer.Write( Commodity );
}
public override void Deserialize( GenericReader reader )
@ -47,13 +45,13 @@ namespace Server.Items
int version = reader.ReadInt();
m_Commodity = reader.ReadItem();
Commodity = reader.ReadItem();
switch ( version )
{
case 0:
{
if (m_Commodity != null)
if (Commodity != null)
{
Hue = 0x592;
}
@ -67,7 +65,7 @@ namespace Server.Items
Weight = 1.0;
Hue = 0x47;
m_Commodity = commodity;
Commodity = commodity;
LootType = LootType.Blessed;
}
@ -83,26 +81,26 @@ namespace Server.Items
public override void OnDelete()
{
m_Commodity?.Delete();
Commodity?.Delete();
base.OnDelete();
}
public override int LabelNumber => m_Commodity == null ? 1047016 : 1047017;
public override int LabelNumber => Commodity == null ? 1047016 : 1047017;
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if ( m_Commodity != null )
if ( Commodity != null )
{
string args;
if ( m_Commodity.Name == null )
if ( Commodity.Name == null )
args =
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
$"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}";
else
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
args = $"{Commodity.Name}\t{Commodity.Amount}";
list.Add( 1060658, args ); // ~1_val~: ~2_val~
}
@ -116,15 +114,15 @@ namespace Server.Items
{
base.OnSingleClick( from );
if ( m_Commodity != null )
if ( Commodity != null )
{
string args;
if ( m_Commodity.Name == null )
if ( Commodity.Name == null )
args =
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
$"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}";
else
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
args = $"{Commodity.Name}\t{Commodity.Amount}";
LabelTo( from, 1060658, args ); // ~1_val~: ~2_val~
}
@ -138,15 +136,15 @@ namespace Server.Items
CommodityDeedBox cox = CommodityDeedBox.Find( this );
// Veteran Rewards mods
if ( m_Commodity != null )
if ( Commodity != null )
{
if ( box != null && IsChildOf( box ) )
{
number = 1047031; // The commodity has been redeemed.
box.DropItem( m_Commodity );
box.DropItem( Commodity );
m_Commodity = null;
Commodity = null;
Delete();
}
else if ( cox != null )
@ -155,9 +153,9 @@ namespace Server.Items
{
number = 1047031; // The commodity has been redeemed.
cox.DropItem( m_Commodity );
cox.DropItem( Commodity );
m_Commodity = null;
Commodity = null;
Delete();
}
else

View file

@ -6,14 +6,8 @@ namespace Server.Items
{
public class NewPlayerTicket : Item
{
private Mobile m_Owner;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner
{
get => m_Owner;
set => m_Owner = value;
}
public Mobile Owner { get; set; }
public override int LabelNumber => 1062094; // a young player ticket
@ -43,7 +37,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (Mobile) m_Owner );
writer.Write( (Mobile) Owner );
}
public override void Deserialize( GenericReader reader )
@ -56,7 +50,7 @@ namespace Server.Items
{
case 0:
{
m_Owner = reader.ReadMobile();
Owner = reader.ReadMobile();
break;
}
}
@ -67,7 +61,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( from != m_Owner )
if ( from != Owner )
{
from.SendLocalizedMessage( 501926 ); // This isn't your ticket! Shame on you! You have to use YOUR ticket.
}
@ -99,7 +93,7 @@ namespace Server.Items
}
else if ( targeted is NewPlayerTicket theirTicket )
{
Mobile them = theirTicket.m_Owner;
Mobile them = theirTicket.Owner;
if ( them == null || them.Deleted )
{

View file

@ -13,8 +13,6 @@ namespace Server.Items
public override int LabelNumber => 1062332; // a vendor rental contract
private VendorRentalDuration m_Duration;
private int m_Price;
private bool m_LandlordRenew;
private Mobile m_Offeree;
private Timer m_OfferExpireTimer;
@ -30,18 +28,10 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int Price
{
get => m_Price;
set => m_Price = value;
}
public int Price { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool LandlordRenew
{
get => m_LandlordRenew;
set => m_LandlordRenew = value;
}
public bool LandlordRenew { get; set; }
public Mobile Offeree
{
@ -73,7 +63,7 @@ namespace Server.Items
Hue = 0x672;
m_Duration = VendorRentalDuration.Instances[0];
m_Price = 1500;
Price = 1500;
}
public VendorRentalContract( Serial serial ) : base( serial )
@ -338,8 +328,8 @@ namespace Server.Items
writer.WriteEncodedInt( m_Duration.ID );
writer.Write( (int) m_Price );
writer.Write( (bool) m_LandlordRenew );
writer.Write( (int) Price );
writer.Write( (bool) LandlordRenew );
}
public override void Deserialize( GenericReader reader )
@ -354,8 +344,8 @@ namespace Server.Items
else
m_Duration = VendorRentalDuration.Instances[0];
m_Price = reader.ReadInt();
m_LandlordRenew = reader.ReadBool();
Price = reader.ReadInt();
LandlordRenew = reader.ReadBool();
}
}
}

View file

@ -549,8 +549,6 @@ namespace Server.Items
{
private BeverageType m_Content;
private int m_Quantity;
private Mobile m_Poisoner;
private Poison m_Poison;
public override int LabelNumber
{
@ -586,18 +584,10 @@ namespace Server.Items
public bool IsFull => ( m_Quantity >= MaxQuantity );
[CommandProperty( AccessLevel.GameMaster )]
public Poison Poison
{
get => m_Poison;
set => m_Poison = value;
}
public Poison Poison { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Poisoner
{
get => m_Poisoner;
set => m_Poisoner = value;
}
public Mobile Poisoner { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public BeverageType Content
@ -992,8 +982,8 @@ namespace Server.Items
from.PlaySound( Utility.RandomList( 0x30, 0x2D6 ) );
if ( m_Poison != null )
from.ApplyPoison( m_Poisoner, m_Poison );
if ( Poison != null )
from.ApplyPoison( Poisoner, Poison );
--Quantity;
}
@ -1151,9 +1141,9 @@ namespace Server.Items
writer.Write( (int)1 ); // version
writer.Write( (Mobile)m_Poisoner );
writer.Write( (Mobile)Poisoner );
Poison.Serialize( m_Poison, writer );
Poison.Serialize( Poison, writer );
writer.Write( (int)m_Content );
writer.Write( (int)m_Quantity );
}
@ -1181,12 +1171,12 @@ namespace Server.Items
{
case 1:
{
m_Poisoner = reader.ReadMobile();
Poisoner = reader.ReadMobile();
goto case 0;
}
case 0:
{
m_Poison = Poison.Deserialize( reader );
Poison = Poison.Deserialize( reader );
m_Content = (BeverageType)reader.ReadInt();
m_Quantity = reader.ReadInt();
break;

View file

@ -5,18 +5,12 @@ namespace Server.Items
{
public abstract class CookableFood : Item
{
private int m_CookingLevel;
[CommandProperty( AccessLevel.GameMaster )]
public int CookingLevel
{
get => m_CookingLevel;
set => m_CookingLevel = value;
}
public int CookingLevel { get; set; }
public CookableFood( int itemID, int cookingLevel ) : base( itemID )
{
m_CookingLevel = cookingLevel;
CookingLevel = cookingLevel;
}
public CookableFood( Serial serial ) : base( serial )
@ -31,7 +25,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
// Version 1
writer.Write( (int) m_CookingLevel );
writer.Write( (int) CookingLevel );
}
@ -45,7 +39,7 @@ namespace Server.Items
{
case 1:
{
m_CookingLevel = reader.ReadInt();
CookingLevel = reader.ReadInt();
break;
}

View file

@ -5,30 +5,14 @@ namespace Server.Items
{
public abstract class Food : Item
{
private Mobile m_Poisoner;
private Poison m_Poison;
private int m_FillFactor;
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Poisoner { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Poisoner
{
get => m_Poisoner;
set => m_Poisoner = value;
}
public Poison Poison { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Poison Poison
{
get => m_Poison;
set => m_Poison = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public int FillFactor
{
get => m_FillFactor;
set => m_FillFactor = value;
}
public int FillFactor { get; set; }
public Food( int itemID ) : this( 1, itemID )
{
@ -38,7 +22,7 @@ namespace Server.Items
{
Stackable = true;
Amount = amount;
m_FillFactor = 1;
FillFactor = 1;
}
public Food( Serial serial ) : base( serial )
@ -75,8 +59,8 @@ namespace Server.Items
if ( from.Body.IsHuman && !from.Mounted )
from.Animate( 34, 5, 1, true, false, 0 );
if ( m_Poison != null )
from.ApplyPoison( m_Poisoner, m_Poison );
if ( Poison != null )
from.ApplyPoison( Poisoner, Poison );
Consume();
@ -88,7 +72,7 @@ namespace Server.Items
public virtual bool CheckHunger( Mobile from )
{
return FillHunger( from, m_FillFactor );
return FillHunger( from, FillFactor );
}
public static bool FillHunger( Mobile from, int fillFactor )
@ -132,10 +116,10 @@ namespace Server.Items
writer.Write( (int) 4 ); // version
writer.Write( m_Poisoner );
writer.Write( Poisoner );
Poison.Serialize( m_Poison, writer );
writer.Write( m_FillFactor );
Poison.Serialize( Poison, writer );
writer.Write( FillFactor );
}
public override void Deserialize( GenericReader reader )
@ -150,29 +134,29 @@ namespace Server.Items
{
switch ( reader.ReadInt() )
{
case 0: m_Poison = null; break;
case 1: m_Poison = Poison.Lesser; break;
case 2: m_Poison = Poison.Regular; break;
case 3: m_Poison = Poison.Greater; break;
case 4: m_Poison = Poison.Deadly; break;
case 0: Poison = null; break;
case 1: Poison = Poison.Lesser; break;
case 2: Poison = Poison.Regular; break;
case 3: Poison = Poison.Greater; break;
case 4: Poison = Poison.Deadly; break;
}
break;
}
case 2:
{
m_Poison = Poison.Deserialize( reader );
Poison = Poison.Deserialize( reader );
break;
}
case 3:
{
m_Poison = Poison.Deserialize( reader );
m_FillFactor = reader.ReadInt();
Poison = Poison.Deserialize( reader );
FillFactor = reader.ReadInt();
break;
}
case 4:
{
m_Poisoner = reader.ReadMobile();
Poisoner = reader.ReadMobile();
goto case 3;
}
}

View file

@ -9,14 +9,8 @@ namespace Server.Items
{
public abstract class BaseBoard : Container, ISecurable
{
private SecureLevel m_Level;
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_Level;
set => m_Level = value;
}
public SecureLevel Level { get; set; }
public BaseBoard( int itemID ) : base( itemID )
{
@ -57,7 +51,7 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( (int)m_Level );
writer.Write( (int)Level );
}
public override void Deserialize( GenericReader reader )
@ -66,7 +60,7 @@ namespace Server.Items
int version = reader.ReadInt();
if ( version == 1 )
m_Level = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
if ( Weight == 1.0 )
Weight = 5.0;

View file

@ -2,19 +2,13 @@ namespace Server.Items
{
public class BasePiece : Item
{
private BaseBoard m_Board;
public BaseBoard Board
{
get => m_Board;
set => m_Board = value;
}
public BaseBoard Board { get; set; }
public override bool IsVirtualItem => true;
public BasePiece( int itemID, BaseBoard board ) : base( itemID )
{
m_Board = board;
Board = board;
}
public BasePiece( Serial serial ) : base( serial )
@ -26,7 +20,7 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( m_Board );
writer.Write( Board );
}
public override void Deserialize( GenericReader reader )
@ -39,9 +33,9 @@ namespace Server.Items
{
case 0:
{
m_Board = (BaseBoard)reader.ReadItem();
Board = (BaseBoard)reader.ReadItem();
if ( m_Board == null || Parent == null )
if ( Board == null || Parent == null )
Delete();
break;
@ -51,25 +45,25 @@ namespace Server.Items
public override void OnSingleClick( Mobile from )
{
if ( m_Board == null || m_Board.Deleted )
if ( Board == null || Board.Deleted )
Delete();
else if ( !IsChildOf( m_Board ) )
m_Board.DropItem( this );
else if ( !IsChildOf( Board ) )
Board.DropItem( this );
else
base.OnSingleClick( from );
}
public override bool OnDragLift( Mobile from )
{
if ( m_Board == null || m_Board.Deleted )
if ( Board == null || Board.Deleted )
{
Delete();
return false;
}
if ( !IsChildOf( m_Board ) )
if ( !IsChildOf( Board ) )
{
m_Board.DropItem( this );
Board.DropItem( this );
return false;
}
return true;
@ -84,7 +78,7 @@ namespace Server.Items
public override bool DropToItem( Mobile from, Item target, Point3D p )
{
return ( target == m_Board && p.X != -1 && p.Y != -1 && base.DropToItem( from, target, p ) );
return ( target == Board && p.X != -1 && p.Y != -1 && base.DropToItem( from, target, p ) );
}
public override bool DropToWorld( Mobile from, Point3D p )

View file

@ -9,25 +9,23 @@ namespace Server.Engines.Mahjong
return new MahjongPieceDim( position, 20, 40 );
}
private MahjongGame m_Game;
private Point2D m_Position;
private MahjongPieceDirection m_Direction;
private MahjongWind m_Wind;
public MahjongGame Game { get; }
public MahjongGame Game => m_Game;
public Point2D Position => m_Position;
public MahjongPieceDirection Direction => m_Direction;
public MahjongWind Wind => m_Wind;
public Point2D Position { get; private set; }
public MahjongPieceDirection Direction { get; private set; }
public MahjongWind Wind { get; private set; }
public MahjongDealerIndicator( MahjongGame game, Point2D position, MahjongPieceDirection direction, MahjongWind wind )
{
m_Game = game;
m_Position = position;
m_Direction = direction;
m_Wind = wind;
Game = game;
Position = position;
Direction = direction;
Wind = wind;
}
public MahjongPieceDim Dimensions => GetDimensions( m_Position, m_Direction );
public MahjongPieceDim Dimensions => GetDimensions( Position, Direction );
public void Move( Point2D position, MahjongPieceDirection direction, MahjongWind wind )
{
@ -36,31 +34,31 @@ namespace Server.Engines.Mahjong
if ( !dim.IsValid() )
return;
m_Position = position;
m_Direction = direction;
m_Wind = wind;
Position = position;
Direction = direction;
Wind = wind;
m_Game.Players.SendGeneralPacket( true, true );
Game.Players.SendGeneralPacket( true, true );
}
public void Save( GenericWriter writer )
{
writer.Write( (int) 0 ); // version
writer.Write( m_Position );
writer.Write( (int) m_Direction );
writer.Write( (int) m_Wind );
writer.Write( Position );
writer.Write( (int) Direction );
writer.Write( (int) Wind );
}
public MahjongDealerIndicator( MahjongGame game, GenericReader reader )
{
m_Game = game;
Game = game;
int version = reader.ReadInt();
m_Position = reader.ReadPoint2D();
m_Direction = (MahjongPieceDirection) reader.ReadInt();
m_Wind = (MahjongWind) reader.ReadInt();
Position = reader.ReadPoint2D();
Direction = (MahjongPieceDirection) reader.ReadInt();
Wind = (MahjongWind) reader.ReadInt();
}
}
}

View file

@ -2,48 +2,46 @@ namespace Server.Engines.Mahjong
{
public class MahjongDices
{
private MahjongGame m_Game;
private int m_First;
private int m_Second;
public MahjongGame Game { get; }
public MahjongGame Game => m_Game;
public int First => m_First;
public int Second => m_Second;
public int First { get; private set; }
public int Second { get; private set; }
public MahjongDices( MahjongGame game )
{
m_Game = game;
m_First = Utility.Random( 1, 6 );
m_Second = Utility.Random( 1, 6 );
Game = game;
First = Utility.Random( 1, 6 );
Second = Utility.Random( 1, 6 );
}
public void RollDices( Mobile from )
{
m_First = Utility.Random( 1, 6 );
m_Second = Utility.Random( 1, 6 );
First = Utility.Random( 1, 6 );
Second = Utility.Random( 1, 6 );
m_Game.Players.SendGeneralPacket( true, true );
Game.Players.SendGeneralPacket( true, true );
if ( from != null )
m_Game.Players.SendLocalizedMessage( 1062695, $"{from.Name}\t{m_First}\t{m_Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
Game.Players.SendLocalizedMessage( 1062695, $"{from.Name}\t{First}\t{Second}"); // ~1_name~ rolls the dice and gets a ~2_number~ and a ~3_number~!
}
public void Save( GenericWriter writer )
{
writer.Write( (int) 0 ); // version
writer.Write( m_First );
writer.Write( m_Second );
writer.Write( First );
writer.Write( Second );
}
public MahjongDices( MahjongGame game, GenericReader reader )
{
m_Game = game;
Game = game;
int version = reader.ReadInt();
m_First = reader.ReadInt();
m_Second = reader.ReadInt();
First = reader.ReadInt();
Second = reader.ReadInt();
}
}
}

View file

@ -11,29 +11,22 @@ namespace Server.Engines.Mahjong
public const int MaxPlayers = 4;
public const int BaseScore = 30000;
private MahjongTile[] m_Tiles;
private MahjongDealerIndicator m_DealerIndicator;
private MahjongWallBreakIndicator m_WallBreakIndicator;
private MahjongDices m_Dices;
private MahjongPlayers m_Players;
private bool m_ShowScores;
private bool m_SpectatorVision;
private DateTime m_LastReset;
public MahjongTile[] Tiles => m_Tiles;
public MahjongDealerIndicator DealerIndicator => m_DealerIndicator;
public MahjongWallBreakIndicator WallBreakIndicator => m_WallBreakIndicator;
public MahjongDices Dices => m_Dices;
public MahjongPlayers Players => m_Players;
public MahjongTile[] Tiles { get; private set; }
private SecureLevel m_Level;
public MahjongDealerIndicator DealerIndicator { get; private set; }
public MahjongWallBreakIndicator WallBreakIndicator { get; private set; }
public MahjongDices Dices { get; private set; }
public MahjongPlayers Players { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_Level;
set => m_Level = value;
}
public SecureLevel Level { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool ShowScores
@ -47,11 +40,11 @@ namespace Server.Engines.Mahjong
m_ShowScores = value;
if ( value )
m_Players.SendPlayersPacket( true, true );
Players.SendPlayersPacket( true, true );
m_Players.SendGeneralPacket( true, true );
Players.SendGeneralPacket( true, true );
m_Players.SendLocalizedMessage( value ? 1062777 : 1062778 ); // The dealer has enabled/disabled score display.
Players.SendLocalizedMessage( value ? 1062777 : 1062778 ); // The dealer has enabled/disabled score display.
}
}
@ -66,12 +59,12 @@ namespace Server.Engines.Mahjong
m_SpectatorVision = value;
if ( m_Players.IsInGamePlayer( m_Players.DealerPosition ) )
m_Players.Dealer.Send( new MahjongGeneralInfo( this ) );
if ( Players.IsInGamePlayer( Players.DealerPosition ) )
Players.Dealer.Send( new MahjongGeneralInfo( this ) );
m_Players.SendTilesPacket( false, true );
Players.SendTilesPacket( false, true );
m_Players.SendLocalizedMessage( value ? 1062715 : 1062716 ); // The dealer has enabled/disabled Spectator Vision.
Players.SendLocalizedMessage( value ? 1062715 : 1062716 ); // The dealer has enabled/disabled Spectator Vision.
InvalidateProperties();
}
@ -83,12 +76,12 @@ namespace Server.Engines.Mahjong
Weight = 5.0;
BuildWalls();
m_DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North );
m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) );
m_Dices = new MahjongDices( this );
m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore );
DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North );
WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) );
Dices = new MahjongDices( this );
Players = new MahjongPlayers( this, MaxPlayers, BaseScore );
m_LastReset = DateTime.UtcNow;
m_Level = SecureLevel.CoOwners;
Level = SecureLevel.CoOwners;
}
public MahjongGame( Serial serial ) : base( serial )
@ -100,7 +93,7 @@ namespace Server.Engines.Mahjong
for ( int i = 0; i < 17; i++ )
{
Point2D position = new Point2D( x + i*20, y );
m_Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false );
Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false );
}
index += 17;
@ -111,7 +104,7 @@ namespace Server.Engines.Mahjong
for ( int i = 0; i < 17; i++ )
{
Point2D position = new Point2D( x, y + i*20 );
m_Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false );
Tiles[index + i] = new MahjongTile( this, index + i, typeGenerator.Next(), position, stackLevel, direction, false );
}
index += 17;
@ -119,7 +112,7 @@ namespace Server.Engines.Mahjong
private void BuildWalls()
{
m_Tiles = new MahjongTile[17 * 8];
Tiles = new MahjongTile[17 * 8];
MahjongTileTypeGenerator typeGenerator = new MahjongTileTypeGenerator( 4 );
@ -152,9 +145,9 @@ namespace Server.Engines.Mahjong
{
base.GetContextMenuEntries( from, list );
m_Players.CheckPlayers();
Players.CheckPlayers();
if ( from.Alive && IsAccessibleTo( from ) && m_Players.GetInGameMobiles( true, false ).Count == 0 )
if ( from.Alive && IsAccessibleTo( from ) && Players.GetInGameMobiles( true, false ).Count == 0 )
list.Add( new ResetGameEntry( this ) );
SetSecureLevelEntry.AddTo( from, this, list );
@ -180,9 +173,9 @@ namespace Server.Engines.Mahjong
public override void OnDoubleClick( Mobile from )
{
m_Players.CheckPlayers();
Players.CheckPlayers();
m_Players.Join( from );
Players.Join( from );
}
public void ResetGame( Mobile from )
@ -193,14 +186,14 @@ namespace Server.Engines.Mahjong
m_LastReset = DateTime.UtcNow;
if ( from != null )
m_Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game.
Players.SendLocalizedMessage( 1062771, from.Name ); // ~1_name~ has reset the game.
m_Players.SendRelievePacket( true, true );
Players.SendRelievePacket( true, true );
BuildWalls();
m_DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North );
m_WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) );
m_Players = new MahjongPlayers( this, MaxPlayers, BaseScore );
DealerIndicator = new MahjongDealerIndicator( this, new Point2D( 300, 300 ), MahjongPieceDirection.Up, MahjongWind.North );
WallBreakIndicator = new MahjongWallBreakIndicator( this, new Point2D( 335, 335 ) );
Players = new MahjongPlayers( this, MaxPlayers, BaseScore );
}
public void ResetWalls( Mobile from )
@ -212,16 +205,16 @@ namespace Server.Engines.Mahjong
BuildWalls();
m_Players.SendTilesPacket( true, true );
Players.SendTilesPacket( true, true );
if ( from != null )
m_Players.SendLocalizedMessage( 1062696 ); // The dealer rebuilds the wall.
Players.SendLocalizedMessage( 1062696 ); // The dealer rebuilds the wall.
}
public int GetStackLevel( MahjongPieceDim dim )
{
int level = -1;
foreach ( MahjongTile tile in m_Tiles )
foreach ( MahjongTile tile in Tiles )
{
if ( tile.StackLevel > level && dim.IsOverlapping( tile.Dimensions ) )
level = tile.StackLevel;
@ -235,20 +228,20 @@ namespace Server.Engines.Mahjong
writer.Write( (int) 1 ); // version
writer.Write( (int) m_Level );
writer.Write( (int) Level );
writer.Write( m_Tiles.Length );
writer.Write( Tiles.Length );
for ( int i = 0; i < m_Tiles.Length; i++ )
m_Tiles[i].Save( writer );
for ( int i = 0; i < Tiles.Length; i++ )
Tiles[i].Save( writer );
m_DealerIndicator.Save( writer );
DealerIndicator.Save( writer );
m_WallBreakIndicator.Save( writer );
WallBreakIndicator.Save( writer );
m_Dices.Save( writer );
Dices.Save( writer );
m_Players.Save( writer );
Players.Save( writer );
writer.Write( m_ShowScores );
writer.Write( m_SpectatorVision );
@ -264,28 +257,28 @@ namespace Server.Engines.Mahjong
{
case 1:
{
m_Level = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if ( version < 1 )
m_Level = SecureLevel.CoOwners;
Level = SecureLevel.CoOwners;
int length = reader.ReadInt();
m_Tiles = new MahjongTile[length];
Tiles = new MahjongTile[length];
for ( int i = 0; i < length; i++ )
m_Tiles[i] = new MahjongTile( this, reader );
Tiles[i] = new MahjongTile( this, reader );
m_DealerIndicator = new MahjongDealerIndicator( this, reader );
DealerIndicator = new MahjongDealerIndicator( this, reader );
m_WallBreakIndicator = new MahjongWallBreakIndicator( this, reader );
WallBreakIndicator = new MahjongWallBreakIndicator( this, reader );
m_Dices = new MahjongDices( this, reader );
Dices = new MahjongDices( this, reader );
m_Players = new MahjongPlayers( this, reader );
Players = new MahjongPlayers( this, reader );
m_ShowScores = reader.ReadBool();
m_SpectatorVision = reader.ReadBool();

View file

@ -2,43 +2,41 @@ namespace Server.Engines.Mahjong
{
public struct MahjongPieceDim
{
private Point2D m_Position;
private int m_Width;
private int m_Height;
public Point2D Position { get; }
public Point2D Position => m_Position;
public int Width => m_Width;
public int Height => m_Height;
public int Width { get; }
public int Height { get; }
public MahjongPieceDim( Point2D position, int width, int height )
{
m_Position = position;
m_Width = width;
m_Height = height;
Position = position;
Width = width;
Height = height;
}
public bool IsValid()
{
return m_Position.X >= 0 && m_Position.Y >= 0 && m_Position.X + m_Width <= 670 && m_Position.Y + m_Height <= 670;
return Position.X >= 0 && Position.Y >= 0 && Position.X + Width <= 670 && Position.Y + Height <= 670;
}
public bool IsOverlapping( MahjongPieceDim dim )
{
return m_Position.X < dim.m_Position.X + dim.m_Width && m_Position.Y < dim.m_Position.Y + dim.m_Height && m_Position.X + m_Width > dim.m_Position.X && m_Position.Y + m_Height > dim.m_Position.Y;
return Position.X < dim.Position.X + dim.Width && Position.Y < dim.Position.Y + dim.Height && Position.X + Width > dim.Position.X && Position.Y + Height > dim.Position.Y;
}
public int GetHandArea()
{
if ( m_Position.X + m_Width > 150 && m_Position.X < 520 && m_Position.Y < 35 )
if ( Position.X + Width > 150 && Position.X < 520 && Position.Y < 35 )
return 0;
if ( m_Position.X + m_Width > 635 && m_Position.Y + m_Height > 150 && m_Position.Y < 520 )
if ( Position.X + Width > 635 && Position.Y + Height > 150 && Position.Y < 520 )
return 1;
if ( m_Position.X + m_Width > 150 && m_Position.X < 520 && m_Position.Y + m_Height > 635 )
if ( Position.X + Width > 150 && Position.X < 520 && Position.Y + Height > 635 )
return 2;
if ( m_Position.X < 35 && m_Position.Y + m_Height > 150 && m_Position.Y < 520 )
if ( Position.X < 35 && Position.Y + Height > 150 && Position.Y < 520 )
return 3;
return -1;

View file

@ -4,22 +4,21 @@ namespace Server.Engines.Mahjong
{
public class MahjongPlayers
{
private MahjongGame m_Game;
private Mobile[] m_Players;
private bool[] m_InGame;
private bool[] m_PublicHand;
private int[] m_Scores;
private int m_DealerPosition;
private ArrayList m_Spectators;
public MahjongGame Game => m_Game;
public MahjongGame Game { get; }
public int Seats => m_Players.Length;
public Mobile Dealer => m_Players[m_DealerPosition];
public int DealerPosition => m_DealerPosition;
public Mobile Dealer => m_Players[DealerPosition];
public int DealerPosition { get; private set; }
public MahjongPlayers( MahjongGame game, int maxPlayers, int baseScore )
{
m_Game = game;
Game = game;
m_Spectators = new ArrayList();
m_Players = new Mobile[maxPlayers];
@ -52,7 +51,7 @@ namespace Server.Engines.Mahjong
{
if ( Dealer != mobile )
return false;
return m_InGame[m_DealerPosition];
return m_InGame[DealerPosition];
}
public bool IsInGamePlayer( int index )
@ -95,7 +94,7 @@ namespace Server.Engines.Mahjong
m_PublicHand[index] = value;
SendTilesPacket( true, !m_Game.SpectatorVision );
SendTilesPacket( true, !Game.SpectatorVision );
if ( IsInGamePlayer( index ) )
m_Players[index].SendLocalizedMessage( value ? 1062775 : 1062776 ); // Your hand is [not] publicly viewable.
@ -152,11 +151,11 @@ namespace Server.Engines.Mahjong
removed = true;
}
else if ( !m_Game.IsAccessibleTo( player ) || player.Map != m_Game.Map || !player.InRange( m_Game.GetWorldLocation(), 5 ) )
else if ( !Game.IsAccessibleTo( player ) || player.Map != Game.Map || !player.InRange( Game.GetWorldLocation(), 5 ) )
{
m_InGame[i] = false;
player.Send( new MahjongRelieve( m_Game ) );
player.Send( new MahjongRelieve( Game ) );
SendPlayerExitMessage( player );
UpdateDealer( true );
@ -175,11 +174,11 @@ namespace Server.Engines.Mahjong
{
m_Spectators.RemoveAt( i );
}
else if ( !m_Game.IsAccessibleTo( mobile ) || mobile.Map != m_Game.Map || !mobile.InRange( m_Game.GetWorldLocation(), 5 ) )
else if ( !Game.IsAccessibleTo( mobile ) || mobile.Map != Game.Map || !mobile.InRange( Game.GetWorldLocation(), 5 ) )
{
m_Spectators.RemoveAt( i );
mobile.Send( new MahjongRelieve( m_Game ) );
mobile.Send( new MahjongRelieve( Game ) );
}
else
{
@ -193,14 +192,14 @@ namespace Server.Engines.Mahjong
private void UpdateDealer( bool message )
{
if ( IsInGamePlayer( m_DealerPosition ) )
if ( IsInGamePlayer( DealerPosition ) )
return;
for ( int i = m_DealerPosition + 1; i < m_Players.Length; i++ )
for ( int i = DealerPosition + 1; i < m_Players.Length; i++ )
{
if ( IsInGamePlayer( i ) )
{
m_DealerPosition = i;
DealerPosition = i;
if ( message )
SendDealerChangedMessage();
@ -209,11 +208,11 @@ namespace Server.Engines.Mahjong
}
}
for ( int i = 0; i < m_DealerPosition; i++ )
for ( int i = 0; i < DealerPosition; i++ )
{
if ( IsInGamePlayer( i ) )
{
m_DealerPosition = i;
DealerPosition = i;
if ( message )
SendDealerChangedMessage();
@ -225,13 +224,13 @@ namespace Server.Engines.Mahjong
private int GetNextSeat()
{
for ( int i = m_DealerPosition; i < m_Players.Length; i++ )
for ( int i = DealerPosition; i < m_Players.Length; i++ )
{
if ( m_Players[i] == null )
return i;
}
for ( int i = 0; i < m_DealerPosition; i++ )
for ( int i = 0; i < DealerPosition; i++ )
{
if ( m_Players[i] == null )
return i;
@ -271,14 +270,14 @@ namespace Server.Engines.Mahjong
UpdateDealer( false );
if ( sendJoinGame )
player.Send( new MahjongJoinGame( m_Game ) );
player.Send( new MahjongJoinGame( Game ) );
SendPlayersPacket( true, true );
player.Send( new MahjongGeneralInfo( m_Game ) );
player.Send( new MahjongTilesInfo( m_Game, player ) );
player.Send( new MahjongGeneralInfo( Game ) );
player.Send( new MahjongTilesInfo( Game, player ) );
if ( m_DealerPosition == index )
if ( DealerPosition == index )
SendLocalizedMessage( 1062773, player.Name ); // ~1_name~ has entered the game as the dealer.
else
SendLocalizedMessage( 1062772, player.Name ); // ~1_name~ has entered the game as a player.
@ -291,10 +290,10 @@ namespace Server.Engines.Mahjong
m_Spectators.Add( mobile );
}
mobile.Send( new MahjongJoinGame( m_Game ) );
mobile.Send( new MahjongPlayersInfo( m_Game, mobile ) );
mobile.Send( new MahjongGeneralInfo( m_Game ) );
mobile.Send( new MahjongTilesInfo( m_Game, mobile ) );
mobile.Send( new MahjongJoinGame( Game ) );
mobile.Send( new MahjongPlayersInfo( Game, mobile ) );
mobile.Send( new MahjongGeneralInfo( Game ) );
mobile.Send( new MahjongTilesInfo( Game, mobile ) );
}
public void Join( Mobile mobile )
@ -345,7 +344,7 @@ namespace Server.Engines.Mahjong
m_Scores[i] = value;
}
SendPlayersPacket( true, m_Game.ShowScores );
SendPlayersPacket( true, Game.ShowScores );
SendLocalizedMessage( 1062697 ); // The dealer redistributes the score sticks evenly.
}
@ -361,14 +360,14 @@ namespace Server.Engines.Mahjong
m_Scores[fromPosition] -= amount;
m_Scores[toPosition] += amount;
if ( m_Game.ShowScores )
if ( Game.ShowScores )
{
SendPlayersPacket( true, true );
}
else
{
from.Send( new MahjongPlayersInfo( m_Game, from ) );
to.Send( new MahjongPlayersInfo( m_Game, to ) );
from.Send( new MahjongPlayersInfo( Game, from ) );
to.Send( new MahjongPlayersInfo( Game, to ) );
}
SendLocalizedMessage( 1062774, $"{from.Name}\t{to.Name}\t{amount}"); // ~1_giver~ gives ~2_receiver~ ~3_number~ points.
@ -381,7 +380,7 @@ namespace Server.Engines.Mahjong
return;
if ( m_InGame[index] )
player.Send( new MahjongRelieve( m_Game ) );
player.Send( new MahjongRelieve( Game ) );
m_Players[index] = null;
@ -400,14 +399,14 @@ namespace Server.Engines.Mahjong
if ( to == null || !m_InGame[index] )
return;
int oldDealer = m_DealerPosition;
int oldDealer = DealerPosition;
m_DealerPosition = index;
DealerPosition = index;
if ( IsInGamePlayer( oldDealer ) )
m_Players[oldDealer].Send( new MahjongPlayersInfo( m_Game, m_Players[oldDealer] ) );
m_Players[oldDealer].Send( new MahjongPlayersInfo( Game, m_Players[oldDealer] ) );
to.Send( new MahjongPlayersInfo( m_Game, to ) );
to.Send( new MahjongPlayersInfo( Game, to ) );
SendDealerChangedMessage();
}
@ -427,7 +426,7 @@ namespace Server.Engines.Mahjong
{
foreach ( Mobile mobile in GetInGameMobiles( players, spectators ) )
{
mobile.Send( new MahjongPlayersInfo( m_Game, mobile ) );
mobile.Send( new MahjongPlayersInfo( Game, mobile ) );
}
}
@ -438,7 +437,7 @@ namespace Server.Engines.Mahjong
if ( mobiles.Count == 0 )
return;
MahjongGeneralInfo generalInfo = new MahjongGeneralInfo( m_Game );
MahjongGeneralInfo generalInfo = new MahjongGeneralInfo( Game );
generalInfo.Acquire();
@ -454,7 +453,7 @@ namespace Server.Engines.Mahjong
{
foreach ( Mobile mobile in GetInGameMobiles( players, spectators ) )
{
mobile.Send( new MahjongTilesInfo( m_Game, mobile ) );
mobile.Send( new MahjongTilesInfo( Game, mobile ) );
}
}
@ -473,7 +472,7 @@ namespace Server.Engines.Mahjong
if ( mobiles.Count == 0 )
return;
MahjongRelieve relieve = new MahjongRelieve( m_Game );
MahjongRelieve relieve = new MahjongRelieve( Game );
relieve.Acquire();
@ -514,12 +513,12 @@ namespace Server.Engines.Mahjong
writer.Write( m_Scores[i] );
}
writer.Write( m_DealerPosition );
writer.Write( DealerPosition );
}
public MahjongPlayers( MahjongGame game, GenericReader reader )
{
m_Game = game;
Game = game;
m_Spectators = new ArrayList();
int version = reader.ReadInt();
@ -537,7 +536,7 @@ namespace Server.Engines.Mahjong
m_Scores[i] = reader.ReadInt();
}
m_DealerPosition = reader.ReadInt();
DealerPosition = reader.ReadInt();
}
}
}

View file

@ -9,36 +9,35 @@ namespace Server.Engines.Mahjong
return new MahjongPieceDim( position, 30, 20 );
}
private MahjongGame m_Game;
private int m_Number;
private MahjongTileType m_Value;
protected Point2D m_Position;
private int m_StackLevel;
private MahjongPieceDirection m_Direction;
private bool m_Flipped;
public MahjongGame Game => m_Game;
public int Number => m_Number;
public MahjongTileType Value => m_Value;
public MahjongGame Game { get; }
public int Number { get; }
public MahjongTileType Value { get; }
public Point2D Position => m_Position;
public int StackLevel => m_StackLevel;
public MahjongPieceDirection Direction => m_Direction;
public bool Flipped => m_Flipped;
public int StackLevel { get; private set; }
public MahjongPieceDirection Direction { get; private set; }
public bool Flipped { get; private set; }
public MahjongTile( MahjongGame game, int number, MahjongTileType value, Point2D position, int stackLevel, MahjongPieceDirection direction, bool flipped )
{
m_Game = game;
m_Number = number;
m_Value = value;
Game = game;
Number = number;
Value = value;
m_Position = position;
m_StackLevel = stackLevel;
m_Direction = direction;
m_Flipped = flipped;
StackLevel = stackLevel;
Direction = direction;
Flipped = flipped;
}
public MahjongPieceDim Dimensions => GetDimensions( m_Position, m_Direction );
public MahjongPieceDim Dimensions => GetDimensions( m_Position, Direction );
public bool IsMovable => m_Game.GetStackLevel( Dimensions ) <= m_StackLevel;
public bool IsMovable => Game.GetStackLevel( Dimensions ) <= StackLevel;
public void Move( Point2D position, MahjongPieceDirection direction, bool flip, int validHandArea )
{
@ -50,38 +49,38 @@ namespace Server.Engines.Mahjong
return;
m_Position = position;
m_Direction = direction;
m_StackLevel = -1; // Avoid self interference
m_StackLevel = m_Game.GetStackLevel( dim ) + 1;
m_Flipped = flip;
Direction = direction;
StackLevel = -1; // Avoid self interference
StackLevel = Game.GetStackLevel( dim ) + 1;
Flipped = flip;
m_Game.Players.SendTilePacket( this, true, true );
Game.Players.SendTilePacket( this, true, true );
}
public void Save( GenericWriter writer )
{
writer.Write( (int) 0 ); // version
writer.Write( m_Number );
writer.Write( (int) m_Value );
writer.Write( Number );
writer.Write( (int) Value );
writer.Write( m_Position );
writer.Write( m_StackLevel );
writer.Write( (int) m_Direction );
writer.Write( m_Flipped );
writer.Write( StackLevel );
writer.Write( (int) Direction );
writer.Write( Flipped );
}
public MahjongTile( MahjongGame game, GenericReader reader )
{
m_Game = game;
Game = game;
int version = reader.ReadInt();
m_Number = reader.ReadInt();
m_Value = (MahjongTileType) reader.ReadInt();
Number = reader.ReadInt();
Value = (MahjongTileType) reader.ReadInt();
m_Position = reader.ReadPoint2D();
m_StackLevel = reader.ReadInt();
m_Direction = (MahjongPieceDirection) reader.ReadInt();
m_Flipped = reader.ReadBool();
StackLevel = reader.ReadInt();
Direction = (MahjongPieceDirection) reader.ReadInt();
Flipped = reader.ReadBool();
}
}
}

View file

@ -4,28 +4,26 @@ namespace Server.Engines.Mahjong
{
public class MahjongTileTypeGenerator
{
private ArrayList m_LeftTileTypes;
public ArrayList LeftTileTypes => m_LeftTileTypes;
public ArrayList LeftTileTypes { get; }
public MahjongTileTypeGenerator( int count )
{
m_LeftTileTypes = new ArrayList( 34 * count );
LeftTileTypes = new ArrayList( 34 * count );
for ( int i = 1; i <= 34; i++ )
{
for ( int j = 0; j < count; j++ )
{
m_LeftTileTypes.Add( (MahjongTileType)i );
LeftTileTypes.Add( (MahjongTileType)i );
}
}
}
public MahjongTileType Next()
{
int random = Utility.Random( m_LeftTileTypes.Count );
MahjongTileType next = (MahjongTileType)m_LeftTileTypes[random];
m_LeftTileTypes.RemoveAt( random );
int random = Utility.Random( LeftTileTypes.Count );
MahjongTileType next = (MahjongTileType)LeftTileTypes[random];
LeftTileTypes.RemoveAt( random );
return next;
}

View file

@ -7,19 +7,17 @@ namespace Server.Engines.Mahjong
return new MahjongPieceDim( position, 20, 20 );
}
private MahjongGame m_Game;
private Point2D m_Position;
public MahjongGame Game { get; }
public MahjongGame Game => m_Game;
public Point2D Position => m_Position;
public Point2D Position { get; private set; }
public MahjongWallBreakIndicator( MahjongGame game, Point2D position )
{
m_Game = game;
m_Position = position;
Game = game;
Position = position;
}
public MahjongPieceDim Dimensions => GetDimensions( m_Position );
public MahjongPieceDim Dimensions => GetDimensions( Position );
public void Move( Point2D position )
{
@ -28,25 +26,25 @@ namespace Server.Engines.Mahjong
if ( !dim.IsValid() )
return;
m_Position = position;
Position = position;
m_Game.Players.SendGeneralPacket( true, true );
Game.Players.SendGeneralPacket( true, true );
}
public void Save( GenericWriter writer )
{
writer.Write( (int) 0 ); // version
writer.Write( m_Position );
writer.Write( Position );
}
public MahjongWallBreakIndicator( MahjongGame game, GenericReader reader )
{
m_Game = game;
Game = game;
int version = reader.ReadInt();
m_Position = reader.ReadPoint2D();
Position = reader.ReadPoint2D();
}
}
}

View file

@ -9,7 +9,6 @@ namespace Server.Items
{
public class Guildstone : Item, IAddon, IChopable
{
private Guild m_Guild;
private string m_GuildName;
private string m_GuildAbbrev;
@ -28,7 +27,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Guild Guild => m_Guild;
public Guild Guild { get; private set; }
public override int LabelNumber => 1041429; // a guildstone
@ -38,7 +37,7 @@ namespace Server.Items
public Guildstone( Guild g, string guildName, string abbrev ) : base( Guild.NewGuildSystem ? 0xED6 : 0xED4 )
{
m_Guild = g;
Guild = g;
m_GuildName = guildName;
m_GuildAbbrev = abbrev;
@ -53,10 +52,10 @@ namespace Server.Items
{
base.Serialize( writer );
if ( m_Guild != null && !m_Guild.Disbanded )
if ( Guild != null && !Guild.Disbanded )
{
m_GuildName = m_Guild.Name;
m_GuildAbbrev = m_Guild.Abbreviation;
m_GuildName = Guild.Name;
m_GuildAbbrev = Guild.Abbreviation;
}
writer.Write( (int)3 ); // version
@ -66,7 +65,7 @@ namespace Server.Items
writer.Write( m_GuildName );
writer.Write( m_GuildAbbrev );
writer.Write( m_Guild );
writer.Write( Guild );
}
private bool m_BeforeChangeover;
@ -92,7 +91,7 @@ namespace Server.Items
}
case 1:
{
m_Guild = reader.ReadGuild() as Guild;
Guild = reader.ReadGuild() as Guild;
goto case 0;
}
@ -111,7 +110,7 @@ namespace Server.Items
if ( Guild.NewGuildSystem && m_BeforeChangeover )
Timer.DelayCall( TimeSpan.Zero, AddToHouse );
if ( !Guild.NewGuildSystem && m_Guild == null )
if ( !Guild.NewGuildSystem && Guild == null )
Delete();
}
@ -130,15 +129,15 @@ namespace Server.Items
{
base.GetProperties( list );
if ( m_Guild != null && !m_Guild.Disbanded )
if ( Guild != null && !Guild.Disbanded )
{
string name;
string abbr;
if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 )
if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 )
name = "(unnamed)";
if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 )
if ( (abbr = Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 )
abbr = "";
//list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~
@ -154,11 +153,11 @@ namespace Server.Items
{
base.OnSingleClick( from );
if ( m_Guild != null && !m_Guild.Disbanded )
if ( Guild != null && !Guild.Disbanded )
{
string name;
if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 )
if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 )
name = "(unnamed)";
LabelTo( from, name );
@ -171,8 +170,8 @@ namespace Server.Items
public override void OnAfterDelete()
{
if ( !Guild.NewGuildSystem && m_Guild != null && !m_Guild.Disbanded )
m_Guild.Disband();
if ( !Guild.NewGuildSystem && Guild != null && !Guild.Disbanded )
Guild.Disband();
}
public override void OnDoubleClick( Mobile from )
@ -180,7 +179,7 @@ namespace Server.Items
if ( Guild.NewGuildSystem )
return;
if ( m_Guild == null || m_Guild.Disbanded )
if ( Guild == null || Guild.Disbanded )
{
Delete();
}
@ -188,10 +187,10 @@ namespace Server.Items
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m_Guild.Accepted.Contains( from ) )
else if ( Guild.Accepted.Contains( from ) )
{
#region Factions
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
PlayerState guildState = PlayerState.Find( Guild.Leader );
PlayerState targetState = PlayerState.Find( from );
Faction guildFaction = guildState?.Faction;
@ -204,25 +203,25 @@ namespace Server.Items
targetState.Leaving = guildState.Leaving;
#endregion
m_Guild.Accepted.Remove( from );
m_Guild.AddMember( from );
Guild.Accepted.Remove( from );
Guild.AddMember( from );
GuildGump.EnsureClosed( from );
from.SendGump( new GuildGump( from, m_Guild ) );
from.SendGump( new GuildGump( from, Guild ) );
}
else if ( from.AccessLevel < AccessLevel.GameMaster && !m_Guild.IsMember( from ) )
else if ( from.AccessLevel < AccessLevel.GameMaster && !Guild.IsMember( from ) )
{
from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, 501158, "", "" ) ); // You are not a member ...
}
else
{
GuildGump.EnsureClosed( from );
from.SendGump( new GuildGump( from, m_Guild ) );
from.SendGump( new GuildGump( from, Guild ) );
}
}
#region IAddon Members
public Item Deed => new GuildstoneDeed( m_Guild, m_GuildName, m_GuildAbbrev );
public Item Deed => new GuildstoneDeed( Guild, m_GuildName, m_GuildAbbrev );
public bool CouldFit( IPoint3D p, Map map )
{
@ -267,7 +266,6 @@ namespace Server.Items
{
public override int LabelNumber => 1041233; // deed to a guildstone
private Guild m_Guild;
private string m_GuildName;
private string m_GuildAbbrev;
@ -286,7 +284,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Guild Guild => m_Guild;
public Guild Guild { get; private set; }
[Constructible]
public GuildstoneDeed() : this( null, null )
@ -300,7 +298,7 @@ namespace Server.Items
public GuildstoneDeed( Guild g, string guildName, string abbrev ) : base( 0x14F0 )
{
m_Guild = g;
Guild = g;
m_GuildName = guildName;
m_GuildAbbrev = abbrev;
@ -315,10 +313,10 @@ namespace Server.Items
{
base.Serialize( writer );
if ( m_Guild != null && !m_Guild.Disbanded )
if ( Guild != null && !Guild.Disbanded )
{
m_GuildName = m_Guild.Name;
m_GuildAbbrev = m_Guild.Abbreviation;
m_GuildName = Guild.Name;
m_GuildAbbrev = Guild.Abbreviation;
}
writer.Write( (int)1 ); // version
@ -326,7 +324,7 @@ namespace Server.Items
writer.Write( m_GuildName );
writer.Write( m_GuildAbbrev );
writer.Write( m_Guild );
writer.Write( Guild );
}
public override void Deserialize( GenericReader reader )
@ -342,7 +340,7 @@ namespace Server.Items
m_GuildName = reader.ReadString();
m_GuildAbbrev = reader.ReadString();
m_Guild = reader.ReadGuild() as Guild;
Guild = reader.ReadGuild() as Guild;
break;
}
@ -353,15 +351,15 @@ namespace Server.Items
{
base.GetProperties( list );
if ( m_Guild != null && !m_Guild.Disbanded )
if ( Guild != null && !Guild.Disbanded )
{
string name;
string abbr;
if ( (name = m_Guild.Name) == null || (name = name.Trim()).Length <= 0 )
if ( (name = Guild.Name) == null || (name = name.Trim()).Length <= 0 )
name = "(unnamed)";
if ( (abbr = m_Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 )
if ( (abbr = Guild.Abbreviation) == null || (abbr = abbr.Trim()).Length <= 0 )
abbr = "";
//list.Add( 1060802, Utility.FixHtml( name ) ); // Guild name: ~1_val~
@ -408,7 +406,7 @@ namespace Server.Items
{
if ( house != null && house.IsOwner( from ) )
{
Item addon = new Guildstone( m_Guild, m_GuildName, m_GuildAbbrev );
Item addon = new Guildstone( Guild, m_GuildName, m_GuildAbbrev );
addon.MoveToWorld( loc, from.Map );

View file

@ -6,9 +6,7 @@ namespace Server.Items
{
private Timer m_Timer;
private DateTime m_End;
private bool m_BurntOut;
private bool m_Burning;
private bool m_Protected;
private TimeSpan m_Duration = TimeSpan.Zero;
public abstract int LitItemID{ get; }
@ -37,18 +35,10 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public bool BurntOut
{
get => m_BurntOut;
set => m_BurntOut = value;
}
public bool BurntOut { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Protected
{
get => m_Protected;
set => m_Protected = value;
}
public bool Protected { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan Duration
@ -88,7 +78,7 @@ namespace Server.Items
{
int sound = UnlitSound;
if ( m_BurntOut && BurntOutSound != 0 )
if ( BurntOut && BurntOutSound != 0 )
sound = BurntOutSound;
@ -101,7 +91,7 @@ namespace Server.Items
public virtual void Ignite()
{
if ( !m_BurntOut )
if ( !BurntOut )
{
PlayLitSound();
@ -115,12 +105,12 @@ namespace Server.Items
{
m_Burning = false;
if ( m_BurntOut && BurntOutItemID != 0 )
if ( BurntOut && BurntOutItemID != 0 )
ItemID = BurntOutItemID;
else
ItemID = UnlitItemID;
if ( m_BurntOut )
if ( BurntOut )
m_Duration = TimeSpan.Zero;
else if ( m_Duration != TimeSpan.Zero )
m_Duration = m_End - DateTime.UtcNow;
@ -132,7 +122,7 @@ namespace Server.Items
public virtual void Burn()
{
m_BurntOut = true;
BurntOut = true;
Douse();
}
@ -153,10 +143,10 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_BurntOut )
if ( BurntOut )
return;
if ( m_Protected && from.AccessLevel == AccessLevel.Player )
if ( Protected && from.AccessLevel == AccessLevel.Player )
return;
if ( !from.InRange( GetWorldLocation(), 2 ) )
@ -178,10 +168,10 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int) 0 );
writer.Write( m_BurntOut );
writer.Write( BurntOut );
writer.Write( m_Burning );
writer.Write( m_Duration );
writer.Write( m_Protected );
writer.Write( Protected );
if ( m_Burning && m_Duration != TimeSpan.Zero )
writer.WriteDeltaTime( m_End );
@ -197,10 +187,10 @@ namespace Server.Items
{
case 0:
{
m_BurntOut = reader.ReadBool();
BurntOut = reader.ReadBool();
m_Burning = reader.ReadBool();
m_Duration = reader.ReadTimeSpan();
m_Protected = reader.ReadBool();
Protected = reader.ReadBool();
if ( m_Burning && m_Duration != TimeSpan.Zero )
DoTimer( reader.ReadDeltaTime() - DateTime.UtcNow );

View file

@ -25,7 +25,7 @@ namespace Server.Items
base.Serialize( writer );
writer.Write( (int) 1 );
writer.Write( m_IsShipwreckedItem );
writer.Write( IsShipwreckedItem );
}
public override void Deserialize( GenericReader reader )
@ -37,7 +37,7 @@ namespace Server.Items
{
case 1:
{
m_IsShipwreckedItem = reader.ReadBool();
IsShipwreckedItem = reader.ReadBool();
break;
}
}
@ -47,7 +47,7 @@ namespace Server.Items
{
base.AddNameProperties( list );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
list.Add( 1041645 ); // recovered from a shipwreck
}
@ -55,20 +55,15 @@ namespace Server.Items
{
base.OnSingleClick( from );
if ( m_IsShipwreckedItem )
if ( IsShipwreckedItem )
LabelTo( from, 1041645 ); //recovered from a shipwreck
}
#region IShipwreckedItem Members
private bool m_IsShipwreckedItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsShipwreckedItem
{
get => m_IsShipwreckedItem;
set => m_IsShipwreckedItem = value;
}
public bool IsShipwreckedItem { get; set; }
#endregion
}
}

View file

@ -8,54 +8,31 @@ namespace Server.Items
[Flippable( 0x14EB, 0x14EC )]
public class MapItem : Item, ICraftable
{
private Rectangle2D m_Bounds;
private int m_Width, m_Height;
private bool m_Protected;
private bool m_Editable;
private List<Point2D> m_Pins = new List<Point2D>();
private const int MaxUserPins = 50;
[CommandProperty( AccessLevel.GameMaster )]
public bool Protected
{
get => m_Protected;
set => m_Protected = value;
}
public bool Protected { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Rectangle2D Bounds
{
get => m_Bounds;
set => m_Bounds = value;
}
public Rectangle2D Bounds { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Width
{
get => m_Width;
set => m_Width = value;
}
public int Width { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Height
{
get => m_Height;
set => m_Height = value;
}
public int Height { get; set; }
public List<Point2D> Pins => m_Pins;
public List<Point2D> Pins { get; } = new List<Point2D>();
[Constructible]
public MapItem() : base( 0x14EC )
{
Weight = 1.0;
m_Width = 200;
m_Height = 200;
Width = 200;
Height = 200;
}
public virtual void CraftInit( Mobile from )
@ -99,8 +76,8 @@ namespace Server.Items
from.Send( new MapDetails( this ) );
from.Send( new MapDisplay( this ) );
for ( int i = 0; i < m_Pins.Count; ++i )
from.Send( new MapAddPin( this, m_Pins[i] ) );
for ( int i = 0; i < Pins.Count; ++i )
from.Send( new MapAddPin( this, Pins[i] ) );
from.Send( new MapSetEditable( this, ValidateEdit( from ) ) );
}
@ -109,7 +86,7 @@ namespace Server.Items
{
if ( !ValidateEdit( from ) )
return;
if ( m_Pins.Count >= MaxUserPins )
if ( Pins.Count >= MaxUserPins )
return;
Validate( ref x, ref y );
@ -137,7 +114,7 @@ namespace Server.Items
{
if ( !ValidateEdit( from ) )
return;
if ( m_Pins.Count >= MaxUserPins )
if ( Pins.Count >= MaxUserPins )
return;
Validate( ref x, ref y );
@ -164,13 +141,13 @@ namespace Server.Items
{
if ( x < 0 )
x = 0;
else if ( x >= m_Width )
x = m_Width - 1;
else if ( x >= Width )
x = Width - 1;
if ( y < 0 )
y = 0;
else if ( y >= m_Height )
y = m_Height - 1;
else if ( y >= Height )
y = Height - 1;
}
public virtual bool ValidateEdit( Mobile from )
@ -184,7 +161,7 @@ namespace Server.Items
return false;
if ( from.AccessLevel >= AccessLevel.GameMaster )
return true;
if ( !Movable || m_Protected || !from.InRange( GetWorldLocation(), 2 ) )
if ( !Movable || Protected || !from.InRange( GetWorldLocation(), 2 ) )
return false;
object root = RootParent;
@ -197,14 +174,14 @@ namespace Server.Items
public void ConvertToWorld( int x, int y, out int worldX, out int worldY )
{
worldX = ( ( m_Bounds.Width * x ) / Width ) + m_Bounds.X;
worldY = ( ( m_Bounds.Height * y ) / Height ) + m_Bounds.Y;
worldX = ( ( Bounds.Width * x ) / Width ) + Bounds.X;
worldY = ( ( Bounds.Height * y ) / Height ) + Bounds.Y;
}
public void ConvertToMap( int x, int y, out int mapX, out int mapY )
{
mapX = ( ( x - m_Bounds.X ) * Width ) / m_Bounds.Width;
mapY = ( ( y - m_Bounds.Y ) * Width ) / m_Bounds.Height;
mapX = ( ( x - Bounds.X ) * Width ) / Bounds.Width;
mapY = ( ( y - Bounds.Y ) * Width ) / Bounds.Height;
}
public virtual void AddWorldPin( int x, int y )
@ -217,32 +194,32 @@ namespace Server.Items
public virtual void AddPin( int x, int y )
{
m_Pins.Add( new Point2D( x, y ) );
Pins.Add( new Point2D( x, y ) );
}
public virtual void RemovePin( int index )
{
if ( index > 0 && index < m_Pins.Count )
m_Pins.RemoveAt( index );
if ( index > 0 && index < Pins.Count )
Pins.RemoveAt( index );
}
public virtual void InsertPin( int index, int x, int y )
{
if ( index < 0 || index >= m_Pins.Count )
m_Pins.Add( new Point2D( x, y ) );
if ( index < 0 || index >= Pins.Count )
Pins.Add( new Point2D( x, y ) );
else
m_Pins.Insert( index, new Point2D( x, y ) );
Pins.Insert( index, new Point2D( x, y ) );
}
public virtual void ChangePin( int index, int x, int y )
{
if ( index >= 0 && index < m_Pins.Count )
m_Pins[index] = new Point2D( x, y );
if ( index >= 0 && index < Pins.Count )
Pins[index] = new Point2D( x, y );
}
public virtual void ClearPins()
{
m_Pins.Clear();
Pins.Clear();
}
public override void Serialize( GenericWriter writer )
@ -251,16 +228,16 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( m_Bounds );
writer.Write( Bounds );
writer.Write( m_Width );
writer.Write( m_Height );
writer.Write( Width );
writer.Write( Height );
writer.Write( m_Protected );
writer.Write( Protected );
writer.Write( m_Pins.Count );
for ( int i = 0; i < m_Pins.Count; ++i )
writer.Write( m_Pins[i] );
writer.Write( Pins.Count );
for ( int i = 0; i < Pins.Count; ++i )
writer.Write( Pins[i] );
}
public override void Deserialize( GenericReader reader )
@ -273,16 +250,16 @@ namespace Server.Items
{
case 0:
{
m_Bounds = reader.ReadRect2D();
Bounds = reader.ReadRect2D();
m_Width = reader.ReadInt();
m_Height = reader.ReadInt();
Width = reader.ReadInt();
Height = reader.ReadInt();
m_Protected = reader.ReadBool();
Protected = reader.ReadBool();
int count = reader.ReadInt();
for ( int i = 0; i < count; i++ )
m_Pins.Add( reader.ReadPoint2D() );
Pins.Add( reader.ReadPoint2D() );
break;
}

View file

@ -62,55 +62,53 @@ namespace Server.Items
public class PresetMapEntry
{
private int m_Name;
private int m_Width, m_Height;
private Rectangle2D m_Bounds;
public int Name { get; }
public int Name => m_Name;
public int Width => m_Width;
public int Height => m_Height;
public Rectangle2D Bounds => m_Bounds;
public int Width { get; }
public int Height { get; }
public Rectangle2D Bounds { get; }
public PresetMapEntry( int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom )
{
m_Name = name;
m_Width = width;
m_Height = height;
m_Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
Name = name;
Width = width;
Height = height;
Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
}
private static PresetMapEntry[] m_Table = {
new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain
new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae
new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic
new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den
new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia
new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo
new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom
new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia
new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo
new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc
new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew
new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper
new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow
new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm
new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm
new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia
new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo
new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold
new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo
new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae
new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World
new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic
new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den
new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom
new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper
new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm
new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew
new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain
};
public static PresetMapEntry[] Table => m_Table;
public static PresetMapEntry[] Table { get; } =
{
new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain
new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae
new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic
new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den
new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia
new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo
new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom
new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia
new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo
new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc
new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew
new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper
new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow
new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm
new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm
new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia
new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo
new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold
new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo
new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae
new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World
new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic
new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den
new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom
new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper
new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm
new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew
new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain
};
}
public enum PresetMapType

View file

@ -15,7 +15,6 @@ namespace Server.Items
private Mobile m_CompletedBy;
private Mobile m_Decoder;
private Map m_Map;
private Point2D m_Location;
[CommandProperty( AccessLevel.GameMaster )]
public int Level{ get => m_Level;
@ -38,9 +37,7 @@ namespace Server.Items
set{ m_Map = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public Point2D ChestLocation{ get => m_Location;
set => m_Location = value;
}
public Point2D ChestLocation { get; set; }
private static Point2D[] m_Locations;
private static Point2D[] m_HavenLocations;
@ -207,9 +204,9 @@ namespace Server.Items
m_Map = map;
if ( level == 0 )
m_Location = GetRandomHavenLocation();
ChestLocation = GetRandomHavenLocation();
else
m_Location = GetRandomLocation();
ChestLocation = GetRandomLocation();
Width = 300;
Height = 300;
@ -217,8 +214,8 @@ namespace Server.Items
int width = 600;
int height = 600;
int x1 = m_Location.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 );
int y1 = m_Location.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 );
int x1 = ChestLocation.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 );
int y1 = ChestLocation.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 );
if ( x1 < 0 )
x1 = 0;
@ -241,7 +238,7 @@ namespace Server.Items
Bounds = new Rectangle2D( x1, y1, width, height );
Protected = true;
AddWorldPin( m_Location.X, m_Location.Y );
AddWorldPin( ChestLocation.X, ChestLocation.Y );
}
public TreasureMap( Serial serial ) : base( serial )
@ -360,7 +357,7 @@ namespace Server.Items
else
maxRange = 1;
Point2D loc = m_Map.m_Location;
Point2D loc = m_Map.ChestLocation;
int x = loc.X, y = loc.Y;
Point3D chest3D0 = new Point3D( loc, 0 );
@ -858,7 +855,7 @@ namespace Server.Items
writer.Write( m_Completed );
writer.Write( m_Decoder );
writer.Write( m_Map );
writer.Write( m_Location );
writer.Write( ChestLocation );
}
public override void Deserialize( GenericReader reader )
@ -881,7 +878,7 @@ namespace Server.Items
m_Completed = reader.ReadBool();
m_Decoder = reader.ReadMobile();
m_Map = reader.ReadMap();
m_Location = reader.ReadPoint2D();
ChestLocation = reader.ReadPoint2D();
if ( version == 0 && m_Completed )
m_CompletedBy = m_Decoder;

View file

@ -33,18 +33,12 @@ namespace Server.Items
public abstract class BaseBulletinBoard : Item
{
private string m_BoardName;
[CommandProperty( AccessLevel.GameMaster )]
public string BoardName
{
get => m_BoardName;
set => m_BoardName = value;
}
public string BoardName { get; set; }
public BaseBulletinBoard( int itemID ) : base( itemID )
{
m_BoardName = "bulletin board";
BoardName = "bulletin board";
Movable = false;
}
@ -188,7 +182,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (string) m_BoardName );
writer.Write( (string) BoardName );
}
public override void Deserialize( GenericReader reader )
@ -201,7 +195,7 @@ namespace Server.Items
{
case 0:
{
m_BoardName = reader.ReadString();
BoardName = reader.ReadString();
break;
}
}
@ -315,19 +309,9 @@ namespace Server.Items
public class BulletinMessage : Item
{
private Mobile m_Poster;
private string m_Subject;
private DateTime m_Time, m_LastPostTime;
private BulletinMessage m_Thread;
private string m_PostedName;
private int m_PostedBody;
private int m_PostedHue;
private BulletinEquip[] m_PostedEquip;
private string[] m_Lines;
public string GetTimeAsString()
{
return m_Time.ToString( "MMM dd, yyyy" );
return Time.ToString( "MMM dd, yyyy" );
}
public override bool CheckTarget( Mobile from, Targeting.Target targ, object targeted )
@ -344,15 +328,15 @@ namespace Server.Items
{
Movable = false;
m_Poster = poster;
m_Subject = subject;
m_Time = DateTime.UtcNow;
m_LastPostTime = m_Time;
m_Thread = thread;
m_PostedName = m_Poster.Name;
m_PostedBody = m_Poster.Body;
m_PostedHue = m_Poster.Hue;
m_Lines = lines;
Poster = poster;
Subject = subject;
Time = DateTime.UtcNow;
LastPostTime = Time;
Thread = thread;
PostedName = Poster.Name;
PostedBody = Poster.Body;
PostedHue = Poster.Hue;
Lines = lines;
List<BulletinEquip> list = new List<BulletinEquip>();
@ -364,21 +348,28 @@ namespace Server.Items
list.Add( new BulletinEquip( item.ItemID, item.Hue ) );
}
m_PostedEquip = list.ToArray();
PostedEquip = list.ToArray();
}
public Mobile Poster => m_Poster;
public BulletinMessage Thread => m_Thread;
public string Subject => m_Subject;
public DateTime Time => m_Time;
public DateTime LastPostTime{ get => m_LastPostTime;
set => m_LastPostTime = value;
}
public string PostedName => m_PostedName;
public int PostedBody => m_PostedBody;
public int PostedHue => m_PostedHue;
public BulletinEquip[] PostedEquip => m_PostedEquip;
public string[] Lines => m_Lines;
public Mobile Poster { get; private set; }
public BulletinMessage Thread { get; private set; }
public string Subject { get; private set; }
public DateTime Time { get; private set; }
public DateTime LastPostTime { get; set; }
public string PostedName { get; private set; }
public int PostedBody { get; private set; }
public int PostedHue { get; private set; }
public BulletinEquip[] PostedEquip { get; private set; }
public string[] Lines { get; private set; }
public BulletinMessage( Serial serial ) : base( serial )
{
@ -390,28 +381,28 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (Mobile) m_Poster );
writer.Write( (string) m_Subject );
writer.Write( (DateTime) m_Time );
writer.Write( (DateTime) m_LastPostTime );
writer.Write( (bool) (m_Thread != null) );
writer.Write( (Item) m_Thread );
writer.Write( (string) m_PostedName );
writer.Write( (int) m_PostedBody );
writer.Write( (int) m_PostedHue );
writer.Write( (Mobile) Poster );
writer.Write( (string) Subject );
writer.Write( (DateTime) Time );
writer.Write( (DateTime) LastPostTime );
writer.Write( (bool) (Thread != null) );
writer.Write( (Item) Thread );
writer.Write( (string) PostedName );
writer.Write( (int) PostedBody );
writer.Write( (int) PostedHue );
writer.Write( (int) m_PostedEquip.Length );
writer.Write( (int) PostedEquip.Length );
for ( int i = 0; i < m_PostedEquip.Length; ++i )
for ( int i = 0; i < PostedEquip.Length; ++i )
{
writer.Write( (int) m_PostedEquip[i].itemID );
writer.Write( (int) m_PostedEquip[i].hue );
writer.Write( (int) PostedEquip[i].itemID );
writer.Write( (int) PostedEquip[i].hue );
}
writer.Write( (int) m_Lines.Length );
writer.Write( (int) Lines.Length );
for ( int i = 0; i < m_Lines.Length; ++i )
writer.Write( (string) m_Lines[i] );
for ( int i = 0; i < Lines.Length; ++i )
writer.Write( (string) Lines[i] );
}
public override void Deserialize( GenericReader reader )
@ -425,30 +416,30 @@ namespace Server.Items
case 1:
case 0:
{
m_Poster = reader.ReadMobile();
m_Subject = reader.ReadString();
m_Time = reader.ReadDateTime();
m_LastPostTime = reader.ReadDateTime();
Poster = reader.ReadMobile();
Subject = reader.ReadString();
Time = reader.ReadDateTime();
LastPostTime = reader.ReadDateTime();
bool hasThread = reader.ReadBool();
m_Thread = reader.ReadItem() as BulletinMessage;
m_PostedName = reader.ReadString();
m_PostedBody = reader.ReadInt();
m_PostedHue = reader.ReadInt();
Thread = reader.ReadItem() as BulletinMessage;
PostedName = reader.ReadString();
PostedBody = reader.ReadInt();
PostedHue = reader.ReadInt();
m_PostedEquip = new BulletinEquip[reader.ReadInt()];
PostedEquip = new BulletinEquip[reader.ReadInt()];
for ( int i = 0; i < m_PostedEquip.Length; ++i )
for ( int i = 0; i < PostedEquip.Length; ++i )
{
m_PostedEquip[i].itemID = reader.ReadInt();
m_PostedEquip[i].hue = reader.ReadInt();
PostedEquip[i].itemID = reader.ReadInt();
PostedEquip[i].hue = reader.ReadInt();
}
m_Lines = new string[reader.ReadInt()];
Lines = new string[reader.ReadInt()];
for ( int i = 0; i < m_Lines.Length; ++i )
m_Lines[i] = reader.ReadString();
for ( int i = 0; i < Lines.Length; ++i )
Lines[i] = reader.ReadString();
if ( hasThread && m_Thread == null )
if ( hasThread && Thread == null )
Delete();
if ( version == 0 )

View file

@ -29,16 +29,14 @@ namespace Server.Items
return null;
}
private Type m_Type;
private int m_Amount;
public Type Type { get; }
public Type Type => m_Type;
public int Amount => m_Amount;
public int Amount { get; }
private CrystalRechargeInfo( Type type, int amount )
{
m_Type = type;
m_Amount = amount;
Type = type;
Amount = amount;
}
}
@ -49,7 +47,6 @@ namespace Server.Items
public override int LabelNumber => 1060740; // communication crystal
private int m_Charges;
private List<ReceiverCrystal> m_Receivers;
[CommandProperty( AccessLevel.GameMaster )]
public bool Active
@ -73,7 +70,7 @@ namespace Server.Items
}
}
public List<ReceiverCrystal> Receivers => m_Receivers;
public List<ReceiverCrystal> Receivers { get; private set; }
[Constructible]
public BroadcastCrystal() : this( 2000 )
@ -87,7 +84,7 @@ namespace Server.Items
m_Charges = charges;
m_Receivers = new List<ReceiverCrystal>();
Receivers = new List<ReceiverCrystal>();
}
public BroadcastCrystal( Serial serial ) : base( serial )
@ -274,7 +271,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.WriteEncodedInt( m_Charges );
writer.WriteItemList<ReceiverCrystal>( m_Receivers );
writer.WriteItemList<ReceiverCrystal>( Receivers );
}
public override void Deserialize( GenericReader reader )
@ -284,7 +281,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Charges = reader.ReadEncodedInt();
m_Receivers = reader.ReadStrongItemList<ReceiverCrystal>();
Receivers = reader.ReadStrongItemList<ReceiverCrystal>();
}
}

View file

@ -65,27 +65,12 @@ namespace Server.Items
public class Corpse : Container, ICarvable
{
private Mobile m_Owner; // Whos corpse is this?
private Mobile m_Killer; // Who killed the owner?
private CorpseFlag m_Flags; // @see CorpseFlag
private List<Mobile> m_Looters; // Who's looted this corpse?
private List<Item> m_EquipItems; // List of dropped equipment when the owner died. Ingame, these items display /on/ the corpse, not just inside
private List<Item> m_RestoreEquip; // List of items equipped when the owner died. Includes insured and blessed items.
private List<Mobile> m_Aggressors; // Anyone from this list will be able to loot this corpse; we attacked them, or they attacked us when we were freely attackable
private string m_CorpseName; // Value of the CorpseNameAttribute attached to the owner when he died -or- null if the owner had no CorpseNameAttribute; use "the remains of ~name~"
private IDevourer m_Devourer; // The creature that devoured this corpse
// For notoriety:
private AccessLevel m_AccessLevel; // Which AccessLevel the owner had when he died
private Guild m_Guild; // Which Guild the owner was in when he died
private int m_Kills; // How many kills the owner had when he died
private DateTime m_TimeOfDeath; // What time was this corpse created?
private HairInfo m_Hair; // This contains the hair of the owner
private FacialHairInfo m_FacialHair; // This contains the facial hair of the owner
// For Forensics Evaluation
public string m_Forensicist; // Name of the first PlayerMobile who used Forensic Evaluation on the corpse
@ -102,7 +87,7 @@ namespace Server.Items
if ( !Core.SE )
return false;
return ( DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime) );
return ( DateTime.UtcNow < (TimeOfDeath + InstancedCorpseTime) );
}
}
@ -113,10 +98,7 @@ namespace Server.Items
private Mobile m_Mobile;
private Item m_Item;
private bool m_Perpetual; //Needed for Rummaged stuff. CONTRARY to the Patchlog, cause a later FoF contradicts it. Verify on OSI.
public bool Perpetual { get => m_Perpetual;
set => m_Perpetual = value;
}
public bool Perpetual { get; set; }
public InstancedItemInfo( Item i, Mobile m )
{
@ -159,7 +141,7 @@ namespace Server.Items
private void AssignInstancedLoot()
{
if ( m_Aggressors.Count == 0 || Items.Count == 0 )
if ( Aggressors.Count == 0 || Items.Count == 0 )
return;
if ( m_InstancedItems == null )
@ -181,7 +163,7 @@ namespace Server.Items
}
}
List<Mobile> attackers = new List<Mobile>( m_Aggressors );
List<Mobile> attackers = new List<Mobile>( Aggressors );
for ( int i = 1; i < attackers.Count -1; i++ ) //randomize
{
@ -254,16 +236,13 @@ namespace Server.Items
public override bool IsDecoContainer => false;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime TimeOfDeath
{
get => m_TimeOfDeath;
set => m_TimeOfDeath = value;
}
public DateTime TimeOfDeath { get; set; }
public override bool DisplayWeight => false;
public HairInfo Hair => m_Hair;
public FacialHairInfo FacialHair => m_FacialHair;
public HairInfo Hair { get; }
public FacialHairInfo FacialHair { get; }
[CommandProperty( AccessLevel.GameMaster )]
public bool IsBones => GetFlag( CorpseFlag.IsBones );
@ -307,31 +286,23 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public AccessLevel AccessLevel => m_AccessLevel;
public AccessLevel AccessLevel { get; private set; }
public List<Mobile> Aggressors => m_Aggressors;
public List<Mobile> Aggressors { get; private set; }
public List<Mobile> Looters => m_Looters;
public List<Mobile> Looters { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Killer => m_Killer;
public Mobile Killer { get; private set; }
public List<Item> EquipItems => m_EquipItems;
public List<Item> EquipItems { get; private set; }
public List<Item> RestoreEquip
{
get => m_RestoreEquip;
set => m_RestoreEquip = value;
}
public List<Item> RestoreEquip { get; set; }
public Guild Guild => m_Guild;
public Guild Guild { get; }
[CommandProperty( AccessLevel.GameMaster )]
public int Kills
{
get => m_Kills;
set => m_Kills = value;
}
public int Kills { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Criminal
@ -341,7 +312,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Owner => m_Owner;
public Mobile Owner { get; private set; }
public void TurnToBones()
{
@ -488,27 +459,27 @@ namespace Server.Items
Direction = owner.Direction;
Name = owner.Name;
m_Owner = owner;
Owner = owner;
m_CorpseName = GetCorpseName( owner );
m_TimeOfDeath = DateTime.UtcNow;
TimeOfDeath = DateTime.UtcNow;
m_AccessLevel = owner.AccessLevel;
m_Guild = owner.Guild as Guild;
m_Kills = owner.Kills;
AccessLevel = owner.AccessLevel;
Guild = owner.Guild as Guild;
Kills = owner.Kills;
SetFlag( CorpseFlag.Criminal, owner.Criminal );
m_Hair = hair;
m_FacialHair = facialhair;
Hair = hair;
FacialHair = facialhair;
// This corpse does not turn to bones if: the owner is not a player
SetFlag( CorpseFlag.NoBones, !owner.Player );
m_Looters = new List<Mobile>();
m_EquipItems = equipItems;
Looters = new List<Mobile>();
EquipItems = equipItems;
m_Aggressors = new List<Mobile>( owner.Aggressors.Count + owner.Aggressed.Count );
Aggressors = new List<Mobile>( owner.Aggressors.Count + owner.Aggressed.Count );
//bool addToAggressors = !( owner is BaseCreature );
bool isBaseCreature = (owner is BaseCreature);
@ -521,12 +492,12 @@ namespace Server.Items
if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime )
{
m_Killer = info.Attacker;
Killer = info.Attacker;
lastTime = (DateTime.UtcNow - info.LastCombatTime);
}
if ( !isBaseCreature && !info.CriminalAggression )
m_Aggressors.Add( info.Attacker );
Aggressors.Add( info.Attacker );
}
for ( int i = 0; i < owner.Aggressed.Count; ++i )
@ -535,12 +506,12 @@ namespace Server.Items
if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime )
{
m_Killer = info.Defender;
Killer = info.Defender;
lastTime = (DateTime.UtcNow - info.LastCombatTime);
}
if ( !isBaseCreature )
m_Aggressors.Add( info.Defender );
Aggressors.Add( info.Defender );
}
if ( isBaseCreature )
@ -549,7 +520,7 @@ namespace Server.Items
Mobile master = bc.GetMaster();
if ( master != null )
m_Aggressors.Add( master );
Aggressors.Add( master );
List<DamageStore> rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax );
for ( int i = 0; i < rights.Count; ++i )
@ -557,7 +528,7 @@ namespace Server.Items
DamageStore ds = rights[i];
if ( ds.m_HasRight )
m_Aggressors.Add( ds.m_Mobile );
Aggressors.Add( ds.m_Mobile );
}
}
@ -586,19 +557,19 @@ namespace Server.Items
writer.Write( (int) 12 ); // version
if ( m_RestoreEquip == null )
if ( RestoreEquip == null )
{
writer.Write( false );
}
else
{
writer.Write( true );
writer.Write( m_RestoreEquip );
writer.Write( RestoreEquip );
}
writer.Write( (int)m_Flags );
writer.WriteDeltaTime( m_TimeOfDeath );
writer.WriteDeltaTime( TimeOfDeath );
List<KeyValuePair<Item, Point3D>> list = ( m_RestoreTable == null ? null : new List<KeyValuePair<Item, Point3D>>( m_RestoreTable ) );
int count = list?.Count ?? 0;
@ -629,20 +600,20 @@ namespace Server.Items
if ( m_DecayTimer != null )
writer.WriteDeltaTime( m_DecayTime );
writer.Write( m_Looters );
writer.Write( m_Killer );
writer.Write( Looters );
writer.Write( Killer );
writer.Write( m_Aggressors );
writer.Write( Aggressors );
writer.Write( m_Owner );
writer.Write( Owner );
writer.Write( (string) m_CorpseName );
writer.Write( (int) m_AccessLevel );
writer.Write( (Guild) m_Guild );
writer.Write( (int) m_Kills );
writer.Write( (int) AccessLevel );
writer.Write( (Guild) Guild );
writer.Write( (int) Kills );
writer.Write( m_EquipItems );
writer.Write( EquipItems );
}
public override void Deserialize( GenericReader reader )
@ -656,7 +627,7 @@ namespace Server.Items
case 12:
{
if ( reader.ReadBool() )
m_RestoreEquip = reader.ReadStrongItemList();
RestoreEquip = reader.ReadStrongItemList();
goto case 11;
}
@ -665,7 +636,7 @@ namespace Server.Items
// Version 11, we move all bools to a CorpseFlag
m_Flags = (CorpseFlag)reader.ReadInt();
m_TimeOfDeath = reader.ReadDeltaTime();
TimeOfDeath = reader.ReadDeltaTime();
int count = reader.ReadInt();
@ -682,24 +653,24 @@ namespace Server.Items
if ( reader.ReadBool() )
BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow );
m_Looters = reader.ReadStrongMobileList();
m_Killer = reader.ReadMobile();
Looters = reader.ReadStrongMobileList();
Killer = reader.ReadMobile();
m_Aggressors = reader.ReadStrongMobileList();
m_Owner = reader.ReadMobile();
Aggressors = reader.ReadStrongMobileList();
Owner = reader.ReadMobile();
m_CorpseName = reader.ReadString();
m_AccessLevel = (AccessLevel)reader.ReadInt();
AccessLevel = (AccessLevel)reader.ReadInt();
reader.ReadInt(); // guild reserve
m_Kills = reader.ReadInt();
Kills = reader.ReadInt();
m_EquipItems = reader.ReadStrongItemList();
EquipItems = reader.ReadStrongItemList();
break;
}
case 10:
{
m_TimeOfDeath = reader.ReadDeltaTime();
TimeOfDeath = reader.ReadDeltaTime();
goto case 9;
}
@ -734,8 +705,8 @@ namespace Server.Items
}
case 6:
{
m_Looters = reader.ReadStrongMobileList();
m_Killer = reader.ReadMobile();
Looters = reader.ReadStrongMobileList();
Killer = reader.ReadMobile();
goto case 5;
}
@ -747,13 +718,13 @@ namespace Server.Items
}
case 4:
{
m_Aggressors = reader.ReadStrongMobileList();
Aggressors = reader.ReadStrongMobileList();
goto case 3;
}
case 3:
{
m_Owner = reader.ReadMobile();
Owner = reader.ReadMobile();
goto case 2;
}
@ -772,23 +743,23 @@ namespace Server.Items
case 0:
{
if ( version < 10 )
m_TimeOfDeath = DateTime.UtcNow;
TimeOfDeath = DateTime.UtcNow;
if ( version < 7 )
BeginDecay( m_DefaultDecayTime );
if ( version < 6 )
m_Looters = new List<Mobile>();
Looters = new List<Mobile>();
if ( version < 4 )
m_Aggressors = new List<Mobile>();
Aggressors = new List<Mobile>();
m_AccessLevel = (AccessLevel)reader.ReadInt();
AccessLevel = (AccessLevel)reader.ReadInt();
reader.ReadInt(); // guild reserve
m_Kills = reader.ReadInt();
Kills = reader.ReadInt();
SetFlag( CorpseFlag.Criminal, reader.ReadBool() );
m_EquipItems = reader.ReadStrongItemList();
EquipItems = reader.ReadStrongItemList();
break;
}
@ -797,10 +768,10 @@ namespace Server.Items
public bool DevourCorpse()
{
if ( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted )
if ( Devoured || Deleted || Killer == null || Killer.Deleted || !Killer.Alive || !(Killer is IDevourer) || Owner == null || Owner.Deleted )
return false;
m_Devourer = (IDevourer)m_Killer; // Set the devourer the killer
m_Devourer = (IDevourer)Killer; // Set the devourer the killer
return m_Devourer.Devour( this ); // Devour the corpse if it hasn't
}
@ -825,14 +796,14 @@ namespace Server.Items
public bool IsCriminalAction( Mobile from )
{
if ( from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster )
if ( from == Owner || from.AccessLevel >= AccessLevel.GameMaster )
return false;
Party p = Party.Get( m_Owner );
Party p = Party.Get( Owner );
if ( p != null && p.Contains( from ) )
{
PartyMemberInfo pmi = p[m_Owner];
PartyMemberInfo pmi = p[Owner];
if ( pmi != null && pmi.CanLoot )
return false;
@ -870,8 +841,8 @@ namespace Server.Items
if ( item != this && IsCriminalAction( from ) )
from.CriminalAction( true );
if ( !m_Looters.Contains( from ) )
m_Looters.Add( from );
if ( !Looters.Contains( from ) )
Looters.Add( from );
if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) )
m_InstancedItems.Remove( item );
@ -881,14 +852,14 @@ namespace Server.Items
{
base.OnItemLifted( from, item );
if ( item != this && from != m_Owner )
if ( item != this && from != Owner )
from.RevealingAction();
if ( item != this && IsCriminalAction( from ) )
from.CriminalAction( true );
if ( !m_Looters.Contains( from ) )
m_Looters.Add( from );
if ( !Looters.Contains( from ) )
Looters.Add( from );
if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) )
m_InstancedItems.Remove( item );
@ -911,7 +882,7 @@ namespace Server.Items
{
base.GetContextMenuEntries( from, list );
if ( Core.AOS && m_Owner == from && from.Alive )
if ( Core.AOS && Owner == from && from.Alive )
list.Add( new OpenCorpseEntry() );
}
@ -964,7 +935,7 @@ namespace Server.Items
{
if ( !CanLoot( from, item ) )
{
if ( m_Owner == null || !m_Owner.Player )
if ( Owner == null || !Owner.Player )
from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature!
else
from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse.
@ -974,7 +945,7 @@ namespace Server.Items
if ( IsCriminalAction( from ) )
{
if ( m_Owner == null || !m_Owner.Player )
if ( Owner == null || !Owner.Player )
from.SendLocalizedMessage( 1005036 ); // Looting this monster corpse will be a criminal act!
else
from.SendLocalizedMessage( 1005038 ); // Looting this corpse will be a criminal act!
@ -988,7 +959,7 @@ namespace Server.Items
if ( from.AccessLevel > AccessLevel.Player || from.InRange( GetWorldLocation(), 2 ) )
{
#region Self Looting
if ( checkSelfLoot && from == m_Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 )
if ( checkSelfLoot && from == Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 )
{
if ( from.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe )
{
@ -1003,7 +974,7 @@ namespace Server.Items
Container pack = from.Backpack;
if ( m_RestoreEquip != null && pack != null )
if ( RestoreEquip != null && pack != null )
{
List<Item> packItems = new List<Item>( pack.Items ); // Only items in the top-level pack are re-equipped
@ -1011,7 +982,7 @@ namespace Server.Items
{
Item packItem = packItems[i];
if ( m_RestoreEquip.Contains( packItem ) && packItem.Movable )
if ( RestoreEquip.Contains( packItem ) && packItem.Movable )
from.EquipItem( packItem );
}
}
@ -1033,7 +1004,7 @@ namespace Server.Items
item.Location = loc;
pack.AddItem( item );
if ( m_RestoreEquip != null && m_RestoreEquip.Contains( item ) )
if ( RestoreEquip != null && RestoreEquip.Contains( item ) )
from.EquipItem( item );
}
else
@ -1189,7 +1160,7 @@ namespace Server.Items
{
if ( IsCriminalAction( from ) && Map != null && (Map.Rules & MapRules.HarmfulRestrictions) != 0 )
{
if ( m_Owner == null || !m_Owner.Player )
if ( Owner == null || !Owner.Player )
from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature!
else
from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse.
@ -1197,7 +1168,7 @@ namespace Server.Items
return;
}
Mobile dead = m_Owner;
Mobile dead = Owner;
if ( GetFlag( CorpseFlag.Carved ) || dead == null )
{

View file

@ -5,13 +5,11 @@ namespace Server
[AttributeUsage( AttributeTargets.Class )]
public class CorpseNameAttribute : Attribute
{
private string m_Name;
public string Name => m_Name;
public string Name { get; }
public CorpseNameAttribute( string name )
{
m_Name = name;
Name = name;
}
}
}

View file

@ -6,84 +6,76 @@ namespace Server.Items
{
public class DeceitBrazier : Item
{
private static Type[] m_Creatures = {
#region Animals
typeof( FireSteed ), //Set the tents up people!
#endregion
public static Type[] Creatures { get; } =
{
#region Animals
typeof( FireSteed ), //Set the tents up people!
#endregion
#region Undead
typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ),
typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ),
typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ),
typeof( RottingCorpse ), typeof( Ghoul ),
#endregion
#region Undead
typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ),
typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ),
typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ),
typeof( RottingCorpse ), typeof( Ghoul ),
#endregion
#region Demons
typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ),
typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ),
typeof( FireGargoyle ), typeof( HordeMinion ),
#endregion
#region Demons
typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ),
typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ),
typeof( FireGargoyle ), typeof( HordeMinion ),
#endregion
#region Gazers
typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ),
#endregion
#region Gazers
typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ),
#endregion
#region Uncategorized
typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ),
typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ),
typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ),
#endregion
#region Uncategorized
typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ),
typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ),
typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ),
#endregion
#region Arachnid
typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ),
#endregion
#region Arachnid
typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ),
#endregion
#region Repond
typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ),
typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ),
typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ),
typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ),
typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ),
#endregion
#region Repond
typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ),
typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ),
typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ),
typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ),
typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ),
#endregion
#region Reptilian
typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ),
typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ),
typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ),
typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ),
#endregion
#region Reptilian
typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ),
typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ),
typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ),
typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ),
#endregion
#region Elementals
typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ),
typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ),
typeof( AirElemental ), typeof( Golem ),
#endregion
#region Elementals
typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ),
typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ),
typeof( AirElemental ), typeof( Golem ),
#endregion
#region Random Critters
typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ),
typeof( Cougar ), typeof( Alligator )
#endregion
};
public static Type[] Creatures => m_Creatures;
#region Random Critters
typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ),
typeof( Cougar ), typeof( Alligator )
#endregion
};
private Timer m_Timer;
private DateTime m_NextSpawn;
private int m_SpawnRange;
private TimeSpan m_NextSpawnDelay;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime NextSpawn => m_NextSpawn;
public DateTime NextSpawn { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int SpawnRange { get => m_SpawnRange;
set => m_SpawnRange = value;
}
public int SpawnRange { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan NextSpawnDelay { get => m_NextSpawnDelay;
set => m_NextSpawnDelay = value;
}
public TimeSpan NextSpawnDelay { get; set; }
public override int LabelNumber => 1023633; // Brazier
@ -92,9 +84,9 @@ namespace Server.Items
{
Movable = false;
Light = LightType.Circle225;
m_NextSpawn = DateTime.UtcNow;
m_NextSpawnDelay = TimeSpan.FromMinutes( 15.0 );
m_SpawnRange = 5;
NextSpawn = DateTime.UtcNow;
NextSpawnDelay = TimeSpan.FromMinutes( 15.0 );
SpawnRange = 5;
}
public DeceitBrazier( Serial serial ) : base( serial )
@ -107,8 +99,8 @@ namespace Server.Items
writer.Write( (int)0 ); // version
writer.Write( (int)m_SpawnRange );
writer.Write( m_NextSpawnDelay );
writer.Write( (int)SpawnRange );
writer.Write( NextSpawnDelay );
}
public override void Deserialize( GenericReader reader )
@ -119,11 +111,11 @@ namespace Server.Items
if ( version >= 0 )
{
m_SpawnRange = reader.ReadInt();
m_NextSpawnDelay = reader.ReadTimeSpan();
SpawnRange = reader.ReadInt();
NextSpawnDelay = reader.ReadTimeSpan();
}
m_NextSpawn = DateTime.UtcNow;
NextSpawn = DateTime.UtcNow;
}
public virtual void HeedWarning()
@ -135,7 +127,7 @@ namespace Server.Items
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
if ( NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
{
if ( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
{
@ -157,8 +149,8 @@ namespace Server.Items
// Try 10 times to find a Spawnable location.
for( int i = 0; i < 10; i++ )
{
int x = Location.X + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
int x = Location.X + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange);
int y = Location.Y + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange);
int z = Map.GetAverageZ( x, y );
if ( Map.CanSpawnMobile( new Point2D( x, y ), Z ) )
@ -182,10 +174,10 @@ namespace Server.Items
{
try
{
if ( m_NextSpawn < DateTime.UtcNow )
if ( NextSpawn < DateTime.UtcNow )
{
Map map = Map;
BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] );
BaseCreature bc = (BaseCreature)Activator.CreateInstance( Creatures[Utility.Random( Creatures.Length )] );
if ( bc != null )
{
@ -196,7 +188,7 @@ namespace Server.Items
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate
{
bc.Home = Location;
bc.RangeHome = m_SpawnRange;
bc.RangeHome = SpawnRange;
bc.FightMode = FightMode.Closest;
bc.MoveToWorld( spawnLoc, map );
@ -206,7 +198,7 @@ namespace Server.Items
bc.ForceReacquire();
} );
m_NextSpawn = DateTime.UtcNow + m_NextSpawnDelay;
NextSpawn = DateTime.UtcNow + NextSpawnDelay;
}
}
else

View file

@ -21,69 +21,26 @@ namespace Server.Items
public class EffectController : Item
{
private TimeSpan m_EffectDelay;
private ECEffectType m_EffectType;
private EffectTriggerType m_TriggerType;
private IEntity m_Source;
private IEntity m_Target;
private TimeSpan m_TriggerDelay;
private EffectController m_Trigger;
private int m_ItemID;
private int m_Hue;
private int m_RenderMode;
private int m_Speed;
private int m_Duration;
private bool m_FixedDirection;
private bool m_Explodes;
private int m_ParticleEffect;
private int m_ExplodeParticleEffect;
private int m_ExplodeSound;
private EffectLayer m_EffectLayer;
private int m_Unknown;
private TimeSpan m_SoundDelay;
private int m_SoundID;
private bool m_PlaySoundAtTrigger;
private int m_TriggerRange;
[CommandProperty( AccessLevel.GameMaster )]
public ECEffectType EffectType { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public ECEffectType EffectType{ get => m_EffectType;
set => m_EffectType = value;
}
public EffectTriggerType TriggerType { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public EffectTriggerType TriggerType{ get => m_TriggerType;
set => m_TriggerType = value;
}
public EffectLayer EffectLayer { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public EffectLayer EffectLayer{ get => m_EffectLayer;
set => m_EffectLayer = value;
}
public TimeSpan EffectDelay { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan EffectDelay{ get => m_EffectDelay;
set => m_EffectDelay = value;
}
public TimeSpan TriggerDelay { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan TriggerDelay{ get => m_TriggerDelay;
set => m_TriggerDelay = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan SoundDelay{ get => m_SoundDelay;
set => m_SoundDelay = value;
}
public TimeSpan SoundDelay { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
@ -117,81 +74,51 @@ namespace Server.Items
[CommandProperty( AccessLevel.GameMaster )]
public EffectController Sequence{ get => m_Trigger;
set => m_Trigger = value;
}
public EffectController Sequence { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
private bool FixedDirection{ get => m_FixedDirection;
set => m_FixedDirection = value;
}
private bool FixedDirection { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
private bool Explodes{ get => m_Explodes;
set => m_Explodes = value;
}
private bool Explodes { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
private bool PlaySoundAtTrigger{ get => m_PlaySoundAtTrigger;
set => m_PlaySoundAtTrigger = value;
}
private bool PlaySoundAtTrigger { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int EffectItemID{ get => m_ItemID;
set => m_ItemID = value;
}
public int EffectItemID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int EffectHue{ get => m_Hue;
set => m_Hue = value;
}
public int EffectHue { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int RenderMode{ get => m_RenderMode;
set => m_RenderMode = value;
}
public int RenderMode { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Speed{ get => m_Speed;
set => m_Speed = value;
}
public int Speed { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Duration{ get => m_Duration;
set => m_Duration = value;
}
public int Duration { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ParticleEffect{ get => m_ParticleEffect;
set => m_ParticleEffect = value;
}
public int ParticleEffect { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ExplodeParticleEffect{ get => m_ExplodeParticleEffect;
set => m_ExplodeParticleEffect = value;
}
public int ExplodeParticleEffect { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ExplodeSound{ get => m_ExplodeSound;
set => m_ExplodeSound = value;
}
public int ExplodeSound { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Unknown{ get => m_Unknown;
set => m_Unknown = value;
}
public int Unknown { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int SoundID{ get => m_SoundID;
set => m_SoundID = value;
}
public int SoundID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int TriggerRange{ get => m_TriggerRange;
set => m_TriggerRange = value;
}
public int TriggerRange { get; set; }
public override string DefaultName => "Effect Controller";
@ -200,21 +127,21 @@ namespace Server.Items
{
Movable = false;
Visible = false;
m_TriggerType = EffectTriggerType.Sequenced;
m_EffectLayer = (EffectLayer)255;
TriggerType = EffectTriggerType.Sequenced;
EffectLayer = (EffectLayer)255;
}
public override void OnDoubleClick( Mobile from )
{
if ( m_TriggerType == EffectTriggerType.DoubleClick )
if ( TriggerType == EffectTriggerType.DoubleClick )
DoEffect( from );
}
public override bool HandlesOnMovement => ( m_TriggerType == EffectTriggerType.InRange );
public override bool HandlesOnMovement => ( TriggerType == EffectTriggerType.InRange );
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( m.Location != oldLocation && m_TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, m_TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, m_TriggerRange ) )
if ( m.Location != oldLocation && TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, TriggerRange ) )
DoEffect( m );
}
@ -228,9 +155,9 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( m_EffectDelay );
writer.Write( m_TriggerDelay );
writer.Write( m_SoundDelay );
writer.Write( EffectDelay );
writer.Write( TriggerDelay );
writer.Write( SoundDelay );
if ( m_Source is Item srcItem )
writer.Write( srcItem );
@ -242,27 +169,27 @@ namespace Server.Items
else
writer.Write( m_Target as Mobile );
writer.Write( m_Trigger as Item );
writer.Write( Sequence as Item );
writer.Write( m_FixedDirection );
writer.Write( m_Explodes );
writer.Write( m_PlaySoundAtTrigger );
writer.Write( FixedDirection );
writer.Write( Explodes );
writer.Write( PlaySoundAtTrigger );
writer.WriteEncodedInt( (int) m_EffectType );
writer.WriteEncodedInt( (int) m_EffectLayer );
writer.WriteEncodedInt( (int) m_TriggerType );
writer.WriteEncodedInt( (int) EffectType );
writer.WriteEncodedInt( (int) EffectLayer );
writer.WriteEncodedInt( (int) TriggerType );
writer.WriteEncodedInt( m_ItemID );
writer.WriteEncodedInt( m_Hue );
writer.WriteEncodedInt( m_RenderMode );
writer.WriteEncodedInt( m_Speed );
writer.WriteEncodedInt( m_Duration );
writer.WriteEncodedInt( m_ParticleEffect );
writer.WriteEncodedInt( m_ExplodeParticleEffect );
writer.WriteEncodedInt( m_ExplodeSound );
writer.WriteEncodedInt( m_Unknown );
writer.WriteEncodedInt( m_SoundID );
writer.WriteEncodedInt( m_TriggerRange );
writer.WriteEncodedInt( EffectItemID );
writer.WriteEncodedInt( EffectHue );
writer.WriteEncodedInt( RenderMode );
writer.WriteEncodedInt( Speed );
writer.WriteEncodedInt( Duration );
writer.WriteEncodedInt( ParticleEffect );
writer.WriteEncodedInt( ExplodeParticleEffect );
writer.WriteEncodedInt( ExplodeSound );
writer.WriteEncodedInt( Unknown );
writer.WriteEncodedInt( SoundID );
writer.WriteEncodedInt( TriggerRange );
}
private IEntity ReadEntity( GenericReader reader )
@ -280,33 +207,33 @@ namespace Server.Items
{
case 0:
{
m_EffectDelay = reader.ReadTimeSpan();
m_TriggerDelay = reader.ReadTimeSpan();
m_SoundDelay = reader.ReadTimeSpan();
EffectDelay = reader.ReadTimeSpan();
TriggerDelay = reader.ReadTimeSpan();
SoundDelay = reader.ReadTimeSpan();
m_Source = ReadEntity( reader );
m_Target = ReadEntity( reader );
m_Trigger = reader.ReadItem() as EffectController;
Sequence = reader.ReadItem() as EffectController;
m_FixedDirection = reader.ReadBool();
m_Explodes = reader.ReadBool();
m_PlaySoundAtTrigger = reader.ReadBool();
FixedDirection = reader.ReadBool();
Explodes = reader.ReadBool();
PlaySoundAtTrigger = reader.ReadBool();
m_EffectType = (ECEffectType)reader.ReadEncodedInt();
m_EffectLayer = (EffectLayer)reader.ReadEncodedInt();
m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt();
EffectType = (ECEffectType)reader.ReadEncodedInt();
EffectLayer = (EffectLayer)reader.ReadEncodedInt();
TriggerType = (EffectTriggerType)reader.ReadEncodedInt();
m_ItemID = reader.ReadEncodedInt();
m_Hue = reader.ReadEncodedInt();
m_RenderMode = reader.ReadEncodedInt();
m_Speed = reader.ReadEncodedInt();
m_Duration = reader.ReadEncodedInt();
m_ParticleEffect = reader.ReadEncodedInt();
m_ExplodeParticleEffect = reader.ReadEncodedInt();
m_ExplodeSound = reader.ReadEncodedInt();
m_Unknown = reader.ReadEncodedInt();
m_SoundID = reader.ReadEncodedInt();
m_TriggerRange = reader.ReadEncodedInt();
EffectItemID = reader.ReadEncodedInt();
EffectHue = reader.ReadEncodedInt();
RenderMode = reader.ReadEncodedInt();
Speed = reader.ReadEncodedInt();
Duration = reader.ReadEncodedInt();
ParticleEffect = reader.ReadEncodedInt();
ExplodeParticleEffect = reader.ReadEncodedInt();
ExplodeSound = reader.ReadEncodedInt();
Unknown = reader.ReadEncodedInt();
SoundID = reader.ReadEncodedInt();
TriggerRange = reader.ReadEncodedInt();
break;
}
@ -317,31 +244,31 @@ namespace Server.Items
{
IEntity ent = null;
if (m_PlaySoundAtTrigger)
if (PlaySoundAtTrigger)
ent = trigger;
if (ent == null)
ent = this;
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, m_SoundID);
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, SoundID);
}
public void DoEffect(IEntity trigger)
{
if (Deleted || m_TriggerType == EffectTriggerType.None)
if (Deleted || TriggerType == EffectTriggerType.None)
return;
if (trigger is Mobile mobile && mobile.Hidden && mobile.AccessLevel > AccessLevel.Player)
return;
if (m_SoundID > 0)
Timer.DelayCall<IEntity>(m_SoundDelay, PlaySound, trigger);
if (SoundID > 0)
Timer.DelayCall<IEntity>(SoundDelay, PlaySound, trigger);
if (m_Trigger != null)
Timer.DelayCall<IEntity>(m_TriggerDelay, m_Trigger.DoEffect, trigger);
if (Sequence != null)
Timer.DelayCall<IEntity>(TriggerDelay, Sequence.DoEffect, trigger);
if (m_EffectType != ECEffectType.None)
Timer.DelayCall<IEntity>(m_EffectDelay, InternalDoEffect, trigger);
if (EffectType != ECEffectType.None)
Timer.DelayCall<IEntity>(EffectDelay, InternalDoEffect, trigger);
}
public void InternalDoEffect(IEntity trigger)
@ -354,16 +281,16 @@ namespace Server.Items
if (to == null)
to = trigger;
switch (m_EffectType)
switch (EffectType)
{
case ECEffectType.Lightning:
{
Effects.SendBoltEffect(from, false, m_Hue);
Effects.SendBoltEffect(from, false, EffectHue);
break;
}
case ECEffectType.Location:
{
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_Unknown);
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, Unknown);
break;
}
case ECEffectType.Moving:
@ -374,12 +301,12 @@ namespace Server.Items
if (to == this)
to = EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration);
Effects.SendMovingParticles(from, to, m_ItemID, m_Speed, m_Duration, m_FixedDirection, m_Explodes, m_Hue, m_RenderMode, m_ParticleEffect, m_ExplodeParticleEffect, m_ExplodeSound, m_EffectLayer, m_Unknown);
Effects.SendMovingParticles(from, to, EffectItemID, Speed, Duration, FixedDirection, Explodes, EffectHue, RenderMode, ParticleEffect, ExplodeParticleEffect, ExplodeSound, EffectLayer, Unknown);
break;
}
case ECEffectType.Target:
{
Effects.SendTargetParticles(from, m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_EffectLayer, m_Unknown);
Effects.SendTargetParticles(from, EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, EffectLayer, Unknown);
break;
}
}

View file

@ -191,19 +191,17 @@ namespace Server.Items
private class ThrowTarget : Target
{
private Firebomb m_Bomb;
public Firebomb Bomb => m_Bomb;
public Firebomb Bomb { get; }
public ThrowTarget( Firebomb bomb )
: base( 12, true, TargetFlags.None )
{
m_Bomb = bomb;
Bomb = bomb;
}
protected override void OnTarget( Mobile from, object targeted )
{
m_Bomb.OnFirebombTarget( from, targeted );
Bomb.OnFirebombTarget( from, targeted );
}
}
}

View file

@ -13,18 +13,16 @@ namespace Server.Items
typeof( Mobile ), typeof( Direction )
};
private Direction[] m_Directions;
public Direction[] Directions => m_Directions;
public Direction[] Directions { get; }
public FlippableAddonAttribute( params Direction[] directions )
{
m_Directions = directions;
Directions = directions;
}
public virtual void Flip( Mobile from, Item addon )
{
if ( m_Directions != null && m_Directions.Length > 1 )
if ( Directions != null && Directions.Length > 1 )
{
try
{
@ -34,21 +32,21 @@ namespace Server.Items
{
int index = 0;
for ( int i = 0; i < m_Directions.Length; i++ )
for ( int i = 0; i < Directions.Length; i++ )
{
if ( addon.Direction == m_Directions[ i ] )
if ( addon.Direction == Directions[ i ] )
{
index = i + 1;
break;
}
}
if ( index >= m_Directions.Length )
if ( index >= Directions.Length )
index = 0;
ClearComponents( addon );
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } );
BaseHouse house = null;
AddonFitResult result = AddonFitResult.Valid;
@ -65,13 +63,13 @@ namespace Server.Items
if ( result != AddonFitResult.Valid )
{
if ( index == 0 )
index = m_Directions.Length - 1;
index = Directions.Length - 1;
else
index -= 1;
ClearComponents( addon );
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } );
if ( result == AddonFitResult.Blocked )
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
@ -85,7 +83,7 @@ namespace Server.Items
from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.
}
addon.Direction = m_Directions[ index ];
addon.Direction = Directions[ index ];
}
}
catch

View file

@ -61,9 +61,7 @@ namespace Server.Items
[AttributeUsage( AttributeTargets.Class )]
public class FlippableAttribute : Attribute
{
private int[] m_ItemIDs;
public int[] ItemIDs => m_ItemIDs;
public int[] ItemIDs { get; }
public FlippableAttribute()
: this( null )
@ -72,12 +70,12 @@ namespace Server.Items
public FlippableAttribute( params int[] itemIDs )
{
m_ItemIDs = itemIDs;
ItemIDs = itemIDs;
}
public virtual void Flip( Item item )
{
if ( m_ItemIDs == null )
if ( ItemIDs == null )
{
try
{
@ -93,19 +91,19 @@ namespace Server.Items
else
{
int index = 0;
for( int i = 0; i < m_ItemIDs.Length; i++ )
for( int i = 0; i < ItemIDs.Length; i++ )
{
if ( item.ItemID == m_ItemIDs[i] )
if ( item.ItemID == ItemIDs[i] )
{
index = i + 1;
break;
}
}
if ( index > m_ItemIDs.Length - 1 )
if ( index > ItemIDs.Length - 1 )
index = 0;
item.ItemID = m_ItemIDs[index];
item.ItemID = ItemIDs[index];
}
}
}

View file

@ -51,21 +51,17 @@ namespace Server.Items
private class HairDyeEntry
{
private string m_Name;
private int m_HueStart;
private int m_HueCount;
public string Name { get; }
public string Name => m_Name;
public int HueStart { get; }
public int HueStart => m_HueStart;
public int HueCount => m_HueCount;
public int HueCount { get; }
public HairDyeEntry( string name, int hueStart, int hueCount )
{
m_Name = name;
m_HueStart = hueStart;
m_HueCount = hueCount;
Name = name;
HueStart = hueStart;
HueCount = hueCount;
}
}

View file

@ -23,8 +23,6 @@ namespace Server.Items
{
private string m_Description;
private uint m_KeyVal;
private Item m_Link;
private int m_MaxRange;
public static uint RandomValue()
{
@ -101,12 +99,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int MaxRange
{
get => m_MaxRange;
set => m_MaxRange = value;
}
public int MaxRange { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public uint KeyValue
@ -121,12 +114,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Item Link
{
get => m_Link;
set => m_Link = value;
}
public Item Link { get; set; }
public override void Serialize( GenericWriter writer )
{
@ -134,9 +122,9 @@ namespace Server.Items
writer.Write( (int) 2 ); // version
writer.Write( (int) m_MaxRange );
writer.Write( (int) MaxRange );
writer.Write( (Item) m_Link );
writer.Write( (Item) Link );
writer.Write( (string) m_Description );
writer.Write( (uint) m_KeyVal );
@ -152,20 +140,20 @@ namespace Server.Items
{
case 2:
{
m_MaxRange = reader.ReadInt();
MaxRange = reader.ReadInt();
goto case 1;
}
case 1:
{
m_Link = reader.ReadItem();
Link = reader.ReadItem();
goto case 0;
}
case 0:
{
if ( version < 2 || m_MaxRange == 0 )
m_MaxRange = 3;
if ( version < 2 || MaxRange == 0 )
MaxRange = 3;
m_Description = reader.ReadString();
@ -201,9 +189,9 @@ namespace Server.Items
{
Weight = 1.0;
m_MaxRange = 3;
MaxRange = 3;
m_KeyVal = LockVal;
m_Link = link;
Link = link;
}
public Key( Serial serial ) : base( serial )

View file

@ -7,16 +7,14 @@ namespace Server.Items
{
public static readonly int MaxKeys = 20;
private List<Key> m_Keys;
public List<Key> Keys => m_Keys;
public List<Key> Keys { get; private set; }
[Constructible]
public KeyRing() : base( 0x1011 )
{
Weight = 1.0; // They seem to have no weight on OSI ?!
m_Keys = new List<Key>();
Keys = new List<Key>();
}
public override bool OnDragDrop( Mobile from, Item dropped )
@ -98,18 +96,18 @@ namespace Server.Items
{
base.OnDelete();
foreach ( Key key in m_Keys )
foreach ( Key key in Keys )
{
key.Delete();
}
m_Keys.Clear();
Keys.Clear();
}
public void Add( Key key )
{
key.Internalize();
m_Keys.Add( key );
Keys.Add( key );
UpdateItemID();
}
@ -119,14 +117,14 @@ namespace Server.Items
if ( !(Parent is Container cont) )
return;
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
for ( int i = Keys.Count - 1; i >= 0; i-- )
{
Key key = m_Keys[i];
Key key = Keys[i];
if ( !key.Deleted && !cont.TryDropItem( from, key, true ) )
break;
m_Keys.RemoveAt( i );
Keys.RemoveAt( i );
}
UpdateItemID();
@ -134,14 +132,14 @@ namespace Server.Items
public void RemoveKeys( uint keyValue )
{
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
for ( int i = Keys.Count - 1; i >= 0; i-- )
{
Key key = m_Keys[i];
Key key = Keys[i];
if ( key.KeyValue == keyValue )
{
key.Delete();
m_Keys.RemoveAt( i );
Keys.RemoveAt( i );
}
}
@ -150,7 +148,7 @@ namespace Server.Items
public bool ContainsKey( uint keyValue )
{
foreach ( Key key in m_Keys )
foreach ( Key key in Keys )
{
if ( key.KeyValue == keyValue )
return true;
@ -181,7 +179,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.WriteItemList<Key>( m_Keys );
writer.WriteItemList<Key>( Keys );
}
public override void Deserialize( GenericReader reader )
@ -190,7 +188,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Keys = reader.ReadStrongItemList<Key>();
Keys = reader.ReadStrongItemList<Key>();
}
}
}

View file

@ -4,24 +4,14 @@ namespace Server.Items
{
public class MorphItem : Item
{
private int m_InactiveItemID;
private int m_ActiveItemID;
private int m_InRange;
private int m_OutRange;
[CommandProperty( AccessLevel.GameMaster )]
public int InactiveItemID
{
get => m_InactiveItemID;
set => m_InactiveItemID = value;
}
public int InactiveItemID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int ActiveItemID
{
get => m_ActiveItemID;
set => m_ActiveItemID = value;
}
public int ActiveItemID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int InRange
@ -109,8 +99,8 @@ namespace Server.Items
writer.Write( (int) m_OutRange );
writer.Write( (int) m_InactiveItemID );
writer.Write( (int) m_ActiveItemID );
writer.Write( (int) InactiveItemID );
writer.Write( (int) ActiveItemID );
writer.Write( (int) m_InRange );
}
@ -129,8 +119,8 @@ namespace Server.Items
}
case 0:
{
m_InactiveItemID = reader.ReadInt();
m_ActiveItemID = reader.ReadInt();
InactiveItemID = reader.ReadInt();
ActiveItemID = reader.ReadInt();
m_InRange = reader.ReadInt();
if ( version < 1 )

View file

@ -69,37 +69,20 @@ namespace Server.Items
public abstract class BasePlayerBB : Item, ISecurable
{
private PlayerBBMessage m_Greeting;
private List<PlayerBBMessage> m_Messages;
private string m_Title;
private SecureLevel m_Level;
public List<PlayerBBMessage> Messages { get; private set; }
public List<PlayerBBMessage> Messages => m_Messages;
public PlayerBBMessage Greeting
{
get => m_Greeting;
set => m_Greeting = value;
}
public PlayerBBMessage Greeting { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public string Title
{
get => m_Title;
set => m_Title = value;
}
public string Title { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_Level;
set => m_Level = value;
}
public SecureLevel Level { get; set; }
public BasePlayerBB( int itemID ) : base( itemID )
{
m_Messages = new List<PlayerBBMessage>();
m_Level = SecureLevel.Anyone;
Messages = new List<PlayerBBMessage>();
Level = SecureLevel.Anyone;
}
public BasePlayerBB( Serial serial ) : base( serial )
@ -118,24 +101,24 @@ namespace Server.Items
writer.Write( (int) 1 );
writer.Write( (int) m_Level );
writer.Write( (int) Level );
writer.Write( m_Title );
writer.Write( Title );
if ( m_Greeting != null )
if ( Greeting != null )
{
writer.Write( true );
m_Greeting.Serialize( writer );
Greeting.Serialize( writer );
}
else
{
writer.Write( false );
}
writer.WriteEncodedInt( m_Messages.Count );
writer.WriteEncodedInt( Messages.Count );
for ( int i = 0; i < m_Messages.Count; ++i )
m_Messages[i].Serialize( writer );
for ( int i = 0; i < Messages.Count; ++i )
Messages[i].Serialize( writer );
}
public override void Deserialize( GenericReader reader )
@ -148,25 +131,25 @@ namespace Server.Items
{
case 1:
{
m_Level = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
if ( version < 1 )
m_Level = SecureLevel.Anyone;
Level = SecureLevel.Anyone;
m_Title = reader.ReadString();
Title = reader.ReadString();
if ( reader.ReadBool() )
m_Greeting = new PlayerBBMessage( reader );
Greeting = new PlayerBBMessage( reader );
int count = reader.ReadEncodedInt();
m_Messages = new List<PlayerBBMessage>( count );
Messages = new List<PlayerBBMessage>( count );
for ( int i = 0; i < count; ++i )
m_Messages.Add( new PlayerBBMessage( reader ) );
Messages.Add( new PlayerBBMessage( reader ) );
break;
}
@ -327,36 +310,20 @@ namespace Server.Items
public class PlayerBBMessage
{
private DateTime m_Time;
private Mobile m_Poster;
private string m_Message;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime Time { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public DateTime Time
{
get => m_Time;
set => m_Time = value;
}
public Mobile Poster { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Poster
{
get => m_Poster;
set => m_Poster = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public string Message
{
get => m_Message;
set => m_Message = value;
}
public string Message { get; set; }
public PlayerBBMessage( DateTime time, Mobile poster, string message )
{
m_Time = time;
m_Poster = poster;
m_Message = message;
Time = time;
Poster = poster;
Message = message;
}
public PlayerBBMessage( GenericReader reader )
@ -367,9 +334,9 @@ namespace Server.Items
{
case 0:
{
m_Time = reader.ReadDateTime();
m_Poster = reader.ReadMobile();
m_Message = reader.ReadString();
Time = reader.ReadDateTime();
Poster = reader.ReadMobile();
Message = reader.ReadString();
break;
}
}
@ -379,9 +346,9 @@ namespace Server.Items
{
writer.WriteEncodedInt( 0 ); // version
writer.Write( m_Time );
writer.Write( m_Poster );
writer.Write( m_Message );
writer.Write( Time );
writer.Write( Poster );
writer.Write( Message );
}
}

View file

@ -59,25 +59,18 @@ namespace Server.Items
public struct Node
{
private int m_X;
private int m_Y;
public int X { get; set; }
public int X{ get => m_X;
set => m_X = value;
}
public int Y{ get => m_Y;
set => m_Y = value;
}
public int Y { get; set; }
public Node( int x, int y )
{
m_X = x;
m_Y = y;
X = x;
Y = y;
}
}
private int m_SideLength;
private Node[] m_Path;
[CommandProperty( AccessLevel.GameMaster )]
public int SideLength
@ -98,7 +91,7 @@ namespace Server.Items
}
}
public Node[] Path => m_Path;
public Node[] Path { get; private set; }
public override string DefaultName => "a control panel";
@ -180,11 +173,11 @@ namespace Server.Items
}
}
m_Path = new Node[stackSize];
Path = new Node[stackSize];
for ( int i = 0; i < stackSize; i++ )
{
m_Path[i] = stack[i];
Path[i] = stack[i];
}
if ( m_User != null )
@ -544,10 +537,10 @@ namespace Server.Items
writer.WriteEncodedInt( (int) m_SideLength );
writer.WriteEncodedInt( (int) m_Path.Length );
for ( int i = 0; i < m_Path.Length; i++ )
writer.WriteEncodedInt( (int) Path.Length );
for ( int i = 0; i < Path.Length; i++ )
{
Node cur = m_Path[i];
Node cur = Path[i];
writer.WriteEncodedInt( cur.X );
writer.WriteEncodedInt( cur.Y );
@ -562,10 +555,10 @@ namespace Server.Items
m_SideLength = reader.ReadEncodedInt();
m_Path = new Node[reader.ReadEncodedInt()];
for ( int i = 0; i < m_Path.Length; i++ )
Path = new Node[reader.ReadEncodedInt()];
for ( int i = 0; i < Path.Length; i++ )
{
m_Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() );
Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() );
}
}
}

View file

@ -152,40 +152,33 @@ namespace Server.Items
public class PMEntry
{
private Point3D m_Location;
private int m_Number;
public Point3D Location { get; }
public Point3D Location => m_Location;
public int Number => m_Number;
public int Number { get; }
public PMEntry( Point3D loc, int number )
{
m_Location = loc;
m_Number = number;
Location = loc;
Number = number;
}
}
public class PMList
{
private int m_Number, m_SelNumber;
private Map m_Map;
private PMEntry[] m_Entries;
public int Number { get; }
public int Number => m_Number;
public int SelNumber { get; }
public int SelNumber => m_SelNumber;
public Map Map { get; }
public Map Map => m_Map;
public PMEntry[] Entries => m_Entries;
public PMEntry[] Entries { get; }
public PMList( int number, int selNumber, Map map, PMEntry[] entries )
{
m_Number = number;
m_SelNumber = selNumber;
m_Map = map;
m_Entries = entries;
Number = number;
SelNumber = selNumber;
Map = map;
Entries = entries;
}
public static readonly PMList Trammel =

View file

@ -4,30 +4,14 @@ namespace Server.Items
{
public class SerpentPillar : Item
{
private bool m_Active;
private string m_Word;
private Rectangle2D m_Destination;
[CommandProperty( AccessLevel.GameMaster )]
public bool Active { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool Active
{
get => m_Active;
set => m_Active = value;
}
public string Word { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public string Word
{
get => m_Word;
set => m_Word = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public Rectangle2D Destination
{
get => m_Destination;
set => m_Destination = value;
}
public Rectangle2D Destination { get; set; }
[Constructible]
public SerpentPillar() : this( null, new Rectangle2D(), false )
@ -42,9 +26,9 @@ namespace Server.Items
{
Movable = false;
m_Active = active;
m_Word = word;
m_Destination = destination;
Active = active;
Word = word;
Destination = destination;
}
public override bool HandlesOnSpeech => true;
@ -103,9 +87,9 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_Active );
writer.Write( (string) m_Word );
writer.Write( (Rectangle2D) m_Destination );
writer.Write( (bool) Active );
writer.Write( (string) Word );
writer.Write( (Rectangle2D) Destination );
}
public override void Deserialize( GenericReader reader )
@ -114,9 +98,9 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Active = reader.ReadBool();
m_Word = reader.ReadString();
m_Destination = reader.ReadRect2D();
Active = reader.ReadBool();
Word = reader.ReadString();
Destination = reader.ReadRect2D();
}
}
}

View file

@ -52,21 +52,17 @@ namespace Server.Items
private class SpecialBeardDyeEntry
{
private string m_Name;
private int m_HueStart;
private int m_HueCount;
public string Name { get; }
public string Name => m_Name;
public int HueStart { get; }
public int HueStart => m_HueStart;
public int HueCount => m_HueCount;
public int HueCount { get; }
public SpecialBeardDyeEntry( string name, int hueStart, int hueCount )
{
m_Name = name;
m_HueStart = hueStart;
m_HueCount = hueCount;
Name = name;
HueStart = hueStart;
HueCount = hueCount;
}
}

View file

@ -53,21 +53,17 @@ namespace Server.Items
private class SpecialHairDyeEntry
{
private string m_Name;
private int m_HueStart;
private int m_HueCount;
public string Name { get; }
public string Name => m_Name;
public int HueStart { get; }
public int HueStart => m_HueStart;
public int HueCount => m_HueCount;
public int HueCount { get; }
public SpecialHairDyeEntry( string name, int hueStart, int hueCount )
{
m_Name = name;
m_HueStart = hueStart;
m_HueCount = hueCount;
Name = name;
HueStart = hueStart;
HueCount = hueCount;
}
}

View file

@ -565,46 +565,20 @@ namespace Server.Items
m_Table.Remove(from);
}
private int m_StartNumber;
private string m_StartMessage;
private int m_ProgressNumber;
private string m_ProgressMessage;
private bool m_ShowTimeRemaining;
[CommandProperty(AccessLevel.GameMaster)]
public int StartNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int StartNumber
{
get => m_StartNumber;
set => m_StartNumber = value;
}
public string StartMessage { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string StartMessage
{
get => m_StartMessage;
set => m_StartMessage = value;
}
public int ProgressNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int ProgressNumber
{
get => m_ProgressNumber;
set => m_ProgressNumber = value;
}
public string ProgressMessage { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string ProgressMessage
{
get => m_ProgressMessage;
set => m_ProgressMessage = value;
}
[CommandProperty(AccessLevel.GameMaster)]
public bool ShowTimeRemaining
{
get => m_ShowTimeRemaining;
set => m_ShowTimeRemaining = value;
}
public bool ShowTimeRemaining { get; set; }
[Constructible]
public WaitTeleporter()
@ -642,12 +616,12 @@ namespace Server.Items
{
if (m.BeginAction(this))
{
if (m_ProgressMessage != null)
m.SendMessage(m_ProgressMessage);
else if (m_ProgressNumber != 0)
m.SendLocalizedMessage(m_ProgressNumber);
if (ProgressMessage != null)
m.SendMessage(ProgressMessage);
else if (ProgressNumber != 0)
m.SendLocalizedMessage(ProgressNumber);
if (m_ShowTimeRemaining)
if (ShowTimeRemaining)
m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow));
Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(5), EndLock, m);
@ -659,10 +633,10 @@ namespace Server.Items
info.Timer.Stop();
}
if (m_StartMessage != null)
m.SendMessage(m_StartMessage);
else if (m_StartNumber != 0)
m.SendLocalizedMessage(m_StartNumber);
if (StartMessage != null)
m.SendMessage(StartMessage);
else if (StartNumber != 0)
m.SendLocalizedMessage(StartNumber);
if (Delay == TimeSpan.Zero)
DoTeleport(m);
@ -688,11 +662,11 @@ namespace Server.Items
writer.Write((int)0); // version
writer.Write(m_StartNumber);
writer.Write(m_StartMessage);
writer.Write(m_ProgressNumber);
writer.Write(m_ProgressMessage);
writer.Write(m_ShowTimeRemaining);
writer.Write(StartNumber);
writer.Write(StartMessage);
writer.Write(ProgressNumber);
writer.Write(ProgressMessage);
writer.Write(ShowTimeRemaining);
}
public override void Deserialize(GenericReader reader)
@ -701,40 +675,33 @@ namespace Server.Items
int version = reader.ReadInt();
m_StartNumber = reader.ReadInt();
m_StartMessage = reader.ReadString();
m_ProgressNumber = reader.ReadInt();
m_ProgressMessage = reader.ReadString();
m_ShowTimeRemaining = reader.ReadBool();
StartNumber = reader.ReadInt();
StartMessage = reader.ReadString();
ProgressNumber = reader.ReadInt();
ProgressMessage = reader.ReadString();
ShowTimeRemaining = reader.ReadBool();
}
private class TeleportingInfo
{
private WaitTeleporter m_Teleporter;
private Timer m_Timer;
public WaitTeleporter Teleporter { get; }
public WaitTeleporter Teleporter => m_Teleporter;
public Timer Timer => m_Timer;
public Timer Timer { get; }
public TeleportingInfo(WaitTeleporter tele, Timer t)
{
m_Teleporter = tele;
m_Timer = t;
Teleporter = tele;
Timer = t;
}
}
}
public class TimeoutTeleporter : Teleporter
{
private TimeSpan m_TimeoutDelay;
private Dictionary<Mobile, Timer> m_Teleporting;
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan TimeoutDelay
{
get => m_TimeoutDelay;
set => m_TimeoutDelay = value;
}
public TimeSpan TimeoutDelay { get; set; }
[Constructible]
public TimeoutTeleporter()
@ -757,7 +724,7 @@ namespace Server.Items
public void StartTimer(Mobile m)
{
StartTimer(m, m_TimeoutDelay);
StartTimer(m, TimeoutDelay);
}
private void StartTimer(Mobile m, TimeSpan delay)
@ -808,7 +775,7 @@ namespace Server.Items
writer.Write((int)0); // version
writer.Write(m_TimeoutDelay);
writer.Write(TimeoutDelay);
writer.Write(m_Teleporting.Count);
foreach (KeyValuePair<Mobile, Timer> kvp in m_Teleporting)
@ -824,7 +791,7 @@ namespace Server.Items
int version = reader.ReadInt();
m_TimeoutDelay = reader.ReadTimeSpan();
TimeoutDelay = reader.ReadTimeSpan();
m_Teleporting = new Dictionary<Mobile, Timer>();
int count = reader.ReadInt();
@ -841,14 +808,8 @@ namespace Server.Items
public class TimeoutGoal : Item
{
private TimeoutTeleporter m_Teleporter;
[CommandProperty(AccessLevel.GameMaster)]
public TimeoutTeleporter Teleporter
{
get => m_Teleporter;
set => m_Teleporter = value;
}
public TimeoutTeleporter Teleporter { get; set; }
[Constructible]
public TimeoutGoal()
@ -862,7 +823,7 @@ namespace Server.Items
public override bool OnMoveOver(Mobile m)
{
m_Teleporter?.StopTimer(m);
Teleporter?.StopTimer(m);
return true;
}
@ -880,7 +841,7 @@ namespace Server.Items
writer.Write((int)0); // version
writer.WriteItem<TimeoutTeleporter>(m_Teleporter);
writer.WriteItem<TimeoutTeleporter>(Teleporter);
}
public override void Deserialize(GenericReader reader)
@ -889,7 +850,7 @@ namespace Server.Items
int version = reader.ReadInt();
m_Teleporter = reader.ReadItem<TimeoutTeleporter>();
Teleporter = reader.ReadItem<TimeoutTeleporter>();
}
}

View file

@ -6,24 +6,13 @@ namespace Server.Items
{
public class WarningItem : Item
{
private string m_WarningString;
private int m_WarningNumber;
private int m_Range;
private TimeSpan m_ResetDelay;
[CommandProperty( AccessLevel.GameMaster )]
public string WarningString
{
get => m_WarningString;
set => m_WarningString = value;
}
public string WarningString { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int WarningNumber
{
get => m_WarningNumber;
set => m_WarningNumber = value;
}
public int WarningNumber { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Range
@ -33,11 +22,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public TimeSpan ResetDelay
{
get => m_ResetDelay;
set => m_ResetDelay = value;
}
public TimeSpan ResetDelay { get; set; }
[Constructible]
public WarningItem( int itemID, int range, int warning ) : base( itemID )
@ -47,7 +32,7 @@ namespace Server.Items
Movable = false;
m_WarningNumber = warning;
WarningNumber = warning;
m_Range = range;
}
@ -59,7 +44,7 @@ namespace Server.Items
Movable = false;
m_WarningString = warning;
WarningString = warning;
m_Range = range;
}
@ -94,14 +79,14 @@ namespace Server.Items
public virtual void Broadcast( Mobile triggerer )
{
if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + m_ResetDelay)) )
if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + ResetDelay)) )
return;
m_LastBroadcast = DateTime.UtcNow;
m_Broadcasting = true;
SendMessage( triggerer, OnlyToTriggerer, m_WarningString, m_WarningNumber );
SendMessage( triggerer, OnlyToTriggerer, WarningString, WarningNumber );
if ( NeighborRange >= 0 )
{
@ -139,11 +124,11 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( (string) m_WarningString );
writer.Write( (int) m_WarningNumber );
writer.Write( (string) WarningString );
writer.Write( (int) WarningNumber );
writer.Write( (int) m_Range );
writer.Write( (TimeSpan) m_ResetDelay );
writer.Write( (TimeSpan) ResetDelay );
}
public override void Deserialize( GenericReader reader )
@ -156,10 +141,10 @@ namespace Server.Items
{
case 0:
{
m_WarningString = reader.ReadString();
m_WarningNumber = reader.ReadInt();
WarningString = reader.ReadString();
WarningNumber = reader.ReadInt();
m_Range = reader.ReadInt();
m_ResetDelay = reader.ReadTimeSpan();
ResetDelay = reader.ReadTimeSpan();
break;
}
@ -169,35 +154,24 @@ namespace Server.Items
public class HintItem : WarningItem
{
private string m_HintString;
private int m_HintNumber;
[CommandProperty( AccessLevel.GameMaster )]
public string HintString { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public string HintString
{
get => m_HintString;
set => m_HintString = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public int HintNumber
{
get => m_HintNumber;
set => m_HintNumber = value;
}
public int HintNumber { get; set; }
public override bool OnlyToTriggerer => true;
[Constructible]
public HintItem( int itemID, int range, int warning, int hint ) : base( itemID, range, warning )
{
m_HintNumber = hint;
HintNumber = hint;
}
[Constructible]
public HintItem( int itemID, int range, string warning, string hint ) : base( itemID, range, warning )
{
m_HintString = hint;
HintString = hint;
}
public HintItem( Serial serial ) : base( serial )
@ -206,7 +180,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
SendMessage( from, true, m_HintString, m_HintNumber );
SendMessage( from, true, HintString, HintNumber );
}
public override void Serialize( GenericWriter writer )
@ -215,8 +189,8 @@ namespace Server.Items
writer.Write( (int) 0 );
writer.Write( (string) m_HintString );
writer.Write( (int) m_HintNumber );
writer.Write( (string) HintString );
writer.Write( (int) HintNumber );
}
public override void Deserialize( GenericReader reader )
@ -229,8 +203,8 @@ namespace Server.Items
{
case 0:
{
m_HintString = reader.ReadString();
m_HintNumber = reader.ReadInt();
HintString = reader.ReadString();
HintNumber = reader.ReadInt();
break;
}

View file

@ -19,16 +19,14 @@ namespace Server.Items
{
}
private static int[] m_Sounds = { 0x505, 0x506, 0x507 };
public static int[] Sounds => m_Sounds;
public static int[] Sounds { get; } = { 0x505, 0x506, 0x507 };
public override bool HandlesOnMovement => m_TurnedOn && IsLockedDown;
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if ( m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, Location, 2 ) && !Utility.InRange( oldLocation, Location, 2 ) )
Effects.PlaySound( Location, Map, m_Sounds[Utility.Random( m_Sounds.Length )] );
Effects.PlaySound( Location, Map, Sounds[Utility.Random( Sounds.Length )] );
base.OnMovement( m, oldLocation );
}

View file

@ -30,7 +30,6 @@ namespace Server.Items
}
private Timer m_Timer;
private DateTime m_Created;
private ArrayList m_Entries;
@ -41,7 +40,7 @@ namespace Server.Items
m_Entries = new ArrayList();
m_Created = DateTime.UtcNow;
Created = DateTime.UtcNow;
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), OnTick );
}
@ -50,7 +49,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public DateTime Created => m_Created;
public DateTime Created { get; }
[CommandProperty( AccessLevel.GameMaster )]
public CampfireStatus Status
@ -178,14 +177,13 @@ namespace Server.Items
public class CampfireEntry
{
private PlayerMobile m_Player;
private Campfire m_Fire;
private DateTime m_Start;
private bool m_Safe;
public PlayerMobile Player => m_Player;
public Campfire Fire => m_Fire;
public DateTime Start => m_Start;
public PlayerMobile Player { get; }
public Campfire Fire { get; }
public DateTime Start { get; }
public bool Valid => !Fire.Deleted && Fire.Status != CampfireStatus.Off && Player.Map == Fire.Map && Player.InRange( Fire, Campfire.SecureRange );
@ -197,9 +195,9 @@ namespace Server.Items
public CampfireEntry( PlayerMobile player, Campfire fire )
{
m_Player = player;
m_Fire = fire;
m_Start = DateTime.UtcNow;
Player = player;
Fire = fire;
Start = DateTime.UtcNow;
m_Safe = false;
}
}

View file

@ -65,21 +65,19 @@ namespace Server.Items
{
public TrophyInfo( Type type, int id, int deedNum, int addonNum )
{
m_CreatureType = type;
m_NorthID = id;
m_DeedNumber = deedNum;
m_AddonNumber = addonNum;
CreatureType = type;
NorthID = id;
DeedNumber = deedNum;
AddonNumber = addonNum;
}
private Type m_CreatureType;
private int m_NorthID;
private int m_DeedNumber;
private int m_AddonNumber;
public Type CreatureType { get; }
public Type CreatureType => m_CreatureType;
public int NorthID => m_NorthID;
public int DeedNumber => m_DeedNumber;
public int AddonNumber => m_AddonNumber;
public int NorthID { get; }
public int DeedNumber { get; }
public int AddonNumber { get; }
}
@ -170,28 +168,19 @@ namespace Server.Items
{
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
private int m_WestID;
private int m_NorthID;
private int m_DeedNumber;
private int m_AddonNumber;
private Mobile m_Hunter;
private int m_AnimalWeight;
[CommandProperty( AccessLevel.GameMaster )]
public int WestID{ get => m_WestID;
set => m_WestID = value;
}
public int WestID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int NorthID{ get => m_NorthID;
set => m_NorthID = value;
}
public int NorthID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DeedNumber{ get => m_DeedNumber;
set => m_DeedNumber = value;
}
public int DeedNumber { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int AddonNumber{ get => m_AddonNumber;
@ -214,9 +203,9 @@ namespace Server.Items
public TrophyAddon( Mobile from, int itemID, int westID, int northID, int deedNumber, int addonNumber, Mobile hunter, int animalWeight ) : base( itemID )
{
m_WestID = westID;
m_NorthID = northID;
m_DeedNumber = deedNumber;
WestID = westID;
NorthID = northID;
DeedNumber = deedNumber;
m_AddonNumber = addonNumber;
m_Hunter = hunter;
@ -249,7 +238,7 @@ namespace Server.Items
if ( !map.CanFit( p.X, p.Y, p.Z, ItemData.Height ) )
return false;
if ( ItemID == m_NorthID )
if ( ItemID == NorthID )
return BaseAddon.IsWall( p.X, p.Y - 1, p.Z, map ); // North wall
return BaseAddon.IsWall( p.X - 1, p.Y, p.Z, map ); // West wall
}
@ -263,9 +252,9 @@ namespace Server.Items
writer.Write( (Mobile) m_Hunter );
writer.Write( (int) m_AnimalWeight );
writer.Write( (int) m_WestID );
writer.Write( (int) m_NorthID );
writer.Write( (int) m_DeedNumber );
writer.Write( (int) WestID );
writer.Write( (int) NorthID );
writer.Write( (int) DeedNumber );
writer.Write( (int) m_AddonNumber );
}
@ -285,9 +274,9 @@ namespace Server.Items
}
case 0:
{
m_WestID = reader.ReadInt();
m_NorthID = reader.ReadInt();
m_DeedNumber = reader.ReadInt();
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
DeedNumber = reader.ReadInt();
m_AddonNumber = reader.ReadInt();
break;
}
@ -319,7 +308,7 @@ namespace Server.Items
}
}
public Item Deed => new TrophyDeed( m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight );
public Item Deed => new TrophyDeed( WestID, NorthID, DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight );
public override void OnDoubleClick( Mobile from )
{
@ -343,32 +332,23 @@ namespace Server.Items
[Flippable( 0x14F0, 0x14EF )]
public class TrophyDeed : Item
{
private int m_WestID;
private int m_NorthID;
private int m_DeedNumber;
private int m_AddonNumber;
private Mobile m_Hunter;
private int m_AnimalWeight;
[CommandProperty( AccessLevel.GameMaster )]
public int WestID{ get => m_WestID;
set => m_WestID = value;
}
public int WestID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int NorthID{ get => m_NorthID;
set => m_NorthID = value;
}
public int NorthID { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int DeedNumber{ get => m_DeedNumber;
set{ m_DeedNumber = value; InvalidateProperties(); } }
[CommandProperty( AccessLevel.GameMaster )]
public int AddonNumber{ get => m_AddonNumber;
set => m_AddonNumber = value;
}
public int AddonNumber { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Hunter{ get => m_Hunter;
@ -387,10 +367,10 @@ namespace Server.Items
public TrophyDeed( int westID, int northID, int deedNumber, int addonNumber, Mobile hunter, int animalWeight ) : base( 0x14F0 )
{
m_WestID = westID;
m_NorthID = northID;
WestID = westID;
NorthID = northID;
m_DeedNumber = deedNumber;
m_AddonNumber = addonNumber;
AddonNumber = addonNumber;
m_Hunter = hunter;
m_AnimalWeight = animalWeight;
}
@ -425,10 +405,10 @@ namespace Server.Items
writer.Write( (Mobile) m_Hunter );
writer.Write( (int) m_AnimalWeight );
writer.Write( (int) m_WestID );
writer.Write( (int) m_NorthID );
writer.Write( (int) WestID );
writer.Write( (int) NorthID );
writer.Write( (int) m_DeedNumber );
writer.Write( (int) m_AddonNumber );
writer.Write( (int) AddonNumber );
}
public override void Deserialize( GenericReader reader )
@ -447,10 +427,10 @@ namespace Server.Items
}
case 0:
{
m_WestID = reader.ReadInt();
m_NorthID = reader.ReadInt();
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
m_DeedNumber = reader.ReadInt();
m_AddonNumber = reader.ReadInt();
AddonNumber = reader.ReadInt();
break;
}
}
@ -484,15 +464,15 @@ namespace Server.Items
int itemID = 0;
if ( northWall )
itemID = m_NorthID;
itemID = NorthID;
else if ( westWall )
itemID = m_WestID;
itemID = WestID;
else
from.SendLocalizedMessage( 1042626 ); // The trophy must be placed next to a wall.
if ( itemID > 0 )
{
house.Addons.Add( new TrophyAddon( from, itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight ) );
house.Addons.Add( new TrophyAddon( from, itemID, WestID, NorthID, m_DeedNumber, AddonNumber, m_Hunter, m_AnimalWeight ) );
Delete();
}
}

View file

@ -14,15 +14,10 @@ namespace Server.Items
public override int LabelNumber => 1041080; // a message in a bottle
private Map m_TargetMap;
private int m_Level;
[CommandProperty( AccessLevel.GameMaster )]
public Map TargetMap
{
get => m_TargetMap;
set => m_TargetMap = value;
}
public Map TargetMap { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Level
@ -44,7 +39,7 @@ namespace Server.Items
public MessageInABottle( Map map, int level ) : base( 0x099F )
{
Weight = 1.0;
m_TargetMap = map;
TargetMap = map;
m_Level = level;
}
@ -60,7 +55,7 @@ namespace Server.Items
writer.Write( (int) m_Level );
writer.Write( m_TargetMap );
writer.Write( TargetMap );
}
public override void Deserialize( GenericReader reader )
@ -79,12 +74,12 @@ namespace Server.Items
}
case 1:
{
m_TargetMap = reader.ReadMap();
TargetMap = reader.ReadMap();
break;
}
case 0:
{
m_TargetMap = Map.Trammel;
TargetMap = Map.Trammel;
break;
}
}
@ -92,15 +87,15 @@ namespace Server.Items
if ( version < 2 )
m_Level = GetRandomLevel();
if ( version < 3 && m_TargetMap == Map.Tokuno )
m_TargetMap = Map.Trammel;
if ( version < 3 && TargetMap == Map.Tokuno )
TargetMap = Map.Trammel;
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
ReplaceWith( new SOS( m_TargetMap, m_Level ) );
ReplaceWith( new SOS( TargetMap, m_Level ) );
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 501891 ); // You extract the message from the bottle.
}
else

View file

@ -18,9 +18,6 @@ namespace Server.Items
}
private int m_Level;
private Map m_TargetMap;
private Point3D m_TargetLocation;
private int m_MessageIndex;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsAncient => ( m_Level >= 4 );
@ -38,25 +35,13 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public Map TargetMap
{
get => m_TargetMap;
set => m_TargetMap = value;
}
public Map TargetMap { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D TargetLocation
{
get => m_TargetLocation;
set => m_TargetLocation = value;
}
public Point3D TargetLocation { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int MessageIndex
{
get => m_MessageIndex;
set => m_MessageIndex = value;
}
public int MessageIndex { get; set; }
public void UpdateHue()
{
@ -82,9 +67,9 @@ namespace Server.Items
Weight = 1.0;
m_Level = level;
m_MessageIndex = Utility.Random( MessageEntry.Entries.Length );
m_TargetMap = map;
m_TargetLocation = FindLocation( m_TargetMap );
MessageIndex = Utility.Random( MessageEntry.Entries.Length );
TargetMap = map;
TargetLocation = FindLocation( TargetMap );
UpdateHue();
}
@ -101,9 +86,9 @@ namespace Server.Items
writer.Write( m_Level );
writer.Write( m_TargetMap );
writer.Write( m_TargetLocation );
writer.Write( m_MessageIndex );
writer.Write( TargetMap );
writer.Write( TargetLocation );
writer.Write( MessageIndex );
}
public override void Deserialize( GenericReader reader )
@ -123,21 +108,21 @@ namespace Server.Items
}
case 1:
{
m_TargetMap = reader.ReadMap();
m_TargetLocation = reader.ReadPoint3D();
m_MessageIndex = reader.ReadInt();
TargetMap = reader.ReadMap();
TargetLocation = reader.ReadPoint3D();
MessageIndex = reader.ReadInt();
break;
}
case 0:
{
m_TargetMap = Map;
TargetMap = Map;
if ( m_TargetMap == null || m_TargetMap == Map.Internal )
m_TargetMap = Map.Trammel;
if ( TargetMap == null || TargetMap == Map.Internal )
TargetMap = Map.Trammel;
m_TargetLocation = FindLocation( m_TargetMap );
m_MessageIndex = Utility.Random( MessageEntry.Entries.Length );
TargetLocation = FindLocation( TargetMap );
MessageIndex = Utility.Random( MessageEntry.Entries.Length );
break;
}
@ -149,8 +134,8 @@ namespace Server.Items
if ( version < 3 )
UpdateHue();
if ( version < 4 && m_TargetMap == Map.Tokuno )
m_TargetMap = Map.Trammel;
if ( version < 4 && TargetMap == Map.Tokuno )
TargetMap = Map.Trammel;
}
public override void OnDoubleClick( Mobile from )
@ -159,13 +144,13 @@ namespace Server.Items
{
MessageEntry entry;
if ( m_MessageIndex >= 0 && m_MessageIndex < MessageEntry.Entries.Length )
entry = MessageEntry.Entries[m_MessageIndex];
if ( MessageIndex >= 0 && MessageIndex < MessageEntry.Entries.Length )
entry = MessageEntry.Entries[MessageIndex];
else
entry = MessageEntry.Entries[m_MessageIndex = Utility.Random( MessageEntry.Entries.Length )];
entry = MessageEntry.Entries[MessageIndex = Utility.Random( MessageEntry.Entries.Length )];
//from.CloseGump( typeof( MessageGump ) );
from.SendGump( new MessageGump( entry, m_TargetMap, m_TargetLocation ) );
from.SendGump( new MessageGump( entry, TargetMap, TargetLocation ) );
}
else
{
@ -297,36 +282,34 @@ namespace Server.Items
private class MessageEntry
{
private int m_Width, m_Height;
private string m_Message;
public int Width { get; }
public int Width => m_Width;
public int Height => m_Height;
public string Message => m_Message;
public int Height { get; }
public string Message { get; }
public MessageEntry( int width, int height, string message )
{
m_Width = width;
m_Height = height;
m_Message = message;
Width = width;
Height = height;
Message = message;
}
private static MessageEntry[] m_Entries = {
new MessageEntry( 280, 180, "...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...<br><br>uh oh." ),
new MessageEntry( 280, 215, "...been inside this whale for three days now. I've run out of food I can pick out of his teeth. I took a sextant reading through the blowhole: {0}. I'll never see my treasure again..." ),
new MessageEntry( 280, 285, "...grand adventure! Captain Quacklebush had me swab down the decks daily...<br> ...pirates came, I was in the rigging practicing with my sextant. {0} if I am not mistaken...<br> ....scuttled the ship, and our precious cargo went with her and the screaming pirates, down to the bottom of the sea..." ),
new MessageEntry( 280, 180, "Help! Ship going dow...n heavy storms...precious cargo...st reach dest...current coordinates {0}...ve any survivors... ease!" ),
new MessageEntry( 280, 215, "...know that the wreck is near {0} but have not found it. Could the message passed down in my family for generations be wrong? No... I swear on the soul of my grandfather, I will find..." ),
new MessageEntry( 280, 195, "...never expected an iceberg...silly woman on bow crushed instantly...send help to {0}...ey'll never forget the tragedy of the sinking of the Miniscule..." ),
new MessageEntry( 280, 265, "...nobody knew I was a girl. They just assumed I was another sailor...then we met the undine. {0}. It was demanded sacrifice...I was youngset, they figured...<br> ...grabbed the captain's treasure, screamed, 'It'll go down with me!'<br> ...they took me up on it." ),
new MessageEntry( 280, 230, "...so I threw the treasure overboard, before the curse could get me too. But I was too late. Now I am doomed to wander these seas, a ghost forever. Join me: seek ye at {0} if thou wishest my company..." ),
new MessageEntry( 280, 285, "...then the ship exploded. A dragon swooped by. The slime swallowed Bertie whole--he screamed, it was amazing. The sky glowed orange. A sextant reading put us at {0}. Norma was chattering about sailing over the edge of the world. I looked at my hands and saw through them..." ),
new MessageEntry( 280, 285, "...trapped on a deserted island, with a magic fountain supplying wood, fresh water springs, gorgeous scenery, and my lovely young wife. I know the ship with all our life's earnings sank at {0} but I don't know what our coordinates are... someone has GOT to rescue me before Sunday's finals game or I'll go mad..." ),
new MessageEntry( 280, 160, "WANTED: divers exp...d in shipwre...overy. Must have own vess...pply at {0}<br>...good benefits, flexible hours..." ),
new MessageEntry( 280, 250, "...was a cad and a boor, no matter what momma s...rew him overboard! Oh, Anna, 'twas so exciting!<br> Unfort...y he grabbe...est, and all his riches went with him!<br> ...sked the captain, and he says we're at {0}<br>...so maybe..." )
};
public static MessageEntry[] Entries => m_Entries;
public static MessageEntry[] Entries { get; } =
{
new MessageEntry( 280, 180, "...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...<br><br>uh oh." ),
new MessageEntry( 280, 215, "...been inside this whale for three days now. I've run out of food I can pick out of his teeth. I took a sextant reading through the blowhole: {0}. I'll never see my treasure again..." ),
new MessageEntry( 280, 285, "...grand adventure! Captain Quacklebush had me swab down the decks daily...<br> ...pirates came, I was in the rigging practicing with my sextant. {0} if I am not mistaken...<br> ....scuttled the ship, and our precious cargo went with her and the screaming pirates, down to the bottom of the sea..." ),
new MessageEntry( 280, 180, "Help! Ship going dow...n heavy storms...precious cargo...st reach dest...current coordinates {0}...ve any survivors... ease!" ),
new MessageEntry( 280, 215, "...know that the wreck is near {0} but have not found it. Could the message passed down in my family for generations be wrong? No... I swear on the soul of my grandfather, I will find..." ),
new MessageEntry( 280, 195, "...never expected an iceberg...silly woman on bow crushed instantly...send help to {0}...ey'll never forget the tragedy of the sinking of the Miniscule..." ),
new MessageEntry( 280, 265, "...nobody knew I was a girl. They just assumed I was another sailor...then we met the undine. {0}. It was demanded sacrifice...I was youngset, they figured...<br> ...grabbed the captain's treasure, screamed, 'It'll go down with me!'<br> ...they took me up on it." ),
new MessageEntry( 280, 230, "...so I threw the treasure overboard, before the curse could get me too. But I was too late. Now I am doomed to wander these seas, a ghost forever. Join me: seek ye at {0} if thou wishest my company..." ),
new MessageEntry( 280, 285, "...then the ship exploded. A dragon swooped by. The slime swallowed Bertie whole--he screamed, it was amazing. The sky glowed orange. A sextant reading put us at {0}. Norma was chattering about sailing over the edge of the world. I looked at my hands and saw through them..." ),
new MessageEntry( 280, 285, "...trapped on a deserted island, with a magic fountain supplying wood, fresh water springs, gorgeous scenery, and my lovely young wife. I know the ship with all our life's earnings sank at {0} but I don't know what our coordinates are... someone has GOT to rescue me before Sunday's finals game or I'll go mad..." ),
new MessageEntry( 280, 160, "WANTED: divers exp...d in shipwre...overy. Must have own vess...pply at {0}<br>...good benefits, flexible hours..." ),
new MessageEntry( 280, 250, "...was a cad and a boor, no matter what momma s...rew him overboard! Oh, Anna, 'twas so exciting!<br> Unfort...y he grabbe...est, and all his riches went with him!<br> ...sked the captain, and he says we're at {0}<br>...so maybe..." )
};
}
}
}

View file

@ -10,14 +10,8 @@ namespace Server.Items
{
public override int LabelNumber => 1041079; // a special fishing net
private bool m_InUse;
[CommandProperty( AccessLevel.GameMaster )]
public bool InUse
{
get => m_InUse;
set => m_InUse = value;
}
public bool InUse { get; set; }
[Constructible]
public SpecialFishingNet() : base( 0x0DCA )
@ -70,7 +64,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( m_InUse );
writer.Write( InUse );
}
public override void Deserialize( GenericReader reader )
@ -83,9 +77,9 @@ namespace Server.Items
{
case 1:
{
m_InUse = reader.ReadBool();
InUse = reader.ReadBool();
if ( m_InUse )
if ( InUse )
Delete();
break;
@ -97,7 +91,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_InUse )
if ( InUse )
{
from.SendLocalizedMessage( 1010483 ); // Someone is already using that net!
}
@ -116,7 +110,7 @@ namespace Server.Items
public void OnTarget( Mobile from, object obj )
{
if ( Deleted || m_InUse )
if ( Deleted || InUse )
return;
if ( !(obj is IPoint3D p3D) )
@ -147,7 +141,7 @@ namespace Server.Items
from.AddToBackpack( new SpecialFishingNet() );
}
m_InUse = true;
InUse = true;
Movable = false;
MoveToWorld( p, map );

View file

@ -10,43 +10,27 @@ namespace Server.Items
[DispellableFieldAttribute]
public class Moongate : Item
{
private Point3D m_Target;
private Map m_TargetMap;
private bool m_bDispellable;
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Target { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Point3D Target
{
get => m_Target;
set => m_Target = value;
}
public Map TargetMap { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Map TargetMap
{
get => m_TargetMap;
set => m_TargetMap = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public bool Dispellable
{
get => m_bDispellable;
set => m_bDispellable = value;
}
public bool Dispellable { get; set; }
public virtual bool ShowFeluccaWarning => false;
[Constructible]
public Moongate() : this( Point3D.Zero, null )
{
m_bDispellable = true;
Dispellable = true;
}
[Constructible]
public Moongate(bool bDispellable) : this( Point3D.Zero, null )
{
m_bDispellable = bDispellable;
Dispellable = bDispellable;
}
[Constructible]
@ -55,8 +39,8 @@ namespace Server.Items
Movable = false;
Light = LightType.Circle300;
m_Target = target;
m_TargetMap = targetMap;
Target = target;
TargetMap = targetMap;
}
public Moongate( Serial serial ) : base( serial )
@ -104,11 +88,11 @@ namespace Server.Items
{
m.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
}
else if ( m_TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young )
else if ( TargetMap == Map.Felucca && m is PlayerMobile mobile && mobile.Young )
{
mobile.SendLocalizedMessage( 1049543 ); // You decide against traveling to Felucca while you are still young.
}
else if ( (m.Kills >= 5 && m_TargetMap != Map.Felucca) || ( m_TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( m_TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( m_TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) )
else if ( (m.Kills >= 5 && TargetMap != Map.Felucca) || ( TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ) || ( TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ) || ( TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0 ) )
{
m.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
}
@ -116,11 +100,11 @@ namespace Server.Items
{
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
}
else if ( m_TargetMap != null && m_TargetMap != Map.Internal )
else if ( TargetMap != null && TargetMap != Map.Internal )
{
BaseCreature.TeleportPets( m, m_Target, m_TargetMap );
BaseCreature.TeleportPets( m, Target, TargetMap );
m.MoveToWorld( m_Target, m_TargetMap );
m.MoveToWorld( Target, TargetMap );
if ( m.AccessLevel == AccessLevel.Player || !m.Hidden )
m.PlaySound( 0x1FE );
@ -139,11 +123,11 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( m_Target );
writer.Write( m_TargetMap );
writer.Write( Target );
writer.Write( TargetMap );
// Version 1
writer.Write( m_bDispellable );
writer.Write( Dispellable );
}
public override void Deserialize( GenericReader reader )
@ -152,11 +136,11 @@ namespace Server.Items
int version = reader.ReadInt();
m_Target = reader.ReadPoint3D();
m_TargetMap = reader.ReadMap();
Target = reader.ReadPoint3D();
TargetMap = reader.ReadMap();
if ( version >= 1 )
m_bDispellable = reader.ReadBool();
Dispellable = reader.ReadBool();
}
public virtual bool ValidateUse( Mobile from, bool message )
@ -177,7 +161,7 @@ namespace Server.Items
public virtual void BeginConfirmation( Mobile from )
{
if ( IsInTown( from.Location, from.Map ) && !IsInTown( m_Target, m_TargetMap ) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning) )
if ( IsInTown( from.Location, from.Map ) && !IsInTown( Target, TargetMap ) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning) )
{
if ( from.AccessLevel == AccessLevel.Player || !from.Hidden )
from.Send( new PlaySound( 0x20E, from.Location ) );
@ -203,7 +187,7 @@ namespace Server.Items
if ( !ValidateUse( from, false ) || !from.InRange( this, range ) )
return;
if ( m_TargetMap != null )
if ( TargetMap != null )
BeginConfirmation( from );
else
from.SendMessage( "This moongate does not seem to go anywhere." );
@ -241,65 +225,26 @@ namespace Server.Items
public class ConfirmationMoongate : Moongate
{
private int m_GumpWidth;
private int m_GumpHeight;
private int m_TitleColor;
private int m_MessageColor;
private int m_TitleNumber;
private int m_MessageNumber;
private string m_MessageString;
[CommandProperty( AccessLevel.GameMaster )]
public int GumpWidth { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int GumpWidth
{
get => m_GumpWidth;
set => m_GumpWidth = value;
}
public int GumpHeight { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int GumpHeight
{
get => m_GumpHeight;
set => m_GumpHeight = value;
}
public int TitleColor { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int TitleColor
{
get => m_TitleColor;
set => m_TitleColor = value;
}
public int MessageColor { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int MessageColor
{
get => m_MessageColor;
set => m_MessageColor = value;
}
public int TitleNumber { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int TitleNumber
{
get => m_TitleNumber;
set => m_TitleNumber = value;
}
public int MessageNumber { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int MessageNumber
{
get => m_MessageNumber;
set => m_MessageNumber = value;
}
[CommandProperty( AccessLevel.GameMaster )]
public string MessageString
{
get => m_MessageString;
set => m_MessageString = value;
}
public string MessageString { get; set; }
[Constructible]
public ConfirmationMoongate() : this( Point3D.Zero, null )
@ -323,10 +268,10 @@ namespace Server.Items
public override void BeginConfirmation( Mobile from )
{
if ( m_GumpWidth > 0 && m_GumpHeight > 0 && m_TitleNumber > 0 && (m_MessageNumber > 0 || m_MessageString != null) )
if ( GumpWidth > 0 && GumpHeight > 0 && TitleNumber > 0 && (MessageNumber > 0 || MessageString != null) )
{
from.CloseGump( typeof( WarningGump ) );
from.SendGump( new WarningGump( m_TitleNumber, m_TitleColor, m_MessageString == null ? (object)m_MessageNumber : (object)m_MessageString, m_MessageColor, m_GumpWidth, m_GumpHeight, Warning_Callback, from ) );
from.SendGump( new WarningGump( TitleNumber, TitleColor, MessageString == null ? (object)MessageNumber : (object)MessageString, MessageColor, GumpWidth, GumpHeight, Warning_Callback, from ) );
}
else
{
@ -340,16 +285,16 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.WriteEncodedInt( m_GumpWidth );
writer.WriteEncodedInt( m_GumpHeight );
writer.WriteEncodedInt( GumpWidth );
writer.WriteEncodedInt( GumpHeight );
writer.WriteEncodedInt( m_TitleColor );
writer.WriteEncodedInt( m_MessageColor );
writer.WriteEncodedInt( TitleColor );
writer.WriteEncodedInt( MessageColor );
writer.WriteEncodedInt( m_TitleNumber );
writer.WriteEncodedInt( m_MessageNumber );
writer.WriteEncodedInt( TitleNumber );
writer.WriteEncodedInt( MessageNumber );
writer.Write( m_MessageString );
writer.Write( MessageString );
}
public override void Deserialize( GenericReader reader )
@ -362,16 +307,16 @@ namespace Server.Items
{
case 0:
{
m_GumpWidth = reader.ReadEncodedInt();
m_GumpHeight = reader.ReadEncodedInt();
GumpWidth = reader.ReadEncodedInt();
GumpHeight = reader.ReadEncodedInt();
m_TitleColor = reader.ReadEncodedInt();
m_MessageColor = reader.ReadEncodedInt();
TitleColor = reader.ReadEncodedInt();
MessageColor = reader.ReadEncodedInt();
m_TitleNumber = reader.ReadEncodedInt();
m_MessageNumber = reader.ReadEncodedInt();
TitleNumber = reader.ReadEncodedInt();
MessageNumber = reader.ReadEncodedInt();
m_MessageString = reader.ReadString();
MessageString = reader.ReadString();
break;
}

View file

@ -10,7 +10,6 @@ namespace Server.Items
{
private string m_Description;
private bool m_Marked;
private Point3D m_Target;
private Map m_TargetMap;
private BaseHouse m_House;
@ -31,7 +30,7 @@ namespace Server.Items
writer.Write( (string) m_Description );
writer.Write( (bool) m_Marked );
writer.Write( (Point3D) m_Target );
writer.Write( (Point3D) Target );
writer.Write( (Map) m_TargetMap );
}
@ -52,7 +51,7 @@ namespace Server.Items
{
m_Description = reader.ReadString();
m_Marked = reader.ReadBool();
m_Target = reader.ReadPoint3D();
Target = reader.ReadPoint3D();
m_TargetMap = reader.ReadMap();
CalculateHue();
@ -102,11 +101,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
public Point3D Target
{
get => m_Target;
set => m_Target = value;
}
public Point3D Target { get; set; }
[CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
public Map TargetMap
@ -150,7 +145,7 @@ namespace Server.Items
if ( m_House == null )
{
m_Target = m.Location;
Target = m.Location;
m_TargetMap = m.Map;
}
else
@ -176,19 +171,19 @@ namespace Server.Items
if ( map != null && !map.CanFit( x, y, z, 16, false, false ) )
z = map.GetAverageZ( x, y );
m_Target = new Point3D( x, y, z );
Target = new Point3D( x, y, z );
m_TargetMap = map;
}
}
else
{
m_House = null;
m_Target = m.Location;
Target = m.Location;
m_TargetMap = m.Map;
}
if ( !setDesc )
m_Description = BaseRegion.GetRuneNameFor( Region.Find( m_Target, m_TargetMap ) );
m_Description = BaseRegion.GetRuneNameFor( Region.Find( Target, m_TargetMap ) );
CalculateHue();
InvalidateProperties();

View file

@ -138,18 +138,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseConflagrationPotion m_Potion;
public BaseConflagrationPotion Potion => m_Potion;
public BaseConflagrationPotion Potion { get; }
public ThrowTarget( BaseConflagrationPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) || from.Map == null )
@ -169,20 +167,19 @@ namespace Server.Items
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
public class InternalItem : Item
{
private Mobile m_From;
private int m_MinDamage;
private int m_MaxDamage;
private DateTime m_End;
private Timer m_Timer;
public Mobile From => m_From;
public Mobile From { get; private set; }
public override bool BlocksFit => true;
@ -193,7 +190,7 @@ namespace Server.Items
MoveToWorld( loc, map );
m_From = from;
From = from;
m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 );
SetDamage( min, max );
@ -224,14 +221,14 @@ namespace Server.Items
m_MinDamage = min;
m_MaxDamage = max;
if ( m_From == null )
if ( From == null )
return;
int alchemySkill = m_From.Skills.Alchemy.Fixed;
int alchemySkill = From.Skills.Alchemy.Fixed;
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250 ;
m_MinDamage = Scale( m_From, m_MinDamage + alchemyBonus );
m_MaxDamage = Scale( m_From, m_MaxDamage + alchemyBonus );
m_MinDamage = Scale( From, m_MinDamage + alchemyBonus );
m_MaxDamage = Scale( From, m_MaxDamage + alchemyBonus );
}
public override void Serialize( GenericWriter writer )
@ -240,7 +237,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (Mobile) m_From );
writer.Write( (Mobile) From );
writer.Write( (DateTime) m_End );
writer.Write( (int) m_MinDamage );
writer.Write( (int) m_MaxDamage );
@ -252,7 +249,7 @@ namespace Server.Items
int version = reader.ReadInt();
m_From = reader.ReadMobile();
From = reader.ReadMobile();
m_End = reader.ReadDateTime();
m_MinDamage = reader.ReadInt();
m_MaxDamage = reader.ReadInt();
@ -263,11 +260,11 @@ namespace Server.Items
public override bool OnMoveOver( Mobile m )
{
if ( Visible && m_From != null && (!Core.AOS || m != m_From) && SpellHelper.ValidIndirectTarget( m_From, m ) && m_From.CanBeHarmful( m, false ) )
if ( Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget( From, m ) && From.CanBeHarmful( m, false ) )
{
m_From.DoHarmful( m );
From.DoHarmful( m );
AOS.Damage( m, m_From, GetDamage(), 0, 100, 0, 0, 0 );
AOS.Damage( m, From, GetDamage(), 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}

View file

@ -158,18 +158,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseConfusionBlastPotion m_Potion;
public BaseConfusionBlastPotion Potion => m_Potion;
public BaseConfusionBlastPotion Potion { get; }
public ThrowTarget( BaseConfusionBlastPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) || from.Map == null )
@ -189,8 +187,8 @@ namespace Server.Items
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
}

View file

@ -4,17 +4,14 @@ namespace Server.Items
{
public class CureLevelInfo
{
private Poison m_Poison;
private double m_Chance;
public Poison Poison { get; }
public Poison Poison => m_Poison;
public double Chance => m_Chance;
public double Chance { get; }
public CureLevelInfo( Poison poison, double chance )
{
m_Poison = poison;
m_Chance = chance;
Poison = poison;
Chance = chance;
}
}

View file

@ -60,9 +60,7 @@ namespace Server.Items
private Timer m_Timer;
public List<Mobile> Users => m_Users;
private List<Mobile> m_Users;
public List<Mobile> Users { get; private set; }
public override void Drink( Mobile from )
{
@ -80,11 +78,11 @@ namespace Server.Items
from.RevealingAction();
if ( m_Users == null )
m_Users = new List<Mobile>();
if ( Users == null )
Users = new List<Mobile>();
if ( !m_Users.Contains( from ) )
m_Users.Add( from );
if ( !Users.Contains( from ) )
Users.Add( from );
from.Target = new ThrowTarget( this );
@ -164,18 +162,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseExplosionPotion m_Potion;
public BaseExplosionPotion Potion => m_Potion;
public BaseExplosionPotion Potion { get; }
public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) )
@ -200,15 +196,15 @@ namespace Server.Items
to = m;
}
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
Effects.SendMovingEffect( from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0 );
if ( m_Potion.Amount > 1 )
if ( Potion.Amount > 1 )
{
Mobile.LiftItemDupe( m_Potion, 1 );
Mobile.LiftItemDupe( Potion, 1 );
}
m_Potion.Internalize();
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
Potion.Internalize();
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Reposition_OnTick ), new object[]{ from, p, map } );
}
}
@ -219,9 +215,9 @@ namespace Server.Items
Consume();
for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
for ( int i = 0; Users != null && i < Users.Count; ++i )
{
Mobile m = m_Users[i];
Mobile m = Users[i];
if ( m.Target is ThrowTarget targ && targ.Potion == this )
Target.Cancel( m );

View file

@ -22,23 +22,12 @@ namespace Server.Items
set{ m_Quality = value; InvalidateProperties(); }
}
private List<RunebookEntry> m_Entries;
private string m_Description;
private int m_CurCharges, m_MaxCharges;
private int m_DefaultIndex;
private SecureLevel m_Level;
private Mobile m_Crafter;
private DateTime m_NextUse;
private List<Mobile> m_Openers = new List<Mobile>();
[CommandProperty( AccessLevel.GameMaster )]
public DateTime NextUse
{
get => m_NextUse;
set => m_NextUse = value;
}
public DateTime NextUse { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public Mobile Crafter
@ -48,11 +37,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_Level;
set => m_Level = value;
}
public SecureLevel Level { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public string Description
@ -66,24 +51,12 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int CurCharges
{
get => m_CurCharges;
set => m_CurCharges = value;
}
public int CurCharges { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int MaxCharges
{
get => m_MaxCharges;
set => m_MaxCharges = value;
}
public int MaxCharges { get; set; }
public List<Mobile> Openers
{
get => m_Openers;
set => m_Openers = value;
}
public List<Mobile> Openers { get; set; } = new List<Mobile>();
public override int LabelNumber => 1041267; // runebook
@ -96,13 +69,13 @@ namespace Server.Items
Layer = (Core.AOS ? Layer.Invalid : Layer.OneHanded);
m_Entries = new List<RunebookEntry>();
Entries = new List<RunebookEntry>();
m_MaxCharges = maxCharges;
MaxCharges = maxCharges;
m_DefaultIndex = -1;
m_Level = SecureLevel.CoOwners;
Level = SecureLevel.CoOwners;
}
[Constructible]
@ -110,14 +83,14 @@ namespace Server.Items
{
}
public List<RunebookEntry> Entries => m_Entries;
public List<RunebookEntry> Entries { get; private set; }
public RunebookEntry Default
{
get
{
if ( m_DefaultIndex >= 0 && m_DefaultIndex < m_Entries.Count )
return m_Entries[m_DefaultIndex];
if ( m_DefaultIndex >= 0 && m_DefaultIndex < Entries.Count )
return Entries[m_DefaultIndex];
return null;
}
@ -126,7 +99,7 @@ namespace Server.Items
if ( value == null )
m_DefaultIndex = -1;
else
m_DefaultIndex = m_Entries.IndexOf( value );
m_DefaultIndex = Entries.IndexOf( value );
}
}
@ -155,16 +128,16 @@ namespace Server.Items
writer.Write( m_Crafter );
writer.Write( (int) m_Level );
writer.Write( (int) Level );
writer.Write( m_Entries.Count );
writer.Write( Entries.Count );
for ( int i = 0; i < m_Entries.Count; ++i )
m_Entries[i].Serialize( writer );
for ( int i = 0; i < Entries.Count; ++i )
Entries[i].Serialize( writer );
writer.Write( m_Description );
writer.Write( m_CurCharges );
writer.Write( m_MaxCharges );
writer.Write( CurCharges );
writer.Write( MaxCharges );
writer.Write( m_DefaultIndex );
}
@ -193,21 +166,21 @@ namespace Server.Items
}
case 1:
{
m_Level = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
int count = reader.ReadInt();
m_Entries = new List<RunebookEntry>( count );
Entries = new List<RunebookEntry>( count );
for ( int i = 0; i < count; ++i )
m_Entries.Add( new RunebookEntry( reader ) );
Entries.Add( new RunebookEntry( reader ) );
m_Description = reader.ReadString();
m_CurCharges = reader.ReadInt();
m_MaxCharges = reader.ReadInt();
CurCharges = reader.ReadInt();
MaxCharges = reader.ReadInt();
m_DefaultIndex = reader.ReadInt();
break;
@ -222,7 +195,7 @@ namespace Server.Items
else if ( m_DefaultIndex == index )
m_DefaultIndex = -1;
m_Entries.RemoveAt( index );
Entries.RemoveAt( index );
RecallRune rune = new RecallRune();
@ -279,11 +252,11 @@ namespace Server.Items
return false;
}
foreach ( Mobile m in m_Openers )
foreach ( Mobile m in Openers )
if ( IsOpen( m ) )
m.CloseGump( typeof( RunebookGump ) );
m_Openers.Clear();
Openers.Clear();
return true;
}
@ -309,7 +282,7 @@ namespace Server.Items
return;
}
if ( DateTime.UtcNow < m_NextUse )
if ( DateTime.UtcNow < NextUse )
{
from.SendLocalizedMessage( 502406 ); // This book needs time to recharge.
return;
@ -318,14 +291,14 @@ namespace Server.Items
from.CloseGump( typeof( RunebookGump ) );
from.SendGump( new RunebookGump( from, this ) );
m_Openers.Add( from );
Openers.Add( from );
}
}
public virtual void OnTravel()
{
if ( !Core.SA )
m_NextUse = DateTime.UtcNow + UseDelay;
NextUse = DateTime.UtcNow + UseDelay;
}
public override void OnAfterDuped( Item newItem )
@ -333,13 +306,13 @@ namespace Server.Items
if ( !(newItem is Runebook book) )
return;
book.m_Entries = new List<RunebookEntry>();
book.Entries = new List<RunebookEntry>();
for ( int i = 0; i < m_Entries.Count; i++ )
for ( int i = 0; i < Entries.Count; i++ )
{
RunebookEntry entry = m_Entries[i];
RunebookEntry entry = Entries[i];
book.m_Entries.Add( new RunebookEntry( entry.Location, entry.Map, entry.Description, entry.House ) );
book.Entries.Add( new RunebookEntry( entry.Location, entry.Map, entry.Description, entry.House ) );
}
}
@ -353,7 +326,7 @@ namespace Server.Items
if ( house != null && house.IsAosRules && (house.Public ? house.IsBanned( m ) : !house.HasAccess( m )) )
return false;
return ( house != null && house.HasSecureAccess( m, m_Level ) );
return ( house != null && house.HasSecureAccess( m, Level ) );
}
public override bool OnDragDrop( Mobile from, Item dropped )
@ -368,11 +341,11 @@ namespace Server.Items
{
from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
}
else if ( m_Entries.Count < 16 )
else if ( Entries.Count < 16 )
{
if ( rune.Marked && rune.TargetMap != null )
{
m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );
Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );
rune.Delete();
@ -397,20 +370,20 @@ namespace Server.Items
}
else if ( dropped is RecallScroll )
{
if ( m_CurCharges < m_MaxCharges )
if ( CurCharges < MaxCharges )
{
from.Send( new PlaySound( 0x249, GetWorldLocation() ) );
int amount = dropped.Amount;
if ( amount > (m_MaxCharges - m_CurCharges) )
if ( amount > (MaxCharges - CurCharges) )
{
dropped.Consume( m_MaxCharges - m_CurCharges );
m_CurCharges = m_MaxCharges;
dropped.Consume( MaxCharges - CurCharges );
CurCharges = MaxCharges;
}
else
{
m_CurCharges += amount;
CurCharges += amount;
dropped.Delete();
return true;
@ -448,25 +421,20 @@ namespace Server.Items
public class RunebookEntry
{
private Point3D m_Location;
private Map m_Map;
private string m_Description;
private BaseHouse m_House;
public Point3D Location { get; }
public Point3D Location => m_Location;
public Map Map { get; }
public Map Map => m_Map;
public string Description { get; }
public string Description => m_Description;
public BaseHouse House => m_House;
public BaseHouse House { get; }
public RunebookEntry( Point3D loc, Map map, string desc, BaseHouse house )
{
m_Location = loc;
m_Map = map;
m_Description = desc;
m_House = house;
Location = loc;
Map = map;
Description = desc;
House = house;
}
public RunebookEntry( GenericReader reader )
@ -477,14 +445,14 @@ namespace Server.Items
{
case 1:
{
m_House = reader.ReadItem() as BaseHouse;
House = reader.ReadItem() as BaseHouse;
goto case 0;
}
case 0:
{
m_Location = reader.ReadPoint3D();
m_Map = reader.ReadMap();
m_Description = reader.ReadString();
Location = reader.ReadPoint3D();
Map = reader.ReadMap();
Description = reader.ReadString();
break;
}
@ -493,20 +461,20 @@ namespace Server.Items
public void Serialize( GenericWriter writer )
{
if ( m_House != null && !m_House.Deleted )
if ( House != null && !House.Deleted )
{
writer.Write( (byte) 1 ); // version
writer.Write( m_House );
writer.Write( House );
}
else
{
writer.Write( (byte) 0 ); // version
}
writer.Write( m_Location );
writer.Write( m_Map );
writer.Write( m_Description );
writer.Write( Location );
writer.Write( Map );
writer.Write( Description );
}
}
}

View file

@ -6,9 +6,7 @@ namespace Server.Items
{
public class SpellScroll : Item, ICommodity
{
private int m_SpellID;
public int SpellID => m_SpellID;
public int SpellID { get; private set; }
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => (Core.ML);
@ -29,7 +27,7 @@ namespace Server.Items
Weight = 1.0;
Amount = amount;
m_SpellID = spellID;
SpellID = spellID;
}
public override void Serialize( GenericWriter writer )
@ -38,7 +36,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (int) m_SpellID );
writer.Write( (int) SpellID );
}
public override void Deserialize( GenericReader reader )
@ -51,7 +49,7 @@ namespace Server.Items
{
case 0:
{
m_SpellID = reader.ReadInt();
SpellID = reader.ReadInt();
break;
}
@ -77,7 +75,7 @@ namespace Server.Items
return;
}
Spell spell = SpellRegistry.NewSpell( m_SpellID, from, this );
Spell spell = SpellRegistry.NewSpell( SpellID, from, this );
if ( spell != null )
spell.Cast();

View file

@ -317,7 +317,6 @@ namespace Server.Items
public virtual int BookCount => 64;
private ulong m_Content;
private int m_Count;
public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
{
@ -369,7 +368,7 @@ namespace Server.Items
if ( val >= 0 && val < BookCount )
{
m_Content |= (ulong)1 << val;
++m_Count;
++SpellCount;
InvalidateProperties();
@ -393,11 +392,11 @@ namespace Server.Items
{
m_Content = value;
m_Count = 0;
SpellCount = 0;
while ( value > 0 )
{
m_Count += (int)(value & 0x1);
SpellCount += (int)(value & 0x1);
value >>= 1;
}
@ -407,7 +406,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public int SpellCount => m_Count;
public int SpellCount { get; private set; }
[Constructible]
public Spellbook() : this( (ulong)0 )
@ -532,16 +531,16 @@ namespace Server.Items
to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) );
} else {
if (ns.ContainerGridLines) {
to.Send(new SpellbookContent6017(m_Count, BookOffset + 1, m_Content, this));
to.Send(new SpellbookContent6017(SpellCount, BookOffset + 1, m_Content, this));
} else {
to.Send(new SpellbookContent(m_Count, BookOffset + 1, m_Content, this));
to.Send(new SpellbookContent(SpellCount, BookOffset + 1, m_Content, this));
}
}
} else {
if ( ns.ContainerGridLines ) {
to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) );
to.Send( new SpellbookContent6017( SpellCount, BookOffset + 1, m_Content, this ) );
} else {
to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) );
to.Send( new SpellbookContent( SpellCount, BookOffset + 1, m_Content, this ) );
}
}
}
@ -660,7 +659,7 @@ namespace Server.Items
if ( Core.ML && (prop = m_AosAttributes.IncreasedKarmaLoss) != 0 )
list.Add( 1075210, prop.ToString() ); // Increased Karma Loss ~1val~%
list.Add( 1042886, m_Count.ToString() ); // ~1_NUMBERS_OF_SPELLS~ Spells
list.Add( 1042886, SpellCount.ToString() ); // ~1_NUMBERS_OF_SPELLS~ Spells
}
public override void OnSingleClick( Mobile from )
@ -670,7 +669,7 @@ namespace Server.Items
if ( m_Crafter != null )
LabelTo( from, 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
LabelTo( from, 1042886, m_Count.ToString() );
LabelTo( from, 1042886, SpellCount.ToString() );
}
public override void OnDoubleClick( Mobile from )
@ -721,7 +720,7 @@ namespace Server.Items
m_AosSkillBonuses.Serialize( writer );
writer.Write( m_Content );
writer.Write( m_Count );
writer.Write( SpellCount );
}
public override void Deserialize( GenericReader reader )
@ -765,7 +764,7 @@ namespace Server.Items
case 0:
{
m_Content = reader.ReadULong();
m_Count = reader.ReadInt();
SpellCount = reader.ReadInt();
break;
}

View file

@ -157,40 +157,36 @@ namespace Server.Items
public class BandageContext
{
private Mobile m_Healer;
private Mobile m_Patient;
private int m_Slips;
private Timer m_Timer;
public Mobile Healer { get; }
public Mobile Healer => m_Healer;
public Mobile Patient => m_Patient;
public int Slips{ get => m_Slips;
set => m_Slips = value;
}
public Timer Timer => m_Timer;
public Mobile Patient { get; }
public int Slips { get; set; }
public Timer Timer { get; private set; }
public void Slip()
{
m_Healer.SendLocalizedMessage( 500961 ); // Your fingers slip!
++m_Slips;
Healer.SendLocalizedMessage( 500961 ); // Your fingers slip!
++Slips;
}
public BandageContext( Mobile healer, Mobile patient, TimeSpan delay )
{
m_Healer = healer;
m_Patient = patient;
Healer = healer;
Patient = patient;
m_Timer = new InternalTimer( this, delay );
m_Timer.Start();
Timer = new InternalTimer( this, delay );
Timer.Start();
}
public void StopHeal()
{
m_Table.Remove( m_Healer );
m_Table.Remove( Healer );
m_Timer?.Stop();
Timer?.Stop();
m_Timer = null;
Timer = null;
}
private static Dictionary<Mobile, BandageContext> m_Table = new Dictionary<Mobile, BandageContext>();
@ -223,38 +219,38 @@ namespace Server.Items
bool playSound = true;
bool checkSkills = false;
SkillName primarySkill = GetPrimarySkill( m_Patient );
SkillName secondarySkill = GetSecondarySkill( m_Patient );
SkillName primarySkill = GetPrimarySkill( Patient );
SkillName secondarySkill = GetSecondarySkill( Patient );
BaseCreature petPatient = m_Patient as BaseCreature;
BaseCreature petPatient = Patient as BaseCreature;
if ( !m_Healer.Alive )
if ( !Healer.Alive )
{
healerNumber = 500962; // You were unable to finish your work before you died.
patientNumber = -1;
playSound = false;
}
else if ( !m_Healer.InRange( m_Patient, Bandage.Range ) )
else if ( !Healer.InRange( Patient, Bandage.Range ) )
{
healerNumber = 500963; // You did not stay close enough to heal your target.
patientNumber = -1;
playSound = false;
}
else if ( !m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet) )
else if ( !Patient.Alive || (petPatient != null && petPatient.IsDeadPet) )
{
double healing = m_Healer.Skills[primarySkill].Value;
double anatomy = m_Healer.Skills[secondarySkill].Value;
double chance = ((healing - 68.0) / 50.0) - (m_Slips * 0.02);
double healing = Healer.Skills[primarySkill].Value;
double anatomy = Healer.Skills[secondarySkill].Value;
double chance = ((healing - 68.0) / 50.0) - (Slips * 0.02);
if (( (checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble() )
|| ( Core.SE && petPatient is Factions.FactionWarHorse && petPatient.ControlMaster == m_Healer) ) //TODO: Dbl check doesn't check for faction of the horse here?
|| ( Core.SE && petPatient is Factions.FactionWarHorse && petPatient.ControlMaster == Healer) ) //TODO: Dbl check doesn't check for faction of the horse here?
{
if ( m_Patient.Map == null || !m_Patient.Map.CanFit( m_Patient.Location, 16, false, false ) )
if ( Patient.Map == null || !Patient.Map.CanFit( Patient.Location, 16, false, false ) )
{
healerNumber = 501042; // Target can not be resurrected at that location.
patientNumber = 502391; // Thou can not be resurrected there!
}
else if ( m_Patient.Region != null && m_Patient.Region.IsPartOf( "Khaldun" ) )
else if ( Patient.Region != null && Patient.Region.IsPartOf( "Khaldun" ) )
{
healerNumber = 1010395; // The veil of death in this area is too strong and resists thy efforts to restore life.
patientNumber = -1;
@ -264,14 +260,14 @@ namespace Server.Items
healerNumber = 500965; // You are able to resurrect your patient.
patientNumber = -1;
m_Patient.PlaySound( 0x214 );
m_Patient.FixedEffect( 0x376A, 10, 16 );
Patient.PlaySound( 0x214 );
Patient.FixedEffect( 0x376A, 10, 16 );
if ( petPatient != null && petPatient.IsDeadPet )
{
Mobile master = petPatient.ControlMaster;
if ( master != null && m_Healer == master )
if ( master != null && Healer == master )
{
petPatient.ResurrectPet();
@ -285,7 +281,7 @@ namespace Server.Items
healerNumber = 503255; // You are able to resurrect the creature.
master.CloseGump( typeof( PetResurrectGump ) );
master.SendGump( new PetResurrectGump( m_Healer, petPatient ) );
master.SendGump( new PetResurrectGump( Healer, petPatient ) );
}
else
{
@ -302,7 +298,7 @@ namespace Server.Items
healerNumber = 503255; // You are able to resurrect the creature.
friend.CloseGump( typeof( PetResurrectGump ) );
friend.SendGump( new PetResurrectGump( m_Healer, petPatient ) );
friend.SendGump( new PetResurrectGump( Healer, petPatient ) );
found = true;
break;
@ -315,8 +311,8 @@ namespace Server.Items
}
else
{
m_Patient.CloseGump( typeof( ResurrectGump ) );
m_Patient.SendGump( new ResurrectGump( m_Patient, m_Healer ) );
Patient.CloseGump( typeof( ResurrectGump ) );
Patient.SendGump( new ResurrectGump( Patient, Healer ) );
}
}
}
@ -330,19 +326,19 @@ namespace Server.Items
patientNumber = -1;
}
}
else if ( m_Patient.Poisoned )
else if ( Patient.Poisoned )
{
m_Healer.SendLocalizedMessage( 500969 ); // You finish applying the bandages.
Healer.SendLocalizedMessage( 500969 ); // You finish applying the bandages.
double healing = m_Healer.Skills[primarySkill].Value;
double anatomy = m_Healer.Skills[secondarySkill].Value;
double chance = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.1) - (m_Slips * 0.02);
double healing = Healer.Skills[primarySkill].Value;
double anatomy = Healer.Skills[secondarySkill].Value;
double chance = ((healing - 30.0) / 50.0) - (Patient.Poison.Level * 0.1) - (Slips * 0.02);
if ( (checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble() )
{
if ( m_Patient.CurePoison( m_Healer ) )
if ( Patient.CurePoison( Healer ) )
{
healerNumber = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons.
healerNumber = (Healer == Patient) ? -1 : 1010058; // You have cured the target of all poisons.
patientNumber = 1010059; // You have been cured of all poisons.
}
else
@ -357,20 +353,20 @@ namespace Server.Items
patientNumber = -1;
}
}
else if ( BleedAttack.IsBleeding( m_Patient ) )
else if ( BleedAttack.IsBleeding( Patient ) )
{
healerNumber = 1060088; // You bind the wound and stop the bleeding
patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding!
BleedAttack.EndBleed( m_Patient, false );
BleedAttack.EndBleed( Patient, false );
}
else if ( MortalStrike.IsWounded( m_Patient ) )
else if ( MortalStrike.IsWounded( Patient ) )
{
healerNumber = ( m_Healer == m_Patient ? 1005000 : 1010398 );
healerNumber = ( Healer == Patient ? 1005000 : 1010398 );
patientNumber = -1;
playSound = false;
}
else if ( m_Patient.Hits == m_Patient.HitsMax )
else if ( Patient.Hits == Patient.HitsMax )
{
healerNumber = 500967; // You heal what little damage your patient had.
patientNumber = -1;
@ -380,9 +376,9 @@ namespace Server.Items
checkSkills = true;
patientNumber = -1;
double healing = m_Healer.Skills[primarySkill].Value;
double anatomy = m_Healer.Skills[secondarySkill].Value;
double chance = ((healing + 10.0) / 100.0) - (m_Slips * 0.02);
double healing = Healer.Skills[primarySkill].Value;
double anatomy = Healer.Skills[secondarySkill].Value;
double chance = ((healing + 10.0) / 100.0) - (Slips * 0.02);
if ( chance > Utility.RandomDouble() )
{
@ -403,13 +399,13 @@ namespace Server.Items
double toHeal = min + (Utility.RandomDouble() * (max - min));
if ( m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal )
toHeal += m_Patient.HitsMax / 100;
if ( Patient.Body.IsMonster || Patient.Body.IsAnimal )
toHeal += Patient.HitsMax / 100;
if ( Core.AOS )
toHeal -= toHeal * m_Slips * 0.35; // TODO: Verify algorithm
toHeal -= toHeal * Slips * 0.35; // TODO: Verify algorithm
else
toHeal -= m_Slips * 4;
toHeal -= Slips * 4;
if ( toHeal < 1 )
{
@ -417,7 +413,7 @@ namespace Server.Items
healerNumber = 500968; // You apply the bandages, but they barely help.
}
m_Patient.Heal( (int) toHeal, m_Healer, false );
Patient.Heal( (int) toHeal, Healer, false );
}
else
{
@ -427,18 +423,18 @@ namespace Server.Items
}
if ( healerNumber != -1 )
m_Healer.SendLocalizedMessage( healerNumber );
Healer.SendLocalizedMessage( healerNumber );
if ( patientNumber != -1 )
m_Patient.SendLocalizedMessage( patientNumber );
Patient.SendLocalizedMessage( patientNumber );
if ( playSound )
m_Patient.PlaySound( 0x57 );
Patient.PlaySound( 0x57 );
if ( checkSkills )
{
m_Healer.CheckSkill( secondarySkill, 0.0, 120.0 );
m_Healer.CheckSkill( primarySkill, 0.0, 120.0 );
Healer.CheckSkill( secondarySkill, 0.0, 120.0 );
Healer.CheckSkill( primarySkill, 0.0, 120.0 );
}
}

View file

@ -9,23 +9,21 @@ namespace Server.Items
{
private class RepairSkillInfo
{
private CraftSystem m_System;
private Type[] m_NearbyTypes;
private TextDefinition m_NotNearbyMessage, m_Name;
public TextDefinition NotNearbyMessage { get; }
public TextDefinition NotNearbyMessage => m_NotNearbyMessage;
public TextDefinition Name => m_Name;
public TextDefinition Name { get; }
public CraftSystem System => m_System;
public Type[] NearbyTypes => m_NearbyTypes;
public CraftSystem System { get; }
public Type[] NearbyTypes { get; }
public RepairSkillInfo( CraftSystem system, Type[] nearbyTypes, TextDefinition notNearbyMessage, TextDefinition name )
{
m_System = system;
m_NearbyTypes = nearbyTypes;
m_NotNearbyMessage = notNearbyMessage;
m_Name = name;
System = system;
NearbyTypes = nearbyTypes;
NotNearbyMessage = notNearbyMessage;
Name = name;
}
public RepairSkillInfo( CraftSystem system, Type nearbyType, TextDefinition notNearbyMessage, TextDefinition name )
@ -33,23 +31,23 @@ namespace Server.Items
{
}
public static RepairSkillInfo[] Table => m_Table;
private static RepairSkillInfo[] m_Table = {
new RepairSkillInfo( DefBlacksmithy.CraftSystem, typeof( Blacksmith ), 1047013, 1023015 ),
new RepairSkillInfo( DefTailoring.CraftSystem, typeof( Tailor ), 1061132, 1022981 ),
new RepairSkillInfo( DefTinkering.CraftSystem, typeof( Tinker ), 1061166, 1022983 ),
new RepairSkillInfo( DefCarpentry.CraftSystem, typeof( Carpenter ), 1061135, 1060774 ),
new RepairSkillInfo( DefBowFletching.CraftSystem, typeof( Bowyer ), 1061134, 1023005 )
};
public static RepairSkillInfo[] Table { get; } =
{
new RepairSkillInfo( DefBlacksmithy.CraftSystem, typeof( Blacksmith ), 1047013, 1023015 ),
new RepairSkillInfo( DefTailoring.CraftSystem, typeof( Tailor ), 1061132, 1022981 ),
new RepairSkillInfo( DefTinkering.CraftSystem, typeof( Tinker ), 1061166, 1022983 ),
new RepairSkillInfo( DefCarpentry.CraftSystem, typeof( Carpenter ), 1061135, 1060774 ),
new RepairSkillInfo( DefBowFletching.CraftSystem, typeof( Bowyer ), 1061134, 1023005 )
};
public static RepairSkillInfo GetInfo( RepairSkillType type )
{
int v = (int)type;
if ( v < 0 || v >= m_Table.Length )
if ( v < 0 || v >= Table.Length )
v = 0;
return m_Table[v];
return Table[v];
}
}
public enum RepairSkillType

View file

@ -18,25 +18,16 @@ namespace Server.Items
public abstract class BaseInstrument : Item, ICraftable, ISlayer
{
private int m_WellSound, m_BadlySound;
private SlayerName m_Slayer, m_Slayer2;
private InstrumentQuality m_Quality;
private Mobile m_Crafter;
private int m_UsesRemaining;
[CommandProperty( AccessLevel.GameMaster )]
public int SuccessSound
{
get => m_WellSound;
set => m_WellSound = value;
}
public int SuccessSound { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int FailureSound
{
get => m_BadlySound;
set => m_BadlySound = value;
}
public int FailureSound { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public SlayerName Slayer
@ -323,8 +314,8 @@ namespace Server.Items
public BaseInstrument( int itemID, int wellSound, int badlySound ) : base( itemID )
{
m_WellSound = wellSound;
m_BadlySound = badlySound;
SuccessSound = wellSound;
FailureSound = badlySound;
UsesRemaining = Utility.RandomMinMax( InitMinUses, InitMaxUses );
}
@ -440,8 +431,8 @@ namespace Server.Items
writer.WriteEncodedInt( (int)UsesRemaining );
writer.WriteEncodedInt( (int) m_WellSound );
writer.WriteEncodedInt( (int) m_BadlySound );
writer.WriteEncodedInt( (int) SuccessSound );
writer.WriteEncodedInt( (int) FailureSound );
}
public override void Deserialize( GenericReader reader )
@ -471,8 +462,8 @@ namespace Server.Items
UsesRemaining = reader.ReadEncodedInt();
m_WellSound = reader.ReadEncodedInt();
m_BadlySound = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
break;
}
@ -485,15 +476,15 @@ namespace Server.Items
UsesRemaining = reader.ReadEncodedInt();
m_WellSound = reader.ReadEncodedInt();
m_BadlySound = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
break;
}
case 0:
{
m_WellSound = reader.ReadInt();
m_BadlySound = reader.ReadInt();
SuccessSound = reader.ReadInt();
FailureSound = reader.ReadInt();
UsesRemaining = Utility.RandomMinMax( InitMinUses, InitMaxUses );
break;
@ -536,12 +527,12 @@ namespace Server.Items
public void PlayInstrumentWell( Mobile from )
{
from.PlaySound( m_WellSound );
from.PlaySound( SuccessSound );
}
public void PlayInstrumentBadly( Mobile from )
{
from.PlaySound( m_BadlySound );
from.PlaySound( FailureSound );
}
private class InternalTimer : Timer

View file

@ -5,58 +5,53 @@ namespace Server.Items
{
public class CustomHueGroup
{
private int m_Name;
private string m_NameString;
private int[] m_Hues;
public int Name { get; }
public int Name => m_Name;
public string NameString => m_NameString;
public string NameString { get; }
public int[] Hues => m_Hues;
public int[] Hues { get; }
public CustomHueGroup( int name, int[] hues )
{
m_Name = name;
m_Hues = hues;
Name = name;
Hues = hues;
}
public CustomHueGroup( string name, int[] hues )
{
m_NameString = name;
m_Hues = hues;
NameString = name;
Hues = hues;
}
}
public class CustomHuePicker
{
private CustomHueGroup[] m_Groups;
private bool m_DefaultSupported;
private int m_Title;
private string m_TitleString;
public bool DefaultSupported { get; }
public bool DefaultSupported => m_DefaultSupported;
public CustomHueGroup[] Groups => m_Groups;
public int Title => m_Title;
public string TitleString => m_TitleString;
public CustomHueGroup[] Groups { get; }
public int Title { get; }
public string TitleString { get; }
public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported )
{
m_Groups = groups;
m_DefaultSupported = defaultSupported;
Groups = groups;
DefaultSupported = defaultSupported;
}
public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported, int title )
{
m_Groups = groups;
m_DefaultSupported = defaultSupported;
m_Title = title;
Groups = groups;
DefaultSupported = defaultSupported;
Title = title;
}
public CustomHuePicker( CustomHueGroup[] groups, bool defaultSupported, string title )
{
m_Groups = groups;
m_DefaultSupported = defaultSupported;
m_TitleString = title;
Groups = groups;
DefaultSupported = defaultSupported;
TitleString = title;
}
public static readonly CustomHuePicker SpecialDyeTub = new CustomHuePicker( new[]

View file

@ -15,7 +15,6 @@ namespace Server.Items
{
private bool m_Redyable;
private int m_DyedHue;
private SecureLevel m_SecureLevel;
public virtual CustomHuePicker CustomHuePicker => null;
@ -35,7 +34,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (int)m_SecureLevel );
writer.Write( (int)Level );
writer.Write( (bool) m_Redyable );
writer.Write( (int) m_DyedHue );
}
@ -50,7 +49,7 @@ namespace Server.Items
{
case 1:
{
m_SecureLevel = (SecureLevel)reader.ReadInt();
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
@ -85,11 +84,7 @@ namespace Server.Items
}
[CommandProperty( AccessLevel.GameMaster )]
public SecureLevel Level
{
get => m_SecureLevel;
set => m_SecureLevel = value;
}
public SecureLevel Level { get; set; }
[Constructible]
public DyeTub() : base( 0xFAB )

View file

@ -8,14 +8,8 @@ namespace Server.Items
public override int FailMessage => 501021; // That is not a piece of furniture.
public override int LabelNumber => 1041246; // Furniture Dye Tub
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public FurnitureDyeTub()
@ -25,7 +19,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -39,7 +33,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076217 ); // 1st Year Veteran Reward
}
@ -49,7 +43,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -62,7 +56,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -9,14 +9,8 @@ namespace Server.Items
public override int LabelNumber => 1041284; // Leather Dye Tub
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public LeatherDyeTub()
@ -26,7 +20,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -40,7 +34,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076218 ); // 2nd Year Veteran Reward
}
@ -50,7 +44,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -63,7 +57,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -4,14 +4,8 @@ namespace Server.Items
{
public override int LabelNumber => 1006008; // Black Dye Tub
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public RewardBlackDyeTub()
@ -23,7 +17,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -37,7 +31,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076217 ); // 1st Year Veteran Reward
}
@ -47,7 +41,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -60,7 +54,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -9,14 +9,8 @@ namespace Server.Items
public override int LabelNumber => 1049740; // Runebook Dye Tub
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public RunebookDyeTub()
@ -26,7 +20,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -40,7 +34,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076220 ); // 4th Year Veteran Reward
}
@ -50,7 +44,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -63,7 +57,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -7,14 +7,8 @@ namespace Server.Items
public override CustomHuePicker CustomHuePicker => CustomHuePicker.SpecialDyeTub;
public override int LabelNumber => 1041285; // Special Dye Tub
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public SpecialDyeTub()
@ -24,7 +18,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -38,7 +32,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076217 ); // 1st Year Veteran Reward
}
@ -48,7 +42,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -61,7 +55,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -9,14 +9,8 @@ namespace Server.Items
public override int LabelNumber => 1049741; // Reward Statuette Dye Tub
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
public bool IsRewardItem { get; set; }
[Constructible]
public StatuetteDyeTub()
@ -26,7 +20,7 @@ namespace Server.Items
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
@ -40,7 +34,7 @@ namespace Server.Items
{
base.GetProperties( list );
if ( Core.ML && m_IsRewardItem )
if ( Core.ML && IsRewardItem )
list.Add( 1076221 ); // 5th Year Veteran Reward
}
@ -50,7 +44,7 @@ namespace Server.Items
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (bool) IsRewardItem );
}
public override void Deserialize( GenericReader reader )
@ -63,7 +57,7 @@ namespace Server.Items
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}

View file

@ -301,25 +301,25 @@ namespace Server.Items
public static void CreateTimer( Mobile m, TimeSpan delay )
{
if ( m != null )
if ( !m_Timers.ContainsKey( m ) )
m_Timers[m] = new InternalTimer( m, delay );
if ( !Timers.ContainsKey( m ) )
Timers[m] = new InternalTimer( m, delay );
}
public static void StartTimer( Mobile m )
{
m_Timers.TryGetValue( m, out Timer t );
Timers.TryGetValue( m, out Timer t );
t?.Start();
}
public static bool IsDisguised( Mobile m )
{
return m_Timers.ContainsKey( m );
return Timers.ContainsKey( m );
}
public static bool StopTimer( Mobile m )
{
m_Timers.TryGetValue( m, out Timer t );
Timers.TryGetValue( m, out Timer t );
if ( t != null )
{
@ -336,12 +336,12 @@ namespace Server.Items
public static bool RemoveTimer( Mobile m )
{
m_Timers.TryGetValue( m, out Timer t );
Timers.TryGetValue( m, out Timer t );
if ( t != null )
{
t.Stop();
m_Timers.Remove( m );
Timers.Remove( m );
}
return ( t != null );
@ -349,7 +349,7 @@ namespace Server.Items
public static TimeSpan TimeRemaining( Mobile m )
{
m_Timers.TryGetValue( m, out Timer t );
Timers.TryGetValue( m, out Timer t );
if ( t != null )
{
@ -359,8 +359,6 @@ namespace Server.Items
return TimeSpan.Zero;
}
private static Dictionary<Mobile, Timer> m_Timers = new Dictionary<Mobile, Timer>();
public static Dictionary<Mobile, Timer> Timers => m_Timers;
public static Dictionary<Mobile, Timer> Timers { get; } = new Dictionary<Mobile, Timer>();
}
}

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