mirror of https://github.com/hykilpikonna/AquaDX
[+] Add Character all unlock
parent
03ed3f13f4
commit
153029abdd
|
@ -30,6 +30,7 @@ class Maimai2ServletController(
|
||||||
val upsertUserPrint: UpsertUserPrintHandler,
|
val upsertUserPrint: UpsertUserPrintHandler,
|
||||||
val getUserFavoriteItem: GetUserFavoriteItemHandler,
|
val getUserFavoriteItem: GetUserFavoriteItemHandler,
|
||||||
val getUserRivalMusic: GetUserRivalMusicHandler,
|
val getUserRivalMusic: GetUserRivalMusicHandler,
|
||||||
|
val getUserCharacter: GetUserCharacterHandler,
|
||||||
val repos: Mai2Repos
|
val repos: Mai2Repos
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -74,11 +75,6 @@ class Maimai2ServletController(
|
||||||
"userCardList" to repos.userCard.findByUser_Card_ExtId(userId)
|
"userCardList" to repos.userCard.findByUser_Card_ExtId(userId)
|
||||||
) }
|
) }
|
||||||
|
|
||||||
val getUserCharacter = UserReqHandler { _, userId -> mapOf(
|
|
||||||
"userId" to userId,
|
|
||||||
"userCharacterList" to repos.userCharacter.findByUser_Card_ExtId(userId)
|
|
||||||
) }
|
|
||||||
|
|
||||||
val getUserCharge = UserReqHandler { _, userId -> repos.userCharge.findByUser_Card_ExtId(userId).let { mapOf(
|
val getUserCharge = UserReqHandler { _, userId -> repos.userCharge.findByUser_Card_ExtId(userId).let { mapOf(
|
||||||
"userId" to userId,
|
"userId" to userId,
|
||||||
"length" to it.size,
|
"length" to it.size,
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package icu.samnyan.aqua.sega.maimai2.handler
|
||||||
|
|
||||||
|
import icu.samnyan.aqua.net.games.mai2.Maimai2
|
||||||
|
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||||
|
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||||
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
import kotlin.jvm.optionals.getOrNull
|
||||||
|
|
||||||
|
@Component("Maimai2GetUserCharacterHandler")
|
||||||
|
class GetUserCharacterHandler(
|
||||||
|
val repos: Mai2Repos,
|
||||||
|
val maimai2: Maimai2,
|
||||||
|
val cardRepo: CardRepository,
|
||||||
|
) : BaseHandler {
|
||||||
|
val itemUnlock = maimai2.itemMapping[Mai2ItemKind.chara.name]?.map { mapOf(
|
||||||
|
"characterId" to it.key,
|
||||||
|
"level" to 9999,
|
||||||
|
"awakening" to 1,
|
||||||
|
"useCount" to 0
|
||||||
|
) }
|
||||||
|
|
||||||
|
init {
|
||||||
|
if (itemUnlock.isNullOrEmpty()) logger.warn("Mai2 item info is empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun handle(request: Map<String, Any>): Any {
|
||||||
|
val userId = (request["userId"] as Number).toLong()
|
||||||
|
|
||||||
|
// Aqua Net game unlock feature
|
||||||
|
cardRepo.findByExtId(userId).getOrNull()?.aquaUser?.gameOptions?.let { opt ->
|
||||||
|
if (!opt.unlockChara or itemUnlock.isNullOrEmpty()) return@let
|
||||||
|
|
||||||
|
logger.info("Response: ${itemUnlock!!.size} Characters - All unlock")
|
||||||
|
return mapOf(
|
||||||
|
"userId" to userId,
|
||||||
|
"userCharacterList" to itemUnlock
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return mapOf(
|
||||||
|
"userId" to userId,
|
||||||
|
"userCharacterList" to repos.userCharacter.findByUser_Card_ExtId(userId)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val logger: Logger = LoggerFactory.getLogger(GetUserCharacterHandler::class.java)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue