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/garden | |
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/garden')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/CropMoneyDisplay.kt | 79 |
1 files changed, 61 insertions, 18 deletions
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 } |