From 9bf7c088cf84b97cc195ed8f5988dc196701fedf Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 18 Feb 2024 13:29:01 -0500 Subject: [PATCH] Fleshing out constructor --- src/engine/objects/ItemTemplate.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 55f30988..6ceb02ea 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -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 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()); + } }