aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-20 12:18:20 +0200
committerGitHub <noreply@github.com>2024-05-20 12:18:20 +0200
commitfd42f05ce3b849ed579787607bf5f77080aebb7f (patch)
tree85d0cd2a3d91e4591b508ec41304f6f45f6a3159
parent4eb39185cb08727050d9577fc5a6c91921b83eaf (diff)
downloadskyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.tar.gz
skyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.tar.bz2
skyhanni-fd42f05ce3b849ed579787607bf5f77080aebb7f.zip
Fix: bazaar empty data (#1841)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
index 2cb70f857..cd9465264 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/bazaar/HypixelBazaarFetcher.kt
@@ -62,6 +62,11 @@ object HypixelBazaarFetcher {
val internalName = NEUItems.transHypixelNameToInternalName(key)
val sellOfferPrice = product.buySummary.minOfOrNull { it.pricePerUnit } ?: 0.0
val insantBuyPrice = product.sellSummary.maxOfOrNull { it.pricePerUnit } ?: 0.0
+
+ if (product.quickStatus.isEmpty()) {
+ return@mapNotNull null
+ }
+
if (internalName.getItemStackOrNull() == null) {
// Items that exist in Hypixel's Bazaar API, but not in NEU repo (not visible in in the ingame bazaar).
// Should only include Enchants
@@ -72,6 +77,17 @@ object HypixelBazaarFetcher {
internalName to BazaarData(internalName.itemName, sellOfferPrice, insantBuyPrice, product)
}.toMap()
+ private fun BazaarQuickStatus.isEmpty(): Boolean = with(this) {
+ sellPrice == 0.0 &&
+ sellVolume == 0L &&
+ sellMovingWeek == 0L &&
+ sellOrders == 0L &&
+ buyPrice == 0.0 &&
+ buyVolume == 0L &&
+ buyMovingWeek == 0L &&
+ buyOrders == 0L
+ }
+
private fun onError(fetchType: String, e: Exception, rawResponse: String? = null) {
val userMessage = "Failed fetching bazaar price data from hypixel"
failedAttempts++