diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt | 17 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt index b855a49c8..614dcb7e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorFeatures.kt @@ -4,12 +4,12 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.misc.TrevorTheTrapperConfig.TrackerEntry import at.hannibal2.skyhanni.data.IslandType -import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.CheckRenderEntityEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed @@ -34,6 +34,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.findMatcher import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.getLorenzVec @@ -84,6 +85,10 @@ object TrevorFeatures { "clickoption", "Click an option: §r§a§l\\[YES]§r§7 - §r§c§l\\[NO]" ) + private val areaTrappersDenPattern by patternGroup.pattern( + "area.trappersden", + "Trapper's Den" + ) private var timeUntilNextReady = 0 private var trapperReady: Boolean = true @@ -98,6 +103,7 @@ object TrevorFeatures { var questActive = false var inBetweenQuests = false + var inTrapperDen = false private val config get() = SkyHanniMod.feature.misc.trevorTheTrapper @@ -302,7 +308,7 @@ object TrevorFeatures { @SubscribeEvent(priority = EventPriority.HIGHEST) fun onCheckRender(event: CheckRenderEntityEvent<*>) { - if (!inTrapperDen()) return + if (!inTrapperDen) return if (!config.trapperTalkCooldown) return val entity = event.entity if (entity is EntityArmorStand && entity.name == "§e§lCLICK") { @@ -323,6 +329,11 @@ object TrevorFeatures { resetTrapper() } + @SubscribeEvent + fun onTick(event: LorenzTickEvent) { + inTrapperDen = areaTrappersDenPattern.matches(LorenzUtils.skyBlockArea) + } + enum class TrapperStatus(baseColor: LorenzColor) { READY(LorenzColor.DARK_GREEN), WAITING(LorenzColor.DARK_AQUA), @@ -335,8 +346,6 @@ object TrevorFeatures { fun onFarmingIsland() = IslandType.THE_FARMING_ISLANDS.isInIsland() - fun inTrapperDen() = ScoreboardData.sidebarLinesFormatted.contains(" §7⏣ §bTrapper's Den") - @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { event.transform(11, "misc.trevorTheTrapper.textFormat") { element -> diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt index 73aee171e..cc3be8af7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/trevor/TrevorTracker.kt @@ -137,7 +137,7 @@ object TrevorTracker { private fun shouldDisplay(): Boolean { if (!config.dataTracker) return false if (!TrevorFeatures.onFarmingIsland()) return false - if (TrevorFeatures.inTrapperDen()) return true + if (TrevorFeatures.inTrapperDen) return true return when (config.displayType) { true -> (TrevorFeatures.inBetweenQuests || TrevorFeatures.questActive) else -> TrevorFeatures.questActive |