Files
artemis/titles/chuni/luminous.py
2024-04-20 14:07:37 +00:00

260 lines
11 KiB
Python

from typing import Dict
from core.config import CoreConfig
from core.utils import Utils
from titles.chuni.sunplus import ChuniSunPlus
from titles.chuni.const import ChuniConstants
from titles.chuni.config import ChuniConfig
class ChuniLuminous(ChuniSunPlus):
def __init__(self, core_cfg: CoreConfig, game_cfg: ChuniConfig) -> None:
super().__init__(core_cfg, game_cfg)
self.version = ChuniConstants.VER_CHUNITHM_LUMINOUS
async def handle_get_game_setting_api_request(self, data: Dict) -> Dict:
ret = await super().handle_get_game_setting_api_request(data)
ret["gameSetting"]["romVersion"] = self.game_cfg.version.version(self.version)[
"rom"
]
ret["gameSetting"]["dataVersion"] = self.game_cfg.version.version(self.version)[
"data"
]
t_port = ""
if (
not self.core_cfg.server.is_using_proxy
and Utils.get_title_port(self.core_cfg) != 80
):
t_port = f":{self.core_cfg.server.port}"
ret["gameSetting"][
"matchingUri"
] = f"http://{self.core_cfg.server.hostname}{t_port}/SDHD/220/ChuniServlet/"
ret["gameSetting"][
"matchingUriX"
] = f"http://{self.core_cfg.server.hostname}{t_port}/SDHD/220/ChuniServlet/"
ret["gameSetting"][
"udpHolePunchUri"
] = f"http://{self.core_cfg.server.hostname}{t_port}/SDHD/220/ChuniServlet/"
ret["gameSetting"][
"reflectorUri"
] = f"http://{self.core_cfg.server.hostname}{t_port}/SDHD/220/ChuniServlet/"
return ret
async def handle_cm_get_user_preview_api_request(self, data: Dict) -> Dict:
user_data = await super().handle_cm_get_user_preview_api_request(data)
# I don't know if lastDataVersion is going to matter, I don't think CardMaker 1.35 works this far up
user_data["lastDataVersion"] = "2.20.00"
return user_data
async def handle_get_game_map_area_condition_api_request(self, data: Dict) -> Dict:
return {
"length": 1,
"gameMapAreaConditionList": [
{
"mapAreaId": "2206201", # BlythE ULTIMA
"length": 1,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6832", # MISSION in progress
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2024-01-25 00:00:00.0",
},
],
},
{
"mapAreaId": "2206202", # PRIVATE SERVICE ULTIMA
"length": 1,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6832", # MISSION in progress
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2024-01-25 00:00:00.0",
},
],
},
{
"mapAreaId": "2206203", # New York Back Raise
"length": 1,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6833", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
],
},
{
"mapAreaId": "2206204", # Spasmodic
"length": 2,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6834", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6835", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
],
},
{
"mapAreaId": "2206205", # ΩΩPARTS
"length": 2,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6836", # マターリ進行キボンヌ
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6837", # マターリしようよ
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2024-01-25 00:00:00.0",
},
],
},
{
"mapAreaId": "2206206", # Blow My Mind
"length": 1,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6838", # Can you hear me?
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
],
},
# TODO: Proper VALLIS-NERIA: Unlock other areas
# {
# "mapAreaId": "2206207",
# "length": 0,
# "mapAreaConditionList": [
# ],
# }
{
"mapAreaId": "2206207",
"length": 7,
"mapAreaConditionList": [
{
"type": "3",
"conditionId": "6832", # MISSION in progress
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2024-01-25 00:00:00.0",
},
{
"type": "3",
"conditionId": "6833", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6834", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6835", # 今宵、劇場に映し出される景色とは――――。
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6836", # マターリ進行キボンヌ
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
{
"type": "3",
"conditionId": "6837", # マターリしようよ
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2024-01-25 00:00:00.0",
},
{
"type": "3",
"conditionId": "6838", # Can you hear me?
"logicalOpe": "1",
"startDate": "2023-12-14 07:00:00.0",
"endDate": "2099-12-31 00:00:00.0",
},
],
}
]
}
async def handle_get_user_c_mission_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
mission_id = data["missionId"]
progress_list = []
point = 0
mission_data = await self.data.item.get_cmission(user_id, mission_id)
progress_data = await self.data.item.get_cmission_progress(user_id, mission_id)
if mission_data and progress_data:
point = mission_data["point"]
for progress in progress_data:
progress_list.append(
{
"order": progress["order"],
"stage": progress["stage"],
"progress": progress["progress"],
}
)
return {
"userId": user_id,
"missionId": mission_id,
"point": point,
"userCMissionProgressList": progress_list,
}
async def handle_get_user_net_battle_ranking_info_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
net_battle = {}
net_battle_data = await self.data.profile.get_net_battle(user_id)
if net_battle_data:
net_battle = {
"isRankUpChallengeFailed": net_battle_data["isRankUpChallengeFailed"],
"highestBattleRankId": net_battle_data["highestBattleRankId"],
"battleIconId": net_battle_data["battleIconId"],
"battleIconNum": net_battle_data["battleIconNum"],
"avatarEffectPoint": net_battle_data["avatarEffectPoint"],
}
return {
"userId": user_id,
"userNetBattleData": net_battle,
}