From b8e54dd10bb6383d11d15863c2d90c0cabd7ee2e Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 10 Jul 2023 17:18:09 +0200 Subject: Adding Motes NPC price to item lore --- .../skyhanni/features/bazaar/BazaarDataHolder.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt index d426af0cf..d359cebc1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.bazaar import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils @@ -20,15 +21,21 @@ class BazaarDataHolder { val list = mutableMapOf() try { val itemsData = APIUtil.getJSONResponse("https://api.hypixel.net/resources/skyblock/items") + val motesPrice = mutableMapOf() for (element in itemsData["items"].asJsonArray) { val jsonObject = element.asJsonObject - if (jsonObject.has("npc_sell_price")) { - val hypixelId = jsonObject["id"].asString - val npcPrice = jsonObject["npc_sell_price"].asDouble + val hypixelId = jsonObject["id"].asString + jsonObject["npc_sell_price"]?.let { val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId) - list[neuItemId] = npcPrice + list[neuItemId] = it.asDouble + } + jsonObject["motes_sell_price"]?.let { + val neuItemId = NEUItems.transHypixelNameToInternalName(hypixelId) + println("motes price: $neuItemId = $it") + motesPrice[neuItemId] = it.asDouble } } + RiftAPI.motesPrice = motesPrice } catch (e: Throwable) { e.printStackTrace() LorenzUtils.error("Error while trying to read bazaar item list from api: " + e.message) -- cgit