From 2401ee92eb0bfbcf389f71c21f68eda7f1660cfa Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sat, 6 Jan 2024 12:02:58 +0100 Subject: Added options to only show vermin tracker with vacuum on inventory an… (#842) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added options to only show rift vermin tracker with vacuum on inventory and only in west village. #842 --- .../rift/area/westvillage/VerminTrackerConfig.java | 12 ++++++++++++ .../rift/area/westvillage/VerminTracker.kt | 22 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/VerminTrackerConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/VerminTrackerConfig.java index 1fa5833d2..59a54b744 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/VerminTrackerConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/VerminTrackerConfig.java @@ -13,6 +13,18 @@ public class VerminTrackerConfig { @FeatureToggle public boolean enabled = true; + @Expose + @ConfigOption(name = "Show Outside West Village", desc = "Show the Vermin Tracker in other areas of The Rift.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showOutsideWestVillage = false; + + @Expose + @ConfigOption(name = "Show without Vacuum", desc = "Requires you to have Turbomax Vacuum in your inventory.") + @ConfigEditorBoolean + @FeatureToggle + public boolean showWithoutVacuum = false; + @Expose @ConfigOption(name = "Hide Chat", desc = "Hide the chat message when vacuuming a vermin.") @ConfigEditorBoolean diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt index 1f2b38122..55ce4886e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt @@ -3,10 +3,12 @@ package at.hannibal2.skyhanni.features.rift.area.westvillage import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName @@ -28,6 +30,8 @@ object VerminTracker { private val flyPattern by group.pattern("fly", ".*§eYou vacuumed a §.*Fly.*") private val verminBinPattern by group.pattern("binline", "§fVermin Bin: §\\w(?\\d+) (?\\w+)") private val verminBagPattern by group.pattern("bagline", "§fVacuum Bag: §\\w(?\\d+) (?\\w+)") + private var hasVacuum = false + private val TURBOMAX_VACUUM = "TURBOMAX_VACUUM".asInternalName() private val config get() = RiftAPI.config.area.westVillage.verminTracker @@ -49,6 +53,19 @@ object VerminTracker { FLY("§aFlies", flyPattern), } + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + if (!RiftAPI.inRift()) return + if (event.repeatSeconds(1)) { + checkVacuum() + } + } + + private fun checkVacuum() { + hasVacuum = InventoryUtils.getItemsInOwnInventory() + .any { it.getInternalName() == TURBOMAX_VACUUM} + } + @SubscribeEvent fun onChat(event: LorenzChatEvent) { VerminType.entries.forEach { verminType -> @@ -68,7 +85,7 @@ object VerminTracker { val bin = event.inventoryItems[13]?.getLore() ?: return val bag = InventoryUtils.getItemsInOwnInventory() - .firstOrNull { it.getInternalName() == "TURBOMAX_VACUUM".asInternalName() } + .firstOrNull { it.getInternalName() == TURBOMAX_VACUUM } ?.getLore() ?: emptyList() val binCounts = countVermin(bin, verminBinPattern) @@ -125,6 +142,9 @@ object VerminTracker { @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { if (!isEnabled()) return + if (!config.showOutsideWestVillage && + !LorenzUtils.skyBlockArea.let { it == "Infested House" || it == "West Village" }) return + if (!config.showWithoutVacuum && !hasVacuum) return tracker.renderDisplay(config.position) } -- cgit