Upgrades code style - First batch (#22)

This commit is contained in:
Kamron Batman 2018-08-14 06:16:50 +08:00 committed by GitHub
parent 8ee42c8ea2
commit 632e8b4757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1834 changed files with 10245 additions and 10437 deletions

View file

@ -234,7 +234,7 @@ namespace Server.Items
return base.CheckHold( m, item, false, checkItems, plusItems, plusWeight );
}
public override int DefaultMaxWeight{ get{ return 1600; } }
public override int DefaultMaxWeight => 1600;
public override bool CheckContentDisplay( Mobile from )
{
@ -957,7 +957,7 @@ namespace Server.Items
if ( version == 0 && Weight == 15 )
Weight = -1;
if ( version < 2 )
GumpID = 0x10B;
}
@ -993,4 +993,4 @@ namespace Server.Items
Weight = -1;
}
}
}
}

View file

@ -7,13 +7,13 @@ namespace Server.Items
{
public abstract class FillableContainer : LockableContainer
{
public virtual int MinRespawnMinutes { get { return 60; } }
public virtual int MaxRespawnMinutes { get { return 90; } }
public virtual int MinRespawnMinutes => 60;
public virtual int MaxRespawnMinutes => 90;
public virtual bool IsLockable { get { return true; } }
public virtual bool IsTrappable { get { return IsLockable; } }
public virtual bool IsLockable => true;
public virtual bool IsTrappable => IsLockable;
public virtual int SpawnThreshold { get { return 2; } }
public virtual int SpawnThreshold => 2;
protected FillableContent m_Content;
@ -21,7 +21,7 @@ namespace Server.Items
protected Timer m_RespawnTimer;
[CommandProperty( AccessLevel.GameMaster )]
public DateTime NextRespawnTime { get { return m_NextRespawnTime; } }
public DateTime NextRespawnTime => m_NextRespawnTime;
[CommandProperty( AccessLevel.GameMaster )]
public FillableContentType ContentType
@ -275,7 +275,7 @@ namespace Server.Items
public class LibraryBookcase : FillableContainer
{
public override bool IsLockable => false;
public override int SpawnThreshold { get { return 5; } }
public override int SpawnThreshold => 5;
protected override int GetSpawnCount()
{
@ -579,8 +579,8 @@ namespace Server.Items
protected Type[] m_Types;
protected int m_Weight;
public Type[] Types { get { return m_Types; } }
public int Weight { get { return m_Weight; } }
public Type[] Types => m_Types;
public int Weight => m_Weight;
public FillableEntry( Type type )
: this( 1, new Type[] { type } )
@ -631,7 +631,7 @@ namespace Server.Items
{
private BeverageType m_Content;
public BeverageType Content { get { return m_Content; } }
public BeverageType Content => m_Content;
public FillableBvrge( Type type, BeverageType content )
: this( 1, type, content )
@ -700,8 +700,8 @@ namespace Server.Items
private FillableEntry[] m_Entries;
private int m_Weight;
public int Level { get { return m_Level; } }
public Type[] Vendors { get { return m_Vendors; } }
public int Level => m_Level;
public Type[] Vendors => m_Vendors;
public FillableContentType TypeID { get { return Lookup( this ); } }

View file

@ -385,9 +385,7 @@ namespace Server.Items
public static void Close( Container c )
{
Timer t = null;
m_Table.TryGetValue( c, out t );
m_Table.TryGetValue( c, out Timer t );
if ( t != null )
{
@ -427,4 +425,4 @@ namespace Server.Items
DynamicFurniture.Close( m_Container );
}
}
}
}

View file

@ -166,8 +166,8 @@ namespace Server.Items
private MarkContainer m_Container;
private DateTime m_RelockTime;
public MarkContainer Container { get { return m_Container; } }
public DateTime RelockTime { get { return m_RelockTime; } }
public MarkContainer Container => m_Container;
public DateTime RelockTime => m_RelockTime;
public InternalTimer( MarkContainer container ) : this( container, TimeSpan.FromMinutes( 5.0 ) )
{

View file

@ -11,8 +11,8 @@ namespace Server.Items
public class SalvageBag : Bag
{
private bool m_Failure;
public override int LabelNumber { get { return 1079931; } } // Salvage Bag
public override int LabelNumber => 1079931; // Salvage Bag
[Constructible]
public SalvageBag()
@ -39,7 +39,7 @@ namespace Server.Items
list.Add( new SalvageAllEntry( this, IsChildOf( from.Backpack ) && Resmeltables() && Scissorables() ) );
}
}
#region Checks
private bool Resmeltables() //Where context menu checks for metal items and dragon barding deeds
{
@ -63,7 +63,7 @@ namespace Server.Items
}
return false;
}
private bool Scissorables() //Where context menu checks for Leather items and cloth items
{
foreach( Item i in Items )
@ -86,7 +86,7 @@ namespace Server.Items
}
return false;
}
#endregion
#endregion
#region Resmelt.cs
private bool Resmelt( Mobile from, Item item, CraftResource resource )
@ -110,7 +110,7 @@ namespace Server.Items
if( craftResource.Amount < 2 )
return false; // Not enough metal to resmelt
double difficulty = 0.0;
switch ( resource )
@ -123,7 +123,7 @@ namespace Server.Items
case CraftResource.Agapite: difficulty = 90.0; break;
case CraftResource.Verite: difficulty = 95.0; break;
case CraftResource.Valorite: difficulty = 99.0; break;
}
}
Type resourceType = info.ResourceTypes[ 0 ];
Item ingot = (Item)Activator.CreateInstance( resourceType );
@ -143,10 +143,10 @@ namespace Server.Items
{
ingot.Amount = 2;
}
if ( difficulty > from.Skills[ SkillName.Mining ].Value )
{
m_Failure = true;
m_Failure = true;
ingot.Delete();
}
else
@ -167,7 +167,7 @@ namespace Server.Items
return false;
}
#endregion
#region Salvaging
private void SalvageIngots( Mobile from )
{
@ -197,15 +197,15 @@ namespace Server.Items
int salvaged = 0;
int notSalvaged = 0;
Container sBag = this;
List<Item> Smeltables = sBag.FindItemsByType<Item>();
for(int i = Smeltables.Count - 1; i >= 0; i--)
{
Item item = Smeltables[ i ];
if( item is BaseArmor )
{
if( Resmelt( from, item, ( (BaseArmor)item ).Resource ) )
@ -227,7 +227,7 @@ namespace Server.Items
else
notSalvaged++;
}
}
}
if( m_Failure )
{
@ -249,9 +249,9 @@ namespace Server.Items
int salvaged = 0;
int notSalvaged = 0;
Container sBag = this;
List<Item> scissorables = sBag.FindItemsByType<Item>();
for ( int i = scissorables.Count - 1; i >= 0; --i )
@ -268,18 +268,18 @@ namespace Server.Items
++notSalvaged;
}
}
from.SendLocalizedMessage( 1079974, String.Format( "{0}\t{1}", salvaged, salvaged + notSalvaged ) ); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
Container pack = from.Backpack;
foreach (Item i in ((Container)this).FindItemsByType(typeof(Item), true))
{
if( ( i is Leather ) || ( i is Cloth ) || ( i is SpinedLeather ) || ( i is HornedLeather ) || ( i is BarbedLeather ) || ( i is Bandage ) || ( i is Bone ) )
{
from.AddToBackpack( i );
}
}
}
}
private void SalvageAll( Mobile from )

