From e228ff8715f95ed3b909b9e5b06b4466de402eda Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 27 Feb 2024 13:06:14 -0500 Subject: [PATCH] Parsing power actions. --- src/engine/objects/ItemTemplate.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 18004747..2ba82e9f 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -70,6 +70,8 @@ public class ItemTemplate { public EnumSet item_disc_res = EnumSet.noneOf(Enum.DisciplineType.class); public int item_level_req; public Enum.SexType item_sex_req; + public HashMap> item_user_power_action = new HashMap<>(); + public ItemTemplate(JSONObject jsonObject) { @@ -258,6 +260,15 @@ public class ItemTemplate { item_level_req = ((Long) jsonObject.get("item_level_req")).intValue(); item_sex_req = Enum.SexType.valueOf((String) jsonObject.get("item_sex_req")); + JSONArray powerActions = (JSONArray) jsonObject.get("item_user_power_action"); + + for (Object o : powerActions) { + JSONObject powerActionEntry = (JSONObject) o; + String power = (String) powerActionEntry.get("power"); + JSONArray args = (JSONArray) powerActionEntry.get("arguments"); + Pair arguments = new Pair<>(((Long) args.get(0)).intValue(), ((Long) args.get(1)).intValue()); + item_user_power_action.put(power, arguments); + } } catch (Exception e) { Logger.error(e); }