diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-10 17:18:09 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-10 17:18:09 +0200 |
| commit | b8e54dd10bb6383d11d15863c2d90c0cabd7ee2e (patch) | |
| tree | 4712b7cd5979f1c6b246b47954496d25a69b867c /src/main/java/at/hannibal2/skyhanni/features/bazaar | |
| parent | 30805daacae5f5b9d06bd239c958368815236c73 (diff) | |
| download | skyhanni-b8e54dd10bb6383d11d15863c2d90c0cabd7ee2e.tar.gz skyhanni-b8e54dd10bb6383d11d15863c2d90c0cabd7ee2e.tar.bz2 skyhanni-b8e54dd10bb6383d11d15863c2d90c0cabd7ee2e.zip | |
Adding Motes NPC price to item lore
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataHolder.kt | 15 |
1 files changed, 11 insertions, 4 deletions
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<String, Double>() try { val itemsData = APIUtil.getJSONResponse("https://api.hypixel.net/resources/skyblock/items") + val motesPrice = mutableMapOf<String, Double>() 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) |
