From 50de0411385ff51f2ff753630054aa2ea3d4d7ff Mon Sep 17 00:00:00 2001
From: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Date: Sat, 15 Apr 2023 18:49:31 +0200
Subject: removed bazaar update timer removed skyhanni bazaar logic and now
fully using neu bazaar price logic
---
src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt | 11 +++++------
.../java/at/hannibal2/skyhanni/utils/NEUItems.kt | 20 ++++++--------------
2 files changed, 11 insertions(+), 20 deletions(-)
(limited to 'src/main/java/at/hannibal2/skyhanni/utils')
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
index 93e507826..05c549a70 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/APIUtil.kt
@@ -45,7 +45,11 @@ object APIUtil {
try {
return parser.parse(retSrc) as JsonObject
} catch (e: JsonSyntaxException) {
- if (retSrc.contains("
502 Bad Gateway
")) {
+ if (e.message?.contains("Use JsonReader.setLenient(true)") == true) {
+ println("MalformedJsonException: Use JsonReader.setLenient(true)")
+ println(" - getJSONResponse: '$urlString'")
+ LorenzUtils.debug("MalformedJsonException: Use JsonReader.setLenient(true)")
+ } else if (retSrc.contains("502 Bad Gateway
")) {
if (showApiErrors) {
LorenzUtils.clickableChat(
"[SkyHanni] Problems with detecting the Hypixel API. §eClick here to hide this message for now.",
@@ -58,11 +62,6 @@ object APIUtil {
LorenzUtils.error("[SkyHanni] JsonSyntaxException at getJSONResponse!")
println("result: '$retSrc'")
}
- if (e.message?.contains("Use JsonReader.setLenient(true)") == true) {
- println("MalformedJsonException: Use JsonReader.setLenient(true)")
- println(" - getJSONResponse: '$urlString'")
- LorenzUtils.debug("MalformedJsonException: Use JsonReader.setLenient(true)")
- }
e.printStackTrace()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 2549c215b..76a2f7d2a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -1,6 +1,5 @@
package at.hannibal2.skyhanni.utils
-import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
import io.github.moulberry.notenoughupdates.NEUManager
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
@@ -60,28 +59,21 @@ object NEUItems {
return price
}
- fun getPrice(internalName: String, useSellingPrice: Boolean = false): Double {
- val bazaarData = BazaarApi.getBazaarDataForInternalName(internalName)
- bazaarData?.let {
- val buyPrice = it.buyPrice
- if (buyPrice > 0) return buyPrice
-
- val sellPrice = it.sellPrice
- if (sellPrice > 0) return sellPrice
-
- return it.npcPrice
- }
+ fun getPrice(internalName: String): Double {
+ return getPrice(internalName, false)
+ }
+ fun getPrice(internalName: String, useSellingPrice: Boolean): Double {
val result = manager.auctionManager.getBazaarOrBin(internalName, useSellingPrice)
- // TODO remove workaround
if (result == -1.0) {
if (internalName == "JACK_O_LANTERN") {
- return getPrice("PUMPKIN") + 1
+ return getPrice("PUMPKIN", useSellingPrice) + 1
}
if (internalName == "GOLDEN_CARROT") {
// 6.8 for some players
return 7.0 // NPC price
}
+ LorenzUtils.debug("Item price is null for '$internalName'")
}
return result
}
--
cgit