diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-03-06 23:51:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 23:51:02 +0100 |
commit | 0a95a791eb57a546fb5421594abae740faf1dfdb (patch) | |
tree | 82bfc13c544a60d496bab081b66ddd73e07d62a3 /src/main/java/at/hannibal2/skyhanni/features/combat | |
parent | 28430fe85115334fb06fb7e3cc36da819f08dace (diff) | |
download | skyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.tar.gz skyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.tar.bz2 skyhanni-0a95a791eb57a546fb5421594abae740faf1dfdb.zip |
Internal Changes: Many small code cleanups (#1101)
Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt | 18 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt | 26 |
2 files changed, 31 insertions, 13 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 bd1d58894..2e9259f0a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -18,7 +18,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber +import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision import at.hannibal2.skyhanni.utils.NumberUtil.toRoman @@ -150,12 +150,12 @@ object BestiaryData { val progress = line.substring(line.lastIndexOf(' ') + 1) if (previousLine.contains("Families Found")) { progressPattern.matchMatcher(progress) { - familiesFound = group("current").formatNumber() - totalFamilies = group("needed").formatNumber() + familiesFound = group("current").formatLong() + totalFamilies = group("needed").formatLong() } } else if (previousLine.contains("Families Completed")) { progressPattern.matchMatcher(progress) { - familiesCompleted = group("current").formatNumber() + familiesCompleted = group("current").formatLong() } } } @@ -178,7 +178,7 @@ object BestiaryData { for ((lineIndex, line) in stack.getLore().withIndex()) { val loreLine = line.removeColor() if (loreLine.startsWith("Kills: ")) { - actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatNumber() + actualRealTotalKill = "([0-9,.]+)".toRegex().find(loreLine)?.groupValues?.get(1)?.formatLong() ?: 0 } if (!loreLine.startsWith(" ")) continue @@ -186,13 +186,13 @@ object BestiaryData { val progress = loreLine.substring(loreLine.lastIndexOf(' ') + 1) if (previousLine.contains("Progress to Tier")) { progressPattern.matchMatcher(progress) { - totalKillToTier = group("needed").formatNumber() - currentKillToTier = group("current").formatNumber() + totalKillToTier = group("needed").formatLong() + currentKillToTier = group("current").formatLong() } } else if (previousLine.contains("Overall Progress")) { progressPattern.matchMatcher(progress) { - totalKillToMax = group("needed").formatNumber() - currentTotalKill = group("current").formatNumber() + totalKillToMax = group("needed").formatLong() + currentTotalKill = group("current").formatLong() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index b87002c0e..274e64f9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -18,7 +18,6 @@ import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield import at.hannibal2.skyhanni.features.slayer.blaze.setHellionShield import at.hannibal2.skyhanni.test.command.ErrorManager -import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.CollectionUtils.put import at.hannibal2.skyhanni.utils.ConfigUtils @@ -400,7 +399,13 @@ class DamageIndicatorManager { val thorn = checkThorn(health, maxHealth) if (thorn == null) { val floor = DungeonAPI.dungeonFloor - ChatUtils.error("problems with thorn detection! ($floor, $health/$maxHealth)") + ErrorManager.logErrorStateWithData( + "Could not detect thorn", + "checkThorn returns null", + "health" to health, + "maxHealth" to maxHealth, + "floor" to floor, + ) } return thorn } @@ -563,7 +568,16 @@ class DamageIndicatorManager { calcHealth = 0 break } else { - ChatUtils.error("unknown magma boss health sidebar format!") + ErrorManager.logErrorStateWithData( + "Unknown magma boss health sidebar format", + "Damage Indicator could not find magma boss bar data", + "line" to line, + "ScoreboardData.sidebarLinesRaw" to ScoreboardData.sidebarLinesRaw, + "calcHealth" to calcHealth, + "slimeSize" to slimeSize, + "entity" to entity, + "entityData" to entityData, + ) break } @@ -777,7 +791,11 @@ class DamageIndicatorManager { } } } else { - ChatUtils.error("Invalid/impossible thorn floor!") + ErrorManager.logErrorStateWithData( + "Thorn in wrong floor detected", + "Invalid floor for thorn", + "dungeonFloor" to DungeonAPI.dungeonFloor, + ) return null } val color = NumberUtil.percentageColor(health.toLong(), maxHealth.toLong()) |