MonkeyBusiness/modules/iidx/shop.py

65 lines
1.9 KiB
Python
Raw Permalink Normal View History

2022-10-09 06:37:38 +02:00
import config
from fastapi import APIRouter, Request, Response
from core_common import core_process_request, core_prepare_response, E
router = APIRouter(prefix="/local", tags=["local"])
2022-10-11 03:30:53 +02:00
router.model_whitelist = ["LDJ", "KDZ", "JDZ"]
2022-10-09 06:37:38 +02:00
2022-11-15 15:03:37 +01:00
@router.post("/{gameinfo}/shop/getname")
2022-10-09 06:37:38 +02:00
async def shop_getname(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.shop(
cls_opt=0,
opname=config.arcade,
pid=13,
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
2022-11-15 15:03:37 +01:00
@router.post("/{gameinfo}/shop/getconvention")
2022-10-09 06:37:38 +02:00
async def shop_getconvention(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.shop(
E.valid(1, __type="bool"),
music_0=-1,
music_1=-1,
music_2=-1,
music_3=-1,
start_time=0,
end_time=0,
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
2022-11-15 15:03:37 +01:00
@router.post("/{gameinfo}/shop/sentinfo")
2022-10-09 06:37:38 +02:00
async def shop_sentinfo(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
response = E.response(E.shop())
2022-10-09 06:37:38 +02:00
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)
2022-11-15 15:03:37 +01:00
@router.post("/{gameinfo}/shop/sendescapepackageinfo")
2022-10-09 06:37:38 +02:00
async def shop_sendescapepackageinfo(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
response = E.response(E.shop(expire=1200))
2022-10-09 06:37:38 +02:00
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)