forked from MagicBane/Server
Fleshing out constructor
This commit is contained in:
@@ -12,6 +12,8 @@ import engine.math.Vector3fImmutable;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
@@ -24,10 +26,13 @@ public class ItemTemplate {
|
||||
public String obj_name = "";
|
||||
public Vector3fImmutable obj_scale = new Vector3fImmutable();
|
||||
public int obj_render_object;
|
||||
public int obj_icon;
|
||||
public float combat_health_current;
|
||||
public float combat_health_full;
|
||||
public HashMap<String, Float> combat_attack_resist = new HashMap<>();
|
||||
|
||||
public ArrayList combatPowers;
|
||||
|
||||
public ItemTemplate(JSONObject jsonObject) {
|
||||
|
||||
// Reading a String
|
||||
@@ -43,6 +48,7 @@ public class ItemTemplate {
|
||||
// Reading an integer value
|
||||
|
||||
obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue();
|
||||
obj_icon = ((Long) jsonObject.get("obj_icon")).intValue();
|
||||
|
||||
// Reading float values
|
||||
|
||||
@@ -58,7 +64,9 @@ public class ItemTemplate {
|
||||
combat_attack_resist.put((String) key, resist);
|
||||
}
|
||||
|
||||
JSONArray combat_json = (JSONArray) jsonObject.get("combat_powers");
|
||||
combatPowers = (ArrayList) Arrays.asList(combat_json.toArray());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user