Browse Source

String cleanup for skill enums.

combat-2
MagicBot 9 months ago
parent
commit
62e13ade01
  1. 22
      src/engine/objects/ItemTemplate.java

22
src/engine/objects/ItemTemplate.java

@ -105,20 +105,22 @@ public class ItemTemplate {
item_render_object_female = ((Long) jsonObject.get("item_render_object_female")).intValue(); item_render_object_female = ((Long) jsonObject.get("item_render_object_female")).intValue();
item_health_full = ((Double) jsonObject.get("item_health_full")).floatValue(); item_health_full = ((Double) jsonObject.get("item_health_full")).floatValue();
String skills_used = (String) jsonObject.get("item_skill_used"); Object skills_used = jsonObject.get("item_skill_used");
if (skills_used.length() > 1) { if (skills_used instanceof String) {
skills_used = skills_used.replaceAll("\\s", ""); String skilString = (String) skills_used;
skills_used = skills_used.replaceAll(",", ""); skilString = skilString.replaceAll("\\s", "");
item_skill_used.add(Enum.CharacterSkills.valueOf(skills_used)); skilString = skilString.replaceAll(",", "");
item_skill_used.add(Enum.CharacterSkills.valueOf(skilString));
} }
String mastery_used = (String) jsonObject.get("item_skill_mastery_used"); Object mastery_used = jsonObject.get("item_skill_mastery_used");
if (mastery_used.length() > 1) { if (mastery_used instanceof String) {
mastery_used = mastery_used.replaceAll("\\s", ""); String masteryString = (String) mastery_used;
mastery_used = mastery_used.replaceAll(",", ""); masteryString = masteryString.replaceAll("\\s", "");
item_skill_mastery_used.add(Enum.CharacterSkills.valueOf(mastery_used)); masteryString = masteryString.replaceAll(",", "");
item_skill_mastery_used.add(Enum.CharacterSkills.valueOf(masteryString));
} }
} }

Loading…
Cancel
Save