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

Backend: Remove redundant property from HotmAPI.Powder #2128

Merged
merged 1 commit into from
Jul 15, 2024
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
6 changes: 2 additions & 4 deletions src/main/java/at/hannibal2/skyhanni/api/HotmAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ object HotmAPI {

;

val lowName = name.lowercase().firstLetterUppercase()

val heartPattern by RepoPattern.pattern(
"inventory.${name.lowercase()}.heart",
"§7$lowName Powder: §a§.(?<powder>[\\d,]+)"
"§7$displayName Powder: §a§.(?<powder>[\\d,]+)"
)
val resetPattern by RepoPattern.pattern(
"inventory.${name.lowercase()}.reset",
"\\s+§8- §.(?<powder>[\\d,]+) $lowName Powder"
"\\s+§8- §.(?<powder>[\\d,]+) $displayName Powder"
)

fun pattern(isHeart: Boolean) = if (isHeart) heartPattern else resetPattern
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/at/hannibal2/skyhanni/data/HotmData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,13 @@ enum class HotmData(
if (!LorenzUtils.inSkyBlock) return

event.scoreboard.matchFirst(ScoreboardPattern.powderPattern) {
val type = HotmAPI.Powder.entries.firstOrNull { it.lowName == group("type") } ?: return
val type = HotmAPI.Powder.entries.firstOrNull { it.displayName == group("type") } ?: return
val amount = group("amount").formatLong()
val difference = amount - type.getCurrent()

if (difference > 0) {
type.gain(difference)
ChatUtils.debug("Gained §a${difference.addSeparators()} §e${type.lowName} Powder")
ChatUtils.debug("Gained §a${difference.addSeparators()} §e${type.displayName} Powder")
}
}
}
Expand Down Expand Up @@ -742,7 +742,7 @@ enum class HotmData(
event.addIrrelevant {
add("Tokens : $availableTokens/$tokens")
HotmAPI.Powder.entries.forEach {
add("${it.lowName} Powder: ${it.getCurrent()}/${it.getTotal()}")
add("${it.displayName} Powder: ${it.getCurrent()}/${it.getTotal()}")
}
add("Ability: ${HotmAPI.activeMiningAbility?.printName}")
add("Blue Egg: ${HotmAPI.isBlueEggActive}")
Expand Down
Loading