Browse Source

Parsing power_granted_skills

combat-2
MagicBot 8 months ago
parent
commit
772e7f7f29
  1. 17
      src/engine/objects/ItemTemplate.java

17
src/engine/objects/ItemTemplate.java

@ -362,6 +362,15 @@ public class ItemTemplate {
String power_type = (String) powerGrantEntry.get("power_type"); String power_type = (String) powerGrantEntry.get("power_type");
int power_value = ((Long) powerGrantEntry.get("power_value")).intValue(); int power_value = ((Long) powerGrantEntry.get("power_value")).intValue();
item_power_grant.put(power_type, power_value); item_power_grant.put(power_type, power_value);
JSONArray skill_granted_array = (JSONArray) powerGrantEntry.get("power_granted_skills");
for (Object skillGrantEntry : skill_granted_array) {
JSONArray skill_entry = (JSONArray) skillGrantEntry;
String skill_type = (String) skill_entry.get(0);
int skill_level = ((Long) skill_entry.get(1)).intValue();
skill_granted_skills.put(skill_type, skill_level);
}
} }
} }
@ -431,16 +440,16 @@ public class ItemTemplate {
JSONArray skill_grant_json = (JSONArray) jsonObject.get("rune_skill_grant"); JSONArray skill_grant_json = (JSONArray) jsonObject.get("rune_skill_grant");
if (skill_grant_json.isEmpty() == false) if (skill_grant_json.isEmpty() == false)
for (Object o : skill_grant_json) { for (Object runeSkillEntry : skill_grant_json) {
JSONObject skill_granted = (JSONObject) o; JSONObject skill_granted = (JSONObject) runeSkillEntry;
String typeString = (String) skill_granted.get("skill_type"); String typeString = (String) skill_granted.get("skill_type");
int skill_level = ((Long) skill_granted.get("skill_value")).intValue(); int skill_level = ((Long) skill_granted.get("skill_value")).intValue();
rune_skill_grant.put(typeString, skill_level); rune_skill_grant.put(typeString, skill_level);
JSONArray skill_granted_array = (JSONArray) skill_granted.get("skill_granted_skills"); JSONArray skill_granted_array = (JSONArray) skill_granted.get("skill_granted_skills");
for (Object oo : skill_granted_array) { for (Object skillGrantEntry : skill_granted_array) {
JSONArray skill_entry = (JSONArray) oo; JSONArray skill_entry = (JSONArray) skillGrantEntry;
typeString = (String) skill_entry.get(0); typeString = (String) skill_entry.get(0);
skill_level = ((Long) skill_entry.get(1)).intValue(); skill_level = ((Long) skill_entry.get(1)).intValue();
skill_granted_skills.put(typeString, skill_level); skill_granted_skills.put(typeString, skill_level);

Loading…
Cancel
Save