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

@ -7,7 +7,7 @@ namespace Server.Items
{
public abstract class BasePigmentsOfTokuno : Item, IUsesRemaining
{
private static Type[] m_Glasses =
private static readonly Type[] m_Glasses =
{
typeof(MaritimeGlasses),
typeof(WizardsGlasses),
@ -23,7 +23,7 @@ namespace Server.Items
typeof(AnthropomorphistGlasses)
};
private static Type[] m_Replicas =
private static readonly Type[] m_Replicas =
{
typeof(ANecromancerShroud),
typeof(BraveKnightOfTheBritannia),
@ -50,7 +50,7 @@ namespace Server.Items
typeof(Subdue)
};
private static Type[] m_DyableHeritageItems =
private static readonly Type[] m_DyableHeritageItems =
{
typeof(ChargerOfTheFallen),
typeof(SamuraiHelm),
@ -91,13 +91,9 @@ namespace Server.Items
}
}
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of pigments that originally derived from Item */
protected bool InheritsItem{ get; private set; }
#endregion
protected bool InheritsItem { get; private set; }
public override void GetProperties(ObjectPropertyList list)
{
@ -124,8 +120,7 @@ namespace Server.Items
private void InternalCallback(Mobile from, object targeted)
{
if (Deleted || UsesRemaining <= 0 || !from.InRange(GetWorldLocation(), 3) ||
if (Deleted || UsesRemaining <= 0 || !from.InRange(GetWorldLocation(), 3) ||
!IsAccessibleTo(from))
return;
@ -169,7 +164,7 @@ namespace Server.Items
}
else
{
//Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either
// Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either
i.Hue = Hue;
if (--UsesRemaining <= 0)
@ -242,30 +237,28 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
{
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
case 0: // Old pigments that inherited from item
{
InheritsItem = true;
{
InheritsItem = true;
if (this is LesserPigmentsOfTokuno)
((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt();
else if (this is PigmentsOfTokuno)
((PigmentsOfTokuno)this).Type = (PigmentType)reader.ReadEncodedInt();
else if (this is MetalPigmentsOfTokuno)
reader.ReadEncodedInt();
if (this is LesserPigmentsOfTokuno)
((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt();
else if (this is PigmentsOfTokuno)
((PigmentsOfTokuno)this).Type = (PigmentType)reader.ReadEncodedInt();
else if (this is MetalPigmentsOfTokuno)
reader.ReadEncodedInt();
m_UsesRemaining = reader.ReadEncodedInt();
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
break;
}
}
}
#region IUsesRemaining Members
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
@ -282,7 +275,5 @@ namespace Server.Items
get => true;
set { }
}
#endregion
}
}
}

View file

@ -330,7 +330,6 @@ namespace Server.Items
Attributes.DefendChance = 10;
}
public WindsEdge(Serial serial) : base(serial)
{
}
@ -388,7 +387,7 @@ namespace Server.Items
public class PigmentsOfTokuno : BasePigmentsOfTokuno
{
private static int[][] m_Table =
private static readonly int[][] m_Table =
{
// Hue, Label
new[]

View file

@ -292,7 +292,6 @@ namespace Server.Items
Attributes.WeaponSpeed = 20;
}
public Exiler(Serial serial) : base(serial)
{
}
@ -622,7 +621,7 @@ namespace Server.Items
}
}
//Non weapon/armor ones:
// Non weapon/armor ones:
public class AncientUrn : Item
{
@ -644,7 +643,7 @@ namespace Server.Items
{
}
public static string[] Names{ get; } =
public static string[] Names { get; } =
{
"Akira",
"Avaniaga",
@ -870,7 +869,7 @@ namespace Server.Items
public FluteOfRenewal()
{
Slayer = SlayerGroup.Groups[Utility.Random(SlayerGroup.Groups.Length - 1)].Super
.Name; //-1 to exclude Fey slayer. Try to confrim no fey slayer on this on OSI
.Name; // -1 to exclude Fey slayer. Try to confrim no fey slayer on this on OSI
ReplenishesCharges = true;
}
@ -919,7 +918,7 @@ namespace Server.Items
public class LesserPigmentsOfTokuno : BasePigmentsOfTokuno
{
private static int[][] m_Table =
private static readonly int[][] m_Table =
{
// Hue, Label
new[]

View file

@ -24,7 +24,7 @@ namespace Server.Misc
{
public const int ItemsPerReward = 10;
private static Type[][] m_LesserArtifacts =
private static readonly Type[][] m_LesserArtifacts =
{
// ToT One Rewards
new[]
@ -68,7 +68,7 @@ namespace Server.Misc
private static Type[][] m_GreaterArtifacts;
public static Type[] LesserArtifactsTotal{ get; } =
public static Type[] LesserArtifactsTotal { get; } =
{
typeof(AncientFarmersKasa), typeof(AncientSamuraiDo), typeof(ArmsOfTacticalExcellence), typeof(BlackLotusHood),
typeof(DaimyosHelm), typeof(DemonForks), typeof(DragonNunchaku), typeof(Exiler), typeof(GlovesOfTheSun),
@ -80,9 +80,9 @@ namespace Server.Misc
typeof(ChestOfHeirlooms)
};
public static TreasuresOfTokunoEra DropEra{ get; set; } = TreasuresOfTokunoEra.None;
public static TreasuresOfTokunoEra DropEra { get; set; } = TreasuresOfTokunoEra.None;
public static TreasuresOfTokunoEra RewardEra{ get; set; } = TreasuresOfTokunoEra.ToTOne;
public static TreasuresOfTokunoEra RewardEra { get; set; } = TreasuresOfTokunoEra.ToTOne;
public static Type[] LesserArtifacts => m_LesserArtifacts[(int)RewardEra - 1];
@ -113,7 +113,7 @@ namespace Server.Misc
if (r.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(m, m.Map) != null)
return false;
//TODO: a CanReach of something check as opposed to above?
// TODO: a CanReach of something check as opposed to above?
if (r.IsPartOf("Yomotsu Mines") || r.IsPartOf("Fan Dancer's Dojo"))
return true;
@ -130,19 +130,19 @@ namespace Server.Misc
if (bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0)
return;
//25000 for 1/100 chance, 10 hyrus
//1500, 1/1000 chance, 20 lizard men for that chance.
// 25000 for 1/100 chance, 10 hyrus
// 1500, 1/1000 chance, 20 lizard men for that chance.
pm.ToTTotalMonsterFame += (int)(bc.Fame * (1 + Math.Sqrt(pm.Luck) / 100));
//This is the Exponentional regression with only 2 datapoints.
//A log. func would also work, but it didn't make as much sense.
//This function isn't OSI exact being that I don't know OSI's func they used ;p
// This is the Exponentional regression with only 2 datapoints.
// A log. func would also work, but it didn't make as much sense.
// This function isn't OSI exact being that I don't know OSI's func they used ;p
int x = pm.ToTTotalMonsterFame;
//const double A = 8.63316841 * Math.Pow( 10, -4 );
// const double A = 8.63316841 * Math.Pow( 10, -4 );
const double A = 0.000863316841;
//const double B = 4.25531915 * Math.Pow( 10, -6 );
// const double B = 4.25531915 * Math.Pow( 10, -6 );
const double B = 0.00000425531915;
double chance = A * Math.Pow(10, B * x);
@ -260,7 +260,7 @@ namespace Server.Mobiles
SayTo(pm,
1070980); // Congratulations! You have turned in enough minor treasures to earn a greater reward.
pm.CloseGump<ToTTurnInGump>(); //Sanity
pm.CloseGump<ToTTurnInGump>(); // Sanity
if (!pm.HasGump<ToTRedeemGump>())
pm.SendGump(new ToTRedeemGump(this, false));
@ -305,15 +305,14 @@ namespace Server.Gumps
i.Name == null || i.Name.Length <= 0 ? (TextDefinition)i.LabelNumber : (TextDefinition)i.Name) =>
Item = i;
public Item Item{ get; set; }
public Item Item { get; set; }
}
public class ToTTurnInGump : BaseImageTileButtonsGump
{
private Mobile m_Collector;
private readonly Mobile m_Collector;
public ToTTurnInGump(Mobile collector, List<ItemTileButtonInfo> buttons) :
base(1071012, Utility.CastListContravariant<ItemTileButtonInfo, ImageTileButtonInfo>(buttons)) // Click a minor artifact to give it to Ihara Soko.
public ToTTurnInGump(Mobile collector, List<ItemTileButtonInfo> buttons) : base(1071012, Utility.CastListContravariant<ItemTileButtonInfo, ImageTileButtonInfo>(buttons)) // Click a minor artifact to give it to Ihara Soko.
=>
m_Collector = collector;
@ -361,7 +360,7 @@ namespace Server.Gumps
m_Collector.SayTo(pm,
1070980); // Congratulations! You have turned in enough minor treasures to earn a greater reward.
pm.CloseGump<ToTTurnInGump>(); //Sanity
pm.CloseGump<ToTTurnInGump>(); // Sanity
if (!pm.HasGump<ToTRedeemGump>())
pm.SendGump(new ToTRedeemGump(m_Collector, false));
@ -373,7 +372,7 @@ namespace Server.Gumps
List<ItemTileButtonInfo> buttons = FindRedeemableItems(pm);
pm.CloseGump<ToTTurnInGump>(); //Sanity
pm.CloseGump<ToTTurnInGump>(); // Sanity
if (buttons.Count > 0)
pm.SendGump(new ToTTurnInGump(m_Collector, buttons));
@ -388,30 +387,25 @@ namespace Server.Gumps
if (pm.ToTItemsTurnedIn == 0)
m_Collector.SayTo(pm,
1071013); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward
) //This case should ALWAYS be true with this gump, jsut a sanity check
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward) // This case should ALWAYS be true with this gump, jsut a sanity check
m_Collector.SayTo(pm, 1070981,
$"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
m_Collector.SayTo(pm, 1070982); // When you wish to choose your reward, you have but to approach me again.
}
}
}
namespace Server.Gumps
{
public class ToTRedeemGump : BaseImageTileButtonsGump
{
private Mobile m_Collector;
private readonly Mobile m_Collector;
public ToTRedeemGump(Mobile collector, bool pigments) : base(pigments ? 1070986 : 1070985,
pigments
? PigmentRewards[(int)TreasuresOfTokuno.RewardEra - 1].ToArray<ImageTileButtonInfo>()
: NormalRewards[(int)TreasuresOfTokuno.RewardEra - 1].ToArray<ImageTileButtonInfo>()
) =>
: NormalRewards[(int)TreasuresOfTokuno.RewardEra - 1].ToArray<ImageTileButtonInfo>()) =>
m_Collector = collector;
public static TypeTileButtonInfo[][] NormalRewards{ get; } =
public static TypeTileButtonInfo[][] NormalRewards { get; } =
{
// ToT One Rewards
new[]
@ -456,7 +450,7 @@ namespace Server.Gumps
}
};
public static PigmentsTileButtonInfo[][] PigmentRewards{ get; } =
public static PigmentsTileButtonInfo[][] PigmentRewards { get; } =
{
// ToT One Pigment Rewards
new[]
@ -517,9 +511,9 @@ namespace Server.Gumps
{
TypeTileButtonInfo t = (TypeTileButtonInfo)buttonInfo;
if (t.Type == typeof(PigmentsOfTokuno)) //Special case of course.
if (t.Type == typeof(PigmentsOfTokuno)) // Special case of course.
{
pm.CloseGump<ToTTurnInGump>(); //Sanity
pm.CloseGump<ToTTurnInGump>(); // Sanity
pm.CloseGump<ToTRedeemGump>();
pm.SendGump(new ToTRedeemGump(m_Collector, true));
@ -538,7 +532,7 @@ namespace Server.Gumps
}
if (item == null)
return; //Sanity
return; // Sanity
if (pm.AddToBackpack(item))
{
@ -556,7 +550,6 @@ namespace Server.Gumps
}
}
public override void HandleCancel(NetState sender)
{
if (!(sender.Mobile is PlayerMobile pm) || !pm.InRange(m_Collector.Location, 7))
@ -565,8 +558,7 @@ namespace Server.Gumps
if (pm.ToTItemsTurnedIn == 0)
m_Collector.SayTo(pm,
1071013); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward
) //This and above case should ALWAYS be FALSE with this gump, jsut a sanity check
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward) // This and above case should ALWAYS be FALSE with this gump, jsut a sanity check
m_Collector.SayTo(pm, 1070981,
$"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
@ -584,7 +576,7 @@ namespace Server.Gumps
itemID, hue, label, localizedToolTip) =>
Type = type;
public Type Type{ get; }
public Type Type { get; }
}
public class PigmentsTileButtonInfo : ImageTileButtonInfo
@ -593,16 +585,8 @@ namespace Server.Gumps
PigmentsOfTokuno.GetInfo(p)[1]) =>
Pigment = p;
public PigmentType Pigment{ get; set; }
public PigmentType Pigment { get; set; }
}
#region ToT Normal Rewards Table
#endregion
#region ToT Pigment Rewards Table
#endregion
}
}

View file

@ -14,7 +14,7 @@ namespace Server.Misc
public TreasuresOfTokunoPersistance(Serial serial) : base(serial) => Instance = this;
public static TreasuresOfTokunoPersistance Instance{ get; private set; }
public static TreasuresOfTokunoPersistance Instance { get; private set; }
public override string DefaultName => "TreasuresOfTokuno Persistance - Internal";
@ -43,12 +43,12 @@ namespace Server.Misc
switch (version)
{
case 0:
{
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
{
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
break;
}
break;
}
}
}