[+] Last played host

pull/30/head
Azalea 2024-04-22 11:17:16 -04:00
parent 4a84a9ed8e
commit f6cf157930
6 changed files with 11 additions and 3 deletions

View File

@ -137,7 +137,8 @@ abstract class GameApiController<T : IUserData>(name: String, userDataClass: KCl
lastSeen = user.lastPlayDate.toString(),
lastVersion = user.lastRomVersion,
ratingComposition = ratingComp,
recent = plays.sortedBy { it.userPlayDate.toString() }.takeLast(15).reversed()
recent = plays.sortedBy { it.userPlayDate.toString() }.takeLast(15).reversed(),
lastPlayedHost = us.userRepo.findByKeychip(user.lastClientId)?.username
)
}
}

View File

@ -41,6 +41,7 @@ data class GenericGameSummary(
val joined: String,
val lastSeen: String,
val lastVersion: String,
val lastPlayedHost: String? = null,
val ratingComposition: Map<String, Any>,
@ -88,6 +89,7 @@ interface IUserData {
val lastRomVersion: String
val totalScore: Long
var card: Card?
val lastClientId: String
}
interface IGenericGamePlaylog {

View File

@ -70,7 +70,7 @@ class Mai2UserDetail(
var lastAllNetId: Int = 0,
var lastRegionId: Int = 0,
var lastRegionName: String = "",
var lastClientId: String = "",
override var lastClientId: String = "",
var lastCountryCode: String = "",
var lastSelectEMoney: Int = 0,
var lastSelectTicket: Int = 0,

View File

@ -39,6 +39,7 @@ class WaccaServer {
val season = 3
val enabledGates = 1..24
// [[stageId, danLevel], ...]
@Suppress("UNCHECKED_CAST")
val enabledStages = ("[[3014, 14], [3013, 13], [3012, 12], [3011, 11], [3010, 10], [3009, 9], [3008, 8], [3007, 7], [3006, 6], [3005, 5], [3004, 4], [3003, 3], [3002, 2], [3001, 1], [210001, 0], [210002, 0], [210003, 0], [310001, 0], [310002, 0], [310003, 0], [310004, 0], [310005, 0], [310006, 0]]"
.jsonArray() as List<List<Int>>).associate { it[0].int() to it[1].int() }
val enabledTickets = listOf(106001, 106002, 206001, 206002)
@ -154,12 +155,13 @@ fun WaccaServer.init() {
ls(u.lStatus())
}
"user/status/login" api@ { _, (uid) ->
"user/status/login" api@ { req, (uid) ->
val u = user(uid)
if (uid == 0 || u == null) return@api "[[], [], [], 0, [2077, 1, 1, 1, [], []], 0, []]"
// Record login
rp.user.save(u.apply {
lastClientId = req.chipId
loginCount++
if (millis() - lastConsecDate.time > 23 * 60 * 60 * 1000) {
loginCountDays++

View File

@ -45,6 +45,8 @@ class WaccaUser : BaseEntity(), IUserData {
@Convert(converter = IntegerListConverter::class)
var friendViews: MutableList<Int> = mutableListOf(0, 0, 0)
@Column(length = 50)
override var lastClientId = ""
@Column(length = 50)
override var lastRomVersion = "1.0.0"
@Convert(converter = IntegerListConverter::class)
var lastSongInfo: MutableList<Int> = mutableListOf(0, 0, 0, 0, 0)

View File

@ -0,0 +1 @@
ALTER TABLE wacca_user ADD COLUMN `last_client_id` VARCHAR(50) NOT NULL DEFAULT ''