mirror of
https://github.com/drmext/MonkeyBusiness.git
synced 2024-11-24 07:00:15 +01:00
BPL
This commit is contained in:
parent
190ae3c4d6
commit
a4d5243108
@ -31,7 +31,7 @@ async def iidx30gamesystem_systeminfo(request: Request):
|
||||
E.gradeOpenPhase(val=2),
|
||||
E.isEiseiOpenFlg(val=1),
|
||||
E.WorldTourismOpenList(val=1),
|
||||
E.BPLBattleOpenPhase(val=2),
|
||||
E.BPLBattleOpenPhase(val=3),
|
||||
*[
|
||||
E.music_open(
|
||||
E.music_id(s, __type="s32"),
|
||||
|
@ -10,7 +10,8 @@ router = APIRouter(prefix="/lobby", tags=["lobby"])
|
||||
router.model_whitelist = ["LDJ"]
|
||||
|
||||
|
||||
host = {}
|
||||
arena_host = {}
|
||||
bpl_host = {}
|
||||
|
||||
|
||||
@router.post("/{gameinfo}/IIDX30lobby/entry")
|
||||
@ -24,29 +25,29 @@ async def iidx30lobby_entry(request: Request):
|
||||
gp = root.find("address/gp").text
|
||||
la = root.find("address/la").text.split()
|
||||
|
||||
if host and time() < host["time"]:
|
||||
if arena_host and time() < arena_host["time"]:
|
||||
# test menu reset
|
||||
if host["ga"] == ga:
|
||||
is_host = 1
|
||||
host["time"] = time() + 30
|
||||
if arena_host["ga"] == ga:
|
||||
is_arena_host = 1
|
||||
arena_host["time"] = time() + 30
|
||||
else:
|
||||
is_host = 0
|
||||
is_arena_host = 0
|
||||
response = E.response(
|
||||
E.IIDX30lobby(
|
||||
E.host(is_host, __type="bool"),
|
||||
E.host(is_arena_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"),
|
||||
E.ga(arena_host["ga"], __type="u8"),
|
||||
E.gp(arena_host["gp"], __type="u16"),
|
||||
E.la(arena_host["la"], __type="u8"),
|
||||
),
|
||||
)
|
||||
)
|
||||
else:
|
||||
host["ga"] = ga
|
||||
host["gp"] = gp
|
||||
host["la"] = la
|
||||
host["time"] = time() + 30
|
||||
arena_host["ga"] = ga
|
||||
arena_host["gp"] = gp
|
||||
arena_host["la"] = la
|
||||
arena_host["time"] = time() + 30
|
||||
response = E.response(
|
||||
E.IIDX30lobby(
|
||||
E.host(1, __type="bool"),
|
||||
@ -78,10 +79,10 @@ 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"]
|
||||
del arena_host["ga"]
|
||||
del arena_host["gp"]
|
||||
del arena_host["la"]
|
||||
del arena_host["time"]
|
||||
response = E.response(E.IIDX30lobby())
|
||||
|
||||
response_body, response_headers = await core_prepare_response(request, response)
|
||||
@ -92,7 +93,49 @@ async def iidx30lobby_delete(request: Request):
|
||||
async def iidx30lobby_bplbattle_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
|
||||
password = root.find("passward").text # passward
|
||||
ga = root.find("address/ga").text.split()
|
||||
gp = root.find("address/gp").text
|
||||
la = root.find("address/la").text.split()
|
||||
|
||||
if bpl_host and password in bpl_host and time() < bpl_host[password]["time"]:
|
||||
# test menu reset
|
||||
if bpl_host[password]["ga"] == ga:
|
||||
is_bpl_host = 1
|
||||
bpl_host[password]["time"] = time() + 30
|
||||
else:
|
||||
is_bpl_host = 0
|
||||
response = E.response(
|
||||
E.IIDX30lobby(
|
||||
E.host(is_bpl_host, __type="bool"),
|
||||
E.matching_class(arena_class, __type="s32"),
|
||||
E.address(
|
||||
E.ga(bpl_host[password]["ga"], __type="u8"),
|
||||
E.gp(bpl_host[password]["gp"], __type="u16"),
|
||||
E.la(bpl_host[password]["la"], __type="u8"),
|
||||
),
|
||||
)
|
||||
)
|
||||
else:
|
||||
bpl_host[password] = {}
|
||||
bpl_host[password]["ga"] = ga
|
||||
bpl_host[password]["gp"] = gp
|
||||
bpl_host[password]["la"] = la
|
||||
bpl_host[password]["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)
|
||||
@ -112,6 +155,13 @@ async def iidx30lobby_bplbattle_update(request: Request):
|
||||
async def iidx30lobby_bplbattle_delete(request: Request):
|
||||
request_info = await core_process_request(request)
|
||||
|
||||
root = request_info["root"][0]
|
||||
ga = root.find("address/ga").text.split()
|
||||
|
||||
# normal reset
|
||||
for host in bpl_host:
|
||||
if bpl_host[host]["ga"] == ga:
|
||||
del bpl_host[host]
|
||||
response = E.response(E.IIDX30lobby())
|
||||
|
||||
response_body, response_headers = await core_prepare_response(request, response)
|
||||
|
Loading…
Reference in New Issue
Block a user