From 8b6fef4cbceb019deebb362460e07882c6cd27fe Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 4 Apr 2024 11:13:58 -0400 Subject: [PATCH] Both sparse fields parsed --- src/engine/objects/ItemTemplate.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 9f6121bd..02e96f74 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -32,6 +32,7 @@ public class ItemTemplate { public Vector3fImmutable obj_default_alignment; public int obj_render_object; public int obj_icon; + public HashMap obj_sparse_data = new HashMap<>(); public float combat_health_current; public float combat_health_full; public HashMap combat_attack_resist = new HashMap<>(); @@ -126,7 +127,7 @@ public class ItemTemplate { public int rune_group_role_set; public boolean rune_renderable = false; public int rune_natural_power_attack; - public String rune_sparse_data; + public HashMap rune_sparse_data = new HashMap<>(); public ItemTemplate(JSONObject jsonObject) { @@ -164,6 +165,14 @@ public class ItemTemplate { obj_render_object = ((Long) jsonObject.get("obj_render_object")).intValue(); obj_icon = ((Long) jsonObject.get("obj_icon")).intValue(); + JSONObject obj_sparse_json = (JSONObject) jsonObject.get("obj_sparse_data"); + + for (Object key : obj_sparse_json.keySet()) { + String sparseType = (String) key; + String sparseValue = (String) obj_sparse_json.get(key); + obj_sparse_data.put(sparseType, sparseValue); + } + // Reading float values combat_health_current = ((Double) jsonObject.get("combat_health_current")).floatValue(); @@ -485,7 +494,14 @@ public class ItemTemplate { rune_renderable = ((Boolean) jsonObject.get("rune_renderable")); rune_natural_power_attack = ((Long) jsonObject.get("rune_natural_power_attack")).intValue(); - rune_sparse_data = (String) jsonObject.get("rune_sparse_data"); + + JSONObject rune_sparse_json = (JSONObject) jsonObject.get("rune_speed"); + + for (Object key : rune_sparse_json.keySet()) { + String sparseType = (String) key; + int sparseValue = ((Long) rune_sparse_json.get("sparseType")).intValue(); + rune_sparse_data.put(sparseType, sparseValue); + } JSONArray attr_adj_json = (JSONArray) jsonObject.get("rune_attr_adj");