forked from MagicBane/Server
Parse animation data
This commit is contained in:
@@ -14,6 +14,7 @@ import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -58,6 +59,8 @@ public class ItemTemplate {
|
||||
public float item_weapon_projectile_speed;
|
||||
public int item_weapon_combat_idle_anim;
|
||||
public HashMap<Enum.SourceType, int[]> item_weapon_damage = new HashMap<>();
|
||||
public ArrayList<int[]> weapon_attack_anim_right = new ArrayList();
|
||||
public ArrayList<int[]> weapon_attack_anim_left = new ArrayList();
|
||||
public Enum.AttributeType item_primary_attr = Enum.AttributeType.None;
|
||||
public Enum.AttributeType item_secondary_attr = Enum.AttributeType.None;
|
||||
public EnumSet<Enum.ItemFlags> item_flags = EnumSet.noneOf(Enum.ItemFlags.class);
|
||||
@@ -206,6 +209,26 @@ public class ItemTemplate {
|
||||
item_weapon_damage.put(sourceType, minMax);
|
||||
}
|
||||
|
||||
JSONArray attack_anim_right = (JSONArray) jsonObject.get("weapon_attack_anim_right");
|
||||
|
||||
if (attack_anim_right.isEmpty() == false)
|
||||
for (Object o : weapon_damage) {
|
||||
JSONArray animationEntry = (JSONArray) o;
|
||||
int animation = (int) animationEntry.get(0);
|
||||
int duration = (int) animationEntry.get(1);
|
||||
weapon_attack_anim_right.add(new int[]{animation, duration});
|
||||
}
|
||||
|
||||
JSONArray attack_anim_left = (JSONArray) jsonObject.get("attack_anim_left");
|
||||
|
||||
if (attack_anim_left.isEmpty() == false)
|
||||
for (Object o : weapon_damage) {
|
||||
JSONArray animationEntry = (JSONArray) o;
|
||||
int animation = (int) animationEntry.get(0);
|
||||
int duration = (int) animationEntry.get(1);
|
||||
weapon_attack_anim_left.add(new int[]{animation, duration});
|
||||
}
|
||||
|
||||
item_primary_attr = Enum.AttributeType.valueOf((String) jsonObject.get("item_primary_attr"));
|
||||
item_secondary_attr = Enum.AttributeType.valueOf((String) jsonObject.get("item_secondary_attr"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user