From d20a2129aae17f09f7ab8e3d2b3513801498c983 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 24 Feb 2024 15:25:06 -0500 Subject: [PATCH] Weapon field parsing --- src/engine/objects/ItemTemplate.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 12bfb4b7..62f393ef 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -45,8 +45,18 @@ public class ItemTemplate { 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); + // Armor specific fields public float item_bulk_factor; public float item_defense_rating; + // Weapon specific fields + public float item_weapon_wepspeed; + public float item_weapon_max_range; + public int item_weapon_projectile_id; + public float item_weapon_projectile_speed; + public int item_weapon_combat_idle_anim; + public Enum.DamageType item_weapon_damage_type; + public int item_weapon_damage_min; + public int item_weapon_damage_max; public EnumSet item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public EnumSet item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); public int item_initial_charges; @@ -146,6 +156,17 @@ public class ItemTemplate { item_defense_rating = ((Double) jsonObject.get("item_defense_rating")).floatValue(); } + if (item_type.equals(Enum.ItemType.WEAPON)) { + + JSONObject item_weapon = (JSONObject) jsonObject.get("item_weapon"); + item_weapon_wepspeed = ((Double) item_weapon.get("weapon_wepspeed")).floatValue(); + item_weapon_max_range = ((Double) item_weapon.get("weapon_max_range")).floatValue(); + item_weapon_projectile_id = ((Long) item_weapon.get("projectile_id")).intValue(); + item_weapon_projectile_speed = ((Double) item_weapon.get("weapon_max_range")).floatValue(); + item_weapon_combat_idle_anim = ((Long) item_weapon.get("weapon_combat_idle_anime")).intValue(); + + } + JSONArray itemflags = (JSONArray) jsonObject.get("item_flags"); if (itemflags.isEmpty() == false)