[O] Wacca: Simplify data storage, re-init database

This commit is contained in:
Azalea
2024-03-28 19:04:16 -04:00
parent f97cb4a1bb
commit 40fb1c8868
5 changed files with 208 additions and 187 deletions

View File

@@ -5,6 +5,7 @@ import ext.ls
import ext.sec
import ext.toDate
import icu.samnyan.aqua.net.games.BaseEntity
import icu.samnyan.aqua.sega.general.IntegerListConverter
import icu.samnyan.aqua.sega.general.model.Card
import jakarta.persistence.*
import java.util.*
@@ -22,44 +23,37 @@ class WaccaUser : BaseEntity() {
var username = ""
var xp = 0
var wp = 0
var wpTotal = 0
var wp = 500
var wpTotal = 500
var wpSpent = 0
var danType = 0
var danLevel = 0
var title0 = 0
var title1 = 0
var title2 = 0
@Convert(converter = IntegerListConverter::class)
var titles: MutableList<Int> = mutableListOf(0, 0, 0)
var rating = 0
@Temporal(TemporalType.TIMESTAMP)
var vipExpireTime: Date = "2077-01-01".isoDate().toDate()
var alwaysVip = false
var loginCount = 0
var loginCountConsec = 0
var loginCountDays = 0
var loginCountDaysConsec = 0
var loginCountToday = 0
var playcountSingle = 0
var playcountMultiVs = 0
var playcountMultiCoop = 0
var playcountStageup = 0
var playcountTimeFree = 0
var friendView1 = 0
var friendView2 = 0
var friendView3 = 0
@Convert(converter = IntegerListConverter::class)
var playCounts: MutableList<Int> = mutableListOf(0, 0, 0, 0, 0)
@Convert(converter = IntegerListConverter::class)
var friendViews: MutableList<Int> = mutableListOf(0, 0, 0)
@Column(length = 50)
var lastGameVer = "1.0.0"
var lastSongId = 0
var lastSongDifficulty = 0
var lastFolderOrder = 0
var lastFolderId = 0
var lastSongOrder = 0
@Convert(converter = IntegerListConverter::class)
var lastSongInfo: MutableList<Int> = mutableListOf(0, 0, 0, 0, 0)
@Temporal(TemporalType.TIMESTAMP)
var lastConsecDate: Date = Date(0)
@Temporal(TemporalType.TIMESTAMP)
var lastLoginDate: Date = Date()
var gateTutorialFlags: String = "[[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]"
@Convert(converter = IntegerListConverter::class)
var favoriteSongs: MutableList<Int> = mutableListOf()
fun lStatus() = ls(card.extId, username, 1, xp, danLevel, danType, wp, ls(0, 0, 0), loginCount, loginCountDays,
loginCountConsec, loginCountDaysConsec, vipExpireTime.sec, loginCountToday, rating)
(loginCount - 1).coerceAtLeast(0), loginCountDaysConsec, vipExpireTime.sec, loginCountToday, rating)
}

View File

@@ -26,10 +26,10 @@ open class WaccaUserEntity : BaseEntity() {
* In-game option key-value storage
*/
@Entity @Table(name = "wacca_user_option", uniqueConstraints = [UC("", ["user_id", "opt_id"])])
class WcUserOption : WaccaUserEntity() {
var optId = 0
var value = 0
}
class WcUserOption(
var optId: Int = 0,
var value: Int = 0
) : WaccaUserEntity()
@Entity @Table(name = "wacca_user_bingo", uniqueConstraints = [UC("", ["user_id", "page_number"])])
class WcUserBingo : WaccaUserEntity() {
@@ -47,24 +47,19 @@ class WcUserFriend : WaccaUserEntity() {
var isAccepted = false
}
@Entity @Table(name = "wacca_user_favorite_song", uniqueConstraints = [UC("", ["user_id", "song_id"])])
class WcUserFavoriteSong : WaccaUserEntity() {
// TODO: Make this into a list instead?
var songId = 0
}
@Entity @Table(name = "wacca_user_gate", uniqueConstraints = [UC("", ["user_id", "gate_id"])])
class WcUserGate : WaccaUserEntity() {
var gateId = 0
var page = 1
var progress = 0
var loops = 0
@Temporal(TemporalType.TIMESTAMP)
var lastUsed = Date(0)
var missionFlag = 0
var totalPoints = 0
fun ls() = ls(gateId, 1, page, progress, loops, lastUsed, missionFlag)
fun ls() = ls(gateId, 1, page, progress, loops, lastUsed.sec, missionFlag)
}
@Entity @Table(name = "wacca_user_item", uniqueConstraints = [UC("", ["user_id", "item_id", "type"])])