mirror of
https://github.com/drmext/MonkeyBusiness.git
synced 2024-11-15 02:57:38 +01:00
Implement rivals, venue top, and target graphs for IIDX 29
This commit is contained in:
parent
1dbeb4e873
commit
6354361db2
@ -34,19 +34,44 @@ async def iidx29music_getrank(request: Request):
|
|||||||
|
|
||||||
all_scores = {}
|
all_scores = {}
|
||||||
db = get_db()
|
db = get_db()
|
||||||
|
|
||||||
|
profile = db.table('iidx_profile').get(where('iidx_id') == iidxid)['version'][str(game_version)]
|
||||||
|
|
||||||
|
if play_style == 0:
|
||||||
|
rivals = [
|
||||||
|
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),
|
||||||
|
]
|
||||||
|
elif play_style == 1:
|
||||||
|
rivals = [
|
||||||
|
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),
|
||||||
|
]
|
||||||
|
|
||||||
for record in db.table('iidx_scores_best').search(
|
for record in db.table('iidx_scores_best').search(
|
||||||
(where('music_id') < (game_version + 1) * 1000)
|
(where('music_id') < (game_version + 1) * 1000)
|
||||||
& (where('iidx_id') == iidxid)
|
|
||||||
& (where('play_style') == play_style)
|
& (where('play_style') == play_style)
|
||||||
):
|
):
|
||||||
|
if record['iidx_id'] == iidxid:
|
||||||
|
rival_idx = -1
|
||||||
|
elif record['iidx_id'] in rivals:
|
||||||
|
rival_idx = rivals.index(record['iidx_id'])
|
||||||
|
else:
|
||||||
|
continue
|
||||||
music_id = record['music_id']
|
music_id = record['music_id']
|
||||||
clear_flg = record['clear_flg']
|
clear_flg = record['clear_flg']
|
||||||
ex_score = record['ex_score']
|
ex_score = record['ex_score']
|
||||||
miss_count = record['miss_count']
|
miss_count = record['miss_count']
|
||||||
chart_id = record['chart_id']
|
chart_id = record['chart_id']
|
||||||
|
|
||||||
if music_id not in all_scores:
|
if (rival_idx, music_id) not in all_scores:
|
||||||
all_scores[music_id] = {
|
all_scores[rival_idx, music_id] = {
|
||||||
0: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
0: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
||||||
1: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
1: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
||||||
2: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
2: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
||||||
@ -54,20 +79,57 @@ async def iidx29music_getrank(request: Request):
|
|||||||
4: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
4: {'clear_flg': -1, 'ex_score': -1, 'miss_count': -1},
|
||||||
}
|
}
|
||||||
|
|
||||||
all_scores[music_id][chart_id]['clear_flg'] = clear_flg
|
all_scores[rival_idx, music_id][chart_id]['clear_flg'] = clear_flg
|
||||||
all_scores[music_id][chart_id]['ex_score'] = ex_score
|
all_scores[rival_idx, music_id][chart_id]['ex_score'] = ex_score
|
||||||
all_scores[music_id][chart_id]['miss_count'] = miss_count
|
all_scores[rival_idx, music_id][chart_id]['miss_count'] = miss_count
|
||||||
|
|
||||||
|
top_scores = {}
|
||||||
|
for record in db.table('iidx_scores_best').search(
|
||||||
|
(where('music_id') < (game_version + 1) * 1000)
|
||||||
|
& (where('play_style') == play_style)
|
||||||
|
):
|
||||||
|
music_id = record['music_id']
|
||||||
|
ex_score = record['ex_score']
|
||||||
|
chart_id = record['chart_id']
|
||||||
|
iidx_id = record['iidx_id']
|
||||||
|
|
||||||
|
if music_id not in top_scores:
|
||||||
|
top_scores[music_id] = {
|
||||||
|
0: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
|
||||||
|
1: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
|
||||||
|
2: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
|
||||||
|
3: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
|
||||||
|
4: {'djname': "", 'clear_flg': -1, 'ex_score': -1},
|
||||||
|
}
|
||||||
|
|
||||||
|
if ex_score > top_scores[music_id][chart_id]['ex_score']:
|
||||||
|
top_name = db.table('iidx_profile').get(where('iidx_id') == iidx_id)['version'][str(game_version)]['djname']
|
||||||
|
top_scores[music_id][chart_id]['djname'] = top_name
|
||||||
|
top_scores[music_id][chart_id]['clear_flg'] = 1
|
||||||
|
top_scores[music_id][chart_id]['ex_score'] = ex_score
|
||||||
|
|
||||||
response = E.response(
|
response = E.response(
|
||||||
E.IIDX29music(
|
E.IIDX29music(
|
||||||
E.style(type=play_style),
|
E.style(type=play_style),
|
||||||
*[E.m([
|
*[E.m([
|
||||||
-1,
|
i,
|
||||||
k,
|
k,
|
||||||
*[all_scores[k][d]['clear_flg'] for d in range(5)],
|
*[all_scores[i, k][d]['clear_flg'] for d in range(5)],
|
||||||
*[all_scores[k][d]['ex_score'] for d in range(5)],
|
*[all_scores[i, k][d]['ex_score'] for d in range(5)],
|
||||||
*[all_scores[k][d]['miss_count'] for d in range(5)],
|
*[all_scores[i, k][d]['miss_count'] for d in range(5)],
|
||||||
], __type='s16') for k in all_scores]
|
], __type='s16') for i, k in all_scores],
|
||||||
|
*[E.top(
|
||||||
|
E.detail([
|
||||||
|
k,
|
||||||
|
*[top_scores[k][d]['clear_flg'] for d in range(5)],
|
||||||
|
*[top_scores[k][d]['ex_score'] for d in range(5)],
|
||||||
|
], __type='s16'),
|
||||||
|
name0=top_scores[k][0]['djname'],
|
||||||
|
name1=top_scores[k][1]['djname'],
|
||||||
|
name2=top_scores[k][2]['djname'],
|
||||||
|
name3=top_scores[k][3]['djname'],
|
||||||
|
name4=top_scores[k][4]['djname']
|
||||||
|
) for k in top_scores]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -323,9 +385,14 @@ async def iidx29music_reg(request: Request):
|
|||||||
async def iidx29music_appoint(request: Request):
|
async def iidx29music_appoint(request: Request):
|
||||||
request_info = await core_process_request(request)
|
request_info = await core_process_request(request)
|
||||||
|
|
||||||
iidxid = int(request_info['root'][0].attrib['iidxid'])
|
root = request_info['root'][0]
|
||||||
music_id = int(request_info['root'][0].attrib['mid'])
|
|
||||||
chart_id = int(request_info['root'][0].attrib['clid'])
|
iidxid = int(root.attrib['iidxid'])
|
||||||
|
music_id = int(root.attrib['mid'])
|
||||||
|
chart_id = int(root.attrib['clid'])
|
||||||
|
ctype = int(root.attrib['ctype'])
|
||||||
|
subtype = root.attrib['subtype']
|
||||||
|
|
||||||
|
|
||||||
db = get_db()
|
db = get_db()
|
||||||
record = db.table('iidx_scores_best').get(
|
record = db.table('iidx_scores_best').get(
|
||||||
@ -343,6 +410,44 @@ async def iidx29music_appoint(request: Request):
|
|||||||
__size=len(record['ghost']) // 2,
|
__size=len(record['ghost']) // 2,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
if ctype == 1:
|
||||||
|
sdata = db.table('iidx_scores_best').get(
|
||||||
|
(where('iidx_id') == int(subtype))
|
||||||
|
& (where('music_id') == music_id)
|
||||||
|
& (where('chart_id') == chart_id)
|
||||||
|
)
|
||||||
|
elif ctype in (2, 4, 10):
|
||||||
|
sdata = {
|
||||||
|
'game_version': 29,
|
||||||
|
'ghost': "",
|
||||||
|
'ex_score': 0,
|
||||||
|
'iidx_id': 0,
|
||||||
|
'name': "",
|
||||||
|
'pid': 13
|
||||||
|
}
|
||||||
|
|
||||||
|
for record in db.table('iidx_scores_best').search(
|
||||||
|
(where('music_id') == music_id)
|
||||||
|
& (where('chart_id') == chart_id)
|
||||||
|
):
|
||||||
|
if record['ex_score'] > sdata['ex_score']:
|
||||||
|
sdata['game_version'] = record['game_version']
|
||||||
|
sdata['ghost'] = record['ghost']
|
||||||
|
sdata['ex_score'] = record['ex_score']
|
||||||
|
sdata['iidx_id'] = record['iidx_id']
|
||||||
|
sdata['pid'] = record['pid']
|
||||||
|
|
||||||
|
if ctype in (1, 2, 4, 10) and sdata['ex_score'] != 0:
|
||||||
|
vals.append(E.sdata(
|
||||||
|
sdata['ghost'],
|
||||||
|
score=sdata['ex_score'],
|
||||||
|
name=db.table('iidx_profile').get(where('iidx_id') == sdata['iidx_id'])['version'][str(sdata['game_version'])]['djname'],
|
||||||
|
pid=sdata['pid'],
|
||||||
|
__type="bin",
|
||||||
|
__size=len(sdata['ghost']) // 2,
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
response = E.response(
|
response = E.response(
|
||||||
E.IIDX29music(
|
E.IIDX29music(
|
||||||
*vals
|
*vals
|
||||||
|
@ -18,12 +18,24 @@ def get_profile(cid):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def get_profile_by_id(iidx_id):
|
||||||
|
return get_db().table('iidx_profile').get(
|
||||||
|
where('iidx_id') == iidx_id
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_game_profile(cid, game_version):
|
def get_game_profile(cid, game_version):
|
||||||
profile = get_profile(cid)
|
profile = get_profile(cid)
|
||||||
|
|
||||||
return profile['version'].get(str(game_version), None)
|
return profile['version'].get(str(game_version), None)
|
||||||
|
|
||||||
|
|
||||||
|
def get_game_profile_by_id(iidx_id, game_version):
|
||||||
|
profile = get_profile_by_id(iidx_id)
|
||||||
|
|
||||||
|
return profile['version'].get(str(game_version), None)
|
||||||
|
|
||||||
|
|
||||||
def get_id_from_profile(cid):
|
def get_id_from_profile(cid):
|
||||||
profile = get_db().table('iidx_profile').get(
|
profile = get_db().table('iidx_profile').get(
|
||||||
where('card') == cid
|
where('card') == cid
|
||||||
@ -58,6 +70,44 @@ async def iidx29pc_get(request: Request):
|
|||||||
profile = get_game_profile(cid, game_version)
|
profile = get_game_profile(cid, game_version)
|
||||||
djid, djid_split = get_id_from_profile(cid)
|
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] = {}
|
||||||
|
rivals[idx]['spdp'] = 1 if idx < 5 else 2
|
||||||
|
|
||||||
|
rival_profile = get_game_profile_by_id(r, game_version)
|
||||||
|
rdjid = "%08d" % r
|
||||||
|
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']
|
||||||
|
|
||||||
|
|
||||||
response = E.response(
|
response = E.response(
|
||||||
E.IIDX29pc(
|
E.IIDX29pc(
|
||||||
E.pcdata(
|
E.pcdata(
|
||||||
@ -154,7 +204,28 @@ async def iidx29pc_get(request: Request):
|
|||||||
profile["kokokara_start"],
|
profile["kokokara_start"],
|
||||||
],
|
],
|
||||||
__type="s16"),
|
__type="s16"),
|
||||||
E.rlist(),
|
E.rlist(
|
||||||
|
*[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],
|
||||||
|
),
|
||||||
E.ir_data(),
|
E.ir_data(),
|
||||||
E.secret_course_data(),
|
E.secret_course_data(),
|
||||||
E.deller(deller=profile['deller'], rate=0),
|
E.deller(deller=profile['deller'], rate=0),
|
||||||
@ -850,7 +921,7 @@ async def iidx29pc_reg(request: Request):
|
|||||||
'_show_category_rival_winlose': 1,
|
'_show_category_rival_winlose': 1,
|
||||||
'_show_category_all_rival_play': 0,
|
'_show_category_all_rival_play': 0,
|
||||||
'_show_category_arena_winlose': 1,
|
'_show_category_arena_winlose': 1,
|
||||||
'_show_rival_shop_info': 0,
|
'_show_rival_shop_info': 1,
|
||||||
'_hide_play_count': 0,
|
'_hide_play_count': 0,
|
||||||
'_show_score_graph_cutin': 1,
|
'_show_score_graph_cutin': 1,
|
||||||
'_hide_iidx_id': 0,
|
'_hide_iidx_id': 0,
|
||||||
@ -860,7 +931,20 @@ async def iidx29pc_reg(request: Request):
|
|||||||
|
|
||||||
'skin_customize_flag_frame': 0,
|
'skin_customize_flag_frame': 0,
|
||||||
'skin_customize_flag_bgm': 0,
|
'skin_customize_flag_bgm': 0,
|
||||||
'skin_customize_flag_lane': 0
|
'skin_customize_flag_lane': 0,
|
||||||
|
|
||||||
|
# Rivals
|
||||||
|
'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
|
||||||
}
|
}
|
||||||
db.upsert(all_profiles_for_card, where('card') == cid)
|
db.upsert(all_profiles_for_card, where('card') == cid)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user