Skip to content

Commit

Permalink
Fix an issue where a player could not see a skilltree of a class whic…
Browse files Browse the repository at this point in the history
…h it do not own right now
  • Loading branch information
NeumimTo committed Feb 24, 2019
1 parent 785654b commit 7d54a3b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,5 +279,7 @@ public class Localizations {

public static LocalizableParametrizedText UNABLE_TO_REFUND_SKILL;

public static LocalizableParametrizedText UNABLE_TO_REFUND_SKILL_SEALED;
public static LocalizableParametrizedText UNABLE_TO_REFUND_SKILL_SEALED;

public static LocalizableParametrizedText CLASS_NOT_SELECTED;
}
10 changes: 8 additions & 2 deletions Plugin/src/main/java/cz/neumimto/rpg/gui/GuiHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import cz.neumimto.rpg.inventory.data.NKeys;
import cz.neumimto.rpg.inventory.data.SkillTreeInventoryViewControllsData;
import cz.neumimto.rpg.listeners.SkillTreeInventoryListener;
import cz.neumimto.rpg.persistance.model.CharacterClass;
import cz.neumimto.rpg.players.IActiveCharacter;
import cz.neumimto.rpg.players.SkillTreeViewModel;
import cz.neumimto.rpg.players.groups.ClassDefinition;
Expand Down Expand Up @@ -340,11 +341,16 @@ public static ItemStack interactiveModeToitemStack(IActiveCharacter character, S
.build());

ClassDefinition viewedClass = character.getLastTimeInvokedSkillTreeView().getViewedClass();
int sp = character.getCharacterBase().getCharacterClass(viewedClass).getSkillPoints();
CharacterClass characterClass = character.getCharacterBase().getCharacterClass(viewedClass);
if (characterClass == null) {
lore.add(Localizations.CLASS_NOT_SELECTED.toText());
} else {
int sp = characterClass.getSkillPoints();

lore.add(Text.builder("SP: ").color(TextColors.GREEN)
lore.add(Text.builder("SP: ").color(TextColors.GREEN)
.append(Text.builder(String.valueOf(sp)).style(TextStyles.BOLD).build())
.build());
}
md.offer(Keys.ITEM_LORE, lore);
return md;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,5 @@ rpg.main.class_has_no_skilltree=Class {{class}} has no skill tree
rpg.main.not_allowed_manual_skilltree_management=Class {{class}} have not allowed manual skill management
rpg.main.refund_skills_depending=Not possible to refund skill, refund depending skills first
rpg.main.unable_to_refund_skill=Not possible to refund skill
rpg.main.unable_to_refund_skill_sealed=The skill node is sealed, may not be refunded.
rpg.main.unable_to_refund_skill_sealed=The skill node is sealed, may not be refunded.
rpg.main.class_not_selected=&6You dont have this class

0 comments on commit 7d54a3b

Please sign in to comment.