From 5476d238fabdb3ef00a195ec85ec73a44dbdda2a Mon Sep 17 00:00:00 2001 From: MagicBot Date: Thu, 7 Mar 2024 20:39:31 -0500 Subject: [PATCH] Parse offering info. --- src/engine/objects/ItemTemplate.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 31b98a6b..03468c49 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -177,13 +177,13 @@ public class ItemTemplate { // Reading offering data - JSONObject item_offering_info = (JSONObject) jsonObject.get("item_offering_info"); + JSONArray offering_data = (JSONArray) jsonObject.get("item_offering_info"); - for (Object key : item_offering_info.keySet()) { - String shrineType = (String) key; - shrineType = shrineType.replaceAll("-", ""); // For half-giant - int value = ((Double) item_offering_info.get(key)).intValue(); - item_offering_info.put(shrineType, value); + for (Object entry : offering_data) { + JSONObject offering_entry = (JSONObject) entry; + String offering_type = ((String) offering_entry.get("offering_type")).replaceAll("-", ""); + int offering_value = ((Double) offering_entry.get("offering_value")).intValue(); + item_offering_info.put(offering_type, offering_value); } // Fields only present for ARMOR