Global Arena

This commit is contained in:
drmext 2023-06-02 22:56:10 +00:00
parent 0b96ddede0
commit 5d40fe2454
No known key found for this signature in database
GPG Key ID: F1ED48FFE79A6961
4 changed files with 78 additions and 5 deletions

View File

@ -1,3 +1,5 @@
from time import time
import config import config
from fastapi import APIRouter, Request, Response from fastapi import APIRouter, Request, Response
@ -18,9 +20,9 @@ async def iidx30gamesystem_systeminfo(request: Request):
response = E.response( response = E.response(
E.IIDX30gameSystem( E.IIDX30gameSystem(
E.arena_schedule( E.arena_schedule(
E.phase(2, __type="u8"), E.phase(3, __type="u8"),
E.start(1605784800, __type="u32"), E.start(1605784800, __type="u32"),
E.end(1605871200, __type="u32"), E.end(round(time()), __type="u32"),
), ),
E.CommonBossPhase(val=0), E.CommonBossPhase(val=0),
E.Event1InternalPhase(val=0), E.Event1InternalPhase(val=0),
@ -50,7 +52,7 @@ async def iidx30gamesystem_systeminfo(request: Request):
E.arena_music_difficult( E.arena_music_difficult(
E.play_style(s, __type="s32"), E.play_style(s, __type="s32"),
E.arena_class(19, __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.high_difficult(12, __type="s32"),
E.is_leggendaria(1, __type="bool"), E.is_leggendaria(1, __type="bool"),
E.force_music_list_id(0, __type="s32"), E.force_music_list_id(0, __type="s32"),
@ -84,7 +86,7 @@ async def iidx30gamesystem_systeminfo(request: Request):
E.index(0, __type="s32"), E.index(0, __type="s32"),
E.music_id(1000, __type="s32"), E.music_id(1000, __type="s32"),
E.note_grade(0, __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 for s in sp_dp
], ],

View File

@ -1,3 +1,5 @@
from time import time
import config import config
from fastapi import APIRouter, Request, Response from fastapi import APIRouter, Request, Response
@ -8,11 +10,54 @@ router = APIRouter(prefix="/lobby", tags=["lobby"])
router.model_whitelist = ["LDJ"] router.model_whitelist = ["LDJ"]
host = {}
@router.post("/{gameinfo}/IIDX30lobby/entry") @router.post("/{gameinfo}/IIDX30lobby/entry")
async def iidx30lobby_entry(request: Request): async def iidx30lobby_entry(request: Request):
request_info = await core_process_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) response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers) return Response(content=response_body, headers=response_headers)
@ -32,6 +77,11 @@ async def iidx30lobby_update(request: Request):
async def iidx30lobby_delete(request: Request): async def iidx30lobby_delete(request: Request):
request_info = await core_process_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 = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response) response_body, response_headers = await core_prepare_response(request, response)

View File

@ -479,3 +479,14 @@ async def iidx30music_appoint(request: Request):
response_body, response_headers = await core_prepare_response(request, response) response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers) 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)

View File

@ -315,6 +315,16 @@ async def iidx30pc_get(request: Request):
cube=200, cube=200,
season_id=0, 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=6,
play_num_dp=3, play_num_dp=3,
play_num_sp=3, play_num_sp=3,