From e1a70d1a06ab374f312533db3df18af9e1ea7a3e Mon Sep 17 00:00:00 2001 From: Midorica Date: Sun, 12 Nov 2023 16:13:04 -0500 Subject: [PATCH] sao: fix dict lengths of multiple response handlers --- titles/sao/handlers/base.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/titles/sao/handlers/base.py b/titles/sao/handlers/base.py index 0b5c522..db6e98f 100644 --- a/titles/sao/handlers/base.py +++ b/titles/sao/handlers/base.py @@ -720,6 +720,8 @@ class SaoGetHeroLogUserDataListResponse(SaoBaseResponse): resp_data.hero_log_user_data_list.append(hero_data) + resp_data["hero_log_user_data_list_size"] = len(resp_data.hero_log_user_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -877,6 +879,8 @@ class SaoGetEquipmentUserDataListResponse(SaoBaseResponse): resp_data.equipment_user_data_list.append(equipment_data) + resp_data["equipment_user_data_list_size"] = len(resp_data.equipment_user_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -942,6 +946,8 @@ class SaoGetItemUserDataListResponse(SaoBaseResponse): resp_data.item_user_data_list.append(item_data) + resp_data["item_user_data_list_size"] = len(resp_data.item_user_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -1014,6 +1020,8 @@ class SaoGetSupportLogUserDataListResponse(SaoBaseResponse): resp_data.support_log_user_data_list.append(support_data) + resp_data["support_log_user_data_list_size"] = len(resp_data.support_log_user_data_list) + resp_data = resp_struct.build(resp_data) self.length = len(resp_data) @@ -1061,6 +1069,8 @@ class SaoGetTitleUserDataListResponse(SaoBaseResponse): resp_data.title_user_data_list.append(title_data) + resp_data["title_user_data_list_size"] = len(resp_data.title_user_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -1120,6 +1130,8 @@ class SaoGetEpisodeAppendDataListResponse(SaoBaseResponse): own_num=self.own_num_list[i], )) + resp_data["episode_append_data_list_size"] = len(resp_data.episode_append_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -1857,6 +1869,10 @@ class SaoEpisodePlayEndUnanalyzedLogFixedResponse(SaoBaseResponse): resp_data.play_end_unanalyzed_log_reward_data_list.append(reward_resp_data) + resp_data["play_end_unanalyzed_log_reward_data_list_size"] = len(resp_data.play_end_unanalyzed_log_reward_data_list) + for i in range(len(resp_data.play_end_unanalyzed_log_reward_data_list)): + resp_data.play_end_unanalyzed_log_reward_data_list[i]["common_reward_data_size"] = len(resp_data.play_end_unanalyzed_log_reward_data_list[i]["common_reward_data"]) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -1871,6 +1887,7 @@ class SaoGetQuestSceneUserDataListRequest(SaoBaseRequest): class SaoGetQuestSceneUserDataListResponse(SaoBaseResponse): def __init__(self, cmd, quest_data) -> None: super().__init__(cmd) + self.length = None self.result = 1 # quest_scene_user_data_list_size @@ -1967,6 +1984,10 @@ class SaoGetQuestSceneUserDataListResponse(SaoBaseResponse): resp_data.quest_scene_user_data_list.append(quest_resp_data) + resp_data["quest_scene_user_data_list_size"] = len(resp_data.quest_scene_user_data_list) + for i in range(len(resp_data.quest_scene_user_data_list)): + resp_data.quest_scene_user_data_list[i]["quest_scene_best_score_user_data_size"] = len(resp_data.quest_scene_user_data_list[i]["quest_scene_best_score_user_data"]) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -2252,6 +2273,8 @@ class SaoSynthesizeEnhancementHeroLogResponse(SaoBaseResponse): resp_data.hero_log_user_data_list.append(hero_data) + resp_data["hero_log_user_data_list_size"] = len(resp_data.hero_log_user_data_list) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -2411,6 +2434,8 @@ class SaoSynthesizeEnhancementEquipmentResponse(SaoBaseResponse): resp_data.after_equipment_user_data.append(synthesize_equipment_data) + resp_data["after_equipment_user_data_size"] = len(resp_data.after_equipment_user_data) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data) @@ -2911,6 +2936,8 @@ class SaoScanQrQuestProfileCardResponse(SaoBaseResponse): resp_data.read_profile_card_data.append(hero_data) + resp_data["read_profile_card_data_size"] = len(resp_data.read_profile_card_data) + # finally, rebuild the resp_data resp_data = resp_struct.build(resp_data)