1
0
mirror of synced 2024-11-28 07:50:48 +01:00

fixing trial_tower_play_end_unanalyzed_log_fixed for SAO

This commit is contained in:
Midorica 2023-07-02 15:50:42 -04:00
parent d276ac8598
commit da422e602b

View File

@ -1208,32 +1208,9 @@ class SaoBase:
req_data = req_struct.parse(req) req_data = req_struct.parse(req)
user_id = req_data.user_id user_id = req_data.user_id
with open('titles/sao/data/RewardTable.csv', 'r') as f: end_session_data = self.game_data.item.get_end_session(user_id)
keys_unanalyzed = next(f).strip().split(',')
data_unanalyzed = list(DictReader(f, fieldnames=keys_unanalyzed))
randomized_unanalyzed_id = choice(data_unanalyzed) resp = SaoEpisodePlayEndUnanalyzedLogFixedResponse(int.from_bytes(bytes.fromhex(request[:4]), "big")+1, end_session_data[4])
heroList = self.game_data.static.get_hero_id(randomized_unanalyzed_id['CommonRewardId'])
i = 0
# Create a loop to check if the id is a hero or else try 15 times before closing the loop and sending a dummy hero
while not heroList:
if i == 15:
# Return the dummy hero but not save it
resp = SaoEpisodePlayEndUnanalyzedLogFixedResponse(int.from_bytes(bytes.fromhex(request[:4]), "big")+1, 102000070)
return resp.make()
i += 1
randomized_unanalyzed_id = choice(data_unanalyzed)
heroList = self.game_data.static.get_hero_id(randomized_unanalyzed_id['CommonRewardId'])
hero_data = self.game_data.item.get_hero_log(user_id, randomized_unanalyzed_id['CommonRewardId'])
# Avoid having a duplicated card and cause an overwrite
if not hero_data:
self.game_data.item.put_hero_log(user_id, randomized_unanalyzed_id['CommonRewardId'], 1, 0, 101000016, 0, 30086, 1001, 1002, 0, 0)
resp = SaoEpisodePlayEndUnanalyzedLogFixedResponse(int.from_bytes(bytes.fromhex(request[:4]), "big")+1, randomized_unanalyzed_id['CommonRewardId'])
return resp.make() return resp.make()
def handle_cd00(self, request: Any) -> bytes: def handle_cd00(self, request: Any) -> bytes: