Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Custom Scoreboard not showing Kuudra Lines - Part 3 #3157

Merged
merged 3 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,7 @@ object CustomScoreboard {

@HandleEvent
fun onIslandChange(event: IslandChangeEvent) {
if (event.newIsland != IslandType.NONE) {
updateIslandEntries()

runDelayed(3.seconds) {
updateIslandEntries()
}
}
if (event.newIsland != IslandType.NONE) updateIslandEntries()
}

private fun updateIslandEntries() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package at.hannibal2.skyhanni.features.gui.customscoreboard.events

import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getSbLines
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.nether.kuudra.KuudraAPI
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.RegexUtils.allMatches

// scoreboard
Expand All @@ -23,5 +24,5 @@ object ScoreboardEventKuudra : ScoreboardEvent() {

override val configLine = "§7(All Kuudra Lines)"

override fun showIsland() = KuudraAPI.inKuudra()
override fun showIsland() = IslandType.KUUDRA_ARENA.isInIsland()
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package at.hannibal2.skyhanni.features.nether.kuudra

import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.api.event.HandleEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.ScoreboardUpdateEvent
import at.hannibal2.skyhanni.events.kuudra.KuudraCompleteEvent
import at.hannibal2.skyhanni.events.kuudra.KuudraEnterEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUItems.removePrefix
import at.hannibal2.skyhanni.utils.RegexUtils.firstMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matchGroup
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
Expand All @@ -21,13 +22,17 @@ object KuudraAPI {

private val patternGroup = RepoPattern.group("data.kuudra")

/**
* REGEX-TEST: §7⏣ §cKuudra's Hollow §8(T5)
* REGEX-TEST: §7⏣ §cKuudra's Hollow §8(T2)
*/
private val tierPattern by patternGroup.pattern(
"scoreboard.tier",
" §7⏣ §cKuudra's Hollow §8\\(T(?<tier>.*)\\)"
" §7⏣ §cKuudra's Hollow §8\\(T(?<tier>\\d+)\\)",
)
private val completePattern by patternGroup.pattern(
"chat.complete",
"§.\\s*(?:§.)*KUUDRA DOWN!"
"§.\\s*(?:§.)*KUUDRA DOWN!",
)

/**
Expand All @@ -38,7 +43,7 @@ object KuudraAPI {
*/
private val kuudraArmorPattern by patternGroup.pattern(
"internalname.armor",
"(?<tier>HOT|BURNING|FIERY|INFERNAL|)_?(?<type>AURORA|CRIMSON|TERROR|HOLLOW|FERVOR)_(?:HELMET|CHESTPLATE|LEGGINGS|BOOTS)"
"(?<tier>HOT|BURNING|FIERY|INFERNAL|)_?(?<type>AURORA|CRIMSON|TERROR|HOLLOW|FERVOR)_(?:HELMET|CHESTPLATE|LEGGINGS|BOOTS)",
)

private val kuudraTiers = listOf("", "HOT", "BURNING", "FIERY", "INFERNAL")
Expand All @@ -61,16 +66,14 @@ object KuudraAPI {

fun inKuudra() = kuudraTier != null

@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
@HandleEvent
fun onScoreboardChange(event: ScoreboardUpdateEvent) {
if (!LorenzUtils.inSkyBlock) return
if (kuudraTier != null) return
for (line in ScoreboardData.sidebarLinesFormatted) {
tierPattern.matchMatcher(line) {
val tier = group("tier").toInt()
kuudraTier = tier
KuudraEnterEvent(tier).post()
}
tierPattern.firstMatcher(event.added) {
val tier = group("tier").toInt()
kuudraTier = tier
KuudraEnterEvent(tier).post()
}
}

Expand All @@ -81,8 +84,8 @@ object KuudraAPI {

@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
val message = event.message
completePattern.matchMatcher(message) {
if (!LorenzUtils.inSkyBlock) return
completePattern.matchMatcher(event.message) {
val tier = kuudraTier ?: return
KuudraCompleteEvent(tier).post()
}
Expand Down
8 changes: 1 addition & 7 deletions versions/1.8.9/detekt/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<ID>CyclomaticComplexMethod:AdvancedPlayerList.kt$AdvancedPlayerList$fun newSorting(original: List&lt;String&gt;): List&lt;String&gt;</ID>
<ID>CyclomaticComplexMethod:CropMoneyDisplay.kt$CropMoneyDisplay$private fun calculateMoneyPerHour(debugList: MutableList&lt;List&lt;Any&gt;&gt;): Map&lt;NEUInternalName, Array&lt;Double&gt;&gt;</ID>
<ID>CyclomaticComplexMethod:CropMoneyDisplay.kt$CropMoneyDisplay$private fun drawDisplay(): List&lt;List&lt;Any&gt;&gt;</ID>
<ID>CyclomaticComplexMethod:DamageIndicatorManager.kt$DamageIndicatorManager$private fun checkThorn(realHealth: Long, realMaxHealth: Long): String?</ID>
<ID>CyclomaticComplexMethod:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$private fun addEnchantments(stack: ItemStack, list: MutableList&lt;String&gt;): Double</ID>
<ID>CyclomaticComplexMethod:GardenCropMilestoneDisplay.kt$GardenCropMilestoneDisplay$private fun drawProgressDisplay(crop: CropType): List&lt;Renderable&gt;</ID>
<ID>CyclomaticComplexMethod:GardenVisitorFeatures.kt$GardenVisitorFeatures$private fun readToolTip(visitor: VisitorAPI.Visitor, itemStack: ItemStack?, toolTip: MutableList&lt;String&gt;)</ID>
Expand Down Expand Up @@ -186,8 +185,7 @@
<ID>RepoPatternRegexTest:ItemPickupLog.kt$ItemPickupLog$by patternGroup.pattern( "shoppattern", "^(?&lt;itemName&gt;.+?)(?: x\\d+)?\$", )</ID>
<ID>RepoPatternRegexTest:JacobFarmingContestsInventory.kt$JacobFarmingContestsInventory$by RepoPattern.pattern( "garden.jacob.contests.inventory.medal", "§7§7You placed in the (?&lt;medal&gt;.*) §7bracket!" )</ID>
<ID>RepoPatternRegexTest:KloonHacking.kt$KloonHacking$by RepoPattern.pattern( "rift.area.westvillage.kloon.color", "You've set the color of this terminal to (?&lt;color&gt;.*)!" )</ID>
<ID>RepoPatternRegexTest:KuudraAPI.kt$KuudraAPI$by patternGroup.pattern( "chat.complete", "§.\\s*(?:§.)*KUUDRA DOWN!" )</ID>
<ID>RepoPatternRegexTest:KuudraAPI.kt$KuudraAPI$by patternGroup.pattern( "scoreboard.tier", " §7⏣ §cKuudra's Hollow §8\\(T(?&lt;tier&gt;.*)\\)" )</ID>
<ID>RepoPatternRegexTest:KuudraAPI.kt$KuudraAPI$by patternGroup.pattern( "chat.complete", "§.\\s*(?:§.)*KUUDRA DOWN!", )</ID>
<ID>RepoPatternRegexTest:MaxPurseItems.kt$MaxPurseItems$by patternGroup.pattern( "instant", ".*Price per unit: §6(?&lt;coins&gt;[\\d.,]+) coins.*", )</ID>
<ID>RepoPatternRegexTest:MaxPurseItems.kt$MaxPurseItems$by patternGroup.pattern( "order", ".*§6(?&lt;coins&gt;[\\d.,]+) coins §7each.*", )</ID>
<ID>RepoPatternRegexTest:MaxwellAPI.kt$MaxwellAPI$by patternGroup.pattern( "gui.noselectedpower", "(?:§.)*Visit Maxwell in the Hub to learn", )</ID>
Expand Down Expand Up @@ -281,8 +279,6 @@
<ID>ReturnCount:CompactBingoChat.kt$CompactBingoChat$private fun onSkyBlockLevelUp(message: String): Boolean</ID>
<ID>ReturnCount:CrimsonMinibossRespawnTimer.kt$CrimsonMinibossRespawnTimer$private fun updateArea()</ID>
<ID>ReturnCount:CropMoneyDisplay.kt$CropMoneyDisplay$private fun drawDisplay(): List&lt;List&lt;Any&gt;&gt;</ID>
<ID>ReturnCount:DamageIndicatorManager.kt$DamageIndicatorManager$private fun checkThorn(realHealth: Long, realMaxHealth: Long): String?</ID>
<ID>ReturnCount:DamageIndicatorManager.kt$DamageIndicatorManager$private fun getCustomHealth( entityData: EntityData, health: Long, entity: EntityLivingBase, maxHealth: Long, ): String?</ID>
<ID>ReturnCount:EnchantParser.kt$EnchantParser$private fun parseEnchants( loreList: MutableList&lt;String&gt;, enchants: Map&lt;String, Int&gt;, chatComponent: IChatComponent?, )</ID>
<ID>ReturnCount:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator$private fun calculateStarPrice( internalName: NEUInternalName, inputStars: Int, ): Pair&lt;EssenceItemUtils.EssenceUpgradePrice, Pair&lt;Int, Int&gt;&gt;?</ID>
<ID>ReturnCount:FishingAPI.kt$FishingAPI$fun seaCreatureCount(entity: EntityArmorStand): Int</ID>
Expand Down Expand Up @@ -315,7 +311,6 @@
<ID>TooManyFunctions:CollectionUtils.kt$CollectionUtils</ID>
<ID>TooManyFunctions:DailyQuestHelper.kt$DailyQuestHelper</ID>
<ID>TooManyFunctions:EstimatedItemValueCalculator.kt$EstimatedItemValueCalculator</ID>
<ID>TooManyFunctions:GuiRenderUtils.kt$GuiRenderUtils</ID>
<ID>TooManyFunctions:HypixelCommands.kt$HypixelCommands</ID>
<ID>TooManyFunctions:InventoryUtils.kt$InventoryUtils</ID>
<ID>TooManyFunctions:LocationUtils.kt$LocationUtils</ID>
Expand Down Expand Up @@ -402,7 +397,6 @@
<ID>UnsafeCallOnNullableType:SackAPI.kt$SackAPI$oldData!!</ID>
<ID>UnsafeCallOnNullableType:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker$it.get(DisplayMode.SESSION).getItemsProp()[internalName]!!</ID>
<ID>UnsafeCallOnNullableType:SkyHanniBucketedItemTracker.kt$SkyHanniBucketedItemTracker$it.get(DisplayMode.TOTAL).getItemsProp()[internalName]!!</ID>
<ID>UnsafeCallOnNullableType:SkyHanniMod.kt$SkyHanniMod.Companion$Loader.instance().indexedModList[MODID]!!</ID>
<ID>UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$distance!!</ID>
<ID>UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$distance2!!</ID>
<ID>UnsafeCallOnNullableType:SoopyGuessBurrow.kt$SoopyGuessBurrow$firstParticlePoint?.distance(pos)!!</ID>
Expand Down
Loading