Fix two small bugs

- Fix a bug that the level of the character can exceed the max level
- Fix a bug that the response is incorrect when upgrading the characters by `generic core`
This commit is contained in:
Lost-MSth
2022-08-03 22:00:42 +08:00
parent b38dbf1a55
commit 27ee147989
2 changed files with 2 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ class Level:
if exp >= Constant.LEVEL_STEPS[self.max_level]:
self.exp = Constant.LEVEL_STEPS[self.max_level]
self.level = self.max_level
return None
a = []
b = []

View File

@@ -100,7 +100,7 @@ def character_exp(user_id, character_id):
core.amount = - int(request.form['amount'])
core.item_id = 'core_generic'
character.upgrade_by_core(user, core)
return success_return({'user_id': user.user_id, 'character': [character.to_dict], 'cores': user.cores})
return success_return({'user_id': user.user_id, 'character': [character.to_dict()], 'cores': user.cores})
@bp.route('/me/save', methods=['GET']) # 从云端同步