diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-29 12:57:19 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-29 12:57:19 +0200 |
| commit | ab471dbbfd660831e7998a1da596d562a2090677 (patch) | |
| tree | f327806d07e4519797901553628dc6b5dec851ef /src/main/java/at/hannibal2/skyhanni/features/bazaar | |
| parent | b3533ebdae283e2525f660d8ec4e3214a27cab0b (diff) | |
| download | skyhanni-ab471dbbfd660831e7998a1da596d562a2090677.tar.gz skyhanni-ab471dbbfd660831e7998a1da596d562a2090677.tar.bz2 skyhanni-ab471dbbfd660831e7998a1da596d562a2090677.zip | |
+ Money Per Hour now shows NPC Price instead of Sell Offer price when on ironman, stranded or bingo
+ Added Money per Hour Advanced stats
= Money per hour compact price mode now colors current crop different
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bazaar')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarData.kt | 10 | ||||
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt | 33 |
2 files changed, 40 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarData.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarData.kt index b4f00f248..eb76ac18f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarData.kt @@ -1,3 +1,11 @@ package at.hannibal2.skyhanni.features.bazaar -data class BazaarData(val apiName: String, val itemName: String, val sellPrice: Double, val buyPrice: Double, val buyMovingWeek: Int, val sellMovingWeek: Int)
\ No newline at end of file +data class BazaarData( + val apiName: String, + val itemName: String, + val sellPrice: Double, + val buyPrice: Double, + val npcPrice: Double, + val buyMovingWeek: Int, + val sellMovingWeek: Int, +)
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt index 609801cd5..0bcaded93 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bazaar/BazaarDataGrabber.kt @@ -14,9 +14,15 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa companion object { private val itemNames = mutableMapOf<String, String>() + private val npcPrices = mutableMapOf<String, Double>() var lastTime = 0L var currentlyUpdating = false + + fun resetItemNames() { + LorenzUtils.chat("§e[SkyHanni] Reloading the hypixel item api..") + itemNames.clear() + } } private fun loadItemNames(): Boolean { @@ -28,6 +34,17 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa val name = jsonObject["name"].asString val id = jsonObject["id"].asString itemNames[id] = name.removeColor() +// if (id.lowercase().contains("redstone")) { + if (jsonObject.has("npc_sell_price")) { +// println(" ") +// println("name: $name") +// println("id: $id") + val npcPrice = jsonObject["npc_sell_price"].asDouble +// println("npcPrice: $npcPrice") + npcPrices[id] = npcPrice + } +// println("jsonObject: $jsonObject") +// } } currentlyUpdating = false return true @@ -94,7 +111,8 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa val itemName = getItemName(apiName) if (itemName == null) { - LorenzUtils.warning("§c[SkyHanni] bazaar item '$apiName' not found! Try restarting your minecraft to fix this.") + LorenzUtils.warning("§c[SkyHanni] bazaar item '$apiName' not found!") + resetItemNames() continue } @@ -109,7 +127,18 @@ internal class BazaarDataGrabber(private var bazaarMap: MutableMap<String, Bazaa apiName = text } - val data = BazaarData(apiName, itemName, sellPrice, buyPrice, buyMovingWeek, sellMovingWeek) + val npcPrice = npcPrices[apiName] ?: -1.0 +// if (npcPrice == -1.0) { +// if (apiName.lowercase().contains("carrot")) { +// println(" ") +// println("BazaarData") +// println("itemName: '$itemName'") +// println("apiName: '$apiName'") +// println("npc price: $npcPrice") +// } +// } + + val data = BazaarData(apiName, itemName, sellPrice, buyPrice, npcPrice, buyMovingWeek, sellMovingWeek) bazaarMap[itemName] = data } BazaarUpdateEvent(bazaarMap).postAndCatch() |
