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 | |
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
8 files changed, 127 insertions, 24 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f2a55b112..6c6529d10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ + Added **Colored Name** - Show the visitor name in the color of the rarity. + Added **Visitor Item Preview** - Show the base type for the required items next to new visitors (Note that some visitors may require any crop) + Added **Teleport Pad Compact Name** - Hide the 'Warp to' and 'No Destination' texts over teleport pads. ++ Added Money per Hour Advanced stats - Show not only Sell Offer price but also Instant Sell price and NPC Sell price (Suggestion: Enable Compact Price as well for this) ### Features from other Mods diff --git a/FEATURES.md b/FEATURES.md index ba9941109..8795883e0 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -49,7 +49,7 @@ - Set stack number for specific items (stars for crimson armor, minion tier, pet level, new year cake, for golden and diamond dungeon heads the floor number, the tier of master skull and master star, kuudra keys, skill level, and collection level) - Sack name (show short name of sacks) - Anvil Combine Helper (When putting an enchanted book into the first slot of the anvil, all items with the same enchantment are highlighted in the inventory) -- Added compact star counter on all items (not only on items with dungeon stars and master stars but also on crimson armors, cloaks and fishing rods) +- compact star counter on all items (not only on items with dungeon stars and master stars but also on crimson armors, cloaks and fishing rods) - RNG meter features (in the catacombs RNG meter inventory show the dungeon floor number and highlight floors without a drop selected and highlighting the selected drop in the RNG meter inventory for slayer or catacombs) + Show the tuning stats in the Thaumaturgy inventory. + Show the amount of selected tuning points in the stats tuning inventory. @@ -190,12 +190,13 @@ + Farming contest timer. + Wrong fungi cutter mode warning. + Show the price per garden experience inside the visitor gui. -+ Support for mushroom cow pet perk. (Counting and updating mushroom collection when breaking crops with mushroom blocks, added extra gui for time till crop milestones) ++ Support for mushroom cow pet perk. (Counting and updating mushroom collection when breaking crops with mushroom blocks, extra gui for time till crop milestones) + Blocks/Second display in crop milestone gui. + Farming armor drops counter + **Colored Name** - Show the visitor name in the color of the rarity. + **Visitor Item Preview** - Show the base type for the required items next to new visitors (Note that some visitors may require any crop) -+ Added **Teleport Pad Compact Name** - Hide the 'Warp to' and 'No Destination' texts over teleport pads. ++ **Teleport Pad Compact Name** - Hide the 'Warp to' and 'No Destination' texts over teleport pads. ++ Money per Hour Advanced stats - Show not only Sell Offer price but also Instant Sell price and NPC Sell price (Suggestion: Enable Compact Price as well for this) ## Commands - /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki) diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 048f4968a..179104aaf 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnabl import at.hannibal2.skyhanni.config.core.GuiScreenElementWrapper import at.hannibal2.skyhanni.data.ApiDataLoader import at.hannibal2.skyhanni.data.GuiEditManager +import at.hannibal2.skyhanni.features.bazaar.BazaarDataGrabber import at.hannibal2.skyhanni.features.bingo.BingoCardDisplay import at.hannibal2.skyhanni.features.bingo.BingoNextStepHelper import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper @@ -54,6 +55,7 @@ object Commands { registerCommand("shprintbingohelper") { BingoNextStepHelper.command() } registerCommand("shsetapikey") { ApiDataLoader.command(it) } registerCommand("shtestgardenvisitors") { LorenzTest.testGardenVisitors() } + registerCommand("shresetitemnames") { BazaarDataGrabber.resetItemNames() } } private fun registerCommand(name: String, function: (Array<String>) -> Unit) { diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java index 06056903e..528eb7966 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java @@ -510,6 +510,13 @@ public class Garden { @ConfigEditorBoolean @ConfigAccordionId(id = 13) public boolean moneyPerHourCompactPrice = false; + @Expose + @ConfigOption( + name = "Advanced stats", + desc = "Show not only Sell Offer price but also Instant Sell price and NPC Sell price.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 13) + public boolean moneyPerHourAdvancedStats = false; @Expose // @ConfigOption(name = "Money per hour Position", desc = "") 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() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt index d004befd8..094f890a0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt @@ -60,20 +60,31 @@ class CropMoneyDisplay { val newDisplay = mutableListOf<List<Any>>() val title = if (config.moneyPerHourCompact) { - Collections.singletonList("§7Money/hour:") + "§7Money/hour:" } else { - Collections.singletonList("§7Money per hour when selling:") + "§7Money per hour when selling:" } if (!ready) { - newDisplay.add(title) + newDisplay.add(Collections.singletonList(title)) newDisplay.add(Collections.singletonList("§eLoading...")) return newDisplay } if (!hasCropInHand && !config.moneyPerHourAlwaysOn) return newDisplay - newDisplay.add(title) + + newDisplay.add( + Collections.singletonList( + if (config.moneyPerHourAdvancedStats) { + "$title §7(§eSell Offer§7/§eInstant Sell§7/§eNpc Price§7)" + } else if (LorenzUtils.noTradeMode) { + "$title §7(§eNpc Price§7)" + } else { + "$title §7(§eSell Offer§7)" + } + ) + ) val moneyPerHourData = calculateMoneyPerHour() if (moneyPerHourData.isEmpty()) { @@ -91,7 +102,15 @@ class CropMoneyDisplay { } var number = 0 - for ((internalName, moneyPerHour) in moneyPerHourData.sortedDesc()) { + + +// val help = moneyPerHourData.map { it.key to it.value.max() } + val help = mutableMapOf<String, Double>() + for ((name, array) in moneyPerHourData) { + help[name] = array.max() + } + + for (internalName in help.sortedDesc().keys) { number++ val cropName = cropNames[internalName]!! val isCurrent = cropName == GardenAPI.cropInHand @@ -115,13 +134,24 @@ class CropMoneyDisplay { list.add("$currentColor$contestFormat$itemName§7: ") } - - val format = if (config.moneyPerHourCompactPrice) { - NumberUtil.format(moneyPerHour) + val coinsColor = if (isCurrent && config.moneyPerHourCompact) "§e" else "§6" + val moneyArray = moneyPerHourData[internalName]!! + if (config.moneyPerHourAdvancedStats) { + for (price in moneyArray) { + val format = format(price) + list.add("$coinsColor$format") + list.add("§7/") + } + list.removeLast() + } else if (LorenzUtils.noTradeMode) { + // Show npc price + val format = format(moneyArray[2]) + list.add("$coinsColor$format") } else { - LorenzUtils.formatInteger(moneyPerHour.toLong()) + val format = format(moneyArray[0]) + list.add("$coinsColor$format") } - list.add("§6$format") + newDisplay.add(list) } @@ -129,22 +159,35 @@ class CropMoneyDisplay { return newDisplay } - private fun calculateMoneyPerHour(): Map<String, Double> { - val moneyPerHours = mutableMapOf<String, Double>() + private fun format(moneyPerHour: Double) = if (config.moneyPerHourCompactPrice) { + NumberUtil.format(moneyPerHour) + } else { + LorenzUtils.formatInteger(moneyPerHour.toLong()) + } + + // sell offer -> instant sell -> npc + private fun calculateMoneyPerHour(): Map<String, Array<Double>> { + val moneyPerHours = mutableMapOf<String, Array<Double>>() for ((internalName, amount) in multipliers) { - val price = NEUItems.getPrice(internalName) val crop = cropNames[internalName]!! val speed = crop.getSpeed() // No speed data for item in hand if (speed == -1) continue - // Price not found - if (price == -1.0) continue - val speedPerHr = speed.toDouble() * 60 * 60 val blocksPerHour = speedPerHr / amount.toDouble() - val moneyPerHour = price * blocksPerHour - moneyPerHours[internalName] = moneyPerHour + + val bazaarData = BazaarApi.getBazaarDataForInternalName(internalName) ?: continue + + val npcPrice = bazaarData.npcPrice * blocksPerHour +// if (LorenzUtils.noTradeMode) { +// moneyPerHours[internalName] = arrayOf(npcPrice) +// } else { + val sellOffer = bazaarData.buyPrice * blocksPerHour + val instantSell = bazaarData.sellPrice * blocksPerHour + moneyPerHours[internalName] = arrayOf(sellOffer, instantSell, npcPrice) +// } + } return moneyPerHours } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 8633dcadd..1ce7c9e22 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -1,5 +1,6 @@ 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 @@ -41,6 +42,17 @@ object NEUItems { } 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 + } + val result = manager.auctionManager.getBazaarOrBin(internalName, useSellingPrice) // TODO remove workaround if (result == -1.0) { |