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

@ -4,7 +4,7 @@ namespace Server.Items
{
public class PowerScroll : SpecialScroll
{
private static SkillName[] m_Skills =
private static readonly SkillName[] m_Skills =
{
SkillName.Blacksmith,
SkillName.Tailoring,
@ -30,7 +30,7 @@ namespace Server.Items
SkillName.Peacemaking
};
private static SkillName[] m_AOSSkills =
private static readonly SkillName[] m_AOSSkills =
{
SkillName.Chivalry,
SkillName.Focus,
@ -40,13 +40,13 @@ namespace Server.Items
SkillName.SpiritSpeak
};
private static SkillName[] m_SESkills =
private static readonly SkillName[] m_SESkills =
{
SkillName.Ninjitsu,
SkillName.Bushido
};
private static SkillName[] m_MLSkills =
private static readonly SkillName[] m_MLSkills =
{
SkillName.Spellweaving
};
@ -65,7 +65,7 @@ namespace Server.Items
};
*/
private static List<SkillName> _Skills = new List<SkillName>();
private static readonly List<SkillName> _Skills = new List<SkillName>();
[Constructible]
public PowerScroll(SkillName skill = SkillName.Alchemy, double value = 0.0) : base(skill, value)
@ -80,11 +80,13 @@ namespace Server.Items
{
}
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window.
*/
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
1049469;
public override int Title
{
@ -92,11 +94,13 @@ namespace Server.Items
{
double level = (Value - 105.0) / 5.0;
/* Wonderous Scroll (105 Skill): OR
* Exalted Scroll (110 Skill): OR
* Mythical Scroll (115 Skill): OR
* Legendary Scroll (120 Skill):
*/
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR
* Exalted Scroll (110 Skill): OR
* Mythical Scroll (115 Skill): OR
* Legendary Scroll (120 Skill): */
return 1049635 + (int)level;
return 0;
}
@ -154,10 +158,12 @@ namespace Server.Items
double level = (Value - 105.0) / 5.0;
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
list.Add(1049639 + (int)level, GetNameLocalized()); /* a wonderous scroll of ~1_type~ (105 Skill) OR
* an exalted scroll of ~1_type~ (110 Skill) OR
* a mythical scroll of ~1_type~ (115 Skill) OR
* a legendary scroll of ~1_type~ (120 Skill) */
/* a wonderous scroll of ~1_type~ (105 Skill) OR
* an exalted scroll of ~1_type~ (110 Skill) OR
* a mythical scroll of ~1_type~ (115 Skill) OR
* a legendary scroll of ~1_type~ (120 Skill)
*/
list.Add(1049639 + (int)level, GetNameLocalized());
else
list.Add("a power scroll of {0} ({1} Skill)", GetName(), Value);
}

View file

@ -20,10 +20,12 @@ namespace Server.Items
public override int LabelNumber => 1078604; // Scroll of Alacrity
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
* level in that skill by the amount of points displayed on the scroll.
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
*/
public override int Message =>
1078602; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
1078602;
public override string DefaultTitle => "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>";
@ -39,20 +41,17 @@ namespace Server.Items
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
foreach (MLQuestInstance instance in context.QuestInstances)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
#endregion
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
if (pm.AcceleratedStart > DateTime.UtcNow)
{
@ -73,9 +72,10 @@ namespace Server.Items
if (tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up)
{
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
*/
from.SendLocalizedMessage(1094935);
return;
}
@ -112,7 +112,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;

View file

@ -20,10 +20,12 @@ namespace Server.Items
public override int LabelNumber => 1094934; // Scroll of Transcendence
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
* level in that skill by the amount of points displayed on the scroll.
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
*/
public override int Message =>
1094933; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
1094933;
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
@ -50,20 +52,17 @@ namespace Server.Items
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
foreach (MLQuestInstance instance in context.QuestInstances)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
#endregion
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
if (pm.AcceleratedStart > DateTime.UtcNow)
{
@ -111,9 +110,11 @@ namespace Server.Items
if (!canGain)
{
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
*/
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
1094935);
return;
}
@ -140,7 +141,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;

View file

@ -18,23 +18,19 @@ namespace Server.Items
{
}
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */
protected bool InheritsItem{ get; private set; }
protected bool InheritsItem { get; private set; }
#endregion
public abstract int Message{ get; }
public abstract int Message { get; }
public virtual int Title => 0;
public abstract string DefaultTitle{ get; }
public abstract string DefaultTitle { get; }
[CommandProperty(AccessLevel.GameMaster)]
public SkillName Skill{ get; set; }
public SkillName Skill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double Value{ get; set; }
public double Value { get; set; }
public virtual string GetNameLocalized() => $"#{AosSkillBonuses.GetLabel(Skill)}";
@ -94,36 +90,36 @@ namespace Server.Items
switch (version)
{
case 1:
{
Skill = (SkillName)reader.ReadInt();
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
if (!(this is StatCapScroll))
{
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
if (this is ScrollofAlacrity)
Value = 0.0;
else if (this is StatCapScroll)
Value = reader.ReadInt();
else
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
break;
}
if (!(this is StatCapScroll))
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
if (this is ScrollofAlacrity)
Value = 0.0;
else if (this is StatCapScroll)
Value = reader.ReadInt();
else
Value = reader.ReadDouble();
break;
}
}
}
public class InternalGump : Gump
{
private Mobile m_Mobile;
private SpecialScroll m_Scroll;
private readonly Mobile m_Mobile;
private readonly SpecialScroll m_Scroll;
public InternalGump(Mobile mobile, SpecialScroll scroll) : base(25, 50)
{

View file

@ -11,11 +11,13 @@ namespace Server.Items
{
}
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window.
*/
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
1049469;
public override int Title
{
@ -23,12 +25,14 @@ namespace Server.Items
{
int level = ((int)Value - 230) / 5;
/* Wonderous Scroll (+5 Maximum Stats): OR
* Exalted Scroll (+10 Maximum Stats): OR
* Mythical Scroll (+15 Maximum Stats): OR
* Legendary Scroll (+20 Maximum Stats): OR
* Ultimate Scroll (+25 Maximum Stats):
*/
if (level >= 0 && level <= 4 && Value % 5 == 0)
return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR
* Exalted Scroll (+10 Maximum Stats): OR
* Mythical Scroll (+15 Maximum Stats): OR
* Legendary Scroll (+20 Maximum Stats): OR
* Ultimate Scroll (+25 Maximum Stats): */
return 1049458 + level;
return 0;
}
@ -42,11 +46,13 @@ namespace Server.Items
int level = ((int)Value - 230) / 5;
if (level >= 0 && level <= 4 && (int)Value % 5 == 0)
list.Add(1049463 + level, "#1049476"); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
* an ultimate scroll of ~1_type~ (+25 Maximum Stats) */
/* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
* an ultimate scroll of ~1_type~ (+25 Maximum Stats)
*/
list.Add(1049463 + level, "#1049476");
else
list.Add("a scroll of power ({0}{1} Maximum Stats)", Value - 225 >= 0 ? "+" : "", Value - 225);
}
@ -119,7 +125,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;