diff options
author | nea <nea@nea.moe> | 2023-03-14 22:22:18 +0100 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-03-14 22:22:18 +0100 |
commit | 4d22c1e86721e6f3765505aa68984bc709c78fe5 (patch) | |
tree | 8008426f0c6dac49c7bce6986cf12608da9f7c50 /src/main | |
parent | 86cd165c1ad9a72567cf5d033a8ff92779f72b30 (diff) | |
download | NotEnoughUpdates-4d22c1e86721e6f3765505aa68984bc709c78fe5.tar.gz NotEnoughUpdates-4d22c1e86721e6f3765505aa68984bc709c78fe5.tar.bz2 NotEnoughUpdates-4d22c1e86721e6f3765505aa68984bc709c78fe5.zip |
Check for buyback slots in npc shop exporterselectivebuttons
Diffstat (limited to 'src/main')
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java b/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java index 90ef93bb..ab1a6516 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/customtypes/NEUDebugFlag.java @@ -32,6 +32,7 @@ public enum NEUDebugFlag { MAP("Dungeon Map Player Information"), SEARCH("SearchString Matches"), API_CACHE("Api Cache"), + ALWAYS_EXPORT_SHOPS("Always export shops even without buy back slot"), ; private final String description; diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/generators/ItemShopExporter.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/generators/ItemShopExporter.kt index e2673125..9cf98e25 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/generators/ItemShopExporter.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/recipes/generators/ItemShopExporter.kt @@ -20,6 +20,7 @@ package io.github.moulberry.notenoughupdates.recipes.generators import com.google.auto.service.AutoService +import io.github.moulberry.notenoughupdates.options.customtypes.NEUDebugFlag import io.github.moulberry.notenoughupdates.recipes.Ingredient import io.github.moulberry.notenoughupdates.recipes.ItemShopRecipe import io.github.moulberry.notenoughupdates.util.ItemUtils @@ -131,7 +132,14 @@ class ItemShopExporter : RepoExporter { } override fun canExport(gui: GuiScreen): Boolean { - return gui is GuiChest + if (NEUDebugFlag.ALWAYS_EXPORT_SHOPS.isSet) return true + if (gui !is GuiChest) return false + val buyBackSlot = 4 + 9 * 5 + val stacks = gui.inventorySlots.inventory + if (buyBackSlot !in stacks.indices) return false + val buyBackStack = stacks[buyBackSlot] ?: return false + return Utils.cleanColour(buyBackStack.displayName) == "Sell Item" || + ItemUtils.getLore(buyBackStack).any { Utils.cleanColour(it) == "Click to buyback!" } } override val name: String |