Browse Source

More parser work.

combat-2
MagicBot 9 months ago
parent
commit
bb8e8780bd
  1. 8
      src/engine/Enum.java
  2. 11
      src/engine/objects/ItemTemplate.java

8
src/engine/Enum.java

@ -3047,4 +3047,12 @@ public class Enum { @@ -3047,4 +3047,12 @@ public class Enum {
NoDrop,
Rare;
}
public enum ItemUseFlags {
USE_SELF,
USE_TARGET,
EMPTY_DESTROY,
EMPTY_NEWITEM;
}
}

11
src/engine/objects/ItemTemplate.java

@ -48,6 +48,8 @@ public class ItemTemplate { @@ -48,6 +48,8 @@ public class ItemTemplate {
public float item_bulk_factor;
public float item_defense_rating;
public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class);
public int item_initial_charges;
public ItemTemplate(JSONObject jsonObject) {
@ -136,5 +138,14 @@ public class ItemTemplate { @@ -136,5 +138,14 @@ public class ItemTemplate {
for (Object o : itemflags)
item_flags.add(Enum.ItemFlags.valueOf((String) o));
JSONArray itemUseflags = (JSONArray) jsonObject.get("item_use_flags");
if (itemUseflags.isEmpty() == false)
for (Object o : itemUseflags)
item_use_flags.add(Enum.ItemUseFlags.valueOf((String) o));
item_initial_charges = ((Long) jsonObject.get("item_initial_charges")).intValue();
}
}

Loading…
Cancel
Save