From 097f314f95960c565f076d76f176721fa7c8c445 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:57:08 +0200 Subject: Fixed slayer profit tracker showing bz/ah price as npc price. --- .../skyhanni/features/slayer/SlayerItemProfitTracker.kt | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt index a4d18aaa9..cd286beab 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerItemProfitTracker.kt @@ -14,7 +14,6 @@ import at.hannibal2.skyhanni.events.SackChangeEvent import at.hannibal2.skyhanni.events.SlayerChangeEvent import at.hannibal2.skyhanni.events.SlayerQuestCompleteEvent import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData -import at.hannibal2.skyhanni.features.bazaar.BazaarData import at.hannibal2.skyhanni.test.PriceSource import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull import at.hannibal2.skyhanni.utils.ItemUtils.name @@ -24,8 +23,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NEUItems.getNpcPrice -import at.hannibal2.skyhanni.utils.NEUItems.getPrice +import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull +import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -344,14 +343,11 @@ object SlayerItemProfitTracker { list.slayerCompletedCount = 0 } - private fun getPrice(internalName: NEUInternalName) = - internalName.getBazaarData()?.let { getPrice(internalName, it) } ?: internalName.getPrice() + private fun getPrice(internalName: NEUInternalName) = when (config.priceFrom) { + 0 -> internalName.getBazaarData()?.sellPrice ?: internalName.getPriceOrNull() ?: 0.0 + 1 -> internalName.getBazaarData()?.buyPrice ?: internalName.getPriceOrNull() ?: 0.0 - private fun getPrice(internalName: NEUInternalName, bazaarData: BazaarData) = when (config.priceFrom) { - 0 -> bazaarData.sellPrice - 1 -> bazaarData.buyPrice - - else -> internalName.getNpcPrice() + else -> internalName.getNpcPriceOrNull() ?: 0.0 } @SubscribeEvent -- cgit