Arena/BPL CPU bots

This commit is contained in:
drmext 2023-06-15 13:13:04 +00:00
parent a4d5243108
commit 88a638a4c8
No known key found for this signature in database
GPG Key ID: F1ED48FFE79A6961
4 changed files with 355 additions and 80 deletions

View File

@ -14,82 +14,78 @@ router.model_whitelist = ["LDJ"]
async def iidx30gamesystem_systeminfo(request: Request):
request_info = await core_process_request(request)
unlock = () # (28008, 28065, 28073, 28088, 28089, 29027, 29094, 29095)
sp_dp = (0, 1)
unlock = ()
# force unlock LM exclusives to complete unlock all songs server side
# this makes LM exclusive folder disappear, so just use hex edits
# unlock = (28073, 28008, 29095, 29094, 29027, 30077, 30076, 30098)
current_time = round(time())
response = E.response(
E.IIDX30gameSystem(
*[
E.music_open(
E.music_id(mid, __type="s32"),
E.kind(0, __type="s32"),
)
for mid in unlock
],
E.arena_schedule(
E.phase(3, __type="u8"),
E.start(1605784800, __type="u32"),
E.end(round(time()), __type="u32"),
E.start(current_time - 600, __type="u32"),
E.end(current_time + 600, __type="u32"),
),
*[
E.arena_reward(
E.index(unlock.index(mid), __type="s32"),
E.cube_num((unlock.index(mid) + 1) * 50, __type="s32"),
E.kind(0, __type="s32"),
E.value(mid, __type="str"),
)
for mid in unlock
],
*[
E.arena_music_difficult(
E.play_style(sp_dp, __type="s32"),
E.arena_class(arena_class, __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"),
)
for sp_dp in (0, 1)
for arena_class in range(20)
],
*[
E.arena_cpu_define(
E.play_style(sp_dp, __type="s32"),
E.arena_class(arena_class, __type="s32"),
E.grade_id(18, __type="s32"),
E.low_music_difficult(8, __type="s32"),
E.high_music_difficult(12, __type="s32"),
E.is_leggendaria(0, __type="bool"),
)
for sp_dp in (0, 1)
for arena_class in range(20)
],
*[
E.maching_class_range(
E.play_style(sp_dp, __type="s32"),
E.matching_class(arena_class, __type="s32"),
E.low_arena_class(arena_class, __type="s32"),
E.high_arena_class(arena_class, __type="s32"),
)
for sp_dp in (0, 1)
for arena_class in range(20)
],
E.CommonBossPhase(val=0),
E.Event1InternalPhase(val=0),
E.ExtraBossEventPhase(val=0),
E.isNewSongAnother12OpenFlg(val=1),
E.gradeOpenPhase(val=2),
E.isEiseiOpenFlg(val=1),
E.WorldTourismOpenList(val=1),
E.WorldTourismOpenList(val=-1),
E.BPLBattleOpenPhase(val=3),
*[
E.music_open(
E.music_id(s, __type="s32"),
E.kind(0, __type="s32"),
)
for s in unlock
],
*[
E.arena_reward(
E.index(unlock.index(s), __type="s32"),
E.cube_num((unlock.index(s) + 1) * 50, __type="s32"),
E.kind(0, __type="s32"),
E.value(s, __type="str"),
)
for s in unlock
],
*[
E.arena_music_difficult(
E.play_style(s, __type="s32"),
E.arena_class(19, __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"),
)
for s in sp_dp
],
*[
E.arena_cpu_define(
E.play_style(s, __type="s32"),
E.arena_class(19, __type="s32"),
E.grade_id(18, __type="s32"),
E.low_music_difficult(8, __type="s32"),
E.high_music_difficult(12, __type="s32"),
E.is_leggendaria(0, __type="bool"),
)
for s in sp_dp
],
*[
E.maching_class_range(
E.play_style(s[0], __type="s32"),
E.matching_class(s[1], __type="s32"),
E.low_arena_class(0, __type="s32"),
E.high_arena_class(19, __type="s32"),
)
for s in ((0, 2), (0, 1), (1, 2), (1, 1))
],
*[
E.arena_force_music(
E.play_style(s, __type="s32"),
E.force_music_list_id(0, __type="s32"),
E.index(0, __type="s32"),
E.music_id(1000, __type="s32"),
E.note_grade(0, __type="s32"),
E.is_active(0, __type="bool"),
)
for s in sp_dp
],
)
)

View File

@ -162,6 +162,7 @@ async def iidx30lobby_bplbattle_delete(request: Request):
for host in bpl_host:
if bpl_host[host]["ga"] == ga:
del bpl_host[host]
break
response = E.response(E.IIDX30lobby())
response_body, response_headers = await core_prepare_response(request, response)

View File

@ -1,4 +1,5 @@
import time
import random
from enum import IntEnum
from fastapi import APIRouter, Request, Response
@ -144,7 +145,7 @@ async def iidx30music_getrank(request: Request):
name4=top_scores[k][4]["djname"],
)
for k in top_scores
]
],
)
)
@ -480,13 +481,63 @@ 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]
music_list = root.findall("music_list")
music_count = len(music_list)
cpu_list = root.findall("cpu_list")
cpu_count = len(cpu_list)
response = E.response(E.IIDX30music())
cpu_scores = {}
cpu_ghosts = {}
for music in music_list:
i = int(music.find("index").text)
exscore_max = int(music.find("total_notes").text) * 2
cpu_scores[i] = {}
cpu_ghosts[i] = {}
for j in range(cpu_count):
cpu_scores[i][j] = {}
cpu_ghosts[i][j] = {}
exscore = round(exscore_max * random.uniform(0.77, 0.93))
cpu_scores[i][j]["exscore"] = exscore
ghost_len = 64
ghost_data = [0] * ghost_len
for x in range(ghost_len):
ghost_data[x] = exscore // ghost_len
if (exscore % ghost_len) > x:
ghost_data[x] += 1
cpu_ghosts[i][j]["ghost_data"] = ghost_data
response = E.response(
E.IIDX30music(
*[
E.cpu_score_list(
E.index(i, __type="s32"),
*[
E.score_list(
E.index(j, __type="s32"),
E.score(cpu_scores[i][j]["exscore"], __type="s32"),
E.ghost(cpu_ghosts[i][j]["ghost_data"], __type="u8"),
E.enable_score(1, __type="bool"),
E.enable_ghost(1, __type="bool"),
E.location_id("X000000001", __type="str"),
)
for j in range(cpu_count)
],
)
for i in range(music_count)
],
)
)
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)

