From 2d3b74e688233981fa24e01ef58a33e2f116acad Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 27 Feb 2024 14:14:16 -0500 Subject: [PATCH] More parsing work. --- src/engine/Enum.java | 8 ++++++++ src/engine/objects/ItemTemplate.java | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index da309d5a..a6ab2532 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -2991,4 +2991,12 @@ public class Enum { EMPTY_NEWITEM; } + public enum AttributeType { + None, + Strength, + Dexterity, + Constitution, + Intelligence, + Spirit, + } } diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 16b47b70..eee1753a 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -57,8 +57,9 @@ public class ItemTemplate { public int item_weapon_projectile_id; public float item_weapon_projectile_speed; public int item_weapon_combat_idle_anim; - public HashMap item_weapon_damage = new HashMap<>(); + public Enum.AttributeType item_primary_attr = Enum.AttributeType.None; + public Enum.AttributeType item_secondary_attr = Enum.AttributeType.None; public EnumSet item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public EnumSet item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); public int item_initial_charges; @@ -204,6 +205,9 @@ public class ItemTemplate { int[] minMax = {min, max}; item_weapon_damage.put(sourceType, minMax); } + + item_primary_attr = Enum.AttributeType.valueOf((String) jsonObject.get("item_primary_attr")); + item_secondary_attr = Enum.AttributeType.valueOf((String) jsonObject.get("item_secondary_attr")); } JSONArray itemflags = (JSONArray) jsonObject.get("item_flags");