MonkeyBusiness/modules/iidx/iidx29pc.py

1056 lines
36 KiB
Python
Raw Normal View History

2022-08-26 12:39:11 +02:00
from tinydb import Query, where
import config
import random
from fastapi import APIRouter, Request, Response
from core_common import core_process_request, core_prepare_response, E
from core_database import get_db
router = APIRouter(prefix="/local2", tags=["local2"])
router.model_whitelist = ["LDJ"]
def get_profile(cid):
2022-11-15 15:03:37 +01:00
return get_db().table("iidx_profile").get(where("card") == cid)
2022-08-26 12:39:11 +02:00
def get_profile_by_id(iidx_id):
2022-11-15 15:03:37 +01:00
return get_db().table("iidx_profile").get(where("iidx_id") == iidx_id)
2022-08-26 12:39:11 +02:00
def get_game_profile(cid, game_version):
profile = get_profile(cid)
2022-11-15 15:03:37 +01:00
return profile["version"].get(str(game_version), None)
2022-08-26 12:39:11 +02:00
def get_game_profile_by_id(iidx_id, game_version):
profile = get_profile_by_id(iidx_id)
2022-11-15 15:03:37 +01:00
return profile["version"].get(str(game_version), None)
2022-08-26 12:39:11 +02:00
def get_id_from_profile(cid):
2022-11-15 15:03:37 +01:00
profile = get_db().table("iidx_profile").get(where("card") == cid)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
djid = "%08d" % profile["iidx_id"]
djid_split = "-".join([djid[:4], djid[4:]])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
return profile["iidx_id"], djid_split
2022-08-26 12:39:11 +02:00
def calculate_folder_mask(profile):
2022-11-15 15:03:37 +01:00
return (
profile.get("_show_category_grade", 0) << 0
| (profile.get("_show_category_status", 0) << 1)
| (profile.get("_show_category_difficulty", 0) << 2)
| (profile.get("_show_category_alphabet", 0) << 3)
| (profile.get("_show_category_rival_play", 0) << 4)
| (profile.get("_show_category_rival_winlose", 0) << 6)
| (profile.get("_show_rival_shop_info", 0) << 7)
| (profile.get("_hide_play_count", 0) << 8)
| (profile.get("_show_score_graph_cutin", 0) << 9)
| (profile.get("_classic_hispeed", 0) << 10)
| (profile.get("_hide_iidx_id", 0) << 12)
)
@router.post("/{gameinfo}/IIDX29pc/get")
2022-08-26 12:39:11 +02:00
async def iidx29pc_get(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
game_version = request_info["game_version"]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
cid = request_info["root"][0].attrib["cid"]
2022-08-26 12:39:11 +02:00
profile = get_game_profile(cid, game_version)
djid, djid_split = get_id_from_profile(cid)
rival_ids = [
profile.get("sp_rival_1_iidx_id", 0),
profile.get("sp_rival_2_iidx_id", 0),
profile.get("sp_rival_3_iidx_id", 0),
profile.get("sp_rival_4_iidx_id", 0),
profile.get("sp_rival_5_iidx_id", 0),
profile.get("dp_rival_1_iidx_id", 0),
profile.get("dp_rival_2_iidx_id", 0),
profile.get("dp_rival_3_iidx_id", 0),
profile.get("dp_rival_4_iidx_id", 0),
profile.get("dp_rival_5_iidx_id", 0),
]
rivals = {}
for idx, r in enumerate(rival_ids):
if r == 0:
continue
rivals[idx] = {}
2022-11-15 15:03:37 +01:00
rivals[idx]["spdp"] = 1 if idx < 5 else 2
rival_profile = get_game_profile_by_id(r, game_version)
rdjid = "%08d" % r
2022-11-15 15:03:37 +01:00
rdjid_split = "-".join([rdjid[:4], rdjid[4:]])
rivals[idx]["djid"] = rdjid
rivals[idx]["djid_split"] = rdjid_split
rivals[idx]["djname"] = rival_profile["djname"]
rivals[idx]["region"] = rival_profile["region"]
rivals[idx]["sa"] = rival_profile["sach"]
rivals[idx]["sg"] = rival_profile["grade_single"]
rivals[idx]["da"] = rival_profile["dach"]
rivals[idx]["dg"] = rival_profile["grade_double"]
rivals[idx]["body"] = rival_profile["body"]
rivals[idx]["face"] = rival_profile["face"]
rivals[idx]["hair"] = rival_profile["hair"]
rivals[idx]["hand"] = rival_profile["hand"]
rivals[idx]["head"] = rival_profile["head"]
2022-08-26 12:39:11 +02:00
response = E.response(
E.IIDX29pc(
E.pcdata(
2022-11-15 15:03:37 +01:00
d_auto_adjust=profile["d_auto_adjust"],
d_auto_scrach=profile["d_auto_scrach"],
d_camera_layout=profile["d_camera_layout"],
d_disp_judge=profile["d_disp_judge"],
d_exscore=profile["d_exscore"],
d_gauge_disp=profile["d_gauge_disp"],
d_ghost_score=profile["d_ghost_score"],
d_gno=profile["d_gno"],
d_graph_score=profile["d_graph_score"],
d_gtype=profile["d_gtype"],
d_hispeed=profile["d_hispeed"],
d_judge=profile["d_judge"],
d_judgeAdj=profile["d_judgeAdj"],
d_lane_brignt=profile["d_lane_brignt"],
d_liflen=profile["d_liflen"],
d_notes=profile["d_notes"],
d_opstyle=profile["d_opstyle"],
d_pace=profile["d_pace"],
d_sdlen=profile["d_sdlen"],
d_sdtype=profile["d_sdtype"],
d_sorttype=profile["d_sorttype"],
d_sub_gno=profile["d_sub_gno"],
d_timing=profile["d_timing"],
d_tsujigiri_disp=profile["d_tsujigiri_disp"],
d_tune=profile["d_tune"],
dach=profile["dach"],
dp_opt=profile["dp_opt"],
dp_opt2=profile["dp_opt2"],
2022-08-26 12:39:11 +02:00
dpnum=profile["dpnum"],
2022-11-15 15:03:37 +01:00
gpos=profile["gpos"],
2022-08-26 12:39:11 +02:00
id=djid,
idstr=djid_split,
2022-11-15 15:03:37 +01:00
mode=profile["mode"],
name=profile["djname"],
ngrade=profile["ngrade"],
pid=profile["region"],
pmode=profile["pmode"],
rtype=profile["rtype"],
s_auto_adjust=profile["s_auto_adjust"],
s_auto_scrach=profile["s_auto_scrach"],
s_camera_layout=profile["s_camera_layout"],
s_disp_judge=profile["s_disp_judge"],
s_exscore=profile["s_exscore"],
s_gauge_disp=profile["s_gauge_disp"],
s_ghost_score=profile["s_ghost_score"],
s_gno=profile["s_gno"],
s_graph_score=profile["s_graph_score"],
s_gtype=profile["s_gtype"],
s_hispeed=profile["s_hispeed"],
s_judge=profile["s_judge"],
s_judgeAdj=profile["s_judgeAdj"],
s_lane_brignt=profile["s_lane_brignt"],
s_liflen=profile["s_liflen"],
s_notes=profile["s_notes"],
s_opstyle=profile["s_opstyle"],
s_pace=profile["s_pace"],
s_sdlen=profile["s_sdlen"],
s_sdtype=profile["s_sdtype"],
s_sorttype=profile["s_sorttype"],
s_sub_gno=profile["s_sub_gno"],
s_timing=profile["s_timing"],
s_tsujigiri_disp=profile["s_tsujigiri_disp"],
s_tune=profile["s_tune"],
sach=profile["sach"],
sp_opt=profile["sp_opt"],
spnum=profile["spnum"],
),
E.qprodata(
[
profile["head"],
profile["hair"],
profile["face"],
profile["hand"],
profile["body"],
],
__type="u32",
__size=5 * 4,
2022-08-26 12:39:11 +02:00
),
E.skin(
[
profile["frame"],
profile["turntable"],
profile["explosion"],
profile["bgm"],
calculate_folder_mask(profile),
profile["sudden"],
profile["judge_pos"],
profile["categoryvoice"],
profile["note"],
profile["fullcombo"],
profile["keybeam"],
profile["judgestring"],
-1,
profile["soundpreview"],
profile["grapharea"],
profile["effector_lock"],
profile["effector_type"],
profile["explosion_size"],
profile["alternate_hcn"],
profile["kokokara_start"],
],
2022-11-15 15:03:37 +01:00
__type="s16",
),
E.rlist(
2022-11-15 15:03:37 +01:00
*[
E.rival(
E.is_robo(0, __type="bool"),
E.shop(name=config.arcade),
E.qprodata(
body=rivals[r]["body"],
face=rivals[r]["face"],
hair=rivals[r]["hair"],
hand=rivals[r]["hand"],
head=rivals[r]["head"],
),
da=rivals[r]["da"],
dg=rivals[r]["dg"],
djname=rivals[r]["djname"],
id=rivals[r]["djid"],
id_str=rivals[r]["djid_split"],
pid=rivals[r]["region"],
sa=rivals[r]["sa"],
sg=rivals[r]["sg"],
spdp=rivals[r]["spdp"],
)
for r in rivals
],
),
2022-08-26 12:39:11 +02:00
E.ir_data(),
E.secret_course_data(),
2022-11-15 15:03:37 +01:00
E.deller(deller=profile["deller"], rate=0),
2022-08-26 12:39:11 +02:00
E.secret(
2022-11-15 15:03:37 +01:00
E.flg1(profile.get("secret_flg1", [-1, -1, -1]), __type="s64"),
E.flg2(profile.get("secret_flg2", [-1, -1, -1]), __type="s64"),
E.flg3(profile.get("secret_flg3", [-1, -1, -1]), __type="s64"),
E.flg4(profile.get("secret_flg4", [-1, -1, -1]), __type="s64"),
2022-08-26 12:39:11 +02:00
),
E.join_shop(join_cflg=1, join_id=10, join_name=config.arcade, joinflg=1),
2022-11-15 15:03:37 +01:00
E.leggendaria(
E.flg1(profile.get("leggendaria_flg1", [-1, -1, -1]), __type="s64")
),
2022-08-26 12:39:11 +02:00
E.grade(
2022-11-15 15:03:37 +01:00
*[E.g(x, __type="u8") for x in profile["grade_values"]],
dgid=profile["grade_double"],
sgid=profile["grade_single"],
2022-08-26 12:39:11 +02:00
),
E.world_tourism_secret_flg(
2022-11-15 15:03:37 +01:00
E.flg1(profile.get("wt_flg1", [-1, -1, -1]), __type="s64"),
E.flg2(profile.get("wt_flg2", [-1, -1, -1]), __type="s64"),
2022-08-26 12:39:11 +02:00
),
E.lightning_setting(
2022-11-15 15:03:37 +01:00
E.slider(
profile.get("lightning_setting_slider", [0] * 7), __type="s32"
),
E.light(
profile.get("lightning_setting_light", [1] * 10), __type="bool"
),
E.concentration(
profile.get("lightning_setting_concentration", 0), __type="bool"
),
headphone_vol=profile.get("lightning_setting_headphone_vol", 0),
resistance_sp_left=profile.get(
"lightning_setting_resistance_sp_left", 0
),
resistance_sp_right=profile.get(
"lightning_setting_resistance_sp_right", 0
),
resistance_dp_left=profile.get(
"lightning_setting_resistance_dp_left", 0
),
resistance_dp_right=profile.get(
"lightning_setting_resistance_dp_right", 0
),
skin_0=profile.get("lightning_setting_skin_0", 0),
flg_skin_0=profile.get("lightning_setting_flg_skin_0", 0),
2022-08-26 12:39:11 +02:00
),
E.arena_data(
E.achieve_data(
arena_class=-1,
counterattack_num=0,
best_top_class_continuing=0,
now_top_class_continuing=0,
play_style=0,
rating_value=90,
),
E.achieve_data(
arena_class=-1,
counterattack_num=0,
best_top_class_continuing=0,
now_top_class_continuing=0,
play_style=1,
rating_value=90,
),
E.cube_data(
cube=200,
season_id=0,
),
play_num=6,
play_num_dp=3,
play_num_sp=3,
prev_best_class_sp=18,
prev_best_class_dp=18,
),
E.follow_data(),
E.classic_course_data(),
E.bind_eaappli(),
E.ea_premium_course(),
E.enable_qr_reward(),
E.nostalgia_open(),
E.event_1(
2022-11-15 15:03:37 +01:00
story_prog=profile.get("event_1_story_prog", 0),
last_select_area=profile.get("event_1_last_select_area", 0),
failed_num=profile.get("event_1_failed_num", 0),
event_play_num=profile.get("event_1_event_play_num", 0),
last_select_area_id=profile.get("event_1_last_select_area_id", 0),
last_select_platform_type=profile.get(
"event_1_last_select_platform_type", 0
),
last_select_platform_id=profile.get(
"event_1_last_select_platform_id", 0
),
2022-08-26 12:39:11 +02:00
),
2022-11-15 15:03:37 +01:00
E.language_setting(language=profile["language_setting"]),
E.movie_agreement(agreement_version=profile["movie_agreement"]),
2022-08-26 12:39:11 +02:00
E.bpl_virtual(),
2022-11-15 15:03:37 +01:00
E.lightning_play_data(
spnum=profile["lightning_play_data_spnum"],
dpnum=profile["lightning_play_data_dpnum"],
),
2022-08-26 12:39:11 +02:00
E.weekly(
mid=-1,
wid=1,
),
E.packinfo(
music_0=-1,
music_1=-1,
music_2=-1,
pack_id=1,
),
E.kac_entry_info(
E.enable_kac_deller(),
E.disp_kac_mark(),
E.open_kac_common_music(),
E.open_kac_new_a12_music(),
E.is_kac_entry(),
E.is_kac_evnet_entry(),
),
E.orb_data(rest_orb=100, present_orb=100),
E.visitor(anum=1, pnum=2, snum=1, vs_flg=1),
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.bemani_musiq_fes(music_list=-1),
E.busou_linkage(music_list=-1),
E.busou_linkage_2(music_list=-1),
E.valkyrie_linkage_data(progress=-1),
E.valkyrie_linkage_2_data(progress=-1),
E.achievements(
2022-11-15 15:03:37 +01:00
E.trophy(profile.get("achievements_trophy", [])[:20], __type="s64"),
pack=profile.get("achievements_pack_id", 0),
pack_comp=profile.get("achievements_pack_comp", 0),
last_weekly=profile.get("achievements_last_weekly", 0),
weekly_num=profile.get("achievements_weekly_num", 0),
visit_flg=profile.get("achievements_visit_flg", 0),
2022-08-26 12:39:11 +02:00
rival_crush=0,
),
E.notes_radar(
E.radar_score(
2022-11-15 15:03:37 +01:00
profile["notes_radar_single"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
style=0,
),
E.notes_radar(
E.radar_score(
2022-11-15 15:03:37 +01:00
profile["notes_radar_double"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
style=1,
),
E.dj_rank(
E.rank(
2022-11-15 15:03:37 +01:00
profile["dj_rank_single_rank"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
E.point(
2022-11-15 15:03:37 +01:00
profile["dj_rank_single_point"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
style=0,
),
E.dj_rank(
E.rank(
2022-11-15 15:03:37 +01:00
profile["dj_rank_double_rank"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
E.point(
2022-11-15 15:03:37 +01:00
profile["dj_rank_double_point"],
2022-08-26 12:39:11 +02:00
__type="s32",
),
style=1,
),
E.step(
E.is_track_ticket(
2022-11-15 15:03:37 +01:00
profile["stepup_is_track_ticket"],
2022-08-26 12:39:11 +02:00
__type="bool",
),
2022-11-15 15:03:37 +01:00
dp_level=profile["stepup_dp_level"],
dp_mplay=profile["stepup_dp_mplay"],
enemy_damage=profile["stepup_enemy_damage"],
enemy_defeat_flg=profile["stepup_enemy_defeat_flg"],
mission_clear_num=profile["stepup_mission_clear_num"],
progress=profile["stepup_progress"],
sp_level=profile["stepup_sp_level"],
sp_mplay=profile["stepup_sp_mplay"],
tips_read_list=profile["stepup_tips_read_list"],
total_point=profile["stepup_total_point"],
2022-08-26 12:39:11 +02:00
),
E.skin_customize_flg(
2022-11-15 15:03:37 +01:00
skin_frame_flg=profile["skin_customize_flag_frame"],
skin_bgm_flg=profile["skin_customize_flag_bgm"],
skin_lane_flg3=profile["skin_customize_flag_lane"],
),
2022-08-26 12:39:11 +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}/IIDX29pc/common")
2022-08-26 12:39:11 +02:00
async def iidx29pc_common(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.IIDX29pc(
E.monthly_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
2022-11-15 15:03:37 +01:00
__type="u16",
),
2022-08-26 12:39:11 +02:00
E.total_mranking(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
2022-11-15 15:03:37 +01:00
__type="u16",
),
2022-08-26 12:39:11 +02:00
# E.internet_ranking(),
# E.secret_ex_course(),
E.kac_mid([-1, -1, -1, -1, -1], __type="s32"),
E.kac_clid([2, 2, 2, 2, 2], __type="s32"),
E.ir(beat=3),
2022-11-15 15:03:37 +01:00
E.cm(compo="cm_ultimate", folder="cm_ultimate", id=0),
2022-08-26 12:39:11 +02:00
E.tdj_cm(
2022-11-15 15:03:37 +01:00
E.cm(filename="cm_bn_001", id=0),
E.cm(filename="cm_bn_002", id=1),
E.cm(filename="event_bn_001", id=2),
E.cm(filename="event_bn_004", id=3),
E.cm(filename="event_bn_006", id=4),
E.cm(filename="fipb_001", id=5),
E.cm(filename="year_bn_004", id=6),
E.cm(filename="year_bn_005", id=7),
E.cm(filename="year_bn_006_2", id=8),
E.cm(filename="year_bn_007", id=9),
2022-08-26 12:39:11 +02:00
),
# E.playvideo_disable_music(E.music(musicid=-1)),
# E.music_movie_suspend(E.music(music_id=-1, kind=0, name='')),
# E.bpl_virtual(),
E.movie_agreement(version=1),
2022-11-15 15:03:37 +01:00
E.license("None", __type="str"),
2022-08-26 12:39:11 +02:00
E.file_recovery(url=str(config.ip)),
E.movie_upload(url=str(config.ip)),
# E.button_release_frame(frame=''),
# E.trigger_logic_type(type=''),
# E.cm_movie_info(type=''),
E.escape_package_info(),
# E.expert(phase=1),
# E.expert_random_secret(phase=1),
E.boss(phase=0), # disable event
E.vip_pass_black(),
E.eisei(open=1),
E.deller_bonus(open=1),
E.newsong_another(open=1),
# E.pcb_check(flg=0)
E.expert_secret_full_open(),
E.eaorder_phase(phase=-1),
E.common_evnet(flg=-1),
E.system_voice_phase(phase=random.randint(1, 10)), # TODO: Figure out range
E.extra_boss_event(phase=6),
E.event1_phase(phase=4),
E.premium_area_news(open=1),
E.premium_area_qpro(open=1),
# E.disable_same_triger(frame=-1),
E.play_video(),
E.world_tourism(open_list=1),
E.bpl_battle(phase=1),
E.display_asio_logo(),
# E.force_rom_check(),
E.lane_gacha(),
# E.fps_fix(),
# E.save_unsync_log(),
2022-11-15 15:03:37 +01:00
expire=600,
2022-08-26 12:39:11 +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}/IIDX29pc/save")
2022-08-26 12:39:11 +02:00
async def iidx29pc_save(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
game_version = request_info["game_version"]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
xid = int(request_info["root"][0].attrib["iidxid"])
cid = request_info["root"][0].attrib["cid"]
clt = int(request_info["root"][0].attrib["cltype"])
2022-08-26 12:39:11 +02:00
profile = get_profile(cid)
2022-11-15 15:03:37 +01:00
game_profile = profile["version"].get(str(game_version), {})
2022-08-26 12:39:11 +02:00
for k in [
2022-11-15 15:03:37 +01:00
"d_auto_adjust",
"d_auto_scrach",
"d_camera_layout",
"d_disp_judge",
"d_gauge_disp",
"d_ghost_score",
"d_gno",
"d_graph_score",
"d_gtype",
"d_hispeed",
"d_judge",
"d_judgeAdj",
"d_lane_brignt",
"d_notes",
"d_opstyle",
"d_pace",
"d_sdlen",
"d_sdtype",
"d_sorttype",
"d_sub_gno",
"d_timing",
"d_tsujigiri_disp",
"dp_opt",
"dp_opt2",
"gpos",
"mode",
"ngrade",
"pmode",
"rtype",
"s_auto_adjust",
"s_auto_scrach",
"s_camera_layout",
"s_disp_judge",
"s_gauge_disp",
"s_ghost_score",
"s_gno",
"s_graph_score",
"s_gtype",
"s_hispeed",
"s_judge",
"s_judgeAdj",
"s_lane_brignt",
"s_notes",
"s_opstyle",
"s_pace",
"s_sdlen",
"s_sdtype",
"s_sorttype",
"s_sub_gno",
"s_timing",
"s_tsujigiri_disp",
"sp_opt",
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
if k in request_info["root"][0].attrib:
game_profile[k] = request_info["root"][0].attrib[k]
2022-08-26 12:39:11 +02:00
for k in [
2022-11-15 15:03:37 +01:00
("d_liflen", "d_lift"),
("dach", "d_achi"),
("s_liflen", "s_lift"),
("sach", "s_achi"),
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
if k[1] in request_info["root"][0].attrib:
game_profile[k[0]] = request_info["root"][0].attrib[k[1]]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
lightning_setting = request_info["root"][0].find("lightning_setting")
2022-08-26 12:39:11 +02:00
if lightning_setting is not None:
for k in [
2022-11-15 15:03:37 +01:00
"headphone_vol",
"resistance_dp_left",
"resistance_dp_right",
"resistance_sp_left",
"resistance_sp_right",
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
game_profile["lightning_setting_" + k] = int(lightning_setting.attrib[k])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
slider = lightning_setting.find("slider")
2022-08-26 12:39:11 +02:00
if slider is not None:
2022-11-15 15:03:37 +01:00
game_profile["lightning_setting_slider"] = [
int(x) for x in slider.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
light = lightning_setting.find("light")
2022-08-26 12:39:11 +02:00
if light is not None:
2022-11-15 15:03:37 +01:00
game_profile["lightning_setting_light"] = [
int(x) for x in light.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
concentration = lightning_setting.find("concentration")
2022-08-26 12:39:11 +02:00
if concentration is not None:
2022-11-15 15:03:37 +01:00
game_profile["lightning_setting_concentration"] = int(concentration.text)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
lightning_customize_flg = request_info["root"][0].find("lightning_customize_flg")
2022-08-26 12:39:11 +02:00
if lightning_customize_flg is not None:
for k in [
2022-11-15 15:03:37 +01:00
"flg_skin_0",
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
game_profile["lightning_setting_" + k] = int(
lightning_customize_flg.attrib[k]
)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
secret = request_info["root"][0].find("secret")
2022-08-26 12:39:11 +02:00
if secret is not None:
2022-11-15 15:03:37 +01:00
for k in ["flg1", "flg2", "flg3", "flg4"]:
2022-08-26 12:39:11 +02:00
flg = secret.find(k)
if flg is not None:
2022-11-15 15:03:37 +01:00
game_profile["secret_" + k] = [int(x) for x in flg.text.split(" ")]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
leggendaria = request_info["root"][0].find("leggendaria")
2022-08-26 12:39:11 +02:00
if leggendaria is not None:
2022-11-15 15:03:37 +01:00
for k in ["flg1"]:
2022-08-26 12:39:11 +02:00
flg = leggendaria.find(k)
if flg is not None:
2022-11-15 15:03:37 +01:00
game_profile["leggendaria_" + k] = [int(x) for x in flg.text.split(" ")]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
step = request_info["root"][0].find("step")
2022-08-26 12:39:11 +02:00
if step is not None:
for k in [
2022-11-15 15:03:37 +01:00
"dp_level",
"dp_mplay",
"enemy_damage",
"enemy_defeat_flg",
"mission_clear_num",
"progress",
"sp_level",
"sp_mplay",
"tips_read_list",
"total_point",
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
game_profile["stepup_" + k] = int(step.attrib[k])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
is_track_ticket = step.find("is_track_ticket")
2022-08-26 12:39:11 +02:00
if is_track_ticket is not None:
2022-11-15 15:03:37 +01:00
game_profile["stepup_is_track_ticket"] = int(is_track_ticket.text)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
dj_ranks = request_info["root"][0].findall("dj_rank")
2022-08-26 12:39:11 +02:00
dj_ranks = [] if dj_ranks is None else dj_ranks
for dj_rank in dj_ranks:
2022-11-15 15:03:37 +01:00
style = int(dj_rank.attrib["style"])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
rank = dj_rank.find("rank")
game_profile["dj_rank_" + ["single", "double"][style] + "_rank"] = [
int(x) for x in rank.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
point = dj_rank.find("point")
game_profile["dj_rank_" + ["single", "double"][style] + "_point"] = [
int(x) for x in point.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
notes_radars = request_info["root"][0].findall("notes_radar")
2022-08-26 12:39:11 +02:00
notes_radars = [] if notes_radars is None else notes_radars
for notes_radar in notes_radars:
2022-11-15 15:03:37 +01:00
style = int(notes_radar.attrib["style"])
score = notes_radar.find("radar_score")
game_profile["notes_radar_" + ["single", "double"][style]] = [
int(x) for x in score.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
achievements = request_info["root"][0].find("achievements")
2022-08-26 12:39:11 +02:00
if achievements is not None:
for k in [
2022-11-15 15:03:37 +01:00
"last_weekly",
"pack_comp",
"pack_flg",
"pack_id",
"play_pack",
"visit_flg",
"weekly_num",
2022-08-26 12:39:11 +02:00
]:
2022-11-15 15:03:37 +01:00
game_profile["achievements_" + k] = int(achievements.attrib[k])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
trophy = achievements.find("trophy")
2022-08-26 12:39:11 +02:00
if trophy is not None:
2022-11-15 15:03:37 +01:00
game_profile["achievements_trophy"] = [
int(x) for x in trophy.text.split(" ")
]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
grade = request_info["root"][0].find("grade")
2022-08-26 12:39:11 +02:00
if grade is not None:
grade_values = []
2022-11-15 15:03:37 +01:00
for g in grade.findall("g"):
grade_values.append([int(x) for x in g.text.split(" ")])
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
profile["grade_single"] = int(grade.attrib["sgid"])
profile["grade_double"] = int(grade.attrib["dgid"])
profile["grade_values"] = grade_values
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
deller_amount = game_profile.get("deller", 0)
deller = request_info["root"][0].find("deller")
2022-08-26 12:39:11 +02:00
if deller is not None:
2022-11-15 15:03:37 +01:00
deller_amount = int(deller.attrib["deller"])
game_profile["deller"] = deller_amount
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
language = request_info["root"][0].find("language_setting")
2022-08-26 12:39:11 +02:00
if language is not None:
2022-11-15 15:03:37 +01:00
language_value = int(language.attrib["language"])
game_profile["language_setting"] = language_value
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
game_profile["spnum"] = game_profile.get("spnum", 0) + (1 if clt == 0 else 0)
game_profile["dpnum"] = game_profile.get("dpnum", 0) + (1 if clt == 1 else 0)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
if request_info["model"] == "TDJ":
game_profile["lightning_play_data_spnum"] = game_profile.get(
"lightning_play_data_spnum", 0
) + (1 if clt == 0 else 0)
game_profile["lightning_play_data_dpnum"] = game_profile.get(
"lightning_play_data_dpnum", 0
) + (1 if clt == 1 else 0)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
profile["version"][str(game_version)] = game_profile
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
get_db().table("iidx_profile").upsert(profile, where("card") == cid)
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
response = E.response(E.IIDX29pc(iidxid=xid, cltype=clt))
2022-08-26 12:39:11 +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}/IIDX29pc/visit")
2022-08-26 12:39:11 +02:00
async def iidx29pc_visit(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.IIDX29pc(
aflg=1,
anum=1,
pflg=1,
pnum=1,
sflg=1,
snum=1,
)
)
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}/IIDX29pc/reg")
2022-08-26 12:39:11 +02:00
async def iidx29pc_reg(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
game_version = request_info["game_version"]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
cid = request_info["root"][0].attrib["cid"]
name = request_info["root"][0].attrib["name"]
pid = request_info["root"][0].attrib["pid"]
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
db = get_db().table("iidx_profile")
2022-08-26 12:39:11 +02:00
all_profiles_for_card = db.get(Query().card == cid)
if all_profiles_for_card is None:
2022-11-15 15:03:37 +01:00
all_profiles_for_card = {"card": cid, "version": {}}
2022-08-26 12:39:11 +02:00
2022-11-15 15:03:37 +01:00
if "iidx_id" not in all_profiles_for_card:
2022-08-26 12:39:11 +02:00
iidx_id = random.randint(10000000, 99999999)
2022-11-15 15:03:37 +01:00
all_profiles_for_card["iidx_id"] = iidx_id
all_profiles_for_card["version"][str(game_version)] = {
"game_version": game_version,
"djname": name,
"region": int(pid),
"head": 0,
"hair": 0,
"face": 0,
"hand": 0,
"body": 0,
"frame": 0,
"turntable": 0,
"explosion": 0,
"bgm": 0,
"folder_mask": 0,
"sudden": 0,
"judge_pos": 0,
"categoryvoice": 0,
"note": 0,
"fullcombo": 0,
"keybeam": 0,
"judgestring": 0,
"soundpreview": 0,
"grapharea": 0,
"effector_lock": 0,
"effector_type": 0,
"explosion_size": 0,
"alternate_hcn": 0,
"kokokara_start": 0,
"d_auto_adjust": 0,
"d_auto_scrach": 0,
"d_camera_layout": 0,
"d_disp_judge": 0,
"d_exscore": 0,
"d_gauge_disp": 0,
"d_ghost_score": 0,
"d_gno": 0,
"d_graph_score": 0,
"d_gtype": 0,
"d_hispeed": 0.000000,
"d_judge": 0,
"d_judgeAdj": 0,
"d_lane_brignt": 0,
"d_liflen": 0,
"d_notes": 0.000000,
"d_opstyle": 0,
"d_pace": 0,
"d_sdlen": 0,
"d_sdtype": 0,
"d_sorttype": 0,
"d_sub_gno": 0,
"d_timing": 0,
"d_tsujigiri_disp": 0,
"d_tune": 0,
"dach": 0,
"dp_opt": 0,
"dp_opt2": 0,
"dpnum": 0,
"gpos": 0,
"mode": 0,
"ngrade": 0,
"pmode": 0,
"rtype": 0,
"s_auto_adjust": 0,
"s_auto_scrach": 0,
"s_camera_layout": 0,
"s_disp_judge": 0,
"s_exscore": 0,
"s_gauge_disp": 0,
"s_ghost_score": 0,
"s_gno": 0,
"s_graph_score": 0,
"s_gtype": 0,
"s_hispeed": 0.000000,
"s_judge": 0,
"s_judgeAdj": 0,
"s_lane_brignt": 0,
"s_liflen": 0,
"s_notes": 0.000000,
"s_opstyle": 0,
"s_pace": 0,
"s_sdlen": 0,
"s_sdtype": 0,
"s_sorttype": 0,
"s_sub_gno": 0,
"s_timing": 0,
"s_tsujigiri_disp": 0,
"s_tune": 0,
"sach": 0,
"sp_opt": 0,
"spnum": 0,
"deller": 0,
2022-08-26 12:39:11 +02:00
# Step up mode
2022-11-15 15:03:37 +01:00
"stepup_dp_level": 0,
"stepup_dp_mplay": 0,
"stepup_enemy_damage": 0,
"stepup_enemy_defeat_flg": 0,
"stepup_mission_clear_num": 0,
"stepup_progress": 0,
"stepup_sp_level": 0,
"stepup_sp_mplay": 0,
"stepup_tips_read_list": 0,
"stepup_total_point": 0,
"stepup_is_track_ticket": 0,
2022-08-26 12:39:11 +02:00
# DJ Rank
2022-11-15 15:03:37 +01:00
"dj_rank_single_rank": [0] * 15,
"dj_rank_double_rank": [0] * 15,
"dj_rank_single_point": [0] * 15,
"dj_rank_double_point": [0] * 15,
2022-08-26 12:39:11 +02:00
# Notes Radar
2022-11-15 15:03:37 +01:00
"notes_radar_single": [0] * 6,
"notes_radar_double": [0] * 6,
2022-08-26 12:39:11 +02:00
# Grades
2022-11-15 15:03:37 +01:00
"grade_single": -1,
"grade_double": -1,
"grade_values": [],
2022-08-26 12:39:11 +02:00
# Achievements
2022-11-15 15:03:37 +01:00
"achievements_trophy": [0] * 160,
"achievements_last_weekly": 0,
"achievements_pack_comp": 0,
"achievements_pack_flg": 0,
"achievements_pack_id": 0,
"achievements_play_pack": 0,
"achievements_visit_flg": 0,
"achievements_weekly_num": 0,
2022-08-26 12:39:11 +02:00
# Other
2022-11-15 15:03:37 +01:00
"language_setting": 0,
"movie_agreement": 0,
"lightning_play_data_spnum": 0,
"lightning_play_data_dpnum": 0,
2022-08-26 12:39:11 +02:00
# Lightning model settings
2022-11-15 15:03:37 +01:00
"lightning_setting_slider": [0] * 7,
"lightning_setting_light": [1] * 10,
"lightning_setting_concentration": 0,
"lightning_setting_headphone_vol": 0,
"lightning_setting_resistance_sp_left": 0,
"lightning_setting_resistance_sp_right": 0,
"lightning_setting_resistance_dp_left": 0,
"lightning_setting_resistance_dp_right": 0,
"lightning_setting_skin_0": 0,
"lightning_setting_flg_skin_0": 0,
2022-08-26 12:39:11 +02:00
# Event_1 settings
2022-11-15 15:03:37 +01:00
"event_1_story_prog": 0,
"event_1_last_select_area": 0,
"event_1_failed_num": 0,
"event_1_event_play_num": 0,
"event_1_last_select_area_id": 0,
"event_1_last_select_platform_type": 0,
"event_1_last_select_platform_id": 0,
2022-08-26 12:39:11 +02:00
# Web UI/Other options
2022-11-15 15:03:37 +01:00
"_show_category_grade": 0,
"_show_category_status": 1,
"_show_category_difficulty": 1,
"_show_category_alphabet": 1,
"_show_category_rival_play": 0,
"_show_category_rival_winlose": 1,
"_show_category_all_rival_play": 0,
"_show_category_arena_winlose": 1,
"_show_rival_shop_info": 1,
"_hide_play_count": 0,
"_show_score_graph_cutin": 1,
"_hide_iidx_id": 0,
"_classic_hispeed": 0,
"_beginner_option_swap": 1,
"_show_lamps_as_no_play_in_arena": 0,
"skin_customize_flag_frame": 0,
"skin_customize_flag_bgm": 0,
"skin_customize_flag_lane": 0,
# Rivals
2022-11-15 15:03:37 +01:00
"sp_rival_1_iidx_id": 0,
"sp_rival_2_iidx_id": 0,
"sp_rival_3_iidx_id": 0,
"sp_rival_4_iidx_id": 0,
"sp_rival_5_iidx_id": 0,
"dp_rival_1_iidx_id": 0,
"dp_rival_2_iidx_id": 0,
"dp_rival_3_iidx_id": 0,
"dp_rival_4_iidx_id": 0,
"dp_rival_5_iidx_id": 0,
2022-08-26 12:39:11 +02:00
}
2022-11-15 15:03:37 +01:00
db.upsert(all_profiles_for_card, where("card") == cid)
2022-08-26 12:39:11 +02:00
card, card_split = get_id_from_profile(cid)
2022-11-15 15:03:37 +01:00
response = E.response(E.IIDX29pc(id=card, id_str=card_split))
2022-08-26 12:39:11 +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}/IIDX29pc/getLaneGachaTicket")
2022-08-26 12:39:11 +02:00
async def iidx29pc_getlanegachaticket(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.IIDX29pc(
E.ticket(
ticket_id=0,
arrange_id=0,
expire_date=0,
),
E.setting(
sp=0,
dp_left=0,
dp_right=0,
),
E.info(
last_page=0,
),
E.free(
num=10,
),
E.favorite(
arrange=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}/IIDX29pc/drawLaneGacha")
2022-08-26 12:39:11 +02:00
async def iidx29pc_drawlanegacha(request: Request):
request_info = await core_process_request(request)
response = E.response(
E.IIDX29pc(
E.ticket(
ticket_id=0,
arrange_id=0,
expire_date=0,
),
2022-11-15 15:03:37 +01:00
E.session(session_id=0),
status=0,
2022-08-26 12:39:11 +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}/IIDX29pc/eaappliresult")
2022-08-26 12:39:11 +02:00
async def iidx29pc_eaappliresult(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
response = E.response(E.IIDX29pc())
2022-08-26 12:39:11 +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}/IIDX29pc/logout")
2022-08-26 12:39:11 +02:00
async def iidx29pc_logout(request: Request):
request_info = await core_process_request(request)
2022-11-15 15:03:37 +01:00
response = E.response(E.IIDX29pc())
2022-08-26 12:39:11 +02:00
response_body, response_headers = await core_prepare_response(request, response)
return Response(content=response_body, headers=response_headers)