From 783c4f380b02b50b43801c44f8c189d9ad546bc6 Mon Sep 17 00:00:00 2001 From: Trîggered <57991380+Triggered0@users.noreply.github.com> Date: Sun, 9 Jun 2024 09:55:29 +0300 Subject: Feature: Skymart Copper Price Bazaar Options (#2030) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../config/features/garden/SkyMartConfig.java | 23 ++++++++++++++++++++++ .../garden/inventory/SkyMartCopperPrice.kt | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/garden/SkyMartConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/garden/SkyMartConfig.java index 095c3733c..b477d2329 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/garden/SkyMartConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/garden/SkyMartConfig.java @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.FeatureToggle; import at.hannibal2.skyhanni.config.core.config.Position; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; @@ -23,4 +24,26 @@ public class SkyMartConfig { @Expose @ConfigLink(owner = SkyMartConfig.class, field = "copperPrice") public Position copperPricePos = new Position(211, 132, false, true); + + @Expose + @ConfigOption(name = "Overlay Price", desc = "Toggle for Bazaar 'sell order' vs 'instant sell' price in copper price overlay.") + @ConfigEditorDropdown + public OverlayPriceTypeEntry overlayPriceType = OverlayPriceTypeEntry.INSTANT_SELL; + + public enum OverlayPriceTypeEntry { + INSTANT_SELL("Instant Sell"), + SELL_ORDER("Sell Order"), + ; + private final String str; + + + OverlayPriceTypeEntry(String str) { + this.str = str; + } + + @Override + public String toString() { + return str; + } + } } 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 c01998cd4..625216f85 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,6 +1,7 @@ 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 @@ -55,7 +56,8 @@ object SkyMartCopperPrice { } ?: continue val internalName = item.getInternalName() - val itemPrice = internalName.getPriceOrNull() ?: continue + val useSellPrice = config.overlayPriceType == SkyMartConfig.OverlayPriceTypeEntry.SELL_ORDER + val itemPrice = internalName.getPriceOrNull(useSellPrice) ?: continue val profit = itemPrice - (otherItemsPrice ?: 0.0) val factor = profit / copper -- cgit