aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorEmpa <42304516+ItsEmpa@users.noreply.github.com>2024-01-06 12:02:58 +0100
committerGitHub <noreply@github.com>2024-01-06 12:02:58 +0100
commit2401ee92eb0bfbcf389f71c21f68eda7f1660cfa (patch)
treeec523772980046bc5416991ae1377b9840535f6c /src/main
parentc80872349035fb8951a995ccdf8b9f74bbb50bf7 (diff)
downloadskyhanni-2401ee92eb0bfbcf389f71c21f68eda7f1660cfa.tar.gz
skyhanni-2401ee92eb0bfbcf389f71c21f68eda7f1660cfa.tar.bz2
skyhanni-2401ee92eb0bfbcf389f71c21f68eda7f1660cfa.zip
Added options to only show vermin tracker with vacuum on inventory an… (#842)
Added options to only show rift vermin tracker with vacuum on inventory and only in west village. #842
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/rift/area/westvillage/VerminTrackerConfig.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/VerminTracker.kt22
2 files changed, 33 insertions, 1 deletions
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
@@ -14,6 +14,18 @@ public class VerminTrackerConfig {
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
@FeatureToggle
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(?<count>\\d+) (?<vermin>\\w+)")
private val verminBagPattern by group.pattern("bagline", "§fVacuum Bag: §\\w(?<count>\\d+) (?<vermin>\\w+)")
+ private var hasVacuum = false
+ private val TURBOMAX_VACUUM = "TURBOMAX_VACUUM".asInternalName()
private val config get() = RiftAPI.config.area.westVillage.verminTracker
@@ -50,6 +54,19 @@ object VerminTracker {
}
@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 ->
if (verminType.pattern.matches(event.message)) {
@@ -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)
}