From af3aa497d1b6f82af4b1966fd3cb5feda372f451 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 22 Feb 2024 23:51:22 -0500 Subject: [PATCH] [O] Better understanding of the data type of different games --- src/main/java/icu/samnyan/aqua/net/UserRegistrar.kt | 8 ++++---- src/main/java/icu/samnyan/aqua/sega/general/model/Card.kt | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/icu/samnyan/aqua/net/UserRegistrar.kt b/src/main/java/icu/samnyan/aqua/net/UserRegistrar.kt index ff60f1f2..a30cefe4 100644 --- a/src/main/java/icu/samnyan/aqua/net/UserRegistrar.kt +++ b/src/main/java/icu/samnyan/aqua/net/UserRegistrar.kt @@ -30,11 +30,11 @@ class UserRegistrar( val emailProps: EmailProperties ) { companion object { - // Random long with length 9 (10^10 possibilities) - // This is because DIVA is using int for card ID, which is at max 10 digits (2147483647) - // TODO: Figure out if DIVA can handle int64 + // Random long with length 9-10 + // We chose 1e9 as the start because normal cards took 0...1e9-1 + // This is because games can only take uint32 for card ID, which is at max 10 digits (4294967295) const val cardExtIdStart = 1e9.toLong() - const val cardExtIdEnd = 1e10.toLong() - 1 + const val cardExtIdEnd = 4294967295 } /** diff --git a/src/main/java/icu/samnyan/aqua/sega/general/model/Card.kt b/src/main/java/icu/samnyan/aqua/sega/general/model/Card.kt index f251da48..d1de2e28 100644 --- a/src/main/java/icu/samnyan/aqua/sega/general/model/Card.kt +++ b/src/main/java/icu/samnyan/aqua/sega/general/model/Card.kt @@ -18,7 +18,8 @@ class Card( @JsonIgnore val id: Long = 0, - // A external id + // An external id (THIS IS UINT32!!!!) + // IDK why samnyan used Long, Games cannot parse the full int64 value and will cast it to uint32 @Column(name = "ext_id", unique = true, nullable = false) @JsonIgnore // Sensitive information var extId: Long = 0, @@ -48,5 +49,6 @@ class Card( private val serialVersionUID = 1L } + @Suppress("unused") // Used by serialization val isLinked get() = aquaUser != null }