Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Jan 3, 2025
1 parent 47e2bb1 commit 9642ef6
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ object BestiaryData {
*/
private val tierProgressPattern by patternGroup.pattern(
"tierprogress",
"§7Progress to Tier [\\dIVXC]+: §b[\\d.]+%"
"§7Progress to Tier [\\dIVXC]+: §b[\\d.]+%",
)

/**
Expand All @@ -57,7 +57,7 @@ object BestiaryData {
*/
private val overallProgressPattern by patternGroup.pattern(
"overallprogress",
"§7Overall Progress: §b[\\d.]+%(?: §7\\(§c§lMAX!§7\\))?"
"§7Overall Progress: §b[\\d.]+%(?: §7\\(§c§lMAX!§7\\))?",
)

/**
Expand All @@ -66,7 +66,7 @@ object BestiaryData {
*/
private val progressPattern by patternGroup.pattern(
"progress",
"(?<current>[0-9kKmMbB,.]+)/(?<needed>[0-9kKmMbB,.]+\$)"
"(?<current>[0-9kKmMbB,.]+)/(?<needed>[0-9kKmMbB,.]+\$)",
)

/**
Expand All @@ -75,7 +75,7 @@ object BestiaryData {
*/
private val titlePattern by patternGroup.pattern(
"title",
"^(?:\\(\\d+\\/\\d+\\) )?(?<title>Bestiary|.+) ➜ .+\$"
"^(?:\\(\\d+\\/\\d+\\) )?(?<title>Bestiary|.+) ➜ .+\$",
)

private var display = emptyList<List<Any>>()
Expand All @@ -97,7 +97,7 @@ object BestiaryData {
if (!isEnabled()) return
if (inInventory) {
config.position.renderStringsAndItems(
display, extraSpace = -1, itemScale = 0.7, posLabel = "Bestiary Data"
display, extraSpace = -1, itemScale = 0.7, posLabel = "Bestiary Data",
)
}
}
Expand Down Expand Up @@ -237,8 +237,8 @@ object BestiaryData {
currentTotalKill,
totalKillToTier,
currentKillToTier,
actualRealTotalKill
)
actualRealTotalKill,
),
)
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ object BestiaryData {
buildList {
add(" §7- ")
add("${mob.name}: §cNot unlocked!")
}
},
)
continue
}
Expand All @@ -316,7 +316,7 @@ object BestiaryData {
"§6Percent to max: §b${mob.percentToMaxFormatted()}",
"§6Percent to tier: §b${mob.percentToTierFormatted()}",
"",
"§7More info thing"
"§7More info thing",
)

private fun getMobLine(mob: BestiaryMob, isMaxed: Boolean): String {
Expand Down Expand Up @@ -370,7 +370,7 @@ object BestiaryData {
// todo: avoid ordinal
config.numberFormat = BestiaryConfig.NumberFormatEntry.entries[(config.numberFormat.ordinal + 1) % 2]
update()
}
},
)

newDisplay.addButton(
Expand All @@ -380,7 +380,7 @@ object BestiaryData {
// todo: avoid ordinal
config.displayType = DisplayTypeEntry.entries[(config.displayType.ordinal + 1) % 8]
update()
}
},
)

newDisplay.addButton(
Expand All @@ -389,7 +389,7 @@ object BestiaryData {
onChange = {
config.replaceRoman = !config.replaceRoman
update()
}
},
)

newDisplay.addButton(
Expand All @@ -398,30 +398,29 @@ object BestiaryData {
onChange = {
config.hideMaxed = !config.hideMaxed
update()
}
},
)
}

private fun addCategories(newDisplay: MutableList<List<Any>>) {
if (catList.isNotEmpty()) {
newDisplay.addAsSingletonList("§7Category")
for (cat in catList) {
newDisplay.add(
buildList {
add(" §7- ${cat.name}§7: ")
val element = when {
cat.familiesCompleted == cat.totalFamilies -> "§c§lCompleted!"
cat.familiesFound == cat.totalFamilies -> "§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
cat.familiesFound < cat.totalFamilies ->
"§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, " +
"§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"

else -> continue
}
add(element)
if (catList.isEmpty()) return
newDisplay.addAsSingletonList("§7Category")
for (cat in catList) {
newDisplay.add(
buildList {
add(" §7- ${cat.name}§7: ")
val element = when {
cat.familiesCompleted == cat.totalFamilies -> "§c§lCompleted!"
cat.familiesFound == cat.totalFamilies -> "§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"
cat.familiesFound < cat.totalFamilies ->
"§b${cat.familiesFound}§7/§b${cat.totalFamilies} §7found, " +
"§b${cat.familiesCompleted}§7/§b${cat.totalFamilies} §7completed"

else -> continue
}
)
}
add(element)
},
)
}
}

Expand Down

0 comments on commit 9642ef6

Please sign in to comment.