|
|
@ -8,11 +8,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
package engine.objects; |
|
|
|
package engine.objects; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import engine.Enum; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import engine.math.Vector3fImmutable; |
|
|
|
import org.json.simple.JSONArray; |
|
|
|
import org.json.simple.JSONArray; |
|
|
|
import org.json.simple.JSONObject; |
|
|
|
import org.json.simple.JSONObject; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.EnumSet; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -30,7 +31,11 @@ public class ItemTemplate { |
|
|
|
public float combat_health_full; |
|
|
|
public float combat_health_full; |
|
|
|
public HashMap<String, Float> combat_attack_resist = new HashMap<>(); |
|
|
|
public HashMap<String, Float> combat_attack_resist = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
public ArrayList combatPowers; |
|
|
|
public Enum.ItemType item_type; |
|
|
|
|
|
|
|
public int item_eq_slots_value; |
|
|
|
|
|
|
|
public boolean item_eq_slots_type; |
|
|
|
|
|
|
|
public EnumSet<Enum.ItemEquipSlotType> item_eq_slots_or; |
|
|
|
|
|
|
|
public EnumSet<Enum.ItemEquipSlotType> item_eq_slots_and; |
|
|
|
|
|
|
|
|
|
|
|
public ItemTemplate(JSONObject jsonObject) { |
|
|
|
public ItemTemplate(JSONObject jsonObject) { |
|
|
|
|
|
|
|
|
|
|
@ -63,13 +68,20 @@ public class ItemTemplate { |
|
|
|
combat_attack_resist.put((String) key, resist); |
|
|
|
combat_attack_resist.put((String) key, resist); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Reading arraylist of ints
|
|
|
|
// Parsing an enum
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray combat_json = (JSONArray) jsonObject.get("combat_powers"); |
|
|
|
item_type = Enum.ItemType.valueOf((String) jsonObject.get("item_type")); |
|
|
|
|
|
|
|
|
|
|
|
if (combat_json.isEmpty() == false) |
|
|
|
item_eq_slots_value = ((Long) jsonObject.get("item_eq_slots_value")).intValue(); |
|
|
|
for (Object o : combat_json) |
|
|
|
item_eq_slots_type = (boolean) jsonObject.get("item_eq_slots_value"); |
|
|
|
combatPowers.add(o); |
|
|
|
|
|
|
|
|
|
|
|
// Parsing an enumset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONArray eq_slots_or = (JSONArray) jsonObject.get("item_eq_slots_or"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (eq_slots_or.isEmpty() == false) |
|
|
|
|
|
|
|
for (Object o : eq_slots_or) |
|
|
|
|
|
|
|
item_eq_slots_or.add(Enum.ItemEquipSlotType.valueOf((String) o)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|