aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLulonaut <lulonaut@lulonaut.tech>2024-01-04 11:14:30 +0100
committerGitHub <noreply@github.com>2024-01-04 11:14:30 +0100
commit5eb0881e1b470d33a8e02f7d877f9b225516789b (patch)
tree47048d8f4c57c1d8ae9e180d405e01369b992781
parentd28081d8cd0573be977211cbca75ffac926b210b (diff)
downloadNotEnoughUpdates-5eb0881e1b470d33a8e02f7d877f9b225516789b.tar.gz
NotEnoughUpdates-5eb0881e1b470d33a8e02f7d877f9b225516789b.tar.bz2
NotEnoughUpdates-5eb0881e1b470d33a8e02f7d877f9b225516789b.zip
Fix bestiary migration check for newly created profiles (#986)
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
index 69688fcc..ef8468ac 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/profileviewer/bestiary/BestiaryData.kt
@@ -99,8 +99,12 @@ object BestiaryData {
*/
fun hasMigrated(profileInfo: JsonObject): Boolean {
val bestiaryObject = profileInfo.getAsJsonObject("bestiary") ?: return false
-
- return (bestiaryObject.get("migration") ?: return false).asBoolean
+ return if (bestiaryObject.has("migration")) {
+ bestiaryObject.get("migration").asBoolean
+ } else {
+ // The account is new and therefore already uses the new format
+ true
+ }
}
/**
@@ -231,7 +235,7 @@ object BestiaryData {
kills
}
- val totalProgress = (effectiveKills/cap*100).roundToDecimals(1)
+ val totalProgress = (effectiveKills / cap * 100).roundToDecimals(1)
var level = 0
for (requiredKills in bracketData) {
@@ -253,8 +257,8 @@ object BestiaryData {
var completed = 0
for (mob in mobs) {
- if(mob.kills > 0) found++
- if(mob.mobLevelData.maxLevel) completed++
+ if (mob.kills > 0) found++
+ if (mob.mobLevelData.maxLevel) completed++
}
return FamilyData(found, completed, mobs.size)