View file

@ -12,8 +12,8 @@ namespace Server.Items
private Mobile m_Owner;
private BaseHouse m_House;
public override double DefaultWeight{ get{ return 100; } }
public override int LabelNumber { get { return 1023712; } }
public override double DefaultWeight => 100;
public override int LabelNumber => 1023712;
public StrongBox( Mobile owner, BaseHouse house ) : base( 0xE80 )
{
@ -37,7 +37,7 @@ namespace Server.Items
}
}
public override int DefaultMaxWeight{ get{ return 0; } }
public override int DefaultMaxWeight => 0;
public StrongBox( Serial serial ) : base(serial)
{

View file

@ -11,9 +11,9 @@ namespace Server.Items
{
public class TreasureMapChest : LockableContainer
{
public override int LabelNumber{ get{ return 3000541; } }
public override int LabelNumber => 3000541;
public static Type[] Artifacts { get { return m_Artifacts; } }
public static Type[] Artifacts => m_Artifacts;
private static Type[] m_Artifacts = new Type[]
{
@ -46,7 +46,7 @@ namespace Server.Items
[CommandProperty( AccessLevel.GameMaster )]
public bool Temporary{ get{ return m_Temporary; } set{ m_Temporary = value; } }
public List<Mobile> Guardians { get { return m_Guardians; } }
public List<Mobile> Guardians => m_Guardians;
[Constructible]
public TreasureMapChest( int level ) : this( null, level, false )
@ -71,7 +71,7 @@ namespace Server.Items
private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
{
int rnd = Utility.Random( 15 );
if ( Core.SE )
{
if ( rnd < 1 )
@ -135,7 +135,7 @@ namespace Server.Items
cont.Movable = false;
cont.Locked = true;
int numberItems;
if ( level == 0 )
{
cont.LockLevel = 0; // Can't be unlocked
@ -163,11 +163,11 @@ namespace Server.Items
cont.LockLevel = cont.RequiredSkill - 10;
cont.MaxLockLevel = cont.RequiredSkill + 40;
//Publish 67 gold change
//if ( Core.SA )
// cont.DropItem( new Gold( level * 5000 ) );
//else
//else
cont.DropItem( new Gold( level * 1000 ) );
for ( int i = 0; i < level * 5; ++i )
@ -188,7 +188,7 @@ namespace Server.Items
}
else
numberItems = level * 6;
for ( int i = 0; i < numberItems; ++i )
{
Item item;