Browse Source

Proper parsing of power grants

combat-2
MagicBot 8 months ago
parent
commit
db91b606f6
  1. 13
      src/engine/objects/ItemTemplate.java

13
src/engine/objects/ItemTemplate.java

@ -350,13 +350,18 @@ public class ItemTemplate {
item_user_power_action.put(power, arguments); item_user_power_action.put(power, arguments);
} }
JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant"); JSONArray powerGrantsArray = (JSONArray) jsonObject.get("item_power_grant");
if (powerGrants.isEmpty() == false) { if (powerGrantsArray.isEmpty() == false) {
for (Object grantedPower : powerGrants) { for (Object grantEntry : powerGrantsArray) {
JSONObject powerGrant = (JSONObject) grantedPower; JSONObject powerGrant = (JSONObject) grantEntry;
for (Object key : powerGrant.keySet()) {
String powerString = (String) key;
int powerLevel = ((Long) powerGrant.get(key)).intValue();
item_power_grant.put(powerString, powerLevel);
}
} }
} }

Loading…
Cancel
Save