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

@ -20,7 +20,7 @@ namespace Server.Engines.Craft
private bool m_DoNotColor;
private CraftMarkOption m_MarkOption;
public List<CraftItem> Items { get { return m_Items; } }
public List<CraftItem> Items => m_Items;
public int LastResourceIndex{ get{ return m_LastResourceIndex; } set{ m_LastResourceIndex = value; } }
public int LastResourceIndex2{ get{ return m_LastResourceIndex2; } set{ m_LastResourceIndex2 = value; } }
public int LastGroupIndex{ get{ return m_LastGroupIndex; } set{ m_LastGroupIndex = value; } }
@ -56,4 +56,4 @@ namespace Server.Engines.Craft
m_Items.Insert( 0, item );
}
}
}
}

View file

@ -93,11 +93,9 @@ namespace Server.Engines.Craft
}
private static Dictionary<Type, int> _itemIds = new Dictionary<Type, int>();
public static int ItemIDOf( Type type ) {
int itemId;
if ( !_itemIds.TryGetValue( type, out itemId ) ) {
public static int ItemIDOf( Type type ) {
if (!_itemIds.TryGetValue( type, out int itemId )) {
if ( type == typeof( FactionExplosionTrap ) ) {
itemId = 14034;
} else if ( type == typeof( FactionGasTrap ) ) {
@ -323,7 +321,7 @@ namespace Server.Engines.Craft
0x398C, 0x399F, // Fire field
0x2DDB, 0x2DDC, //Elven stove
0x19AA, 0x19BB, // Veteran Reward Brazier
0x197A, 0x19A9, // Large Forge
0x197A, 0x19A9, // Large Forge
0x0FB1, 0x0FB1, // Small Forge
0x2DD8, 0x2DD8 // Elven Forge
};
@ -753,7 +751,7 @@ namespace Server.Engines.Craft
return false;
}
}
int index = 0;
// Consume ALL
@ -872,7 +870,7 @@ namespace Server.Engines.Craft
if ( from.Talisman is BaseTalisman )
{
BaseTalisman talisman = (BaseTalisman) from.Talisman;
if ( talisman.Skill == system.MainSkill )
{
chance -= talisman.SuccessBonus / 100.0;
@ -960,7 +958,7 @@ namespace Server.Engines.Craft
if ( allRequiredSkills && from.Talisman is BaseTalisman )
{
BaseTalisman talisman = (BaseTalisman) from.Talisman;
if ( talisman.Skill == craftSystem.MainSkill )
chance += talisman.SuccessBonus / 100.0;
}

View file

@ -29,14 +29,14 @@ namespace Server.Engines.Craft
private List<int> m_Recipes;
private List<int> m_RareRecipes;
public int MinCraftEffect { get { return m_MinCraftEffect; } }
public int MaxCraftEffect { get { return m_MaxCraftEffect; } }
public double Delay { get { return m_Delay; } }
public int MinCraftEffect => m_MinCraftEffect;
public int MaxCraftEffect => m_MaxCraftEffect;
public double Delay => m_Delay;
public CraftItemCol CraftItems{ get { return m_CraftItems; } }
public CraftGroupCol CraftGroups{ get { return m_CraftGroups; } }
public CraftSubResCol CraftSubRes{ get { return m_CraftSubRes; } }
public CraftSubResCol CraftSubRes2{ get { return m_CraftSubRes2; } }
public CraftItemCol CraftItems => m_CraftItems;
public CraftGroupCol CraftGroups => m_CraftGroups;
public CraftSubResCol CraftSubRes => m_CraftSubRes;
public CraftSubResCol CraftSubRes2 => m_CraftSubRes2;
public abstract SkillName MainSkill{ get; }
@ -65,8 +65,7 @@ namespace Server.Engines.Craft
return null;
}
CraftContext c = null;
m_ContextTable.TryGetValue( m, out c );
m_ContextTable.TryGetValue( m, out CraftContext c );
if ( c == null )
m_ContextTable[m] = c = new CraftContext();
@ -129,7 +128,7 @@ namespace Server.Engines.Craft
}
public void CreateItem( Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem )
{
{
// Verify if the type is in the list of the craftable item
CraftItem craftItem = m_CraftItems.SearchFor( type );
if ( craftItem != null )
@ -224,7 +223,7 @@ namespace Server.Engines.Craft
CraftItem craftItem = m_CraftItems.GetAt( index );
craftItem.Hits = hits;
}
public void SetUseAllRes( int index, bool useAll )
{
CraftItem craftItem = m_CraftItems.GetAt( index );
@ -386,4 +385,4 @@ namespace Server.Engines.Craft
public abstract int CanCraft( Mobile from, BaseTool tool, Type itemType );
}
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Engines.Craft
private static Dictionary<int, Recipe> m_Recipes = new Dictionary<int, Recipe>();
public static Dictionary<int, Recipe> Recipes { get { return m_Recipes; } }
public static Dictionary<int, Recipe> Recipes => m_Recipes;
private static int m_LargestRecipeID;
public static int LargestRecipeID{ get{ return m_LargestRecipeID; } }

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Craft
}
}
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin( CraftItem item )
{
@ -38,17 +38,17 @@ namespace Server.Engines.Craft
private DefBlacksmithy() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
{
/*
base( MinCraftEffect, MaxCraftEffect, Delay )
MinCraftEffect : The minimum number of time the mobile will play the craft effect
MaxCraftEffect : The maximum number of time the mobile will play the craft effect
Delay : The delay between each craft effect
Example: (3, 6, 1.7) would make the mobile do the PlayCraftEffect override
function between 3 and 6 time, with a 1.7 second delay each time.
*/
*/
}
private static Type typeofAnvil = typeof( AnvilAttribute );
@ -178,7 +178,7 @@ namespace Server.Engines.Craft
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
else
return 1044154; // You create the item.
}
}
@ -188,7 +188,7 @@ namespace Server.Engines.Craft
/*
Synthax for a SIMPLE craft item
AddCraft( ObjectType, Group, MinSkill, MaxSkill, ResourceType, Amount, Message )
ObjectType : The type of the object you want to add to the build list.
Group : The group in wich the object will be showed in the craft menu.
MinSkill : The minimum of skill value
@ -196,10 +196,10 @@ namespace Server.Engines.Craft
ResourceType : The type of the resource the mobile need to create the item
Amount : The amount of the ResourceType it need to create the item
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified resource is missing.
Synthax for a COMPLEXE craft item. A complexe item is an item that need either more than
only one skill, or more than only one resource.
Coming soon....
*/
@ -245,7 +245,7 @@ namespace Server.Engines.Craft
index = AddCraft( typeof( PlateHaidate ), 1011078, 1030200, 65.0, 115.0, typeof( IronIngot ), 1044036, 20, 1044037 );
SetNeededExpansion( index, Expansion.SE );
}
#endregion
@ -266,16 +266,16 @@ namespace Server.Engines.Craft
index = AddCraft( typeof( HeavyPlateJingasa ), 1011079, 1030178, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
SetNeededExpansion( index, Expansion.SE );
index = AddCraft( typeof( LightPlateJingasa ), 1011079, 1030188, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
SetNeededExpansion( index, Expansion.SE );
index = AddCraft( typeof( SmallPlateJingasa ), 1011079, 1030191, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
SetNeededExpansion( index, Expansion.SE );
index = AddCraft( typeof( DecorativePlateKabuto ), 1011079, 1030179, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 );
SetNeededExpansion( index, Expansion.SE );
index = AddCraft( typeof( PlateBattleKabuto ), 1011079, 1030192, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 );
SetNeededExpansion( index, Expansion.SE );
@ -589,7 +589,7 @@ namespace Server.Engines.Craft
AddRes( index, typeof( Turquoise ), 1032691, 1, 1044240 );
AddRecipe( index, 36 );
SetNeededExpansion( index, Expansion.ML );
}
#endregion
@ -693,7 +693,7 @@ namespace Server.Engines.Craft
index = AddCraft( typeof( DragonChest ), 1053114, 1029793, 85.0, 135.0, typeof( RedScales ), 1060883, 36, 1060884 );
SetUseSubRes2( index, true );
#endregion
// Set the overridable material
SetSubRes( typeof( IronIngot ), 1044022 );

View file

@ -76,12 +76,12 @@ namespace Server.Engines.Craft
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
else
return 1044154; // You create the item.
}
}
public override CraftECA ECA{ get{ return CraftECA.FiftyPercentChanceMinusTenPercent; } }
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
public override void InitCraftList()
{
@ -217,4 +217,4 @@ namespace Server.Engines.Craft
Repair = Core.AOS;
}
}
}
}

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Craft
}
}
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin( CraftItem item )
{
@ -73,7 +73,7 @@ namespace Server.Engines.Craft
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
else
return 1044154; // You create the item.
}
}

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Craft
}
}
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin( CraftItem item )
{
@ -97,7 +97,7 @@ namespace Server.Engines.Craft
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
else
return 1044154; // You create the item.
}
}
@ -128,7 +128,7 @@ namespace Server.Engines.Craft
index = AddCraft( typeof( ClothNinjaHood ), 1011375, 1030202, 80.0, 105.0, typeof( Cloth ), 1044286, 13, 1044287 );
SetNeededExpansion( index, Expansion.SE );
index = AddCraft( typeof( Kasa ), 1011375, 1030211, 60.0, 85.0, typeof( Cloth ), 1044286, 12, 1044287 );
index = AddCraft( typeof( Kasa ), 1011375, 1030211, 60.0, 85.0, typeof( Cloth ), 1044286, 12, 1044287 );
SetNeededExpansion( index, Expansion.SE );
}
#endregion
@ -368,7 +368,7 @@ namespace Server.Engines.Craft
#region Bone Armor
index = AddCraft( typeof( BoneHelm ), 1049149, 1025206, 85.0, 110.0, typeof( Leather ), 1044462, 4, 1044463 );
AddRes( index, typeof( Bone ), 1049064, 2, 1049063 );
index = AddCraft( typeof( BoneGloves ), 1049149, 1025205, 89.0, 114.0, typeof( Leather ), 1044462, 6, 1044463 );
AddRes( index, typeof( Bone ), 1049064, 2, 1049063 );
@ -377,7 +377,7 @@ namespace Server.Engines.Craft
index = AddCraft( typeof( BoneLegs ), 1049149, 1025202, 95.0, 120.0, typeof( Leather ), 1044462, 10, 1044463 );
AddRes( index, typeof( Bone ), 1049064, 6, 1049063 );
index = AddCraft( typeof( BoneChest ), 1049149, 1025199, 96.0, 121.0, typeof( Leather ), 1044462, 12, 1044463 );
AddRes( index, typeof( Bone ), 1049064, 10, 1049063 );
@ -400,4 +400,4 @@ namespace Server.Engines.Craft
CanEnhance = Core.AOS;
}
}
}
}

