Browse Source

Weapon field parsing

combat-2
MagicBot 9 months ago
parent
commit
d20a2129aa
  1. 21
      src/engine/objects/ItemTemplate.java

21
src/engine/objects/ItemTemplate.java

@ -45,8 +45,18 @@ public class ItemTemplate {
public int item_parry_anim_id; public int item_parry_anim_id;
public EnumSet<Enum.CharacterSkills> item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class); public EnumSet<Enum.CharacterSkills> item_skill_used = EnumSet.noneOf(Enum.CharacterSkills.class);
public EnumSet<Enum.CharacterSkills> item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class); public EnumSet<Enum.CharacterSkills> item_skill_mastery_used = EnumSet.noneOf(Enum.CharacterSkills.class);
// Armor specific fields
public float item_bulk_factor; public float item_bulk_factor;
public float item_defense_rating; 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<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class); public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); public EnumSet<Enum.ItemUseFlags> item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class);
public int item_initial_charges; public int item_initial_charges;
@ -146,6 +156,17 @@ public class ItemTemplate {
item_defense_rating = ((Double) jsonObject.get("item_defense_rating")).floatValue(); 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"); JSONArray itemflags = (JSONArray) jsonObject.get("item_flags");
if (itemflags.isEmpty() == false) if (itemflags.isEmpty() == false)

Loading…
Cancel
Save