diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index f25417f9..daa1ad95 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -54,6 +54,8 @@ public class ItemTemplate { public EnumSet item_race_req = EnumSet.noneOf(Enum.MonsterType.class); public EnumSet item_race_res = EnumSet.noneOf(Enum.MonsterType.class); + public EnumSet item_class_req = EnumSet.noneOf(Enum.ClassType.class); + public EnumSet item_class_res = EnumSet.noneOf(Enum.ClassType.class); public ItemTemplate(JSONObject jsonObject) { @@ -186,6 +188,21 @@ public class ItemTemplate { item_race_req.add(Enum.MonsterType.valueOf(race)); } + JSONObject class_required = (JSONObject) jsonObject.get("item_class_req"); + restrict = ((Boolean) class_required.get("restrict")); + JSONArray classes = (JSONArray) class_required.get("classes"); + + for (Object o : races) { + String classEntry = (String) o; + classEntry = classEntry.replaceAll("\\s", ""); + classEntry = classEntry.replaceAll(",", ""); + + if (restrict) + item_class_res.add(Enum.ClassType.valueOf(classEntry)); + else + item_class_req.add(Enum.ClassType.valueOf(classEntry)); + } + } catch (Exception e) { Logger.error(e); }