View file

@ -110,7 +110,7 @@ namespace Server.Engines.Craft
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
else
return 1044154; // You create the item.
}
}
@ -326,7 +326,7 @@ namespace Server.Engines.Craft
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
AddRes( index, typeof( Gears ), 1044254, 1, 1044253 );
// Faction Spike Trap
// Faction Spike Trap
index = AddCraft( typeof( FactionSpikeTrapDeed ), 1044052, 1044601, 65.0, 115.0, typeof( Silver ), 1044572, Core.AOS ? 250 : 1000, 1044253 );
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
AddRes( index, typeof( Springs ), 1044171, 1, 1044253 );
@ -498,7 +498,7 @@ namespace Server.Engines.Craft
[CraftItemID( 0x1BFC )]
public class DartTrapCraft : TrapCraft
{
public override TrapType TrapType{ get{ return TrapType.DartTrap; } }
public override TrapType TrapType => TrapType.DartTrap;
public DartTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
{
@ -508,7 +508,7 @@ namespace Server.Engines.Craft
[CraftItemID( 0x113E )]
public class PoisonTrapCraft : TrapCraft
{
public override TrapType TrapType{ get{ return TrapType.PoisonTrap; } }
public override TrapType TrapType => TrapType.PoisonTrap;
public PoisonTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
{
@ -518,10 +518,10 @@ namespace Server.Engines.Craft
[CraftItemID( 0x370C )]
public class ExplosionTrapCraft : TrapCraft
{
public override TrapType TrapType{ get{ return TrapType.ExplosionTrap; } }
public override TrapType TrapType => TrapType.ExplosionTrap;
public ExplosionTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
{
}
}
}
}