diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-01 16:11:16 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-05-01 16:11:16 +0200 |
commit | 6ff32f911279eea29fbbb69e031e027a2c1a5d9c (patch) | |
tree | 278c27bdb1f90108b78a186bcdf09e3f401b08e3 /src/main/java/at | |
parent | 29a4ef26301b92805d30849684362c2c65082197 (diff) | |
download | skyhanni-6ff32f911279eea29fbbb69e031e027a2c1a5d9c.tar.gz skyhanni-6ff32f911279eea29fbbb69e031e027a2c1a5d9c.tar.bz2 skyhanni-6ff32f911279eea29fbbb69e031e027a2c1a5d9c.zip |
Compact SkyBlock Level up messages in bingo
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt | 52 |
1 files changed, 44 insertions, 8 deletions
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 d043c2364..c0159a5e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/CompactBingoChat.kt @@ -3,26 +3,39 @@ package at.hannibal2.skyhanni.features.bingo import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class CompactBingoChat { private var blockedSkillLevelUp = false + private var blockedSkyblockLevelUp = false private var blockedCollectionLevelUp = false private var collectionLevelUpLastLine: String? = null private var newArea = 0//0 = nothing, 1 = after first message, 2 = after second message private var blockedBestiarity = false + private val healthPattern = " §r§7§8\\+§a.* §c❤ Health".toPattern() + private val strengthPattern = " §r§7§8\\+§a. §c❁ Strength".toPattern() @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (!LorenzUtils.isBingoProfile) return if (!SkyHanniMod.feature.bingo.compactChatMessages) return - if (onSkillLevelUp(event.message)) event.blockedReason = "compact_skill_level_up" - if (onCollectionLevelUp(event.message)) event.blockedReason = "compact_collection_level_up" - if (onNewAreaDiscovered(event.message)) event.blockedReason = "compact_new_area_discovered" - if (onBestiarityUpgrade(event.message)) event.blockedReason = "compact_skill_level_up" + val message = event.message + if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { + blockedSkillLevelUp = false + blockedSkyblockLevelUp = false + event.blockedReason = "compact_skill_or_skyblock_level_up" + return + } + + if (onSkillLevelUp(message)) event.blockedReason = "compact_skill_level_up" + if (onSkyBlockLevelUp(message)) event.blockedReason = "compact_skyblock_level_up" + if (onCollectionLevelUp(message)) event.blockedReason = "compact_collection_level_up" + if (onNewAreaDiscovered(message)) event.blockedReason = "compact_new_area_discovered" + if (onBestiarityUpgrade(message)) event.blockedReason = "compact_skill_level_up" } private fun onSkillLevelUp(message: String): Boolean { @@ -30,10 +43,6 @@ class CompactBingoChat { blockedSkillLevelUp = true return false } - if (message == "§3§l▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬") { - blockedSkillLevelUp = false - return true - } if (blockedSkillLevelUp) { if (!message.contains("Access to") && !message.endsWith(" Enchantment")) { @@ -44,6 +53,33 @@ class CompactBingoChat { return false } + private fun onSkyBlockLevelUp(message: String): Boolean { + if (message.startsWith(" §r§3§lSKYBLOCK LEVEL UP §bLevel ")) { + blockedSkyblockLevelUp = true + return false + } + + if (blockedSkyblockLevelUp) { + if (message == " §r§a§lREWARDS") return true + // We don't care about extra health & strength + healthPattern.matchMatcher(message) { + return true + } + strengthPattern.matchMatcher(message) { + return true + } + + // No Bazaar and Community Shopin bingo + if (message == " §r§7§6Access to Bazaar") return true + if (message == " §r§7§bAccess to Community Shop") return true + + // Always enabled in bingo + if (message == " §r§7§8+§aAuto-pickup block and mob drops") return true + } + + return false + } + private fun onCollectionLevelUp(message: String): Boolean { if (message.startsWith(" §r§6§lCOLLECTION LEVEL UP ")) { blockedCollectionLevelUp = true |