mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Fixing styling on Alchemy
This commit is contained in:
@ -82,12 +82,16 @@ public class AlchemyCommand extends SkillCommand {
|
||||
List<String> messages = new ArrayList<String>();
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user