View File

@ -1,5 +1,6 @@
from tinydb import Query, where
from time import time
import config
import random
@ -105,6 +106,8 @@ async def iidx30pc_get(request: Request):
rivals[idx]["hand"] = rival_profile["hand"]
rivals[idx]["head"] = rival_profile["head"]
current_time = round(time())
response = E.response(
E.IIDX30pc(
E.pcdata(
@ -215,6 +218,9 @@ async def iidx30pc_get(request: Request):
],
__type="s16",
),
E.spdp_rival(
flg=-1
), # required for rivals to load after switching spdp in music select
E.rlist(
*[
E.rival(
@ -262,6 +268,15 @@ async def iidx30pc_get(request: Request):
E.flg1(profile.get("wt_flg1", [-1, -1, -1]), __type="s64"),
E.flg2(profile.get("wt_flg2", [-1, -1, -1]), __type="s64"),
),
E.world_tourism(
*[
E.tour_data(
tour_id=i,
progress=50, # set to 49 to see WT folders, 50 is completed/hidden
)
for i in range(13)
],
),
E.lightning_setting(
E.slider(
profile.get("lightning_setting_slider", [0] * 7), __type="s32"
@ -315,15 +330,53 @@ async def iidx30pc_get(request: Request):
cube=200,
season_id=0,
),
E.ranker_data(
play_style=0,
pref_id=0,
rank_num=(random.choice([random.randint(1, 5), 573])),
),
E.ranker_data(
play_style=1,
pref_id=0,
rank_num=(random.choice([random.randint(1, 5), 573])),
),
E.lose_data(
play_style=0,
lose_value=0,
),
E.lose_data(
play_style=1,
lose_value=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",
chat_type_1="やあ",
chat_type_2="こんにちは",
chat_type_3="おす",
),
E.tendency(
play_style=0,
rank0=1,
rank1=2,
rank2=3,
rank3=4,
rank4=3,
rank5=1,
),
E.player_kind_data(
kind=(random.choice([random.randint(0, 13), 0])),
),
E.setting(
stats_type=0,
),
E.qpro_motion(
motion_0=1,
motion_1=2,
motion_2=3,
),
play_num=6,
play_num_dp=3,
@ -367,17 +420,13 @@ async def iidx30pc_get(request: Request):
E.tonjyutsu(black_pass=-1, platinum_pass=-1),
E.pay_per_use(item_num=99),
E.old_linkage_secret_flg(
floor_infection4=-1,
bemani_janken=-1,
ichika_rush=-1,
nono_rush=-1,
song_battle=-1,
),
E.floor_infection4(music_list=-1),
E.bemani_vote(music_list=-1),
E.bemani_janken_meeting(music_list=-1),
E.bemani_rush(music_list_ichika=-1, music_list_nono=-1),
E.ultimate_mobile_link(music_list=-1),
E.ultimate_mobile_link(E.link_flag(), music_list=-1),
E.bemani_musiq_fes(music_list=-1),
E.busou_linkage(music_list=-1),
E.busou_linkage_2(music_list=-1),
@ -471,19 +520,196 @@ async def iidx30pc_get(request: Request):
skin_bgm_flg=profile["skin_customize_flag_bgm"],
skin_lane_flg3=profile["skin_customize_flag_lane"],
),
# E.event_1(
# E.flyer_data(
# flyer_id=0,
# play_num=0,
# last_select_genre=0,
# flyer_prog=0,
# skill_param=0,
# ),
# E.genre_data(
# E.is_complete(0, __type="bool"),
# flyer_id=0,
# genre_id=0,
# play_num=0,
# gauge=0,
# ),
# event_play_num=0,
# last_select_flyer_id=0,
# ),
E.player_compe(
E.compe_data(
E.compe_music(
index=0,
music_id=26029,
style_id=0,
note_grade_id=3,
ex_score=6,
pgreat_num=6,
great_num=6,
miss_num=6,
),
E.compe_music(
index=1,
music_id=29057,
style_id=0,
note_grade_id=3,
ex_score=6,
pgreat_num=6,
great_num=6,
miss_num=6,
),
E.compe_music(
index=2,
music_id=8027,
style_id=0,
note_grade_id=3,
ex_score=6,
pgreat_num=6,
great_num=6,
miss_num=6,
),
E.compe_music(
index=3,
music_id=16027,
style_id=0,
note_grade_id=3,
ex_score=6,
pgreat_num=6,
great_num=6,
miss_num=6,
),
compe_id=0,
forced_option=1,
compe_end_time=current_time,
compe_name="Monkey Business",
maker_name="kors k",
ex_score=666,
pgreat_num=666,
great_num=666,
my_rank=1,
total_join=1,
),
),
# E.news(
# *[E(x,
# E.detail(
# music_id=1000,
# class_id=3,
# news_type=0,
# news_data=1572,
# news_time=current_time,
# dj_name="TEST",
# ),
# last_read_time=current_time,
# )for x in ("news_data_all", "news_data_shop", "news_data_grade", "news_data_rival", "news_data_all_top", "news_data_area_top", "news_data_shop_top")],
# disp_score_type=0,
# ),
E.exam_data(
E.music(
radar_type=1,
index=0,
music_id=26029,
class_id=3,
rank=1,
score=1,
),
E.music(
radar_type=1,
index=1,
music_id=29057,
class_id=3,
rank=1,
score=1,
),
E.music(
radar_type=1,
index=2,
music_id=8027,
class_id=3,
rank=1,
score=1,
),
E.music(
radar_type=1,
index=3,
music_id=16027,
class_id=3,
rank=1,
score=1,
),
exam_id=0,
entry_num=1,
rank=1,
total_score=1,
end_time=current_time,
),
# E.questionnaire(
# *[E.questionnaire_data(
# questionnaire_id=i,
# answer="what is this?"
# )for i in range(10)],
# ),
E.badge(
# Base
E.badge_data(
category_id=0,
badge_flg_id=0,
badge_flg=0,
category_id=1,
badge_flg_id=23,
badge_flg=554321,
),
E.badge_data(
category_id=1,
badge_flg_id=11,
badge_flg=554321,
),
E.badge_equip(
E.equip_flg(0, __type="bool"),
category_id=0,
badge_flg_id=0,
index=0,
E.equip_flg(1, __type="bool"),
category_id=1,
badge_flg_id=23,
index=5,
slot=0,
),
E.badge_equip(
E.equip_flg(1, __type="bool"),
category_id=1,
badge_flg_id=11,
index=5,
slot=4,
),
# Class
E.badge_data(
category_id=2,
badge_flg_id=0,
badge_flg=191919191919,
),
E.badge_equip(
E.equip_flg(1, __type="bool"),
category_id=2,
badge_flg_id=0,
index=2,
slot=3,
),
E.badge_equip(
E.equip_flg(1, __type="bool"),
category_id=2,
badge_flg_id=0,
index=5,
slot=1,
),
# Radar Rank
E.badge_data(
category_id=7,
badge_flg_id=1,
badge_flg=1010101010,
),
E.badge_equip(
E.equip_flg(1, __type="bool"),
category_id=7,
badge_flg_id=1,
index=2,
slot=2,
),
),
)
)
@ -560,6 +786,7 @@ async def iidx30pc_common(request: Request):
E.lane_gacha(),
# E.fps_fix(),
# E.save_unsync_log(),
E.tourism_booster(),
expire=600,
)
)