GITADORA Battle Mode

This commit is contained in:
drmext 2023-05-20 19:52:04 +00:00
parent d3a3cf0bae
commit c9c254e233
No known key found for this signature in database
GPG Key ID: F1ED48FFE79A6961
2 changed files with 71 additions and 22 deletions

View File

@ -166,32 +166,32 @@ async def gitadora_gametop_get(ver: str, request: Request):
E.send_gb_point(0, __type="s32"),
),
E.greeting(
E.greeting_1("", __type="str"),
E.greeting_2("", __type="str"),
E.greeting_3("", __type="str"),
E.greeting_4("", __type="str"),
E.greeting_5("", __type="str"),
E.greeting_6("", __type="str"),
E.greeting_7("", __type="str"),
E.greeting_8("", __type="str"),
E.greeting_9("", __type="str"),
E.greeting_1("hi", __type="str"),
E.greeting_2("hi", __type="str"),
E.greeting_3("hi", __type="str"),
E.greeting_4("hi", __type="str"),
E.greeting_5("hi", __type="str"),
E.greeting_6("hi", __type="str"),
E.greeting_7("hi", __type="str"),
E.greeting_8("hi", __type="str"),
E.greeting_9("hi", __type="str"),
),
E.setting(
E.matching(0, __type="s32"),
E.info_level(0, __type="s32"),
E.matching(1, __type="s32"),
E.info_level(1, __type="s32"),
),
E.score(
E.battle_class(0, __type="s32"),
E.max_battle_class(0, __type="s32"),
E.battle_point(0, __type="s32"),
E.win(0, __type="s32"),
E.lose(0, __type="s32"),
E.draw(0, __type="s32"),
E.consecutive_win(0, __type="s32"),
E.max_consecutive_win(0, __type="s32"),
E.glorious_win(0, __type="s32"),
E.max_defeat_skill(0, __type="s32"),
E.latest_result(0, __type="s32"),
E.battle_class(100, __type="s32"),
E.max_battle_class(100, __type="s32"),
E.battle_point(100, __type="s32"),
E.win(100, __type="s32"),
E.lose(100, __type="s32"),
E.draw(100, __type="s32"),
E.consecutive_win(100, __type="s32"),
E.max_consecutive_win(100, __type="s32"),
E.glorious_win(100, __type="s32"),
E.max_defeat_skill(100, __type="s32"),
E.latest_result(5, __type="s32"),
),
E.history(),
),

49
modules/gitadora/lobby.py Normal file
View File

@ -0,0 +1,49 @@
from fastapi import APIRouter, Request, Response
from core_common import E, core_prepare_response, core_process_request
router = APIRouter(prefix="/lobby", tags=["lobby"])
router.model_whitelist = ["M32"]
host = {}
@router.post("/{gameinfo}/lobby/request")
async def gitadora_lobby_request(request: Request):
request_info = await core_process_request(request)
root = request_info["root"][0][0]
address_ip = root.find("address/ip").text
check_attestid = root.find("check/attestid").text
if host:
if host["ip"] != address_ip:
response = E.response(
E.lobby(
E.lobbydata(
E.candidate(
E.address(
E.ip(host["ip"], __type="str"),
),
E.check(
E.attestid(host["attestid"], __type="str"),
),
),
),
)
)
elif host["ip"] == address_ip:
response = E.response(E.lobby())
del host["ip"]
del host["attestid"]
else:
host["ip"] = address_ip
host["attestid"] = check_attestid
response = E.response(E.lobby())
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)