Browse Source

Parsing grants

combat-2
MagicBot 9 months ago
parent
commit
67e4011c65
  1. 13
      src/engine/objects/ItemTemplate.java

13
src/engine/objects/ItemTemplate.java

@ -71,6 +71,9 @@ public class ItemTemplate { @@ -71,6 +71,9 @@ public class ItemTemplate {
public Enum.SexType item_sex_req;
public HashMap<String, int[]> item_user_power_action = new HashMap<>();
public static HashMap<String, Integer> item_power_grant = new HashMap<>();
public ItemTemplate(JSONObject jsonObject) {
try {
@ -274,6 +277,16 @@ public class ItemTemplate { @@ -274,6 +277,16 @@ public class ItemTemplate {
int[] arguments = {((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()};
item_user_power_action.put(power, arguments);
}
JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant");
for (Object o : powerGrants) {
JSONObject powerGrantEntry = (JSONObject) o;
String power_type = (String) powerGrantEntry.get("power_type");
int power_value = ((Long) powerGrantEntry.get("power_value")).intValue();
item_power_grant.put(power_type, power_value);
}
} catch (Exception e) {
Logger.error(e);
}

Loading…
Cancel
Save