From 5e8b4e0e613531002a9db8aaf678a87e029b82df Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Feb 2024 14:17:11 -0500 Subject: [PATCH] Parsing enumsets for eq slots --- src/engine/objects/ItemTemplate.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 8922fa7d..4b854fee 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -34,8 +34,8 @@ public class ItemTemplate { public Enum.ItemType item_type; public int item_eq_slots_value; public boolean item_eq_slots_type; - public EnumSet item_eq_slots_or; - public EnumSet item_eq_slots_and; + public EnumSet item_eq_slots_or = EnumSet.noneOf(Enum.ItemEquipSlotType.class); + public EnumSet item_eq_slots_and = EnumSet.noneOf(Enum.ItemEquipSlotType.class); public ItemTemplate(JSONObject jsonObject) { @@ -83,5 +83,11 @@ public class ItemTemplate { for (Object o : eq_slots_or) item_eq_slots_or.add(Enum.ItemEquipSlotType.valueOf((String) o)); + JSONArray eq_slots_and = (JSONArray) jsonObject.get("eq_slots_and"); + + if (eq_slots_and.isEmpty() == false) + for (Object o : eq_slots_or) + item_eq_slots_and.add(Enum.ItemEquipSlotType.valueOf((String) o)); + } }