diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 18:55:26 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-04-15 18:55:26 +0200 |
commit | d9b4dbfb8a3cdc6f869d740af9b0e38b44ecea2d (patch) | |
tree | 90cfcb468f7498bbdcde76fd9e50ed401c3ef74e /src | |
parent | 50de0411385ff51f2ff753630054aa2ea3d4d7ff (diff) | |
download | skyhanni-d9b4dbfb8a3cdc6f869d740af9b0e38b44ecea2d.tar.gz skyhanni-d9b4dbfb8a3cdc6f869d740af9b0e38b44ecea2d.tar.bz2 skyhanni-d9b4dbfb8a3cdc6f869d740af9b0e38b44ecea2d.zip |
When only the NPC price is shown, display the price exclusively for the base item
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index 26ddd50c0..5757a5c61 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -114,7 +114,7 @@ class CropMoneyDisplay { } try { - if (internalName == "ENCHANTED_SEEDS") { + if (isSeeds(internalName)) { list.add(NEUItems.getItemStack("BOX_OF_SEEDS")) } else { list.add(NEUItems.getItemStack(internalName)) @@ -189,11 +189,25 @@ class CropMoneyDisplay { var seedsPrice: BazaarData? = null var seedsPerHour = 0.0 - for ((internalName, amount) in multipliers.moveEntryToTop { it.key == "ENCHANTED_SEEDS" }) { + val onlyNpcPrice = (!config.moneyPerHourUseCustomFormat && LorenzUtils.noTradeMode) || + (config.moneyPerHourUseCustomFormat && config.moneyPerHourCustomFormat.size == 1 + && config.moneyPerHourCustomFormat[0] == 2) + + for ((internalName, amount) in multipliers.moveEntryToTop { isSeeds(it.key) }) { val crop = cropNames[internalName]!! + // When only the NPC price is shown, display the price exclusively for the base item + if (onlyNpcPrice) { + if (amount != 1) continue + } else { + if (amount < 10) { + continue + } + } + var speed = crop.getSpeed().toDouble() if (speed == -1.0) continue - val isSeeds = internalName == "ENCHANTED_SEEDS" + + val isSeeds = isSeeds(internalName) if (isSeeds) speed *= 1.36 if (crop.replenish) { val blockPerSecond = crop.multiplier * 20 @@ -228,6 +242,8 @@ class CropMoneyDisplay { return moneyPerHours } + private fun isSeeds(internalName: String) = (internalName == "ENCHANTED_SEEDS" || internalName == "SEEDS") + private fun formatNumbers(sellOffer: Double, instantSell: Double, npcPrice: Double): Array<Double> { return if (config.moneyPerHourUseCustomFormat) { val map = mapOf( @@ -253,12 +269,6 @@ class CropMoneyDisplay { private fun init() { if (loaded) return - - if (BazaarApi.bazaarMap.isEmpty()) { - LorenzUtils.debug("bz not ready for money/time!") - return - } - loaded = true SkyHanniMod.coroutineScope.launch { @@ -269,7 +279,6 @@ class CropMoneyDisplay { if (internalName == "ENCHANTED_BREAD") continue val (newId, amount) = NEUItems.getMultiplier(internalName) - if (amount < 10) continue val itemName = NEUItems.getItemStack(newId).name?.removeColor() ?: continue val crop = CropType.getByItemName(itemName) crop?.let { |