From 5f871b1945924d21acb2b1fe3c953674715eb603 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 26 Dec 2024 18:51:26 -0500 Subject: [PATCH] [O] Rewrite map area condition --- .../sega/chusan/ChusanServletController.kt | 36 ++++++++++++++++++ .../chusan/handler/GetUserMapAreaHandler.kt | 38 ------------------- 2 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/icu/samnyan/aqua/sega/chusan/handler/GetUserMapAreaHandler.kt diff --git a/src/main/java/icu/samnyan/aqua/sega/chusan/ChusanServletController.kt b/src/main/java/icu/samnyan/aqua/sega/chusan/ChusanServletController.kt index cecbfdb0..068e8e01 100644 --- a/src/main/java/icu/samnyan/aqua/sega/chusan/ChusanServletController.kt +++ b/src/main/java/icu/samnyan/aqua/sega/chusan/ChusanServletController.kt @@ -271,4 +271,40 @@ fun ChusanServletController.init() { "GetGameEvent" static { db.gameEvent.findByEnable(true).let { mapOf("type" to 1, "length" to it.size, "gameEventList" to it) } } "GetGameCharge" static { db.gameCharge.findAll().let { mapOf("length" to it.size, "gameChargeList" to it) } } "GetGameGacha" static { db.gameGacha.findAll().let { mapOf("length" to it.size, "gameGachaList" to it, "registIdList" to empty) } } + "GetGameMapAreaCondition" static { + mapOf( + "gameMapAreaConditionList" to listOf( + mapOf("mapAreaId" to 2206201, "mapAreaConditionList" to listOf( + mapOf("type" to 3, "conditionId" to 6832, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 2206203, "mapAreaConditionList" to listOf( + mapOf("type" to 3, "conditionId" to 6833, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 2206204, "mapAreaConditionList" to listOf( + mapOf("type" to 3, "conditionId" to 6834, "logicalOpe" to 1), + mapOf("type" to 3, "conditionId" to 6835, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 2206205, "mapAreaConditionList" to listOf( + mapOf("type" to 3, "conditionId" to 6837, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 2206206, "mapAreaConditionList" to listOf( + mapOf("type" to 3, "conditionId" to 6838, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 2206207, "mapAreaConditionList" to listOf( + mapOf("type" to 2, "conditionId" to 2206201, "logicalOpe" to 1), + mapOf("type" to 2, "conditionId" to 2206202, "logicalOpe" to 1), + mapOf("type" to 2, "conditionId" to 2206203, "logicalOpe" to 1), + mapOf("type" to 2, "conditionId" to 2206204, "logicalOpe" to 1), + mapOf("type" to 2, "conditionId" to 2206205, "logicalOpe" to 1), + mapOf("type" to 2, "conditionId" to 2206206, "logicalOpe" to 1) + )), + mapOf("mapAreaId" to 3229301, "mapAreaConditionList" to listOf( + mapOf("type" to 1, "conditionId" to 3020701, "logicalOpe" to 2) + )), + mapOf("mapAreaId" to 3229302, "mapAreaConditionList" to listOf( + mapOf("type" to 1, "conditionId" to 3020701, "logicalOpe" to 1) + )) + ) + ) + } } diff --git a/src/main/java/icu/samnyan/aqua/sega/chusan/handler/GetUserMapAreaHandler.kt b/src/main/java/icu/samnyan/aqua/sega/chusan/handler/GetUserMapAreaHandler.kt deleted file mode 100644 index 033075f2..00000000 --- a/src/main/java/icu/samnyan/aqua/sega/chusan/handler/GetUserMapAreaHandler.kt +++ /dev/null @@ -1,38 +0,0 @@ -package icu.samnyan.aqua.sega.chusan.handler - -import ext.logger -import icu.samnyan.aqua.sega.chusan.model.Chu3UserMapRepo -import icu.samnyan.aqua.sega.general.BaseHandler -import icu.samnyan.aqua.sega.util.jackson.StringMapper -import org.springframework.stereotype.Component - -/** - * Handle GetUserMap request - * @author samnyan (privateamusement@protonmail.com) - */ -@Component("ChusanGetUserMapAreaHandler") -class GetUserMapAreaHandler( - private val mapper: StringMapper, - private val userMapRepo: Chu3UserMapRepo -) : BaseHandler { - - @Suppress("UNCHECKED_CAST") - override fun handle(request: Map): String { - val userId = request["userId"] as String? - val maps = (request["mapAreaIdList"] as List>) - .mapNotNull { it["mapAreaId"]?.toIntOrNull() } - - val resultMap = mapOf( - "userId" to userId, - "userMapAreaList" to userMapRepo.findAllByUserCardExtIdAndMapAreaIdIn(userId?.toLong() ?: return "{}", maps) - ) - - val json = mapper.write(resultMap) - logger.info("Response: $json") - return json - } - - companion object { - private val logger = logger() - } -}