[+] Wacca: More database fields

This commit is contained in:
Azalea
2024-03-29 00:24:02 -04:00
parent aa1caacfd6
commit abc21badb1
5 changed files with 44 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package icu.samnyan.aqua.sega.wacca.model.db
import jakarta.transaction.Transactional
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.NoRepositoryBean
import org.springframework.stereotype.Component
@@ -31,6 +32,8 @@ interface WcUserItemRepo : IWaccaUserLinked<WcUserItem> {
}
interface WcUserBestScoreRepo : IWaccaUserLinked<WcUserScore> {
fun findByUserAndSongIdAndDifficulty(user: WaccaUser, songId: Int, difficulty: Int): WcUserScore?
@Query("SELECT SUM(score) FROM WcUserScore WHERE user = :user")
fun sumScoreByUser(user: WaccaUser): Long
}
interface WcUserPlayLogRepo : IWaccaUserLinked<WcUserPlayLog>
interface WcUserStageUpRepo : IWaccaUserLinked<WcUserStageUp>

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.net.games.IGenericUserData
import icu.samnyan.aqua.sega.general.IntegerListConverter
import icu.samnyan.aqua.sega.general.model.Card
import jakarta.persistence.*
@@ -14,13 +15,13 @@ import java.util.*
* General user information
*/
@Entity @Table(name = "wacca_user")
class WaccaUser : BaseEntity() {
class WaccaUser : BaseEntity(), IGenericUserData {
@OneToOne
@JoinColumn(name = "aime_card_id", unique = true)
var card: Card = Card()
override var card: Card? = Card()
@Column(length = 8)
var username = ""
override var userName = ""
var xp = 0
var wp = 500
@@ -30,7 +31,8 @@ class WaccaUser : BaseEntity() {
var danLevel = 0
@Convert(converter = IntegerListConverter::class)
var titles: MutableList<Int> = mutableListOf(0, 0, 0)
var rating = 0
override var playerRating = 0
override var highestRating = 0
@Temporal(TemporalType.TIMESTAMP)
var vipExpireTime: Date = "2077-01-01".isoDate().toDate()
var alwaysVip = false
@@ -43,17 +45,22 @@ class WaccaUser : BaseEntity() {
@Convert(converter = IntegerListConverter::class)
var friendViews: MutableList<Int> = mutableListOf(0, 0, 0)
@Column(length = 50)
var lastGameVer = "1.0.0"
override var lastRomVersion = "1.0.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()
override var lastPlayDate: Date = Date()
@Temporal(TemporalType.TIMESTAMP)
override var firstPlayDate: Date = Date()
var gateTutorialFlags: String = "[[1, 0], [2, 0], [3, 0], [4, 0], [5, 0]]"
@Convert(converter = IntegerListConverter::class)
var favoriteSongs: MutableList<Int> = mutableListOf()
override var totalScore = 0L
fun lStatus() = ls(card.extId, username, 1, xp, danLevel, danType, wp, ls(0, 0, 0), loginCount, loginCountDays,
(loginCount - 1).coerceAtLeast(0), loginCountDaysConsec, vipExpireTime.sec, loginCountToday, rating)
fun lStatus() = ls(card?.extId,
userName, 1, xp, danLevel, danType, wp, ls(0, 0, 0), loginCount, loginCountDays,
(loginCount - 1).coerceAtLeast(0), loginCountDaysConsec, vipExpireTime.sec, loginCountToday, this.playerRating
)
}