aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-07-21 11:16:24 +0200
committerGitHub <noreply@github.com>2024-07-21 11:16:24 +0200
commita2266a87073622b6547b3704f7ad81de0f6cb5b2 (patch)
treeb7a60b39c13bdc1443ab2f007cb8d3a8e2a9f512 /src/main/java/at
parentbad8528b29b16c3b901fb17e19cb932d67fdca46 (diff)
downloadskyhanni-a2266a87073622b6547b3704f7ad81de0f6cb5b2.tar.gz
skyhanni-a2266a87073622b6547b3704f7ad81de0f6cb5b2.tar.bz2
skyhanni-a2266a87073622b6547b3704f7ad81de0f6cb5b2.zip
Fix: Slayer detection (#2232)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
index a5f8af5c7..52afc0256 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -61,20 +61,21 @@ object SlayerQuestWarning {
private fun getSlayerData() = if (RiftAPI.inRift()) outsideRiftData else insideRiftData
+ private fun String.inCombat() = contains("Combat") || contains("Kills")
+ private fun String.inBoss() = this == "Slay the boss!"
+ private fun String?.bossSlain() = this == "Boss slain!"
+ private fun String.noSlayer() = this == "no slayer"
+
private fun change(old: String, new: String) {
- if (new.contains("Combat")) {
- if (!old.contains("Combat")) {
- needSlayerQuest = false
- }
+ if (!old.inCombat() && new.inCombat()) {
+ needSlayerQuest = false
}
- if (new == "no slayer") {
- if (old == "Slay the boss!") {
- needNewQuest("The old slayer quest has failed!")
- }
+ if (old.inBoss() && new.noSlayer()) {
+ needNewQuest("The old slayer quest has failed!")
}
- if (new == "Boss slain!") {
+ if (new.bossSlain()) {
DelayedRun.runDelayed(2.seconds) {
- if (getSlayerData().currentSlayerState == "Boss slain!") {
+ if (getSlayerData().currentSlayerState.bossSlain()) {
needNewQuest("You have no Auto-Slayer active!")
}
}
@@ -133,7 +134,7 @@ object SlayerQuestWarning {
SlayerAPI.latestWrongAreaWarning = SimpleTimeMark.now()
warn(
"Wrong Slayer!",
- "Wrong slayer selected! You have $activeSlayerName selected and you are in an $slayerName area!"
+ "Wrong slayer selected! You have $activeSlayerName selected and you are in an $slayerName area!",
)
}
}