diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index bf72c21e..cc180f04 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -350,13 +350,18 @@ public class ItemTemplate { 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) { - JSONObject powerGrant = (JSONObject) grantedPower; + for (Object grantEntry : powerGrantsArray) { + 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); + } } }