Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,81 +1,92 @@
namespace Server.Factions
{
public enum MerchantTitle
{
None,
Scribe,
Carpenter,
Blacksmith,
Bowyer,
Tialor
}
public enum MerchantTitle
{
None,
Scribe,
Carpenter,
Blacksmith,
Bowyer,
Tialor
}
public class MerchantTitleInfo
{
public SkillName Skill { get; }
public class MerchantTitleInfo
{
public MerchantTitleInfo(SkillName skill, double requirement, TextDefinition title, TextDefinition label,
TextDefinition assigned)
{
Skill = skill;
Requirement = requirement;
Title = title;
Label = label;
Assigned = assigned;
}
public double Requirement { get; }
public SkillName Skill{ get; }
public TextDefinition Title { get; }
public double Requirement{ get; }
public TextDefinition Label { get; }
public TextDefinition Title{ get; }
public TextDefinition Assigned { get; }
public TextDefinition Label{ get; }
public MerchantTitleInfo( SkillName skill, double requirement, TextDefinition title, TextDefinition label, TextDefinition assigned )
{
Skill = skill;
Requirement = requirement;
Title = title;
Label = label;
Assigned = assigned;
}
}
public TextDefinition Assigned{ get; }
}
public class MerchantTitles
{
public static MerchantTitleInfo[] Info { get; } =
{
new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ),
new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ),
new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ),
new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ),
new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ),
new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ),
};
public class MerchantTitles
{
public static MerchantTitleInfo[] Info{ get; } =
{
new MerchantTitleInfo(SkillName.Inscribe, 90.0, new TextDefinition(1060773, "Scribe"),
new TextDefinition(1011468, "SCRIBE"),
new TextDefinition(1010121, "You now have the faction title of scribe")),
new MerchantTitleInfo(SkillName.Carpentry, 90.0, new TextDefinition(1060774, "Carpenter"),
new TextDefinition(1011469, "CARPENTER"),
new TextDefinition(1010122, "You now have the faction title of carpenter")),
new MerchantTitleInfo(SkillName.Tinkering, 90.0, new TextDefinition(1022984, "Tinker"),
new TextDefinition(1011470, "TINKER"),
new TextDefinition(1010123, "You now have the faction title of tinker")),
new MerchantTitleInfo(SkillName.Blacksmith, 90.0, new TextDefinition(1023016, "Blacksmith"),
new TextDefinition(1011471, "BLACKSMITH"),
new TextDefinition(1010124, "You now have the faction title of blacksmith")),
new MerchantTitleInfo(SkillName.Fletching, 90.0, new TextDefinition(1023022, "Bowyer"),
new TextDefinition(1011472, "BOWYER"),
new TextDefinition(1010125, "You now have the faction title of Bowyer")),
new MerchantTitleInfo(SkillName.Tailoring, 90.0, new TextDefinition(1022982, "Tailor"),
new TextDefinition(1018300, "TAILOR"),
new TextDefinition(1042162, "You now have the faction title of Tailor"))
};
public static MerchantTitleInfo GetInfo( MerchantTitle title )
{
int idx = (int)title - 1;
public static MerchantTitleInfo GetInfo(MerchantTitle title)
{
int idx = (int)title - 1;
if ( idx >= 0 && idx < Info.Length )
return Info[idx];
if (idx >= 0 && idx < Info.Length)
return Info[idx];
return null;
}
return null;
}
public static bool HasMerchantQualifications( Mobile mob )
{
for ( int i = 0; i < Info.Length; ++i )
{
if ( IsQualified( mob, Info[i] ) )
return true;
}
public static bool HasMerchantQualifications(Mobile mob)
{
for (int i = 0; i < Info.Length; ++i)
if (IsQualified(mob, Info[i]))
return true;
return false;
}
return false;
}
public static bool IsQualified( Mobile mob, MerchantTitle title )
{
return IsQualified( mob, GetInfo( title ) );
}
public static bool IsQualified(Mobile mob, MerchantTitle title)
{
return IsQualified(mob, GetInfo(title));
}
public static bool IsQualified( Mobile mob, MerchantTitleInfo info )
{
if ( mob == null || info == null )
return false;
public static bool IsQualified(Mobile mob, MerchantTitleInfo info)
{
if (mob == null || info == null)
return false;
return ( mob.Skills[info.Skill].Value >= info.Requirement );
}
}
return mob.Skills[info.Skill].Value >= info.Requirement;
}
}
}