mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-13 03:27:26 +08:00
[Enhance] Support 'skill_ilith_ivy'
- Add support for the skill 'skill_ilith_ivy' - For Arcaea 4.5.0
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from random import randint
|
||||
from time import time
|
||||
|
||||
from flask import Blueprint, request
|
||||
|
||||
from core.constant import Constant
|
||||
from core.course import CoursePlay
|
||||
from core.error import InputError
|
||||
from core.rank import RankList
|
||||
@@ -25,22 +27,34 @@ def score_token():
|
||||
@arc_try
|
||||
def score_token_world(user_id):
|
||||
|
||||
stamina_multiply = int(request.args.get('stamina_multiply', 1))
|
||||
fragment_multiply = int(request.args.get('fragment_multiply', 100))
|
||||
prog_boost_multiply = int(request.args.get('prog_boost_multiply', 0))
|
||||
beyond_boost_gauge_use = int(request.args.get('beyond_boost_gauge_use', 0))
|
||||
d = request.args.get
|
||||
|
||||
stamina_multiply = int(d('stamina_multiply', 1))
|
||||
fragment_multiply = int(d('fragment_multiply', 100))
|
||||
prog_boost_multiply = int(d('prog_boost_multiply', 0))
|
||||
beyond_boost_gauge_use = int(d('beyond_boost_gauge_use', 0))
|
||||
skill_ilith_ivy_flag = None
|
||||
if d('skill_id') == 'skill_ilith_ivy' and d('is_skill_sealed') == 'false':
|
||||
# 处理 ivy 技能
|
||||
# TODO: 需要重构整个 user_play,世界模式 / 课题模式,所以现在临时 work 一下
|
||||
skill_ilith_ivy_flag = ''.join([str(randint(0, 2)) for _ in range(5)])
|
||||
with Connect() as c:
|
||||
x = UserPlay(c, UserOnline(c, user_id))
|
||||
x.song.set_chart(request.args['song_id'], int(
|
||||
request.args['difficulty']))
|
||||
x.set_play_state_for_world(
|
||||
stamina_multiply, fragment_multiply, prog_boost_multiply, beyond_boost_gauge_use)
|
||||
return success_return({
|
||||
stamina_multiply, fragment_multiply, prog_boost_multiply, beyond_boost_gauge_use, skill_ilith_ivy_flag)
|
||||
|
||||
r = {
|
||||
"stamina": x.user.stamina.stamina,
|
||||
"max_stamina_ts": x.user.stamina.max_stamina_ts,
|
||||
"token": x.song_token
|
||||
"token": x.song_token,
|
||||
}
|
||||
)
|
||||
if skill_ilith_ivy_flag:
|
||||
r['play_parameters'] = {
|
||||
'skill_ilith_ivy': list(map(lambda x: Constant.WORLD_VALUE_NAME_ENUM[int(x)], skill_ilith_ivy_flag))
|
||||
}
|
||||
return success_return(r)
|
||||
|
||||
|
||||
@bp.route('/token/course', methods=['GET']) # 课题模式成绩上传所需的token
|
||||
@@ -97,6 +111,7 @@ def song_score_post(user_id):
|
||||
x.submission_hash = request.form['submission_hash']
|
||||
if 'combo_interval_bonus' in request.form:
|
||||
x.combo_interval_bonus = int(request.form['combo_interval_bonus'])
|
||||
x.highest_health = request.form.get("highest_health", type=int)
|
||||
if not x.is_valid:
|
||||
raise InputError('Invalid score.', 107)
|
||||
x.upload_score()
|
||||
|
||||
Reference in New Issue
Block a user