Browse Source

Weapon field parsing

combat-2
MagicBot 9 months ago
parent
commit
5cdf1d5599
  1. 11
      src/engine/objects/ItemTemplate.java

11
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_projectile_speed = ((Double) item_weapon.get("weapon_projectile_speed")).floatValue();
item_weapon_combat_idle_anim = ((Long) item_weapon.get("weapon_combat_idle_anim")).intValue(); item_weapon_combat_idle_anim = ((Long) item_weapon.get("weapon_combat_idle_anim")).intValue();
JSONObject weapon_damage = (JSONObject) item_weapon.get("weapon_damage"); JSONArray weapon_damage = (JSONArray) 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();
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"); JSONArray itemflags = (JSONArray) jsonObject.get("item_flags");

Loading…
Cancel
Save