Browse Source

Parsing discs

combat-2
MagicBot 9 months ago
parent
commit
d3f9b53810
  1. 17
      src/engine/objects/ItemTemplate.java

17
src/engine/objects/ItemTemplate.java

@ -56,6 +56,8 @@ public class ItemTemplate {
public EnumSet<Enum.ClassType> item_class_req = EnumSet.noneOf(Enum.ClassType.class); public EnumSet<Enum.ClassType> item_class_req = EnumSet.noneOf(Enum.ClassType.class);
public EnumSet<Enum.ClassType> item_class_res = EnumSet.noneOf(Enum.ClassType.class); public EnumSet<Enum.ClassType> item_class_res = EnumSet.noneOf(Enum.ClassType.class);
public EnumSet<Enum.ClassType> item_disc_req = EnumSet.noneOf(Enum.ClassType.class);
public EnumSet<Enum.ClassType> item_disc_res = EnumSet.noneOf(Enum.ClassType.class);
public ItemTemplate(JSONObject jsonObject) { public ItemTemplate(JSONObject jsonObject) {
@ -203,6 +205,21 @@ public class ItemTemplate {
item_class_req.add(Enum.ClassType.valueOf(classEntry)); item_class_req.add(Enum.ClassType.valueOf(classEntry));
} }
JSONObject disc_required = (JSONObject) jsonObject.get("item_disc_req");
restrict = ((Boolean) disc_required.get("restrict"));
JSONArray discs = (JSONArray) disc_required.get("classes");
for (Object o : discs) {
String disc = (String) o;
disc = disc.replaceAll("\\s", "");
disc = disc.replaceAll(",", "");
if (restrict)
item_disc_res.add(Enum.ClassType.valueOf(disc));
else
item_disc_req.add(Enum.ClassType.valueOf(disc));
}
} catch (Exception e) { } catch (Exception e) {
Logger.error(e); Logger.error(e);
} }

Loading…
Cancel
Save