Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -11,11 +11,11 @@ namespace Server.Engines.Harvest
{
public HarvestSystem() => Definitions = new List<HarvestDefinition>();
public List<HarvestDefinition> Definitions{ get; }
public List<HarvestDefinition> Definitions { get; }
public virtual bool CheckTool(Mobile from, Item tool)
{
bool wornOut = tool?.Deleted != false || tool is IUsesRemaining remaining && remaining.UsesRemaining <= 0;
bool wornOut = tool?.Deleted != false || (tool as IUsesRemaining)?.UsesRemaining <= 0;
if (wornOut)
from.SendLocalizedMessage(1044038); // You have worn out your tool!
@ -139,7 +139,7 @@ namespace Server.Engines.Harvest
}
else
{
//The whole harvest system is kludgy and I'm sure this is just adding to it.
// The whole harvest system is kludgy and I'm sure this is just adding to it.
if (item.Stackable)
{
int amount = def.ConsumedPerHarvest;
@ -152,11 +152,11 @@ namespace Server.Engines.Harvest
bool inFelucca = map == Map.Felucca;
if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount &&
0.1 > Utility.RandomDouble())
Utility.RandomDouble() < 0.1)
item.Amount = feluccaRacialAmount;
else if (inFelucca && bank.Current >= feluccaAmount)
item.Amount = feluccaAmount;
else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble())
else if (eligableForRacialBonus && bank.Current >= racialAmount && Utility.RandomDouble() < 0.1)
item.Amount = racialAmount;
else
item.Amount = amount;
@ -180,8 +180,7 @@ namespace Server.Engines.Harvest
{
Item bonusItem = Construct(bonus.Type, from);
if (Give(from, bonusItem, true)
) //Bonuses always allow placing at feet, even if pack is full irregrdless of def
if (Give(from, bonusItem, true)) // Bonuses always allow placing at feet, even if pack is full irregrdless of def
bonus.SendSuccessTo(from);
else
item.Delete();
@ -349,10 +348,10 @@ namespace Server.Engines.Harvest
from.Animate(Utility.RandomList(def.EffectActions), 5, 1, true, false, 0);
}
public virtual HarvestDefinition GetDefinition(int tileID)
{
return Definitions.FirstOrDefault(check => check.Validate(tileID));
}
public virtual HarvestDefinition GetDefinition() => Definitions.First();
public virtual HarvestDefinition GetDefinition(int tileID) =>
Definitions.FirstOrDefault(check => check.Validate(tileID));
public virtual void StartHarvesting(Mobile from, Item tool, object toHarvest)
{
@ -425,17 +424,3 @@ namespace Server.Engines.Harvest
}
}
}
namespace Server
{
public interface IChopable
{
void OnChop(Mobile from);
}
[AttributeUsage(AttributeTargets.Class)]
public class FurnitureAttribute : Attribute
{
public static bool Check(Item item) => item?.GetType().IsDefined(typeof(FurnitureAttribute), false) == true;
}
}