Hover tips now show level requirements for upgrading skills

This commit is contained in:
nossr50 2019-01-25 18:51:04 -08:00
parent cf9117097d
commit 1c58bd392d
2 changed files with 32 additions and 11 deletions

View File

@ -378,7 +378,15 @@ public class TextComponentFactory {
addSubSkillTypeToHoverEventJSON(abstractSubSkill, componentBuilder);
//RANK
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill));
int curRank = RankUtils.getRank(player, abstractSubSkill);
int nextRank = 0;
if(curRank < abstractSubSkill.getNumRanks() && abstractSubSkill.getNumRanks() > 0)
{
nextRank = RankUtils.getRankUnlockLevel(abstractSubSkill, curRank+1);
}
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, abstractSubSkill.getNumRanks(), RankUtils.getRank(player, abstractSubSkill), nextRank);
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
componentBuilder.append("\n").append(abstractSubSkill.getDescription()).append("\n");
@ -401,15 +409,19 @@ public class TextComponentFactory {
return componentBuilder;
}
private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank) {
private static void addRanked(ChatColor ccRank, ChatColor ccCurRank, ChatColor ccPossessive, ChatColor ccNumRanks, ComponentBuilder componentBuilder, int numRanks, int rank, int nextRank) {
if (numRanks > 0) {
//Rank
componentBuilder.append(LocaleLoader.getString("JSON.Rank") + ": ").bold(false).color(ccRank);
//Rank: x
componentBuilder.append(LocaleLoader.getString("JSON.Hover.Rank", String.valueOf(rank))).append("\n")
.bold(false).italic(false).strikethrough(false).underlined(false);
//x of y
componentBuilder.append(String.valueOf(rank)).color(ccCurRank);
componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);
//Next Rank: x
if(nextRank > rank)
componentBuilder.append(LocaleLoader.getString("JSON.Hover.NextRank", String.valueOf(nextRank))).append("\n")
.bold(false).italic(false).strikethrough(false).underlined(false);
/*componentBuilder.append(" " + LocaleLoader.getString("JSON.RankPossesive") + " ").color(ccPossessive);
componentBuilder.append(String.valueOf(numRanks)).color(ccNumRanks);*/
}
}
@ -468,12 +480,19 @@ public class TextComponentFactory {
//RANK
if(subSkillType.getNumRanks() > 0)
{
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType));
int curRank = RankUtils.getRank(player, subSkillType);
int nextRank = 0;
if(curRank < subSkillType.getNumRanks() && subSkillType.getNumRanks() > 0)
{
nextRank = RankUtils.getRankUnlockLevel(subSkillType, curRank+1);
}
addRanked(ccRank, ccCurRank, ccPossessive, ccNumRanks, componentBuilder, subSkillType.getNumRanks(), RankUtils.getRank(player, subSkillType), nextRank);
//Empty line
componentBuilder.append("\n").bold(false);
}
componentBuilder.append("\n").bold(false);
componentBuilder.append(LocaleLoader.getString("JSON.DescriptionHeader"));
componentBuilder.color(ccDescriptionHeader);
componentBuilder.append("\n");

View File

@ -45,6 +45,8 @@ JSON.URL.Spigot=The official mcMMO Spigot Resource Page!
JSON.URL.Translation=Translate mcMMO into other languages!
JSON.URL.Wiki=The official mcMMO wiki!
JSON.SkillUnlockMessage=[[GOLD]][ mcMMO[[YELLOW]] @[[DARK_AQUA]]{0} [[GOLD]]Rank [[DARK_AQUA]]{1}[[GOLD]] Unlocked! ]
JSON.Hover.Rank=&e&lRank:&r &f{0}
JSON.Hover.NextRank=&7&oNext upgrade at level {0}
#This is the message sent to players when an ability is activated
JSON.Notification.SuperAbility={0}