diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java index 1fdecbb3e..7bb3b167d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AlchemyCommand.java @@ -82,12 +82,16 @@ public class AlchemyCommand extends SkillCommand { List messages = new ArrayList(); 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) { - messages.add(LocaleLoader.getString("Alchemy.Concoctions.Rank", tier, RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS))); - messages.add(LocaleLoader.getString("Alchemy.Concoctions.Ingredients", ingredientCount, ingredientList)); + messages.add(getStatMessage(false, true, SubSkillType.ALCHEMY_CONCOCTIONS, String.valueOf(tier), String.valueOf(RankUtils.getHighestRank(SubSkillType.ALCHEMY_CONCOCTIONS)))); + 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; diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java index 89fc25da6..742847f95 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SkillCommand.java @@ -235,14 +235,33 @@ public abstract class SkillCommand implements TabExecutor { return new String[] { String.valueOf(length), String.valueOf(enduranceLength) }; } - /** - * Grab the stat string for a given subskill - * @param subSkillType target subskill - */ - protected String getStatMessage(SubSkillType subSkillType, String stat) + protected String getStatMessage(SubSkillType subSkillType, String... vars) { - String statDescription = subSkillType.getLocaleStatDescription(); - return subSkillType.getLocaleStat(statDescription, stat); + return getStatMessage(false, false, subSkillType, vars); + } + + 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); diff --git a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java index bfa5298af..3d96cc86f 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java +++ b/src/main/java/com/gmail/nossr50/datatypes/skills/SubSkillType.java @@ -251,6 +251,10 @@ public enum SubSkillType { } 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) { @@ -258,7 +262,18 @@ public enum SubSkillType { return statMsg; } + public String getCustomLocaleStat(String... vars) + { + String statMsg = LocaleLoader.getString("Ability.Generic.Template.Custom", (Object[]) vars); + return statMsg; + } + private String getFromLocaleSubAddress(String s) { return LocaleLoader.getString(getLocaleKeyRoot() + s); } + + private String getLocaleKeyFromSubAddress(String s) + { + return getLocaleKeyRoot() + s; + } } diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index c9b25513c..f3fa0ffa3 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -61,6 +61,7 @@ Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!** Ability.Generic.Template.Lock=[[GRAY]]{0} # Skill Command Styling Ability.Generic.Template=[[DARK_AQUA]]{0}: [[GREEN]]{1} +Ability.Generic.Template.Custom=[[DARK_AQUA]]{0} Skills.Overhaul.Header=[[RED]][]=====[][[GREEN]] {0} [[RED]][]=====[] Effects.Effects=EFFECTS Effects.SubSkills.Overhaul=Sub-Skills @@ -142,13 +143,13 @@ Acrobatics.SkillName=ACROBATICS #ALCHEMY Alchemy.SubSkill.Catalysis.Name=Catalysis Alchemy.SubSkill.Catalysis.Description=Increases potion brewing speed +Alchemy.SubSkill.Catalysis.Stat=Brewing Speed Alchemy.SubSkill.Concoctions.Name=Concoctions 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.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 #ARCHERY