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

@ -10,7 +10,7 @@ namespace Server.Engines.Harvest
{
private static Mining m_System;
private static int[] m_Offsets =
private static readonly int[] m_Offsets =
{
-1, -1,
-1, 0,
@ -24,8 +24,6 @@ namespace Server.Engines.Harvest
private Mining()
{
#region Mining for ore and stone
OreAndStone = new HarvestDefinition
{
BankWidth = 8,
@ -74,15 +72,15 @@ namespace Server.Engines.Harvest
};
HarvestVein[] veins = {
new HarvestVein(49.6, 0.0, res[0], null), // Iron
new HarvestVein(11.2, 0.5, res[1], res[0]), // Dull Copper
new HarvestVein(09.8, 0.5, res[2], res[0]), // Shadow Iron
new HarvestVein(08.4, 0.5, res[3], res[0]), // Copper
new HarvestVein(07.0, 0.5, res[4], res[0]), // Bronze
new HarvestVein(05.6, 0.5, res[5], res[0]), // Gold
new HarvestVein(04.2, 0.5, res[6], res[0]), // Agapite
new HarvestVein(02.8, 0.5, res[7], res[0]), // Verite
new HarvestVein(01.4, 0.5, res[8], res[0]) // Valorite
new HarvestVein(496, 0.0, res[0], null), // Iron
new HarvestVein(112, 0.5, res[1], res[0]), // Dull Copper
new HarvestVein(098, 0.5, res[2], res[0]), // Shadow Iron
new HarvestVein(084, 0.5, res[3], res[0]), // Copper
new HarvestVein(070, 0.5, res[4], res[0]), // Bronze
new HarvestVein(056, 0.5, res[5], res[0]), // Gold
new HarvestVein(042, 0.5, res[6], res[0]), // Agapite
new HarvestVein(028, 0.5, res[7], res[0]), // Verite
new HarvestVein(014, 0.5, res[8], res[0]) // Valorite
};
OreAndStone.Resources = res;
@ -91,7 +89,7 @@ namespace Server.Engines.Harvest
if (Core.ML)
OreAndStone.BonusResources = new[]
{
new BonusHarvestResource(0, 99.4, null, null), //Nothing
new BonusHarvestResource(0, 99.4, null, null), // Nothing
new BonusHarvestResource(100, .1, 1072562, typeof(BlueDiamond)),
new BonusHarvestResource(100, .1, 1072567, typeof(DarkSapphire)),
new BonusHarvestResource(100, .1, 1072570, typeof(EcruCitrine)),
@ -105,10 +103,6 @@ namespace Server.Engines.Harvest
Definitions.Add(OreAndStone);
#endregion
#region Mining for sand
Sand = new HarvestDefinition
{
BankWidth = 8,
@ -143,22 +137,20 @@ namespace Server.Engines.Harvest
veins = new[]
{
new HarvestVein(100.0, 0.0, res[0], null)
new HarvestVein(1000, 0.0, res[0], null)
};
Sand.Resources = res;
Sand.Veins = veins;
Definitions.Add(Sand);
#endregion
}
public static Mining System => m_System ?? (m_System = new Mining());
public HarvestDefinition OreAndStone{ get; }
public HarvestDefinition OreAndStone { get; }
public HarvestDefinition Sand{ get; }
public HarvestDefinition Sand { get; }
public override Type GetResourceType(Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc,
HarvestResource resource)
@ -166,13 +158,11 @@ namespace Server.Engines.Harvest
if (def != OreAndStone)
return base.GetResourceType(from, tool, def, map, loc, resource);
if (from.Skills.Mining.Base >= 100.0 && from is PlayerMobile pm && pm.StoneMining && pm.ToggleMiningStone
&& 0.1 > Utility.RandomDouble())
&& Utility.RandomDouble() < 0.1)
return resource.Types[1];
return resource.Types[0];
}
public override bool CheckHarvest(Mobile from, Item tool)
@ -247,7 +237,7 @@ namespace Server.Engines.Harvest
public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein,
HarvestBank bank, HarvestResource resource, object harvested)
{
if (tool is GargoylesPickaxe && def == OreAndStone && 0.1 > Utility.RandomDouble())
if (tool is GargoylesPickaxe && def == OreAndStone && Utility.RandomDouble() < 0.1)
{
HarvestResource res = vein.PrimaryResource;
@ -324,9 +314,7 @@ namespace Server.Engines.Harvest
from.SendLocalizedMessage(501863); // You can't mine that.
}
#region Tile lists
private static int[] m_MountainAndCaveTiles =
private static readonly int[] m_MountainAndCaveTiles =
{
220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
230, 231, 236, 237, 238, 239, 240, 241, 242, 243,
@ -365,7 +353,7 @@ namespace Server.Engines.Harvest
0x4549, 0x454A, 0x454B, 0x454C, 0x454D, 0x454E, 0x454F
};
private static int[] m_SandTiles =
private static readonly int[] m_SandTiles =
{
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
@ -389,7 +377,5 @@ namespace Server.Engines.Harvest
1617, 1618, 1623, 1624, 1625, 1626, 1635, 1636, 1637,
1638, 1639, 1640, 1641, 1642, 1647, 1648, 1649, 1650
};
#endregion
}
}