Tower progression now working for SAO

This commit is contained in:
Midorica 2023-06-24 20:09:37 -04:00
parent d5bff0e891
commit 391edd3354
2 changed files with 38 additions and 14 deletions

View File

@ -437,7 +437,6 @@ python dbutils.py --game SDEW upgrade
```
### Notes
- Tower Quests currently force unlocked, no progression
- Co-Op (matching) is not supported
- Shop is not functionnal
- Player title is currently static and cannot be changed in-game

View File

@ -817,7 +817,7 @@ class SaoBase:
resp = SaoEpisodePlayEndResponse(int.from_bytes(bytes.fromhex(request[:4]), "big")+1)
return resp.make()
def handle_c914(self, request: Any) -> bytes: # TBD
def handle_c914(self, request: Any) -> bytes:
#quest/trial_tower_play_start
req = bytes.fromhex(request)[24:]
@ -932,8 +932,33 @@ class SaoBase:
req_data = req_struct.parse(req)
# Add tower progression to database
user_id = req_data.user_id
trial_tower_id = req_data.trial_tower_id
quest_clear_flag = bool(req_data.score_data[0].boss_destroying_num)
clear_time = req_data.score_data[0].clear_time
combo_num = req_data.score_data[0].combo_num
total_damage = req_data.score_data[0].total_damage
concurrent_destroying_num = req_data.score_data[0].concurrent_destroying_num
if quest_clear_flag is True:
# Save tower progression - to be revised to avoid saving worse score
if trial_tower_id == 10:
trial_tower_id = 10001
elif trial_tower_id == 20:
trial_tower_id = 10002
elif trial_tower_id == 30:
trial_tower_id = 10003
elif trial_tower_id == 40:
trial_tower_id = 10004
elif trial_tower_id == 50:
trial_tower_id = 10005
else:
trial_tower_id = trial_tower_id + 3000
self.game_data.item.put_player_quest(user_id, episode_id, quest_clear_flag, clear_time, combo_num, total_damage, concurrent_destroying_num)
# Update the profile
profile = self.game_data.profile.get_profile(req_data.user_id)
profile = self.game_data.profile.get_profile(user_id)
exp = int(profile["rank_exp"]) + 100 #always 100 extra exp for some reason
col = int(profile["own_col"]) + int(req_data.base_get_data[0].get_col)
@ -956,7 +981,7 @@ class SaoBase:
break
updated_profile = self.game_data.profile.put_profile(
req_data.user_id,
user_id,
profile["user_type"],
profile["nick_name"],
player_level,
@ -968,8 +993,8 @@ class SaoBase:
)
# Update heroes from the used party
play_session = self.game_data.item.get_session(req_data.user_id)
session_party = self.game_data.item.get_hero_party(req_data.user_id, play_session["user_party_team_id"])
play_session = self.game_data.item.get_session(user_id)
session_party = self.game_data.item.get_hero_party(user_id, play_session["user_party_team_id"])
hero_list = []
hero_list.append(session_party["user_hero_log_id_1"])
@ -977,12 +1002,12 @@ class SaoBase:
hero_list.append(session_party["user_hero_log_id_3"])
for i in range(0,len(hero_list)):
hero_data = self.game_data.item.get_hero_log(req_data.user_id, hero_list[i])
hero_data = self.game_data.item.get_hero_log(user_id, hero_list[i])
log_exp = int(hero_data["log_exp"]) + int(req_data.base_get_data[0].get_hero_log_exp)
self.game_data.item.put_hero_log(
req_data.user_id,
user_id,
hero_data["user_hero_log_id"],
hero_data["log_level"],
log_exp,
@ -1005,11 +1030,11 @@ class SaoBase:
itemList = self.game_data.static.get_item_id(commonRewardId)
if heroList:
self.game_data.item.put_hero_log(req_data.user_id, commonRewardId, 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
self.game_data.item.put_hero_log(user_id, commonRewardId, 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
if equipmentList:
self.game_data.item.put_equipment_data(req_data.user_id, commonRewardId, 1, 200, 0, 0, 0)
self.game_data.item.put_equipment_data(user_id, commonRewardId, 1, 200, 0, 0, 0)
if itemList:
self.game_data.item.put_item(req_data.user_id, commonRewardId)
self.game_data.item.put_item(user_id, commonRewardId)
# Generate random hero(es) based off the response
for a in range(0,req_data.get_unanalyzed_log_tmp_reward_data_list_length):
@ -1026,11 +1051,11 @@ class SaoBase:
equipmentList = self.game_data.static.get_equipment_id(randomized_unanalyzed_id['CommonRewardId'])
itemList = self.game_data.static.get_item_id(randomized_unanalyzed_id['CommonRewardId'])
if heroList:
self.game_data.item.put_hero_log(req_data.user_id, randomized_unanalyzed_id['CommonRewardId'], 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
self.game_data.item.put_hero_log(user_id, randomized_unanalyzed_id['CommonRewardId'], 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
if equipmentList:
self.game_data.item.put_equipment_data(req_data.user_id, randomized_unanalyzed_id['CommonRewardId'], 1, 200, 0, 0, 0)
self.game_data.item.put_equipment_data(user_id, randomized_unanalyzed_id['CommonRewardId'], 1, 200, 0, 0, 0)
if itemList:
self.game_data.item.put_item(req_data.user_id, randomized_unanalyzed_id['CommonRewardId'])
self.game_data.item.put_item(user_id, randomized_unanalyzed_id['CommonRewardId'])
# Send response