summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-07-15 16:45:09 +0200
committerGitHub <noreply@github.com>2024-07-15 16:45:09 +0200
commitad7c6dfc824bb7d2b1405ec5f7c0a017612bbf2f (patch)
tree4a9786dd9c2578d0063ccd179200f04b612d7e35 /src/main/java/at/hannibal2/skyhanni/features/garden
parenta716e5d26a6ae6c79300c298c221382fb73e21a8 (diff)
downloadskyhanni-ad7c6dfc824bb7d2b1405ec5f7c0a017612bbf2f.tar.gz
skyhanni-ad7c6dfc824bb7d2b1405ec5f7c0a017612bbf2f.tar.bz2
skyhanni-ad7c6dfc824bb7d2b1405ec5f7c0a017612bbf2f.zip
Fix: price source inconsistencies (bz sell/buy and npc price) (#2221)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt4
2 files changed, 2 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
index 303fd7464..8ed772ea3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt
@@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.features.garden.composter
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig
-import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.OverlayPriceTypeEntry
import at.hannibal2.skyhanni.config.features.garden.composter.ComposterConfig.RetrieveFromEntry
import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull
import at.hannibal2.skyhanni.data.jsonobjects.repo.GardenJson
@@ -535,8 +534,7 @@ object ComposterOverlay {
}
private fun getPrice(internalName: NEUInternalName): Double {
- val useSellPrice = config.overlayPriceType == ComposterConfig.OverlayPriceTypeEntry.BUY_ORDER
- val price = internalName.getPrice(useSellPrice)
+ val price = internalName.getPrice(config.priceSource)
if (internalName.equals("BIOFUEL") && price > 20_000) return 20_000.0
return price
@@ -622,9 +620,6 @@ object ComposterOverlay {
event.move(3, "garden.composterOverlayOrganicMatterPos", "garden.composters.overlayOrganicMatterPos")
event.move(3, "garden.composterOverlayFuelExtrasPos", "garden.composters.overlayFuelExtrasPos")
event.move(3, "garden.composterRoundDown", "garden.composters.roundDown")
- event.transform(15, "garden.composters.overlayPriceType") { element ->
- ConfigUtils.migrateIntToEnum(element, OverlayPriceTypeEntry::class.java)
- }
event.transform(15, "garden.composters.retrieveFrom") { element ->
ConfigUtils.migrateIntToEnum(element, RetrieveFromEntry::class.java)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
index b2575c88d..5ef150907 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt
@@ -1,7 +1,6 @@
package at.hannibal2.skyhanni.features.garden.inventory
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
-import at.hannibal2.skyhanni.config.features.garden.SkyMartConfig
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
@@ -56,8 +55,7 @@ object SkyMartCopperPrice {
} ?: continue
val internalName = item.getInternalName()
- val useSellPrice = config.overlayPriceType == SkyMartConfig.OverlayPriceTypeEntry.SELL_ORDER
- val itemPrice = internalName.getPriceOrNull(useSellPrice) ?: continue
+ val itemPrice = internalName.getPriceOrNull(config.priceSource) ?: continue
val profit = itemPrice - (otherItemsPrice ?: 0.0)
val factor = profit / copper