summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/bingo
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/bingo')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt29
5 files changed, 65 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
index a86a05c60..037233772 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
@@ -27,7 +27,10 @@ object BingoAPI {
val communityGoals get() = bingoGoals.values.filter { it.type == GoalType.COMMUNITY }
var lastBingoCardOpenTime = SimpleTimeMark.farPast()
- private val detectionPattern by RepoPattern.pattern("bingo.detection.scoreboard", " §.Ⓑ §.Bingo")
+ private val detectionPattern by RepoPattern.pattern(
+ "bingo.detection.scoreboard",
+ " §.Ⓑ §.Bingo"
+ )
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt
index 7c0e74cae..814de64ef 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class CompactBingoChat {
@@ -16,20 +17,29 @@ class CompactBingoChat {
private var inSkyBlockLevelUp = false
private var inCollectionLevelUp = false
private var collectionLevelUpLastLine: String? = null
- private var newArea = 0// 0 = nothing, 1 = after first message, 2 = after second message
- private val healthPattern = " {3}§r§7§8\\+§a.* §c❤ Health".toPattern()
- private val strengthPattern = " {3}§r§7§8\\+§a. §c❁ Strength".toPattern()
+ private var newArea = 0 // 0 = nothing, 1 = after first message, 2 = after second message
+
+ private val patternGroup = RepoPattern.group("bingo.compactchat")
+ private val healthPattern by patternGroup.pattern(
+ "health",
+ " {3}§r§7§8\\+§a.* §c❤ Health"
+ )
+ private val strengthPattern by patternGroup.pattern(
+ "strength",
+ " {3}§r§7§8\\+§a. §c❁ Strength"
+ )
+ private val borderPattern by patternGroup.pattern(
+ "border",
+ "§[e3]§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
+ )
- // TODO USE SH-REPO
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
if (!config.enabled) return
if (!LorenzUtils.isBingoProfile && !config.outsideBingo) return
val message = event.message
- if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬" ||
- message == "§e§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬"
- ) {
+ borderPattern.matchMatcher(message) {
inSkillLevelUp = false
inSkyBlockLevelUp = false
inCollectionLevelUp = false
@@ -45,6 +55,7 @@ class CompactBingoChat {
if (onNewAreaDiscovered(message)) event.blockedReason = "compact_new_area_discovered"
}
+ // TODO USE SH-REPO
private fun onSkillLevelUp(message: String): Boolean {
if (message.startsWith(" §r§b§lSKILL LEVEL UP ")) {
inSkillLevelUp = true
@@ -74,7 +85,7 @@ class CompactBingoChat {
return true
}
- // No Bazaar and Community Shopin bingo
+ // No Bazaar and Community Shop in bingo
if (message == " §r§7§6Access to Bazaar") return true
if (message == " §r§7§bAccess to Community Shop") return true
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
index 930ea6883..dbdf73535 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt
@@ -21,6 +21,7 @@ import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import com.google.gson.JsonArray
import com.google.gson.JsonObject
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
import net.minecraft.client.Minecraft
import net.minecraft.item.ItemStack
@@ -31,8 +32,11 @@ class MinionCraftHelper {
private val config get() = SkyHanniMod.feature.event.bingo
- // TODO USE SH-REPO
- private var minionNamePattern = "(?<name>.*) Minion (?<number>.*)".toPattern()
+ private val minionNamePattern by RepoPattern.pattern(
+ "bingo.minion.name",
+ "(?<name>.*) Minion (?<number>.*)"
+ )
+
private var display = emptyList<String>()
private var hasMinionInInventory = false
private var hasItemsForMinion = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
index be27e25a2..c0606ad54 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt
@@ -25,12 +25,19 @@ import kotlin.time.Duration
class BingoCardReader {
private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
-
- private val percentagePattern by RepoPattern.pattern("bingo.card.percentage", " {2}§8Top §.(?<percentage>.*)%")
-
- // TODO USE SH-REPO
- private val goalCompletePattern = "§6§lBINGO GOAL COMPLETE! §r§e(?<name>.*)".toPattern()
- private val personalHiddenGoalPattern = ".*§7§eThe next hint will unlock in (?<time>.*)".toPattern()
+ private val patternGroup = RepoPattern.group("bingo.card")
+ private val percentagePattern by patternGroup.pattern(
+ "percentage",
+ " {2}§8Top §.(?<percentage>.*)%"
+ )
+ private val goalCompletePattern by patternGroup.pattern(
+ "goalcomplete",
+ "§6§lBINGO GOAL COMPLETE! §r§e(?<name>.*)"
+ )
+ private val personalHiddenGoalPattern by patternGroup.pattern(
+ "hiddengoal",
+ ".*§7§eThe next hint will unlock in (?<time>.*)"
+ )
@SubscribeEvent
fun onInventoryOpen(event: InventoryUpdatedEvent) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
index 6987edb82..be4a8c7a4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
@@ -24,6 +24,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class BingoNextStepHelper {
@@ -31,15 +32,31 @@ class BingoNextStepHelper {
private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
private var dirty = true
- // TODO USE SH-REPO
- private val crystalObtainedPattern = " *§r§e(?<crystalName>Topaz|Sapphire|Jade|Amethyst|Amber) Crystal".toPattern()
+ private val patternGroup = RepoPattern.group("bingo.steps")
+ private val crystalObtainedPattern by patternGroup.pattern(
+ "crystal.obtained",
+ " *§r§e(?<crystalName>Topaz|Sapphire|Jade|Amethyst|Amber) Crystal"
+ )
+ private val collectionPattern by patternGroup.pattern(
+ "collection",
+ "Reach (?<amount>[0-9]+(?:,\\d+)*) (?<name>.*) Collection\\."
+ )
+ private val crystalPattern by patternGroup.pattern(
+ "crystal.obtain",
+ "Obtain a (?<name>\\w+) Crystal in the Crystal Hollows\\."
+ )
+ private val skillPattern by patternGroup.pattern(
+ "skill",
+ "Obtain level (?<level>.*) in the (?<skill>.*) Skill."
+ )
+ private val crystalFoundPattern by patternGroup.pattern(
+ "crystal.found",
+ " *§r§5§l✦ CRYSTAL FOUND §r§7\\(.§r§7/5§r§7\\)"
+ )
+
private val itemIslandRequired = mutableMapOf<String, IslandVisitStep>()
private val itemPreconditions = mutableMapOf<String, NextStep>()
private val islands = mutableMapOf<IslandType, IslandVisitStep>()
- 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 {