Browse Source

Both sparse fields parsed

combat-2
MagicBot 8 months ago
parent
commit
8b6fef4cbc
  1. 20
      src/engine/objects/ItemTemplate.java

20
src/engine/objects/ItemTemplate.java

@ -32,6 +32,7 @@ public class ItemTemplate { @@ -32,6 +32,7 @@ public class ItemTemplate {
public Vector3fImmutable obj_default_alignment;
public int obj_render_object;
public int obj_icon;
public HashMap<String, String> obj_sparse_data = new HashMap<>();
public float combat_health_current;
public float combat_health_full;
public HashMap<String, Float> combat_attack_resist = new HashMap<>();
@ -126,7 +127,7 @@ public class ItemTemplate { @@ -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<String, Integer> rune_sparse_data = new HashMap<>();
public ItemTemplate(JSONObject jsonObject) {
@ -164,6 +165,14 @@ public class ItemTemplate { @@ -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 { @@ -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");

Loading…
Cancel
Save