From 5cdf1d559930a86991be3e7257bc1b8bbaa30d2a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 24 Feb 2024 15:45:22 -0500 Subject: [PATCH] Weapon field parsing --- src/engine/objects/ItemTemplate.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 2ad79448..f19ef567 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -165,11 +165,14 @@ public class ItemTemplate { item_weapon_projectile_speed = ((Double) item_weapon.get("weapon_projectile_speed")).floatValue(); item_weapon_combat_idle_anim = ((Long) item_weapon.get("weapon_combat_idle_anim")).intValue(); - JSONObject weapon_damage = (JSONObject) item_weapon.get("weapon_damage"); - item_weapon_damage_type = Enum.DamageType.valueOf((String) weapon_damage.get("damage_type")); - item_weapon_damage_min = ((Long) weapon_damage.get("damage_min")).intValue(); - item_weapon_damage_max = ((Long) weapon_damage.get("damage_max")).intValue(); + JSONArray weapon_damage = (JSONArray) item_weapon.get("weapon_damage"); + for (Object o : weapon_damage) { + JSONObject damage_entry = (JSONObject) o; + item_weapon_damage_type = Enum.DamageType.valueOf((String) damage_entry.get("damage_type")); + item_weapon_damage_min = ((Long) damage_entry.get("damage_min")).intValue(); + item_weapon_damage_max = ((Long) damage_entry.get("damage_max")).intValue(); + } } JSONArray itemflags = (JSONArray) jsonObject.get("item_flags");