summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/combat
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt38
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt19
3 files changed, 53 insertions, 18 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
index a5b0cd386..bd1d58894 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
@@ -27,18 +27,28 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object BestiaryData {
private val config get() = SkyHanniMod.feature.combat.bestiary
+
+ private val patternGroup = RepoPattern.group("combat.bestiary.data")
+ private val progressPattern by patternGroup.pattern(
+ "progress",
+ "(?<current>[0-9kKmMbB,.]+)/(?<needed>[0-9kKmMbB,.]+\$)"
+ )
+ private val titlePattern by patternGroup.pattern(
+ "title",
+ "^(?:\\(\\d+/\\d+\\) )?(Bestiary|.+) ➜ (.+)\$"
+ )
+
private var display = emptyList<List<Any>>()
private val mobList = mutableListOf<BestiaryMob>()
private val stackList = mutableMapOf<Int, ItemStack>()
private val catList = mutableListOf<Category>()
- private val progressPattern = "(?<current>[0-9kKmMbB,.]+)/(?<needed>[0-9kKmMbB,.]+$)".toPattern()
- private val titlePattern = "^(?:\\(\\d+/\\d+\\) )?(Bestiary|.+) ➜ (.+)$".toPattern()
private var inInventory = false
private var isCategory = false
private var overallProgressEnabled = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt
index 5c1e0976e..0364bda1a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt
@@ -52,6 +52,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import io.github.moulberry.notenoughupdates.util.Utils
import io.github.moulberry.notenoughupdates.util.XPInformation
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -68,16 +69,33 @@ object GhostCounter {
private var display = emptyList<List<Any>>()
var ghostCounterV3File =
File("." + File.separator + "config" + File.separator + "ChatTriggers" + File.separator + "modules" + File.separator + "GhostCounterV3" + File.separator + ".persistantData.json")
- private val skillXPPattern = "[+](?<gained>[0-9,.]+) \\((?<current>[0-9,.]+)(?:/(?<total>[0-9,.]+))?\\)".toPattern()
- private val combatSectionPattern =
- ".*[+](?<gained>[0-9,.]+) (?<skillName>[A-Za-z]+) \\((?<progress>(?<current>[0-9.,]+)/(?<total>[0-9.,]+)|(?<percent>[0-9.]+)%)\\).*".toPattern()
- private val killComboExpiredPattern =
- "§cYour Kill Combo has expired! You reached a (?<combo>.*) Kill Combo!".toPattern()
- private val ghostXPPattern =
- "(?<current>\\d+(?:\\.\\d+)?(?:,\\d+)?[kK]?)/(?<total>\\d+(?:\\.\\d+)?(?:,\\d+)?[kKmM]?)".toPattern()
- private val bestiaryPattern =
- ".*(?:§\\d|§\\w)+BESTIARY (?:§\\d|§\\w)+Ghost (?:§\\d|§\\w)(?<previousLevel>\\d+)➜(?:§\\d|§\\w)(?<nextLevel>\\d+).*".toPattern() // &3&lBESTIARY &b&lGhost &89➜&b10
- private val skillLevelPattern = ".*§e§lSkills: §r§a(?<skillName>.*) (?<skillLevel>\\d+).*".toPattern()
+
+ private val patternGroup = RepoPattern.group("combat.ghostcounter")
+ private val skillXPPattern by patternGroup.pattern(
+ "skillxp",
+ "[+](?<gained>[0-9,.]+) \\((?<current>[0-9,.]+)(?:/(?<total>[0-9,.]+))?\\)"
+ )
+ private val combatSectionPattern by patternGroup.pattern(
+ "combatsection",
+ ".*[+](?<gained>[0-9,.]+) (?<skillName>[A-Za-z]+) \\((?<progress>(?<current>[0-9.,]+)/(?<total>[0-9.,]+)|(?<percent>[0-9.]+)%)\\).*"
+ )
+ private val killComboExpiredPattern by patternGroup.pattern(
+ "killcomboexpired",
+ "§cYour Kill Combo has expired! You reached a (?<combo>.*) Kill Combo!"
+ )
+ private val ghostXPPattern by patternGroup.pattern(
+ "ghostxp",
+ "(?<current>\\d+(?:\\.\\d+)?(?:,\\d+)?[kK]?)/(?<total>\\d+(?:\\.\\d+)?(?:,\\d+)?[kKmM]?)"
+ )
+ private val bestiaryPattern by patternGroup.pattern(
+ "bestiary",
+ ".*(?:§\\d|§\\w)+BESTIARY (?:§\\d|§\\w)+Ghost (?:§\\d|§\\w)(?<previousLevel>\\d+)➜(?:§\\d|§\\w)(?<nextLevel>\\d+).*"
+ )
+ private val skillLevelPattern by patternGroup.pattern(
+ "skilllevel",
+ ".*§e§lSkills: §r§a(?<skillName>.*) (?<skillLevel>\\d+).*"
+ )
+
private val format = NumberFormat.getInstance()
private var percent: Float = 0.0f
private var totalSkillXp = 0
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt
index 08c8ddf31..f92e8dccd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/mobs/SpawnTimers.kt
@@ -14,6 +14,7 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.TimeUtils.format
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import at.hannibal2.skyhanni.utils.toLorenzVec
import net.minecraft.network.play.server.S2APacketParticles
import net.minecraft.util.EnumParticleTypes
@@ -25,12 +26,18 @@ class SpawnTimers {
private val config get() = SkyHanniMod.feature.combat.mobs
+ private val patternGroup = RepoPattern.group("combat.mobs.spawntime.arachne")
+ private val arachneFragmentPattern by patternGroup.pattern(
+ "fragment",
+ "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$"
+ )
+ private val arachneCrystalPattern by patternGroup.pattern(
+ "crystal",
+ "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$"
+ )
+
private val arachneAltarLocation = LorenzVec(-283f, 51f, -179f)
private var arachneSpawnTime = SimpleTimeMark.farPast()
- private val arachneFragmentMessage =
- "^☄ [a-z0-9_]{2,22} placed an arachne's calling! something is awakening! \\(4/4\\)\$".toPattern()
- private val arachneCrystalMessage =
- "^☄ [a-z0-9_]{2,22} placed an arachne crystal! something is awakening!$".toPattern()
private var saveNextTickParticles = false
private var particleCounter = 0
private var tickTime: Long = 0
@@ -60,8 +67,8 @@ class SpawnTimers {
if (!isEnabled()) return
val message = event.message.removeColor().lowercase()
- if (arachneFragmentMessage.matches(message) || arachneCrystalMessage.matches(message)) {
- if (arachneCrystalMessage.matches(message)) {
+ if (arachneFragmentPattern.matches(message) || arachneCrystalPattern.matches(message)) {
+ if (arachneCrystalPattern.matches(message)) {
saveNextTickParticles = true
searchTime = System.currentTimeMillis()
particleCounter = 0