forked from Hay1tsme/artemis
sao: fix episode_play_end
This commit is contained in:
parent
0e739b2077
commit
773729dc0c
@ -355,49 +355,11 @@ class SaoBase:
|
||||
|
||||
def handle_c806(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||
#custom/change_party
|
||||
req = bytes.fromhex(request)[24:]
|
||||
|
||||
req_struct = Struct(
|
||||
Padding(20),
|
||||
"ticket_id" / Bytes(1), # needs to be parsed as an int
|
||||
Padding(1),
|
||||
"user_id_size" / Rebuild(Int32ub, len_(this.user_id) * 2), # calculates the length of the user_id
|
||||
"user_id" / PaddedString(this.user_id_size, "utf_16_le"), # user_id is a (zero) padded string
|
||||
"act_type" / Int8ub, # play_mode is a byte
|
||||
Padding(3),
|
||||
"party_data_list_length" / Rebuild(Int8ub, len_(this.party_data_list)), # party_data_list is a byte,
|
||||
"party_data_list" / Array(this.party_data_list_length, Struct(
|
||||
"user_party_id_size" / Rebuild(Int32ub, len_(this.user_party_id) * 2), # calculates the length of the user_party_id
|
||||
"user_party_id" / PaddedString(this.user_party_id_size, "utf_16_le"), # user_party_id is a (zero) padded string
|
||||
"team_no" / Int8ub, # team_no is a byte
|
||||
Padding(3),
|
||||
"party_team_data_list_length" / Rebuild(Int8ub, len_(this.party_team_data_list)), # party_team_data_list is a byte
|
||||
"party_team_data_list" / Array(this.party_team_data_list_length, Struct(
|
||||
"user_party_team_id_size" / Rebuild(Int32ub, len_(this.user_party_team_id) * 2), # calculates the length of the user_party_team_id
|
||||
"user_party_team_id" / PaddedString(this.user_party_team_id_size, "utf_16_le"), # user_party_team_id is a (zero) padded string
|
||||
"arrangement_num" / Int8ub, # arrangement_num is a byte
|
||||
"user_hero_log_id_size" / Rebuild(Int32ub, len_(this.user_hero_log_id) * 2), # calculates the length of the user_hero_log_id
|
||||
"user_hero_log_id" / PaddedString(this.user_hero_log_id_size, "utf_16_le"), # user_hero_log_id is a (zero) padded string
|
||||
"main_weapon_user_equipment_id_size" / Rebuild(Int32ub, len_(this.main_weapon_user_equipment_id) * 2), # calculates the length of the main_weapon_user_equipment_id
|
||||
"main_weapon_user_equipment_id" / PaddedString(this.main_weapon_user_equipment_id_size, "utf_16_le"), # main_weapon_user_equipment_id is a (zero) padded string
|
||||
"sub_equipment_user_equipment_id_size" / Rebuild(Int32ub, len_(this.sub_equipment_user_equipment_id) * 2), # calculates the length of the sub_equipment_user_equipment_id
|
||||
"sub_equipment_user_equipment_id" / PaddedString(this.sub_equipment_user_equipment_id_size, "utf_16_le"), # sub_equipment_user_equipment_id is a (zero) padded string
|
||||
"skill_slot1_skill_id" / Int32ub, # skill_slot1_skill_id is a int,
|
||||
"skill_slot2_skill_id" / Int32ub, # skill_slot1_skill_id is a int,
|
||||
"skill_slot3_skill_id" / Int32ub, # skill_slot1_skill_id is a int,
|
||||
"skill_slot4_skill_id" / Int32ub, # skill_slot1_skill_id is a int,
|
||||
"skill_slot5_skill_id" / Int32ub, # skill_slot1_skill_id is a int,
|
||||
)),
|
||||
)),
|
||||
|
||||
)
|
||||
|
||||
req_data = req_struct.parse(req)
|
||||
user_id = req_data.user_id
|
||||
req_data = SaoChangePartyRequest(header, request)
|
||||
party_hero_list = []
|
||||
|
||||
for party_team in req_data.party_data_list[0].party_team_data_list:
|
||||
hero_data = self.game_data.item.get_hero_log(user_id, party_team["user_hero_log_id"])
|
||||
hero_data = self.game_data.item.get_hero_log(req_data.user_id, party_team["user_hero_log_id"])
|
||||
hero_level = 1
|
||||
hero_exp = 0
|
||||
|
||||
@ -406,7 +368,7 @@ class SaoBase:
|
||||
hero_exp = hero_data["log_exp"]
|
||||
|
||||
self.game_data.item.put_hero_log(
|
||||
user_id,
|
||||
req_data.user_id,
|
||||
party_team["user_hero_log_id"],
|
||||
hero_level,
|
||||
hero_exp,
|
||||
@ -421,38 +383,14 @@ class SaoBase:
|
||||
|
||||
party_hero_list.append(party_team["user_hero_log_id"])
|
||||
|
||||
self.game_data.item.put_hero_party(user_id, req_data.party_data_list[0].party_team_data_list[0].user_party_team_id, party_hero_list[0], party_hero_list[1], party_hero_list[2])
|
||||
self.game_data.item.put_hero_party(req_data.user_id, req_data.party_data_list[0].party_team_data_list[0].user_party_team_id, party_hero_list[0], party_hero_list[1], party_hero_list[2])
|
||||
|
||||
resp = SaoNoopResponse(header.cmd +1)
|
||||
return resp.make()
|
||||
|
||||
def handle_c904(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||
#quest/episode_play_start
|
||||
req = bytes.fromhex(request)[24:]
|
||||
|
||||
req_struct = Struct(
|
||||
Padding(20),
|
||||
"ticket_id" / Bytes(1), # needs to be parsed as an int
|
||||
Padding(1),
|
||||
"user_id_size" / Rebuild(Int32ub, len_(this.user_id) * 2), # calculates the length of the user_id
|
||||
"user_id" / PaddedString(this.user_id_size, "utf_16_le"), # user_id is a (zero) padded string
|
||||
"episode_id" / Int32ub, # episode_id is a int,
|
||||
"play_mode" / Int8ub, # play_mode is a byte
|
||||
Padding(3),
|
||||
"play_start_request_data_length" / Rebuild(Int8ub, len_(this.play_start_request_data)), # play_start_request_data_length is a byte,
|
||||
"play_start_request_data" / Array(this.play_start_request_data_length, Struct(
|
||||
"user_party_id_size" / Rebuild(Int32ub, len_(this.user_party_id) * 2), # calculates the length of the user_party_id
|
||||
"user_party_id" / PaddedString(this.user_party_id_size, "utf_16_le"), # user_party_id is a (zero) padded string
|
||||
"appoint_leader_resource_card_code_size" / Rebuild(Int32ub, len_(this.appoint_leader_resource_card_code) * 2), # calculates the length of the total_damage
|
||||
"appoint_leader_resource_card_code" / PaddedString(this.appoint_leader_resource_card_code_size, "utf_16_le"), # total_damage is a (zero) padded string
|
||||
"use_profile_card_code_size" / Rebuild(Int32ub, len_(this.use_profile_card_code) * 2), # calculates the length of the total_damage
|
||||
"use_profile_card_code" / PaddedString(this.use_profile_card_code_size, "utf_16_le"), # use_profile_card_code is a (zero) padded string
|
||||
"quest_drop_boost_apply_flag" / Int8ub, # quest_drop_boost_apply_flag is a byte
|
||||
)),
|
||||
|
||||
)
|
||||
|
||||
req_data = req_struct.parse(req)
|
||||
req_data = SaoEpisodePlayStartRequest(header, request)
|
||||
|
||||
user_id = req_data.user_id
|
||||
profile_data = self.game_data.profile.get_profile(user_id)
|
||||
@ -471,108 +409,21 @@ class SaoBase:
|
||||
def handle_c908(self, header: SaoRequestHeader, request: bytes) -> bytes: # Level calculation missing for the profile and heroes
|
||||
#quest/episode_play_end
|
||||
|
||||
req = bytes.fromhex(request)[24:]
|
||||
|
||||
req_struct = Struct(
|
||||
Padding(20),
|
||||
"ticket_id" / Bytes(1), # needs to be parsed as an int
|
||||
Padding(1),
|
||||
"user_id_size" / Rebuild(Int32ub, len_(this.user_id) * 2), # calculates the length of the user_id
|
||||
"user_id" / PaddedString(this.user_id_size, "utf_16_le"), # user_id is a (zero) padded string
|
||||
Padding(2),
|
||||
"episode_id" / Int16ub, # episode_id is a short,
|
||||
Padding(3),
|
||||
"play_end_request_data" / Int8ub, # play_end_request_data is a byte
|
||||
Padding(1),
|
||||
"play_result_flag" / Int8ub, # play_result_flag is a byte
|
||||
Padding(2),
|
||||
"base_get_data_length" / Rebuild(Int8ub, len_(this.base_get_data)), # base_get_data_length is a byte,
|
||||
"base_get_data" / Array(this.base_get_data_length, Struct(
|
||||
"get_hero_log_exp" / Int32ub, # get_hero_log_exp is an int
|
||||
"get_col" / Int32ub, # get_num is a short
|
||||
)),
|
||||
Padding(3),
|
||||
"get_player_trace_data_list_length" / Rebuild(Int8ub, len_(this.get_player_trace_data_list)), # get_player_trace_data_list_length is a byte
|
||||
"get_player_trace_data_list" / Array(this.get_player_trace_data_list_length, Struct(
|
||||
"user_quest_scene_player_trace_id" / Int32ub, # user_quest_scene_player_trace_id is an int
|
||||
)),
|
||||
Padding(3),
|
||||
"get_rare_drop_data_list_length" / Rebuild(Int8ub, len_(this.get_rare_drop_data_list)), # get_rare_drop_data_list_length is a byte
|
||||
"get_rare_drop_data_list" / Array(this.get_rare_drop_data_list_length, Struct(
|
||||
"quest_rare_drop_id" / Int32ub, # quest_rare_drop_id is an int
|
||||
)),
|
||||
Padding(3),
|
||||
"get_special_rare_drop_data_list_length" / Rebuild(Int8ub, len_(this.get_special_rare_drop_data_list)), # get_special_rare_drop_data_list_length is a byte
|
||||
"get_special_rare_drop_data_list" / Array(this.get_special_rare_drop_data_list_length, Struct(
|
||||
"quest_special_rare_drop_id" / Int32ub, # quest_special_rare_drop_id is an int
|
||||
)),
|
||||
Padding(3),
|
||||
"get_unanalyzed_log_tmp_reward_data_list_length" / Rebuild(Int8ub, len_(this.get_unanalyzed_log_tmp_reward_data_list)), # get_unanalyzed_log_tmp_reward_data_list_length is a byte
|
||||
"get_unanalyzed_log_tmp_reward_data_list" / Array(this.get_unanalyzed_log_tmp_reward_data_list_length, Struct(
|
||||
"unanalyzed_log_grade_id" / Int32ub, # unanalyzed_log_grade_id is an int,
|
||||
)),
|
||||
Padding(3),
|
||||
"get_event_item_data_list_length" / Rebuild(Int8ub, len_(this.get_event_item_data_list)), # get_event_item_data_list_length is a byte,
|
||||
"get_event_item_data_list" / Array(this.get_event_item_data_list_length, Struct(
|
||||
"event_item_id" / Int32ub, # event_item_id is an int
|
||||
"get_num" / Int16ub, # get_num is a short
|
||||
)),
|
||||
Padding(3),
|
||||
"discovery_enemy_data_list_length" / Rebuild(Int8ub, len_(this.discovery_enemy_data_list)), # discovery_enemy_data_list_length is a byte
|
||||
"discovery_enemy_data_list" / Array(this.discovery_enemy_data_list_length, Struct(
|
||||
"enemy_kind_id" / Int32ub, # enemy_kind_id is an int
|
||||
"destroy_num" / Int16ub, # destroy_num is a short
|
||||
)),
|
||||
Padding(3),
|
||||
"destroy_boss_data_list_length" / Rebuild(Int8ub, len_(this.destroy_boss_data_list)), # destroy_boss_data_list_length is a byte
|
||||
"destroy_boss_data_list" / Array(this.destroy_boss_data_list_length, Struct(
|
||||
"boss_type" / Int8ub, # boss_type is a byte
|
||||
"enemy_kind_id" / Int32ub, # enemy_kind_id is an int
|
||||
"destroy_num" / Int16ub, # destroy_num is a short
|
||||
)),
|
||||
Padding(3),
|
||||
"mission_data_list_length" / Rebuild(Int8ub, len_(this.mission_data_list)), # mission_data_list_length is a byte
|
||||
"mission_data_list" / Array(this.mission_data_list_length, Struct(
|
||||
"mission_id" / Int32ub, # enemy_kind_id is an int
|
||||
"clear_flag" / Int8ub, # boss_type is a byte
|
||||
"mission_difficulty_id" / Int16ub, # destroy_num is a short
|
||||
)),
|
||||
Padding(3),
|
||||
"score_data_length" / Rebuild(Int8ub, len_(this.score_data)), # score_data_length is a byte
|
||||
"score_data" / Array(this.score_data_length, Struct(
|
||||
"clear_time" / Int32ub, # clear_time is an int
|
||||
"combo_num" / Int32ub, # boss_type is a int
|
||||
"total_damage_size" / Rebuild(Int32ub, len_(this.total_damage) * 2), # calculates the length of the total_damage
|
||||
"total_damage" / PaddedString(this.total_damage_size, "utf_16_le"), # total_damage is a (zero) padded string
|
||||
"concurrent_destroying_num" / Int16ub, # concurrent_destroying_num is a short
|
||||
"reaching_skill_level" / Int16ub, # reaching_skill_level is a short
|
||||
"ko_chara_num" / Int8ub, # ko_chara_num is a byte
|
||||
"acceleration_invocation_num" / Int16ub, # acceleration_invocation_num is a short
|
||||
"boss_destroying_num" / Int16ub, # boss_destroying_num is a short
|
||||
"synchro_skill_used_flag" / Int8ub, # synchro_skill_used_flag is a byte
|
||||
"used_friend_skill_id" / Int32ub, # used_friend_skill_id is an int
|
||||
"friend_skill_used_flag" / Int8ub, # friend_skill_used_flag is a byte
|
||||
"continue_cnt" / Int16ub, # continue_cnt is a short
|
||||
"total_loss_num" / Int16ub, # total_loss_num is a short
|
||||
)),
|
||||
|
||||
)
|
||||
|
||||
req_data = req_struct.parse(req)
|
||||
req_data = SaoEpisodePlayEndRequest(header, request)
|
||||
|
||||
# Add stage progression to database
|
||||
user_id = req_data.user_id
|
||||
episode_id = req_data.episode_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
|
||||
quest_clear_flag = bool(req_data.play_end_request_data_list[0].score_data_list[0].boss_destroying_num)
|
||||
clear_time = req_data.play_end_request_data_list[0].score_data_list[0].clear_time
|
||||
combo_num = req_data.play_end_request_data_list[0].score_data_list[0].combo_num
|
||||
total_damage = req_data.play_end_request_data_list[0].score_data_list[0].total_damage
|
||||
concurrent_destroying_num = req_data.play_end_request_data_list[0].score_data_list[0].concurrent_destroying_num
|
||||
|
||||
profile = self.game_data.profile.get_profile(user_id)
|
||||
vp = int(profile["own_vp"])
|
||||
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)
|
||||
col = int(profile["own_col"]) + int(req_data.play_end_request_data_list[0].base_get_data_list[0].get_col)
|
||||
|
||||
if quest_clear_flag is True:
|
||||
# Save stage progression - to be revised to avoid saving worse score
|
||||
@ -638,7 +489,7 @@ class SaoBase:
|
||||
for i in range(0,len(hero_list)):
|
||||
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)
|
||||
log_exp = int(hero_data["log_exp"]) + int(req_data.play_end_request_data_list[0].base_get_data_list[0].get_hero_log_exp)
|
||||
|
||||
# Calculate hero level based off experience and the CSV list
|
||||
with open(r'titles/sao/data/HeroLogLevel.csv') as csv_file:
|
||||
@ -674,8 +525,8 @@ class SaoBase:
|
||||
# Grab the rare loot from the table, match it with the right item and then push to the player profile
|
||||
json_data = {"data": []}
|
||||
|
||||
for r in range(0,req_data.get_rare_drop_data_list_length):
|
||||
rewardList = self.game_data.static.get_rare_drop_id(int(req_data.get_rare_drop_data_list[r].quest_rare_drop_id))
|
||||
for r in range(0,req_data.play_end_request_data_list[0].get_rare_drop_data_list):
|
||||
rewardList = self.game_data.static.get_rare_drop_id(int(req_data.play_end_request_data_list[0].get_rare_drop_data_list[r].quest_rare_drop_id))
|
||||
commonRewardId = rewardList["commonRewardId"]
|
||||
|
||||
heroList = self.game_data.static.get_hero_id(commonRewardId)
|
||||
@ -690,14 +541,14 @@ class SaoBase:
|
||||
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):
|
||||
for a in range(0,req_data.play_end_request_data_list[0].get_unanalyzed_log_tmp_reward_data_count):
|
||||
|
||||
with open('titles/sao/data/RewardTable.csv', 'r') as f:
|
||||
keys_unanalyzed = next(f).strip().split(',')
|
||||
data_unanalyzed = list(DictReader(f, fieldnames=keys_unanalyzed))
|
||||
|
||||
randomized_unanalyzed_id = choice(data_unanalyzed)
|
||||
while int(randomized_unanalyzed_id['UnanalyzedLogGradeId']) != req_data.get_unanalyzed_log_tmp_reward_data_list[a].unanalyzed_log_grade_id:
|
||||
while int(randomized_unanalyzed_id['UnanalyzedLogGradeId']) != req_data.play_end_request_data_list[0].get_unanalyzed_log_tmp_reward_data_list[a].unanalyzed_log_grade_id:
|
||||
randomized_unanalyzed_id = choice(data_unanalyzed)
|
||||
|
||||
heroList = self.game_data.static.get_hero_id(randomized_unanalyzed_id['CommonRewardId'])
|
||||
|
@ -1473,6 +1473,29 @@ class SaoGetResourcePathInfoResponse(SaoBaseResponse):
|
||||
class SaoEpisodePlayStartRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
ticket_id = decode_str(data, off)
|
||||
self.ticket_id = ticket_id[0]
|
||||
off += ticket_id[1]
|
||||
|
||||
user_id = decode_str(data, off)
|
||||
self.user_id = user_id[0]
|
||||
off += user_id[1]
|
||||
|
||||
self.episode_id = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.play_mode = decode_byte(data, off)
|
||||
off += BYTE_OFF
|
||||
|
||||
self.play_start_request_data_count = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.play_start_request_data: List[PlayStartRequestData] = []
|
||||
for _ in range(self.play_start_request_data_count):
|
||||
tmp = PlayStartRequestData(data, off)
|
||||
self.play_start_request_data.append(tmp)
|
||||
off += tmp.get_size()
|
||||
|
||||
class SaoEpisodePlayStartResponse(SaoBaseResponse):
|
||||
def __init__(self, cmd, profile_data) -> None:
|
||||
@ -1520,6 +1543,35 @@ class SaoEpisodePlayStartResponse(SaoBaseResponse):
|
||||
class SaoEpisodePlayEndRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
ticket_id = decode_str(data, off)
|
||||
self.ticket_id = ticket_id[0]
|
||||
off += ticket_id[1]
|
||||
|
||||
user_id = decode_str(data, off)
|
||||
self.user_id = user_id[0]
|
||||
off += user_id[1]
|
||||
|
||||
self.episode_id = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.play_end_request_data_count = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.play_end_request_data_list: List[PlayEndRequestData] = []
|
||||
for _ in range(self.play_end_request_data_count):
|
||||
tmp = PlayEndRequestData(data, off)
|
||||
off += tmp.get_size()
|
||||
self.play_end_request_data_list.append(tmp)
|
||||
|
||||
self.multi_play_end_request_data_count = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.multi_play_end_request_data_list: List[MultiPlayEndRequestData] = []
|
||||
for _ in range(self.multi_play_end_request_data_count):
|
||||
tmp = MultiPlayEndRequestData(data, off)
|
||||
off += tmp.get_size()
|
||||
self.multi_play_end_request_data_list.append(tmp)
|
||||
|
||||
class SaoEpisodePlayEndResponse(SaoBaseResponse):
|
||||
def __init__(self, cmd) -> None:
|
||||
@ -2033,15 +2085,15 @@ class SaoSynthesizeEnhancementHeroLogRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
ticket_id = decode_str(data, 0)
|
||||
ticket_id = decode_str(data, off)
|
||||
self.ticket_id = ticket_id[0]
|
||||
off += ticket_id[1]
|
||||
|
||||
user_id = decode_str(data, 0)
|
||||
user_id = decode_str(data, off)
|
||||
self.user_id = user_id[0]
|
||||
off += user_id[1]
|
||||
|
||||
origin_user_hero_log_id = decode_str(data, 0)
|
||||
origin_user_hero_log_id = decode_str(data, off)
|
||||
self.origin_user_hero_log_id = origin_user_hero_log_id[0]
|
||||
off += origin_user_hero_log_id[1]
|
||||
|
||||
@ -2210,15 +2262,15 @@ class SaoSynthesizeEnhancementEquipmentRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
ticket_id = decode_str(data, 0)
|
||||
ticket_id = decode_str(data, off)
|
||||
self.ticket_id = ticket_id[0]
|
||||
off += ticket_id[1]
|
||||
|
||||
user_id = decode_str(data, 0)
|
||||
user_id = decode_str(data, off)
|
||||
self.user_id = user_id[0]
|
||||
off += user_id[1]
|
||||
|
||||
origin_user_equipment_id = decode_str(data, 0)
|
||||
origin_user_equipment_id = decode_str(data, off)
|
||||
self.origin_user_equipment_id = origin_user_equipment_id[0]
|
||||
off += origin_user_equipment_id[1]
|
||||
|
||||
@ -2885,4 +2937,28 @@ class SaoConsumeCreditGuestRequest(SaoBaseRequest):
|
||||
|
||||
self.consume_num = decode_byte(data, off)
|
||||
off += BYTE_OFF
|
||||
|
||||
|
||||
class SaoChangePartyRequest(SaoBaseRequest):
|
||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||
super().__init__(header, data)
|
||||
off = 0
|
||||
ticket_id = decode_str(data, off)
|
||||
self.ticket_id = ticket_id[0]
|
||||
off += ticket_id[1]
|
||||
|
||||
user_id = decode_str(data, off)
|
||||
self.user_id = user_id[0]
|
||||
off += user_id[1]
|
||||
|
||||
self.act_type = decode_byte(data, off)
|
||||
off += BYTE_OFF
|
||||
|
||||
self.party_data_count = decode_int(data, off)
|
||||
off += INT_OFF
|
||||
|
||||
self.party_data_list: List[PartyData] = []
|
||||
|
||||
for _ in range(self.party_data_count):
|
||||
tmp = PartyData(data, off)
|
||||
self.party_data_list.append(tmp)
|
||||
off += tmp.get_size()
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Tuple
|
||||
from typing import Tuple, List
|
||||
import struct
|
||||
import logging
|
||||
|
||||
@ -66,10 +66,10 @@ def encode_str(s: str) -> bytes:
|
||||
|
||||
class BaseHelper:
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
pass
|
||||
self._sz = 0
|
||||
|
||||
def get_size(self) -> int:
|
||||
return 0
|
||||
return self._sz
|
||||
|
||||
class MaterialCommonRewardUserData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
@ -77,6 +77,305 @@ class MaterialCommonRewardUserData(BaseHelper):
|
||||
offset += SHORT_OFF
|
||||
|
||||
self.user_common_reward_id = decode_short(data, offset)
|
||||
|
||||
def get_size(self) -> int:
|
||||
return SHORT_OFF + SHORT_OFF
|
||||
|
||||
self._sz = SHORT_OFF + SHORT_OFF
|
||||
|
||||
class PartyTeamData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
sz = 0
|
||||
user_party_team_id = decode_str(data, offset + sz)
|
||||
self.user_party_team_id = user_party_team_id[0]
|
||||
sz += user_party_team_id[1]
|
||||
|
||||
self.arrangement_num = decode_byte(data, offset + sz)
|
||||
sz += BYTE_OFF
|
||||
|
||||
user_hero_log_id = decode_str(data, offset + sz)
|
||||
self.user_hero_log_id = user_hero_log_id[0]
|
||||
sz += user_hero_log_id[1]
|
||||
|
||||
main_weapon_user_equipment_id = decode_str(data, offset + sz)
|
||||
self.main_weapon_user_equipment_id = main_weapon_user_equipment_id[0]
|
||||
sz += main_weapon_user_equipment_id[1]
|
||||
|
||||
sub_equipment_user_equipment_id = decode_str(data, offset + sz)
|
||||
self.sub_equipment_user_equipment_id = sub_equipment_user_equipment_id[0]
|
||||
sz += sub_equipment_user_equipment_id[1]
|
||||
|
||||
self.skill_slot1_skill_id = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.skill_slot2_skill_id = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.skill_slot3_skill_id = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.skill_slot4_skill_id = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.skill_slot5_skill_id = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self._sz = sz
|
||||
|
||||
class PartyData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
sz = 0
|
||||
user_party_id = decode_str(data, offset + sz)
|
||||
self.user_party_id = user_party_id[0]
|
||||
sz += user_party_id[1]
|
||||
|
||||
self.team_no = decode_byte(data, offset + sz)
|
||||
sz += BYTE_OFF
|
||||
|
||||
self.party_team_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.party_team_data_list: List[PartyTeamData] = []
|
||||
for _ in range(self.party_team_data_count):
|
||||
tmp = PartyTeamData(data, offset + sz)
|
||||
self.party_team_data_list.append(tmp)
|
||||
sz += tmp.get_size()
|
||||
|
||||
self._sz = sz
|
||||
|
||||
class PlayStartRequestData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
sz = 0
|
||||
user_party_id = decode_str(data, offset + sz)
|
||||
self.user_party_id = user_party_id[0]
|
||||
sz += user_party_id[1]
|
||||
|
||||
appoint_leader_resource_card_code = decode_str(data, offset + sz)
|
||||
self.appoint_leader_resource_card_code = appoint_leader_resource_card_code[0]
|
||||
sz += appoint_leader_resource_card_code[1]
|
||||
|
||||
use_profile_card_code = decode_str(data, offset + sz)
|
||||
self.use_profile_card_code = use_profile_card_code[0]
|
||||
sz += use_profile_card_code[1]
|
||||
|
||||
self.quest_drop_boost_apply_flag = decode_byte(data, offset + sz)
|
||||
sz += BYTE_OFF
|
||||
|
||||
self._sz = sz
|
||||
|
||||
class GetPlayerTraceData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
user_quest_scene_player_trace_id = decode_str(data, offset)
|
||||
self.user_quest_scene_player_trace_id = user_quest_scene_player_trace_id[0]
|
||||
self._sz = user_quest_scene_player_trace_id[1]
|
||||
|
||||
class BaseGetData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.get_hero_log_exp = decode_int(data, offset)
|
||||
offset += INT_OFF
|
||||
|
||||
self.get_col = decode_int(data, offset)
|
||||
|
||||
self._sz = INT_OFF + INT_OFF
|
||||
|
||||
class RareDropData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.quest_rare_drop_id = decode_int(data, offset)
|
||||
|
||||
self._sz = INT_OFF
|
||||
|
||||
class UnanalyzedLogTmpRewardData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.unanalyzed_log_grade_id = decode_int(data, offset)
|
||||
|
||||
self._sz = INT_OFF
|
||||
|
||||
class SpecialRareDropData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.quest_special_rare_drop_id = decode_int(data, offset)
|
||||
|
||||
self._sz = INT_OFF
|
||||
|
||||
class EventItemData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.event_item_id = decode_int(data, offset)
|
||||
offset += INT_OFF
|
||||
self.get_num = decode_short(data, offset)
|
||||
|
||||
self._sz = INT_OFF + SHORT_OFF
|
||||
|
||||
class DiscoveryEnemyData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.enemy_kind_id = decode_int(data, offset)
|
||||
offset += INT_OFF
|
||||
self.destroy_num = decode_short(data, offset)
|
||||
|
||||
self._sz = INT_OFF + SHORT_OFF
|
||||
|
||||
class DestroyBossData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.boss_type = decode_byte(data, offset)
|
||||
offset += BYTE_OFF
|
||||
self.enemy_kind_id = decode_int(data, offset)
|
||||
offset += INT_OFF
|
||||
self.mission_difficulty_id = decode_short(data, offset)
|
||||
|
||||
self._sz = INT_OFF + SHORT_OFF + BYTE_OFF
|
||||
|
||||
class MissionData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
self.mission_id = decode_int(data, offset)
|
||||
offset += INT_OFF
|
||||
self.clear_flag = decode_byte(data, offset)
|
||||
offset += BYTE_OFF
|
||||
self.destroy_num = decode_short(data, offset)
|
||||
|
||||
self._sz = INT_OFF + SHORT_OFF + BYTE_OFF
|
||||
|
||||
class ScoreData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
super().__init__(data, offset)
|
||||
self.clear_time = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
|
||||
self.combo_num = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
|
||||
total_damage = decode_str(data, offset + self._sz)
|
||||
self.total_damage = total_damage[0]
|
||||
self._sz += total_damage[1]
|
||||
|
||||
self.concurrent_destroying_num = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
self.reaching_skill_level = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
self.ko_chara_num = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
|
||||
self.acceleration_invocation_num = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
self.boss_destroying_num = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
self.synchro_skill_used_flag = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
|
||||
self.used_friend_skill_id = decode_int(data, offset + self._sz)
|
||||
self._sz += INT_OFF
|
||||
|
||||
self.friend_skill_used_flag = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
|
||||
self.continue_cnt = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
self.total_loss_num = decode_short(data, offset + self._sz)
|
||||
self._sz += SHORT_OFF
|
||||
|
||||
class PlayEndRequestData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
sz = 0
|
||||
self.play_result_flag = decode_byte(data, offset + sz)
|
||||
sz += BYTE_OFF
|
||||
|
||||
self.base_get_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.base_get_data_list: List[BaseGetData] = []
|
||||
for _ in range(self.base_get_data_count):
|
||||
tmp = BaseGetData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.base_get_data_list.append(tmp)
|
||||
|
||||
self.get_player_trace_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.get_player_trace_data: List[GetPlayerTraceData] = []
|
||||
for _ in range(self.get_player_trace_data_count):
|
||||
tmp = GetPlayerTraceData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.get_player_trace_data.append(tmp)
|
||||
|
||||
self.get_rare_drop_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.get_rare_drop_data_list: List[RareDropData] = []
|
||||
for _ in range(self.get_rare_drop_data_count):
|
||||
tmp = RareDropData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.get_rare_drop_data_list.append(tmp)
|
||||
|
||||
self.get_special_rare_drop_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.get_special_rare_drop_data_list: List[SpecialRareDropData] = []
|
||||
for _ in range(self.get_special_rare_drop_data_count):
|
||||
tmp = SpecialRareDropData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.get_special_rare_drop_data_list.append(tmp)
|
||||
|
||||
self.get_unanalyzed_log_tmp_reward_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.get_unanalyzed_log_tmp_reward_data_list: List[UnanalyzedLogTmpRewardData] = []
|
||||
for _ in range(self.get_unanalyzed_log_tmp_reward_data_count):
|
||||
tmp = UnanalyzedLogTmpRewardData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.get_unanalyzed_log_tmp_reward_data_list.append(tmp)
|
||||
|
||||
self.get_event_item_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.get_event_item_data_list: List[EventItemData] = []
|
||||
for _ in range(self.get_event_item_data_count):
|
||||
tmp = EventItemData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.get_event_item_data_list.append(tmp)
|
||||
|
||||
self.discovery_enemy_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.discovery_enemy_data_list: List[DiscoveryEnemyData] = []
|
||||
for _ in range(self.discovery_enemy_data_count):
|
||||
tmp = DiscoveryEnemyData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.discovery_enemy_data_list.append(tmp)
|
||||
|
||||
self.destroy_boss_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.destroy_boss_data_list: List[DestroyBossData] = []
|
||||
for _ in range(self.destroy_boss_data_count):
|
||||
tmp = DestroyBossData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.destroy_boss_data_list.append(tmp)
|
||||
|
||||
self.mission_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.mission_data_list: List[MissionData] = []
|
||||
for _ in range(self.mission_data_count):
|
||||
tmp = MissionData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.mission_data_list.append(tmp)
|
||||
|
||||
self.score_data_count = decode_int(data, offset + sz)
|
||||
sz += INT_OFF
|
||||
|
||||
self.score_data_list: List[ScoreData] = []
|
||||
for _ in range(self.score_data_count):
|
||||
tmp = ScoreData(data, sz)
|
||||
sz += tmp.get_size()
|
||||
self.score_data_list.append(tmp)
|
||||
|
||||
self._sz = sz
|
||||
|
||||
class MultiPlayEndRequestData(BaseHelper):
|
||||
def __init__(self, data: bytes, offset: int) -> None:
|
||||
super().__init__(data, offset)
|
||||
self.dummy_1 = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
self.dummy_2 = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
self.dummy_3 = decode_byte(data, offset + self._sz)
|
||||
self._sz += BYTE_OFF
|
||||
|
Loading…
Reference in New Issue
Block a user