Fixing styling on Alchemy

This commit is contained in:
nossr50 2019-01-21 10:09:18 -08:00
parent ba34442ebb
commit 038265b033
4 changed files with 52 additions and 13 deletions

View File

@ -82,12 +82,16 @@ public class AlchemyCommand extends SkillCommand {
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();
if (canCatalysis) { if (canCatalysis) {
messages.add(LocaleLoader.getString("Alchemy.Catalysis.Speed", brewSpeed) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : "")); messages.add(getStatMessage(SubSkillType.ALCHEMY_CATALYSIS, brewSpeed)
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", brewSpeedLucky) : ""));
} }
if (canConcoctions) { if (canConcoctions) {
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))); messages.add(getStatMessage(false, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(tier), String.valueOf(RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))));
messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList)); messages.add(getStatMessage(true, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(ingredientCount), ingredientList));
//messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS)));
//messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList));
} }
return messages; return messages;

View File

@ -235,14 +235,33 @@ public abstract class SkillCommand implements TabExecutor {
return new String[] { String.valueOf(length), String.valueOf(enduranceLength) }; return new String[] { String.valueOf(length), String.valueOf(enduranceLength) };
} }
/** protected String getStatMessage(SubSkillType subSkillType, String... vars)
* Grab the stat string for a given subskill
* @param subSkillType target subskill
*/
protected String getStatMessage(SubSkillType subSkillType, String stat)
{ {
String statDescription = subSkillType.getLocaleStatDescription(); return getStatMessage(false, false, subSkillType, vars);
return subSkillType.getLocaleStat(statDescription, stat); }
protected String getStatMessage(boolean isExtra, boolean isCustom, SubSkillType subSkillType, String... vars)
{
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
if(isCustom)
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
else
{
String[] mergedList = addItemToFirstPositionOfArray(LocaleLoader.getString(statDescriptionKey), vars);
return LocaleLoader.getString(templateKey, mergedList);
}
}
public static String[] addItemToFirstPositionOfArray(String itemToAdd, String... existingArray) {
String[] newArray = new String[existingArray.length + 1];
newArray[0] = itemToAdd;
System.arraycopy(existingArray, 0, newArray, 1, existingArray.length);
return newArray;
} }
protected abstract void dataCalculations(Player player, float skillValue, boolean isLucky); protected abstract void dataCalculations(Player player, float skillValue, boolean isLucky);

View File

@ -251,6 +251,10 @@ public enum SubSkillType {
} }
public String getLocaleStatDescription() { return getFromLocaleSubAddress(".Stat"); } public String getLocaleStatDescription() { return getFromLocaleSubAddress(".Stat"); }
public String getLocaleKeyStatDescription() { return getLocaleKeyFromSubAddress(".Stat"); }
public String getLocaleStatExtraDescription() { return getFromLocaleSubAddress(".Stat.Extra"); }
public String getLocaleKeyStatExtraDescription() { return getLocaleKeyFromSubAddress(".Stat.Extra"); }
public String getLocaleStat(String... vars) public String getLocaleStat(String... vars)
{ {
@ -258,7 +262,18 @@ public enum SubSkillType {
return statMsg; return statMsg;
} }
public String getCustomLocaleStat(String... vars)
{
String statMsg = LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars);
return statMsg;
}
private String getFromLocaleSubAddress(String s) { private String getFromLocaleSubAddress(String s) {
return LocaleLoader.getString(getLocaleKeyRoot() + s); return LocaleLoader.getString(getLocaleKeyRoot() + s);
} }
private String getLocaleKeyFromSubAddress(String s)
{
return getLocaleKeyRoot() + s;
}
} }

View File

@ -61,6 +61,7 @@ Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!**
Ability.Generic.Template.Lock=[[GRAY]]{0} Ability.Generic.Template.Lock=[[GRAY]]{0}
# Skill Command Styling # Skill Command Styling
Ability.Generic.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1} Ability.Generic.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1}
Ability.Generic.Template.Custom=[[DARK_AQUA]]{0}
Skills.Overhaul.Header=[[RED]][]=====[][[GREEN]] {0} [[RED]][]=====[] Skills.Overhaul.Header=[[RED]][]=====[][[GREEN]] {0} [[RED]][]=====[]
Effects.Effects=EFFECTS Effects.Effects=EFFECTS
Effects.SubSkills.Overhaul=Sub-Skills Effects.SubSkills.Overhaul=Sub-Skills
@ -142,13 +143,13 @@ Acrobatics.SkillName=ACROBATICS
#ALCHEMY #ALCHEMY
Alchemy.SubSkill.Catalysis.Name=Catalysis Alchemy.SubSkill.Catalysis.Name=Catalysis
Alchemy.SubSkill.Catalysis.Description=Increases potion brewing speed Alchemy.SubSkill.Catalysis.Description=Increases potion brewing speed
Alchemy.SubSkill.Catalysis.Stat=Brewing Speed
Alchemy.SubSkill.Concoctions.Name=Concoctions Alchemy.SubSkill.Concoctions.Name=Concoctions
Alchemy.SubSkill.Concoctions.Description=Brew potions with more ingredients Alchemy.SubSkill.Concoctions.Description=Brew potions with more ingredients
Alchemy.SubSkill.Concoctions.Stat=Concoctions Rank: [[YELLOW]]{0}/{1}
Alchemy.SubSkill.Concoctions.Stat.Extra=Ingredients [[[YELLOW]]{0}[[DARK_AQUA]]]: [[YELLOW]]{1}
Alchemy.Listener=Alchemy: Alchemy.Listener=Alchemy:
Alchemy.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (CATALYSIS) Alchemy.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (CATALYSIS)
Alchemy.Catalysis.Speed=Brewing Speed: [[YELLOW]]{0}
Alchemy.Concoctions.Rank=Concoctions Rank: [[YELLOW]]{0}/{1}
Alchemy.Concoctions.Ingredients=Ingredients [[[YELLOW]]{0}[[RED]]]: [[YELLOW]]{1}
Alchemy.SkillName=ALCHEMY Alchemy.SkillName=ALCHEMY
#ARCHERY #ARCHERY