aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
index 348d05cb2..03a0776ce 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/TestCopyBestiaryValues.kt
@@ -8,10 +8,11 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullOwner
import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
+import at.hannibal2.skyhanni.utils.NumberUtil.formatInt
import at.hannibal2.skyhanni.utils.OSUtils
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
+import at.hannibal2.skyhanni.utils.StringUtils.removeWordsAtEnd
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import com.google.gson.GsonBuilder
import com.google.gson.annotations.Expose
@@ -67,8 +68,7 @@ object TestCopyBestiaryValues {
}
private fun copy(titleItem: ItemStack, inventoryItems: Map<Int, ItemStack>) {
- val name = titleItem.name ?: return
- val titleName = name.split(" ").dropLast(1).joinToString(" ")
+ val titleName = titleItem.name.removeWordsAtEnd(1)
val obj = BestiarityObject()
obj.name = titleName
@@ -82,14 +82,13 @@ object TestCopyBestiaryValues {
return
}
val capLine = lore.nextAfter(overallProgress) ?: return
- val rawCap = capLine.substringAfter("/").removeColor().formatNumber()
- obj.cap = rawCap.toInt()
+ val rawCap = capLine.substringAfter("/").removeColor().formatInt()
+ obj.cap = rawCap
val mobs = mutableListOf<String>()
for (i in 10..43) {
val stack = inventoryItems[i] ?: continue
- val stackName = stack.name ?: continue
- bestiaryTypePattern.matchMatcher(stackName.removeColor()) {
+ bestiaryTypePattern.matchMatcher(stack.name.removeColor()) {
val lvl = group("lvl").toInt()
var text = group("text").lowercase().replace(" ", "_")