Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Guardian warn text #2718

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.inventory.experimentationtable

import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.PetAPI
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.InventoryUpdatedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
Expand Down Expand Up @@ -169,8 +170,10 @@ object ExperimentationTableAPI {
* REGEX-TEST: §dGuardian
* REGEX-TEST: §9Guardian§e
*/
val petNamePattern by patternGroup.pattern(
private val petNamePattern by patternGroup.pattern(
"guardianpet",
"§[956d]Guardian.*",
)

fun hasGuardianPet(): Boolean = petNamePattern.matches(PetAPI.currentPet)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.features.inventory.experimentationtable

import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.PetAPI
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
Expand All @@ -12,7 +11,6 @@ import at.hannibal2.skyhanni.utils.DelayedRun
import at.hannibal2.skyhanni.utils.HypixelCommands
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.RenderUtils
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SoundUtils
Expand All @@ -31,7 +29,6 @@ object GuardianReminder {

private val config get() = SkyHanniMod.feature.inventory.experimentationTable
private var lastInventoryOpen = SimpleTimeMark.farPast()
private var lastWarn = SimpleTimeMark.farPast()
private var lastErrorSound = SimpleTimeMark.farPast()

@SubscribeEvent
Expand All @@ -44,10 +41,7 @@ object GuardianReminder {
}

private fun warn() {
if (ExperimentationTableAPI.petNamePattern.matches(PetAPI.currentPet)) return

if (lastWarn.passedSince() < 5.seconds) return
lastWarn = SimpleTimeMark.now()
if (ExperimentationTableAPI.hasGuardianPet()) return

ChatUtils.clickToActionOrDisable(
"Use a §9§lGuardian Pet §efor more Exp in the Experimentation Table.",
Expand All @@ -62,6 +56,7 @@ object GuardianReminder {
if (!isEnabled()) return
if (InventoryUtils.openInventoryName() != "Experimentation Table") return
if (lastInventoryOpen.passedSince() > 2.seconds) return
if (ExperimentationTableAPI.hasGuardianPet()) return
val gui = Minecraft.getMinecraft().currentScreen as? GuiContainer ?: return

sendTitle(gui.width, gui.height)
Expand Down
Loading