Fix some bugs

- Second try to fix a bug about API
- Fix a bug that the `prog boost` shows the incorrect value
- Fix a bug that the rewards can be get repeatedly in World Mode
- Fix a bug that second tube of blood of the world boss won't change
This commit is contained in:
Lost-MSth
2022-08-11 22:38:26 +08:00
parent 27ee147989
commit 732947a3f0
4 changed files with 8 additions and 6 deletions

View File

@@ -63,6 +63,9 @@ def request_json_handle(request, required_keys=[], optional_keys=[]):
def wrapped_view(*args, **kwargs):
data = {}
if not request.data:
return view(data, *args, **kwargs)
for key in required_keys:
if key not in request.json:
return error_return(PostError('Missing parameter: ' + key, api_error_code=-100))

View File

@@ -248,7 +248,7 @@ class ProgBoost(UserItem):
世界模式prog_boost\
parameters: `user` - `UserOnline`类或子类的实例
'''
user.update_user_one_column('prog_boost', 1)
user.update_user_one_column('prog_boost', 300)
class Stamina6(UserItem):

View File

@@ -224,7 +224,7 @@ class UserPlay(UserScore):
r['user_rating'] = self.user.rating_ptt
r['finale_challenge_higher'] = self.rating > self.ptt.value
r['global_rank'] = self.user.global_rank
r['finale_play_value'] = 0 # emmmm
r['finale_play_value'] = self.rating * 5 # emmmm
return r
@property
@@ -286,7 +286,7 @@ class UserPlay(UserScore):
self.c.execute('''select prog_boost from user where user_id=:a''', {
'a': self.user.user_id})
x = self.c.fetchone()
if x and x[0] == 1:
if x and x[0] == 300:
self.prog_boost_multiply = 300
self.clear_play_state()
@@ -566,7 +566,6 @@ class UserScoreList:
self.query.query_append({'user_id': self.user.user_id})
self.query.sort += [{'column': 'rating', 'order': 'DESC'}]
print(self.query.sort)
x = Sql(self.c).select('best_score', query=self.query)
self.scores = [UserScore(self.c, self.user).from_list(i) for i in x]

View File

@@ -199,7 +199,7 @@ class UserMap(Map):
@property
def rewards_for_climbing(self) -> list:
rewards = []
for i in range(self.prev_position, self.curr_position+1):
for i in range(self.prev_position+1, self.curr_position+1):
step = self.steps[i]
if step.items:
rewards.append(
@@ -209,7 +209,7 @@ class UserMap(Map):
def rewards_for_climbing_to_dict(self) -> list:
rewards = []
for i in range(self.prev_position, self.curr_position+1):
for i in range(self.prev_position+1, self.curr_position+1):
step = self.steps[i]
if step.items:
rewards.append(