Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

View file

@ -4,10 +4,7 @@ namespace Server.Engines.Craft
{
public class CraftGroupCol : CollectionBase
{
public int Add(CraftGroup craftGroup)
{
return List.Add(craftGroup);
}
public int Add(CraftGroup craftGroup) => List.Add(craftGroup);
public void Remove(int index)
{
@ -20,10 +17,7 @@ namespace Server.Engines.Craft
}
}
public CraftGroup GetAt(int index)
{
return (CraftGroup)List[index];
}
public CraftGroup GetAt(int index) => (CraftGroup)List[index];
public int SearchFor(TextDefinition groupName)
{

View file

@ -339,10 +339,7 @@ namespace Server.Engines.Craft
return craftGroupCol.Count;
}
public static int GetButtonID(int type, int index)
{
return 1 + type + index * 7;
}
public static int GetButtonID(int type, int index) => 1 + type + index * 7;
public void CraftItem(CraftItem item)
{

View file

@ -424,10 +424,8 @@ namespace Server.Engines.Craft
}
public bool ConsumeRes(Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref object message)
{
return ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);
}
ConsumeType consumeType, ref object message) =>
ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, false);
public bool ConsumeRes(Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount,
ConsumeType consumeType, ref object message, bool isFailure)
@ -639,10 +637,7 @@ namespace Server.Engines.Craft
}
}
private int CheckHueGrouping(Item a, Item b)
{
return b.Hue.CompareTo(a.Hue);
}
private int CheckHueGrouping(Item a, Item b) => b.Hue.CompareTo(a.Hue);
public double GetExceptionalChance(CraftSystem system, double chance, Mobile from)
{
@ -686,10 +681,8 @@ namespace Server.Engines.Craft
}
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills)
{
return CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
}
ref bool allRequiredSkills) =>
CheckSkills(from, typeRes, craftSystem, ref quality, ref allRequiredSkills, true);
public bool CheckSkills(Mobile from, Type typeRes, CraftSystem craftSystem, ref int quality,
ref bool allRequiredSkills, bool gainSkills)

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
{
public class CraftItemCol : CollectionBase
{
public int Add(CraftItem craftItem)
{
return List.Add(craftItem);
}
public int Add(CraftItem craftItem) => List.Add(craftItem);
public void Remove(int index)
{
@ -21,10 +18,7 @@ namespace Server.Engines.Craft
}
}
public CraftItem GetAt(int index)
{
return (CraftItem)List[index];
}
public CraftItem GetAt(int index) => (CraftItem)List[index];
public CraftItem SearchForSubclass(Type type)
{

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
[AttributeUsage(AttributeTargets.Class)]
public class CraftItemIDAttribute : Attribute
{
public CraftItemIDAttribute(int itemID)
{
ItemID = itemID;
}
public CraftItemIDAttribute(int itemID) => ItemID = itemID;
public int ItemID{ get; }
}

View file

@ -20,9 +20,6 @@ namespace Server.Engines.Craft
}
}
public CraftRes GetAt(int index)
{
return (CraftRes)List[index];
}
public CraftRes GetAt(int index) => (CraftRes)List[index];
}
}

View file

@ -20,9 +20,6 @@ namespace Server.Engines.Craft
}
}
public CraftSkill GetAt(int index)
{
return (CraftSkill)List[index];
}
public CraftSkill GetAt(int index) => (CraftSkill)List[index];
}
}

View file

