From 5d40fe24548716d075e2c52b71c1843e6ab4c800 Mon Sep 17 00:00:00 2001 From: drmext <71258889+drmext@users.noreply.github.com> Date: Fri, 2 Jun 2023 22:56:10 +0000 Subject: [PATCH] Global Arena --- modules/iidx/iidx30gamesystem.py | 10 +++--- modules/iidx/iidx30lobby.py | 52 +++++++++++++++++++++++++++++++- modules/iidx/iidx30music.py | 11 +++++++ modules/iidx/iidx30pc.py | 10 ++++++ 4 files changed, 78 insertions(+), 5 deletions(-) diff --git a/modules/iidx/iidx30gamesystem.py b/modules/iidx/iidx30gamesystem.py index fffef8d..b9c6cd0 100644 --- a/modules/iidx/iidx30gamesystem.py +++ b/modules/iidx/iidx30gamesystem.py @@ -1,3 +1,5 @@ +from time import time + import config from fastapi import APIRouter, Request, Response @@ -18,9 +20,9 @@ async def iidx30gamesystem_systeminfo(request: Request): response = E.response( E.IIDX30gameSystem( E.arena_schedule( - E.phase(2, __type="u8"), + E.phase(3, __type="u8"), E.start(1605784800, __type="u32"), - E.end(1605871200, __type="u32"), + E.end(round(time()), __type="u32"), ), E.CommonBossPhase(val=0), E.Event1InternalPhase(val=0), @@ -50,7 +52,7 @@ async def iidx30gamesystem_systeminfo(request: Request): E.arena_music_difficult( E.play_style(s, __type="s32"), E.arena_class(19, __type="s32"), - E.low_difficult(1, __type="s32"), + E.low_difficult(8, __type="s32"), E.high_difficult(12, __type="s32"), E.is_leggendaria(1, __type="bool"), E.force_music_list_id(0, __type="s32"), @@ -84,7 +86,7 @@ async def iidx30gamesystem_systeminfo(request: Request): E.index(0, __type="s32"), E.music_id(1000, __type="s32"), E.note_grade(0, __type="s32"), - E.is_active(s, __type="bool"), + E.is_active(0, __type="bool"), ) for s in sp_dp ], diff --git a/modules/iidx/iidx30lobby.py b/modules/iidx/iidx30lobby.py index 07ce81a..39e630f 100644 --- a/modules/iidx/iidx30lobby.py +++ b/modules/iidx/iidx30lobby.py @@ -1,3 +1,5 @@ +from time import time + import config from fastapi import APIRouter, Request, Response @@ -8,11 +10,54 @@ router = APIRouter(prefix="/lobby", tags=["lobby"]) router.model_whitelist = ["LDJ"] +host = {} + + @router.post("/{gameinfo}/IIDX30lobby/entry") async def iidx30lobby_entry(request: Request): request_info = await core_process_request(request) - response = E.response(E.IIDX30lobby()) + root = request_info["root"][0] + sp_dp = root.find("play_style").text + arena_class = root.find("arena_class").text + ga = root.find("address/ga").text.split() + gp = root.find("address/gp").text + la = root.find("address/la").text.split() + + if host and time() < host["time"]: + # test menu reset + if host["ga"] == ga: + is_host = 1 + host["time"] = time() + 30 + else: + is_host = 0 + response = E.response( + E.IIDX30lobby( + E.host(is_host, __type="bool"), + E.matching_class(arena_class, __type="s32"), + E.address( + E.ga(host["ga"], __type="u8"), + E.gp(host["gp"], __type="u16"), + E.la(host["la"], __type="u8"), + ), + ) + ) + else: + host["ga"] = ga + host["gp"] = gp + host["la"] = la + host["time"] = time() + 30 + response = E.response( + E.IIDX30lobby( + E.host(1, __type="bool"), + E.matching_class(arena_class, __type="s32"), + E.address( + E.ga(ga, __type="u8"), + E.gp(gp, __type="u16"), + E.la(la, __type="u8"), + ), + ) + ) response_body, response_headers = await core_prepare_response(request, response) return Response(content=response_body, headers=response_headers) @@ -32,6 +77,11 @@ async def iidx30lobby_update(request: Request): async def iidx30lobby_delete(request: Request): request_info = await core_process_request(request) + # normal reset + del host["ga"] + del host["gp"] + del host["la"] + del host["time"] response = E.response(E.IIDX30lobby()) response_body, response_headers = await core_prepare_response(request, response) diff --git a/modules/iidx/iidx30music.py b/modules/iidx/iidx30music.py index bec40f9..1413da7 100644 --- a/modules/iidx/iidx30music.py +++ b/modules/iidx/iidx30music.py @@ -479,3 +479,14 @@ async def iidx30music_appoint(request: Request): response_body, response_headers = await core_prepare_response(request, response) return Response(content=response_body, headers=response_headers) + +@router.post("/{gameinfo}/IIDX30music/arenaCPU") +async def iidx30music_arenaCPU(request: Request): + request_info = await core_process_request(request) + + root = request_info["root"][0] + + response = E.response(E.IIDX30music()) + + response_body, response_headers = await core_prepare_response(request, response) + return Response(content=response_body, headers=response_headers) diff --git a/modules/iidx/iidx30pc.py b/modules/iidx/iidx30pc.py index 78cba06..21e1332 100644 --- a/modules/iidx/iidx30pc.py +++ b/modules/iidx/iidx30pc.py @@ -315,6 +315,16 @@ async def iidx30pc_get(request: Request): cube=200, season_id=0, ), + E.chat_data( + E.is_chat_0(1, __type="bool"), + E.is_chat_1(1, __type="bool"), + E.is_chat_2(1, __type="bool"), + E.is_chat_3(1, __type="bool"), + chat_type_0="hi", + chat_type_1="hi", + chat_type_2="hi", + chat_type_3="hi", + ), play_num=6, play_num_dp=3, play_num_sp=3,