aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt13
8 files changed, 32 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
index 9c2b4c1d6..f9020b77f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoNextStepHelper.kt
@@ -21,7 +21,6 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -38,6 +37,7 @@ class BingoNextStepHelper {
private val collectionPattern = "Reach (?<amount>[0-9]+(?:,\\d+)*) (?<name>.*) Collection\\.".toPattern()
private val crystalPattern = "Obtain a (?<name>\\w+) Crystal in the Crystal Hollows\\.".toPattern()
private val skillPattern = "Obtain level (?<level>.*) in the (?<skill>.*) Skill.".toPattern()
+ private val crystalFoundPattern = " *§r§5§l✦ CRYSTAL FOUND §r§7\\(.§r§7/5§r§7\\)".toPattern()
private val rhysTaskName = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)"
companion object {
@@ -136,7 +136,7 @@ class BingoNextStepHelper {
for (currentStep in currentSteps) {
if (currentStep is ObtainCrystalStep) {
- if (event.message.matchRegex(" *§r§5§l✦ CRYSTAL FOUND §r§7\\(.§r§7/5§r§7\\)")) {
+ crystalFoundPattern.matchMatcher(event.message) {
nextMessageIsCrystal = true
return
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt
index 5a3249ea3..0d39c0233 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt
@@ -16,7 +16,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth
import at.hannibal2.skyhanni.utils.LorenzUtils.derpy
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.LorenzVec
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.Entity
@@ -71,6 +71,8 @@ class MobFinder {
//F5
private var floor5lividEntity: EntityOtherPlayerMP? = null
private var floor5lividEntitySpawnTime = 0L
+ private val correctLividPattern =
+ "§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!".toPattern()
//F6
private var floor6Giants = false
@@ -587,7 +589,7 @@ class MobFinder {
}
}
- if (message.matchRegex("§c\\[BOSS] (.*) Livid§r§f: Impossible! How did you figure out which one I was\\?!")) {
+ correctLividPattern.matchMatcher(message) {
floor5lividEntity = null
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
index 6e5fc27bd..8602b9282 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonCleanEnd.kt
@@ -10,7 +10,7 @@ import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityOtherPlayerMP
import net.minecraft.entity.item.EntityArmorStand
@@ -20,6 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DungeonCleanEnd {
private val config get() = SkyHanniMod.feature.dungeon.cleanEnd
+ private val catacombsPattern = "([ ]*)§r§c(The|Master Mode) Catacombs §r§8- §r§eFloor (.*)".toPattern()
private var bossDone = false
private var chestsSpawned = false
@@ -32,7 +33,7 @@ class DungeonCleanEnd {
val message = event.message
- if (message.matchRegex("([ ]*)§r§c(The|Master Mode) Catacombs §r§8- §r§eFloor (.*)")) {
+ catacombsPattern.matchMatcher(message) {
chestsSpawned = true
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
index 5f611a587..db4443677 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -38,17 +38,18 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getBottleOfJyrreSeconds
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEdition
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ItemDisplayOverlayFeatures {
+ // TODO USE SH-REPO
private val config get() = SkyHanniMod.feature.inventory
// TODO repo
private val rancherBootsSpeedCapPattern = "§7Current Speed Cap: §a(?<cap>.*)".toPattern()
private val petLevelPattern = "\\[Lvl (?<level>.*)] .*".toPattern()
+ private val masterSkullPattern = "(.*)Master Skull - Tier .".toPattern()
private val gardenVacuumPatterm = "§7Vacuum Bag: §6(?<amount>\\d*) Pests?".toPattern()
private val harvestPattern = "§7§7You may harvest §6(?<amount>.).*".toPattern()
private val dungeonPotionPattern = "Dungeon (?<level>.*) Potion".toPattern()
@@ -75,8 +76,10 @@ object ItemDisplayOverlayFeatures {
}
}
- if (MASTER_SKULL_TIER.isSelected() && itemName.matchRegex("(.*)Master Skull - Tier .")) {
- return itemName.substring(itemName.length - 1)
+ if (MASTER_SKULL_TIER.isSelected()) {
+ masterSkullPattern.matchMatcher(itemName) {
+ return itemName.substring(itemName.length - 1)
+ }
}
if (DUNGEON_HEAD_FLOOR_NUMBER.isSelected() && (itemName.contains("Golden ") || itemName.contains("Diamond "))) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
index 1e19ca676..881c5c215 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/minion/MinionFeatures.kt
@@ -33,7 +33,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
import at.hannibal2.skyhanni.utils.SpecialColour
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.TimeUtils
import at.hannibal2.skyhanni.utils.getLorenzVec
import at.hannibal2.skyhanni.utils.toLorenzVec
@@ -61,6 +61,7 @@ class MinionFeatures {
private var lastInventoryClosed = 0L
private var coinsPerDay = ""
private val minionUpgradePattern = "§aYou have upgraded your Minion to Tier (?<tier>.*)".toPattern()
+ private val minionCoinPattern = "§aYou received §r§6(.*) coins§r§a!".toPattern()
@SubscribeEvent
fun onPlayerInteract(event: PlayerInteractEvent) {
@@ -253,11 +254,10 @@ class MinionFeatures {
if (LorenzUtils.skyBlockIsland != IslandType.PRIVATE_ISLAND) return
val message = event.message
- if (message.matchRegex("§aYou received §r§6(.*) coins§r§a!") && System.currentTimeMillis() - lastInventoryClosed < 2_000) {
+ if (minionCoinPattern.matches(message) && System.currentTimeMillis() - lastInventoryClosed < 2_000) {
minions?.get(lastMinion)?.let {
it.lastClicked = System.currentTimeMillis()
}
-
}
if (message.startsWith("§aYou picked up a minion!") && lastMinion != null) {
minions = minions?.editCopy { remove(lastMinion) }
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
index 5fd7a3b77..447884c05 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangFreezeCooldown.kt
@@ -8,13 +8,16 @@ import at.hannibal2.skyhanni.features.combat.damageindicator.BossType
import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.TimeUtils
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class AshfangFreezeCooldown {
private val config get() = SkyHanniMod.feature.crimsonIsle.ashfang
+ // TODO USE SH-REPO
+ private val cryogenicBlastPattern = "§cAshfang Follower's Cryogenic Blast hit you for (.*) damage!".toPattern()
+
private var lastHit = 0L
@SubscribeEvent
@@ -22,7 +25,7 @@ class AshfangFreezeCooldown {
if (!isEnabled()) return
val message = event.message
- if (message.matchRegex("§cAshfang Follower's Cryogenic Blast hit you for (.*) damage!")) {
+ cryogenicBlastPattern.matchMatcher(message) {
lastHit = System.currentTimeMillis()
}
}
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 df8c47740..52eb9f806 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerQuestWarning.kt
@@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.entity.EntityLivingBase
@@ -18,6 +18,7 @@ import kotlin.time.Duration.Companion.seconds
class SlayerQuestWarning {
private val config get() = SkyHanniMod.feature.slayer
+ private val talkToMaddoxPattern = " {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!".toPattern()
private var needSlayerQuest = false
private var lastWarning = 0L
private var currentReason = ""
@@ -43,7 +44,7 @@ class SlayerQuestWarning {
}
//no auto slayer
- if (message.matchRegex(" {3}§r§5§l» §r§7Talk to Maddox to claim your (.+) Slayer XP!")) {
+ talkToMaddoxPattern.matchMatcher(message) {
needNewQuest("You have no Auto-Slayer active!")
}
if (message == " §r§a§lSLAYER QUEST COMPLETE!") {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 0e9b9f8ae..260d7d4d6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
-import at.hannibal2.skyhanni.utils.StringUtils.matchRegex
+import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.getLorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
@@ -22,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BlazeSlayerDaggerHelper {
private val config get() = SkyHanniMod.feature.slayer.blazes.hellion
+ private val attunementPattern = "§cStrike using the §r(.+) §r§cattunement on your dagger!".toPattern()
private var clientSideClicked = false
private var textTop = ""
@@ -34,12 +35,10 @@ class BlazeSlayerDaggerHelper {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.slayer.blazes.hellion.hideDaggerWarning) return
+ if (!config.hideDaggerWarning) return
val message = event.message
- if (message.matchRegex("§cStrike using the §r(.+) §r§cattunement on your dagger!") ||
- message == "§cYour hit was reduced by Hellion Shield!"
- ) {
+ if (attunementPattern.matches(message) || message == "§cYour hit was reduced by Hellion Shield!") {
event.blockedReason = "blaze_slayer_dagger"
}
}
@@ -63,7 +62,7 @@ class BlazeSlayerDaggerHelper {
checkActiveDagger()
lastNearest = findNearest()
- val first = Dagger.entries[SkyHanniMod.feature.slayer.blazes.hellion.firstDagger]
+ val first = Dagger.entries[config.firstDagger]
val second = first.other()
textTop = format(holding, true, first) + " " + format(holding, true, second)
@@ -71,7 +70,7 @@ class BlazeSlayerDaggerHelper {
}
private fun findNearest(): HellionShield? {
- if (!SkyHanniMod.feature.slayer.blazes.hellion.markRightHellionShield) return null
+ if (!config.markRightHellionShield) return null
if (lastNearestCheck + 100 > System.currentTimeMillis()) return lastNearest
lastNearestCheck = System.currentTimeMillis()