@ -5,10 +5,7 @@ namespace Server.Engines.Craft
{
public class CraftSubResCol : CollectionBase
{
public CraftSubResCol()
{
Init = false;
}
public CraftSubResCol() => Init = false;
public bool Init{ get; set; }
@ -34,10 +31,7 @@ namespace Server.Engines.Craft
}
}
public CraftSubRes GetAt(int index)
{
return (CraftSubRes)List[index];
}
public CraftSubRes GetAt(int index) => (CraftSubRes)List[index];
public CraftSubRes SearchFor(Type type)
{

View file

@ -65,10 +65,7 @@ namespace Server.Engines.Craft
public abstract double GetChanceAtMin(CraftItem item);
public virtual bool RetainsColorFrom(CraftItem item, Type type)
{
return false;
}
public virtual bool RetainsColorFrom(CraftItem item, Type type) => false;
public CraftContext GetContext(Mobile m)
{
@ -92,10 +89,7 @@ namespace Server.Engines.Craft
GetContext(m)?.OnMade(item);
}
public virtual bool ConsumeOnFailure(Mobile from, Type resourceType, CraftItem craftItem)
{
return true;
}
public virtual bool ConsumeOnFailure(Mobile from, Type resourceType, CraftItem craftItem) => true;
public void CreateItem(Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem)
{
@ -122,22 +116,16 @@ namespace Server.Engines.Craft
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
Type typeRes, TextDefinition nameRes, int amount)
{
return AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "");
}
Type typeRes, TextDefinition nameRes, int amount) =>
AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "");
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill,
Type typeRes, TextDefinition nameRes, int amount, TextDefinition message)
{
return AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message);
}
Type typeRes, TextDefinition nameRes, int amount, TextDefinition message) =>
AddCraft(typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message);
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill,
double maxSkill, Type typeRes, TextDefinition nameRes, int amount)
{
return AddCraft(typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "");
}
double maxSkill, Type typeRes, TextDefinition nameRes, int amount) =>
AddCraft(typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "");
public int AddCraft(Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill,
double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message)

View file

@ -37,21 +37,11 @@ namespace Server.Engines.Craft
m_Deed = deed;
}
private int GetWeakenChance(Mobile mob, SkillName skill, int curHits, int maxHits)
{
// 40% - (1% per hp lost) - (1% per 10 craft skill)
return 40 + (maxHits - curHits) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
}
private int GetWeakenChance(Mobile mob, SkillName skill, int curHits, int maxHits) => 40 + (maxHits - curHits) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
private bool CheckWeaken(Mobile mob, SkillName skill, int curHits, int maxHits)
{
return GetWeakenChance(mob, skill, curHits, maxHits) > Utility.Random(100);
}
private bool CheckWeaken(Mobile mob, SkillName skill, int curHits, int maxHits) => GetWeakenChance(mob, skill, curHits, maxHits) > Utility.Random(100);
private int GetRepairDifficulty(int curHits, int maxHits)
{
return (maxHits - curHits) * 1250 / Math.Max(maxHits, 1) - 250;
}
private int GetRepairDifficulty(int curHits, int maxHits) => (maxHits - curHits) * 1250 / Math.Max(maxHits, 1) - 250;
private bool CheckRepairDifficulty(Mobile mob, SkillName skill, int curHits, int maxHits)
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -40,10 +37,7 @@ namespace Server.Engines.Craft
from.PlaySound(0x242);
}
public static bool IsPotion(Type type)
{
return typeofPotion.IsAssignableFrom(type);
}
public static bool IsPotion(Type type) => typeofPotion.IsAssignableFrom(type);
public override int PlayEndingEffect(Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality,
bool makersMark, CraftItem item)

View file

@ -34,10 +34,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public static void CheckAnvilAndForge(Mobile from, int range, out bool anvil, out bool forge)
{
@ -773,10 +770,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -17,10 +17,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -17,10 +17,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -19,10 +19,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -18,10 +18,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
public override double GetChanceAtMin(CraftItem item)
{
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
}
public override double GetChanceAtMin(CraftItem item) => item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -102,10 +99,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -38,10 +38,7 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
{

View file

@ -18,15 +18,9 @@ namespace Server.Engines.Craft
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
public override double GetChanceAtMin(CraftItem item)
{
return 0.0; // 0%
}
public override double GetChanceAtMin(CraftItem item) => 0.0;
public override bool RetainsColorFrom(CraftItem item, Type type)
{
return true;
}
public override bool RetainsColorFrom(CraftItem item, Type type) => true;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{
@ -119,10 +113,7 @@ namespace Server.Engines.Craft
{
private Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7))
{
m_From = from;
}
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(0.7)) => m_From = from;
protected override void OnTick()
{

View file

@ -27,10 +27,7 @@ namespace Server.Engines.Craft
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
public override double GetChanceAtMin(CraftItem item)
{
return 0.5; // 50%
}
public override double GetChanceAtMin(CraftItem item) => 0.5;
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
{

View file

@ -473,10 +473,7 @@ namespace Server.Engines.Craft
{
private TrapCraft m_TrapCraft;
public ContainerTarget(TrapCraft trapCraft) : base(-1, false, TargetFlags.None)
{
m_TrapCraft = trapCraft;
}
public ContainerTarget(TrapCraft trapCraft) : base(-1, false, TargetFlags.None) => m_TrapCraft = trapCraft;
protected override void OnTarget(Mobile from, object targeted)
{