Skip to content

Commit

Permalink
fixed learning skills
Browse files Browse the repository at this point in the history
  • Loading branch information
NeumimTo committed May 15, 2020
1 parent fd728d5 commit 8f20b36
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ public interface CharacterBase extends TimestampEntity {
void setAttributePointsSpent(Integer attributePointsSpent);

Map<String, Set<DateKeyPair>> getUniqueSkillpoints();

void setUniqueSkillpoints(Map<String, Set<DateKeyPair>> uniqueSkillpoints);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ public ActionResult addUniqueSkillpoint(T character, PlayerClassData classByType
if (uniques == null) {
uniques = new HashSet<>();
uniqueSkillpoints.put(key, uniques);
characterBase.setUniqueSkillpoints(uniqueSkillpoints);
}
for (DateKeyPair unique : uniques) {
if (sourceKey.equalsIgnoreCase(unique.getSourceKey())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,34 +349,36 @@ public static List<Text> toLore(ISpongeCharacter character, SkillData skillData,
}

List<String> description = skillData.getDescription(character);
if (description != null && description.size() > 0) {
if (description != null && !description.isEmpty()) {
lore.add(header(locService.translate(LocalizationKeys.DESCRIPTION)));

for (String s : description) {
lore.add(line(s));
}
}

lore.add(header(locService.translate(LocalizationKeys.SKILL_TRAITS)));
Set<ISkillType> skillTypes = skill.getSkillTypes();
StringBuilder builder = new StringBuilder();
Iterator<ISkillType> iterator = skillTypes.iterator();
int i = 0;
boolean firstLine = true;
while (iterator.hasNext()) {
i++;
ISkillType next = iterator.next();
String translate = locService.translate(next.toString()) + " ";
builder.append(translate);
if (i % 4 == 0) {
if (firstLine) {
lore.add(node(locService.translate(LocalizationKeys.SKILL_TYPES), builder.toString()));
} else {
lore.add(line(" - " + builder.toString()));
if (!skillTypes.isEmpty()) {
lore.add(header(locService.translate(LocalizationKeys.SKILL_TRAITS)));
StringBuilder builder = new StringBuilder();
Iterator<ISkillType> iterator = skillTypes.iterator();
int i = 0;
boolean firstLine = true;
while (iterator.hasNext()) {
i++;
ISkillType next = iterator.next();
String translate = locService.translate(next.toString()) + " ";
builder.append(translate);
if (i % 4 == 0) {
if (firstLine) {
lore.add(node(locService.translate(LocalizationKeys.SKILL_TYPES), builder.toString()));
} else {
lore.add(line(" - " + builder.toString()));
}

builder = new StringBuilder();
firstLine = false;
}

builder = new StringBuilder();
firstLine = false;
}
}
}
Expand Down Expand Up @@ -452,7 +454,7 @@ public static Inventory createSkillDetailInventoryView(ISpongeCharacter characte
.build(SpongeRpgPlugin.getInstance());

SpongeSkillTreeViewModel skillTreeViewModel = character.getLastTimeInvokedSkillTreeView();
ItemStack back = back("skilltree view" + skillTreeViewModel.getViewedClass().getName(), translate(LocalizationKeys.SKILLTREE));
ItemStack back = back("skilltree view " + skillTreeViewModel.getViewedClass().getName(), translate(LocalizationKeys.SKILLTREE));
build.query(QueryOperationTypes.INVENTORY_PROPERTY.of(SlotPos.of(0, 0))).offer(back);

if (skillData instanceof SkillPathData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ public Map<String, Set<DateKeyPair>> getUniqueSkillpoints() {
return uniqueSkillpoints;
}

@Override
public void setUniqueSkillpoints(Map<String, Set<DateKeyPair>> uniqueSkillpoints) {
this.uniqueSkillpoints = uniqueSkillpoints;
}

public void postLoad() {
for (BaseCharacterAttribute characterAttribute : baseCharacterAttribute) {
cachedAttributes.put(characterAttribute.getName(), characterAttribute.getLevel());
Expand Down

0 comments on commit 8f20b36

Please sign in to comment.