From 5882e9178278c942d4ee03eea58e3d5ef6af357b Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 7 Jun 2024 13:07:53 +1000 Subject: Backend: Remove deprecated BazaarData values (#1987) --- .../skyhanni/features/combat/ghostcounter/GhostCounter.kt | 6 +++--- .../skyhanni/features/garden/farming/CropMoneyDisplay.kt | 10 +++++----- .../skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt | 2 +- .../hannibal2/skyhanni/features/inventory/bazaar/BazaarData.kt | 4 ---- .../skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt | 2 +- .../at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt | 4 ++-- 6 files changed, 12 insertions(+), 16 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 5fdc1077e..af666b5f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -264,10 +264,10 @@ object GhostCounter { addAsSingletonList(etaFormatting.base.formatText(eta).formatText(killETA)) val rate = 0.12 * (1 + (avgMagicFind.toDouble() / 100)) - val sorrowValue = SORROW.getBazaarData()?.buyPrice?.toLong() ?: 0L + val sorrowValue = SORROW.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L val final: String = (killInterp * sorrowValue * (rate / 100)).toLong().addSeparators() - val plasmaValue = PLASMA.getBazaarData()?.buyPrice?.toLong() ?: 0L - val voltaValue = VOLTA.getBazaarData()?.buyPrice?.toLong() ?: 0L + val plasmaValue = PLASMA.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L + val voltaValue = VOLTA.getBazaarData()?.sellOfferPrice?.toLong() ?: 0L var moneyMade: Long = 0 val priceMap = listOf( Triple("Sorrow", Option.SORROWCOUNT.getInt(), sorrowValue), 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 40509d97c..97a63928c 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 @@ -160,7 +160,7 @@ object CropMoneyDisplay { } val bazaarData = internalName.getBazaarData() val price = - if (LorenzUtils.noTradeMode || bazaarData == null) internalName.getNpcPrice() / 160 else (bazaarData.sellPrice + bazaarData.buyPrice) / 320 + if (LorenzUtils.noTradeMode || bazaarData == null) internalName.getNpcPrice() / 160 else (bazaarData.instantBuyPrice + bazaarData.sellOfferPrice) / 320 extraDicerCoins = 60 * 60 * GardenCropSpeed.getRecentBPS() * dicerDrops * price } @@ -343,8 +343,8 @@ object CropMoneyDisplay { val bazaarData = internalName.getBazaarData() ?: continue var npcPrice = internalName.getNpcPrice() * cropsPerHour - var sellOffer = bazaarData.buyPrice * cropsPerHour - var instantSell = bazaarData.sellPrice * cropsPerHour + var sellOffer = bazaarData.sellOfferPrice * cropsPerHour + var instantSell = bazaarData.instantBuyPrice * cropsPerHour if (debug) { debugList.addAsSingletonList(" npcPrice: ${npcPrice.addSeparators()}") debugList.addAsSingletonList(" sellOffer: ${sellOffer.addSeparators()}") @@ -363,8 +363,8 @@ object CropMoneyDisplay { } val factor = NEUItems.getPrimitiveMultiplier(internalName).amount npcPrice += "SEEDS".asInternalName().getNpcPrice() * seedsPerHour / factor - sellOffer += it.buyPrice * seedsPerHour - instantSell += it.sellPrice * seedsPerHour + sellOffer += it.sellOfferPrice * seedsPerHour + instantSell += it.instantBuyPrice * seedsPerHour } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt index 775432866..b2ab56be6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt @@ -59,7 +59,7 @@ object BazaarBestSellMethod { if (having <= 0) return "" val data = internalName.getBazaarDataOrError() - val totalDiff = (data.buyPrice - data.sellPrice) * having + val totalDiff = (data.sellOfferPrice - data.instantBuyPrice) * having val result = NumberUtil.format(totalDiff.toInt()) val name = internalName.itemName diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarData.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarData.kt index db97d5e6b..21fdddfaf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarData.kt @@ -7,8 +7,4 @@ data class BazaarData( val sellOfferPrice: Double, val instantBuyPrice: Double, val product: BazaarProduct, - @Deprecated("outdated", ReplaceWith("instantBuyPrice")) - val sellPrice: Double = instantBuyPrice, - @Deprecated("outdated", ReplaceWith("sellOfferPrice")) - val buyPrice: Double = sellOfferPrice, ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt index 373b866f2..3522eb735 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarOrderHelper.kt @@ -76,7 +76,7 @@ class BazaarOrderHelper { pricePattern.matchMatcher(line) { val price = group("number").formatDouble() - if (buyOrSell.first && price < data.sellPrice || buyOrSell.second && price > data.buyPrice) { + if (buyOrSell.first && price < data.instantBuyPrice || buyOrSell.second && price > data.sellOfferPrice) { slot highlight LorenzColor.GOLD return } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt index 51a0e4f65..beceaf8f9 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniTracker.kt @@ -41,8 +41,8 @@ open class SkyHanniTracker( private val storedTrackers get() = SkyHanniMod.feature.storage.trackerDisplayModes fun getPricePer(name: NEUInternalName) = when (config.priceFrom) { - PriceFromEntry.INSTANT_SELL -> name.getBazaarData()?.sellPrice ?: name.getPriceOrNull() ?: 0.0 - PriceFromEntry.SELL_OFFER -> name.getBazaarData()?.buyPrice ?: name.getPriceOrNull() ?: 0.0 + PriceFromEntry.INSTANT_SELL -> name.getBazaarData()?.instantBuyPrice ?: name.getPriceOrNull() ?: 0.0 + PriceFromEntry.SELL_OFFER -> name.getBazaarData()?.sellOfferPrice ?: name.getPriceOrNull() ?: 0.0 else -> name.getNpcPriceOrNull() ?: 0.0 } -- cgit