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/bingo | |
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/bingo')
4 files changed, 11 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt index e6d339979..e4bae4f05 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/FirstMinionTier.kt @@ -43,7 +43,7 @@ object FirstMinionTier { minionId: NEUInternalName, ) { if (recipe.getCachedIngredients().any { help.contains(it.internalItemId.asInternalName()) }) { - val name = recipe.output.itemStack.name!!.removeColor() + val name = recipe.output.itemStack.name.removeColor() val abc = name.replace(" I", " 0") minions[abc] = minionId.replace("_1", "_0") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt index a6f81c588..35741622a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/MinionCraftHelper.kt @@ -15,6 +15,7 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getCachedIngredients +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher @@ -222,8 +223,8 @@ class MinionCraftHelper { return } val format = LorenzUtils.formatPercentage(percentage) - val haveFormat = LorenzUtils.formatInteger(have) - val needFormat = LorenzUtils.formatInteger(needAmount) + val haveFormat = have.addSeparators() + val needFormat = needAmount.addSeparators() newDisplay.add("$itemName§8: §e$format §8(§7$haveFormat§8/§7$needFormat§8)") allDone = false } @@ -265,7 +266,7 @@ class MinionCraftHelper { if (event.inventoryName != "Crafted Minions") return for ((_, b) in event.inventoryItems) { - val name = b.name ?: continue + val name = b.name if (!name.startsWith("§e")) continue val internalName = NEUInternalName.fromItemName("$name I") .replace("MINION", "GENERATOR").replace(";", "_").replace("CAVE_SPIDER", "CAVESPIDER") diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt index c0606ad54..91759f003 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt @@ -51,7 +51,7 @@ class BingoCardReader { lore.any { it.endsWith("Community Goal") } -> GoalType.COMMUNITY else -> continue } - val name = stack.name?.removeColor() ?: continue + val name = stack.name.removeColor() var index = 0 val builder = StringBuilder() for (s in lore) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt index be4a8c7a4..30dd81bd7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt @@ -22,6 +22,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -122,9 +124,7 @@ class BingoNextStepHelper { return if (having > 0) { val needed = step.amountNeeded val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed) - val havingFormat = LorenzUtils.formatInteger(having) - val neededFormat = LorenzUtils.formatInteger(needed) - " $percentage ($havingFormat/$neededFormat)" + " $percentage (${having.addSeparators()}/${needed.addSeparators()})" } else "" } } @@ -183,7 +183,7 @@ class BingoNextStepHelper { if (step is ItemsStep) { var totalCount = 0L for ((itemName, multiplier) in step.variants) { - val count = InventoryUtils.countItemsInLowerInventory { it.name?.removeColor() == itemName } + val count = InventoryUtils.countItemsInLowerInventory { it.name.removeColor() == itemName } totalCount += count * multiplier } if (step.amountHaving != totalCount) { @@ -263,7 +263,7 @@ class BingoNextStepHelper { private fun readDescription(description: String): NextStep? { collectionPattern.matchMatcher(description) { - val amount = group("amount").replace(",", "").toInt() + val amount = group("amount").formatInt() val name = group("name") return CollectionStep(name, amount) withItemIslandRequirement name |