From bade2162a660794bc3b8cd7045e8fa714c2e6801 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 24 Feb 2024 07:49:13 -0500 Subject: [PATCH] More parser work. --- src/engine/Enum.java | 10 ++++++++++ src/engine/objects/ItemTemplate.java | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 5be3f1ac..57d79e76 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -3037,4 +3037,14 @@ public class Enum { CHARMED, SIEGEENGINE } + + public enum ItemFlags { + Indestructible, + Identified, + NoBond, + NoQuit, + Magic, + NoDrop, + Rare; + } } diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 61e2798e..ad58467f 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -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 item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class); public EnumSet item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class); + public float item_bulk_factor; + public float item_defense_rating; + public EnumSet item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public ItemTemplate(JSONObject jsonObject) { @@ -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)); + } }