Browse Source

More parser work.

combat-2
MagicBot 9 months ago
parent
commit
bade2162a6
  1. 10
      src/engine/Enum.java
  2. 15
      src/engine/objects/ItemTemplate.java

10
src/engine/Enum.java

@ -3037,4 +3037,14 @@ public class Enum { @@ -3037,4 +3037,14 @@ public class Enum {
CHARMED,
SIEGEENGINE
}
public enum ItemFlags {
Indestructible,
Identified,
NoBond,
NoQuit,
Magic,
NoDrop,
Rare;
}
}

15
src/engine/objects/ItemTemplate.java

@ -42,9 +42,12 @@ public class ItemTemplate { @@ -42,9 +42,12 @@ public class ItemTemplate {
public String item_dsc;
public int item_render_object_female;
public float item_health_full;
public int item_parry_anim_id;
public EnumSet<Enum.CharacterSkills> item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public EnumSet<Enum.CharacterSkills> item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public float item_bulk_factor;
public float item_defense_rating;
public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
public ItemTemplate(JSONObject jsonObject) {
@ -123,5 +126,15 @@ public class ItemTemplate { @@ -123,5 +126,15 @@ public class ItemTemplate {
item_skill_mastery_used.add(Enum.CharacterSkills.valueOf(masteryString));
}
item_parry_anim_id = ((Long) jsonObject.get("item_parry_anim_id")).intValue();
item_bulk_factor = ((Double) jsonObject.get("item_bulk_factor")).floatValue();
item_defense_rating = ((Double) jsonObject.get("item_defense_rating")).floatValue();
JSONArray itemflags = (JSONArray) jsonObject.get("item_flags");
if (itemflags.isEmpty() == false)
for (Object o : itemflags)
item_flags.add(Enum.ItemFlags.valueOf((String) o));
}
}

Loading…
Cancel
Save