forked from Dniel97/artemis
sao: fix synthesize_enhancement_equipment
This commit is contained in:
parent
c370542761
commit
9fdd96b717
@ -305,31 +305,10 @@ class SaoBase:
|
|||||||
|
|
||||||
def handle_c816(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
def handle_c816(self, header: SaoRequestHeader, request: bytes) -> bytes:
|
||||||
#custom/synthesize_enhancement_equipment
|
#custom/synthesize_enhancement_equipment
|
||||||
req = bytes.fromhex(request)[24:]
|
req_data = SaoSynthesizeEnhancementEquipmentRequest(header, request)
|
||||||
|
|
||||||
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
|
|
||||||
"origin_user_equipment_id_size" / Rebuild(Int32ub, len_(this.origin_user_equipment_id) * 2), # calculates the length of the origin_user_equipment_id
|
|
||||||
"origin_user_equipment_id" / PaddedString(this.origin_user_equipment_id_size, "utf_16_le"), # origin_user_equipment_id is a (zero) padded string
|
|
||||||
Padding(3),
|
|
||||||
"material_common_reward_user_data_list_length" / Rebuild(Int8ub, len_(this.material_common_reward_user_data_list)), # material_common_reward_user_data_list is a byte,
|
|
||||||
"material_common_reward_user_data_list" / Array(this.material_common_reward_user_data_list_length, Struct(
|
|
||||||
"common_reward_type" / Int16ub, # team_no is a byte
|
|
||||||
"user_common_reward_id_size" / Rebuild(Int32ub, len_(this.user_common_reward_id) * 2), # calculates the length of the user_common_reward_id
|
|
||||||
"user_common_reward_id" / PaddedString(this.user_common_reward_id_size, "utf_16_le"), # user_common_reward_id is a (zero) padded string
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
|
|
||||||
req_data = req_struct.parse(req)
|
|
||||||
|
|
||||||
user_id = req_data.user_id
|
|
||||||
synthesize_equipment_data = self.game_data.item.get_user_equipment(req_data.user_id, req_data.origin_user_equipment_id)
|
synthesize_equipment_data = self.game_data.item.get_user_equipment(req_data.user_id, req_data.origin_user_equipment_id)
|
||||||
|
|
||||||
for i in range(0,req_data.material_common_reward_user_data_list_length):
|
for i in range(0,req_data.material_common_reward_user_data_count):
|
||||||
|
|
||||||
itemList = self.game_data.static.get_item_id(req_data.material_common_reward_user_data_list[i].user_common_reward_id)
|
itemList = self.game_data.static.get_item_id(req_data.material_common_reward_user_data_list[i].user_common_reward_id)
|
||||||
heroList = self.game_data.static.get_hero_id(req_data.material_common_reward_user_data_list[i].user_common_reward_id)
|
heroList = self.game_data.static.get_hero_id(req_data.material_common_reward_user_data_list[i].user_common_reward_id)
|
||||||
|
@ -2055,7 +2055,6 @@ class SaoSynthesizeEnhancementHeroLogRequest(SaoBaseRequest):
|
|||||||
off += mat.get_size()
|
off += mat.get_size()
|
||||||
self.material_common_reward_user_data_list.append(mat)
|
self.material_common_reward_user_data_list.append(mat)
|
||||||
|
|
||||||
|
|
||||||
class SaoSynthesizeEnhancementHeroLogResponse(SaoBaseResponse):
|
class SaoSynthesizeEnhancementHeroLogResponse(SaoBaseResponse):
|
||||||
def __init__(self, cmd, hero_data) -> None:
|
def __init__(self, cmd, hero_data) -> None:
|
||||||
super().__init__(cmd)
|
super().__init__(cmd)
|
||||||
@ -2207,9 +2206,31 @@ class SaoSynthesizeEnhancementHeroLogResponse(SaoBaseResponse):
|
|||||||
self.length = len(resp_data)
|
self.length = len(resp_data)
|
||||||
return super().make() + resp_data
|
return super().make() + resp_data
|
||||||
|
|
||||||
class SaoSynthesizeEnhancementEquipment(SaoBaseRequest):
|
class SaoSynthesizeEnhancementEquipmentRequest(SaoBaseRequest):
|
||||||
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
def __init__(self, header: SaoRequestHeader, data: bytes) -> None:
|
||||||
super().__init__(header, data)
|
super().__init__(header, data)
|
||||||
|
off = 0
|
||||||
|
ticket_id = decode_str(data, 0)
|
||||||
|
self.ticket_id = ticket_id[0]
|
||||||
|
off += ticket_id[1]
|
||||||
|
|
||||||
|
user_id = decode_str(data, 0)
|
||||||
|
self.user_id = user_id[0]
|
||||||
|
off += user_id[1]
|
||||||
|
|
||||||
|
origin_user_equipment_id = decode_str(data, 0)
|
||||||
|
self.origin_user_equipment_id = origin_user_equipment_id[0]
|
||||||
|
off += origin_user_equipment_id[1]
|
||||||
|
|
||||||
|
self.material_common_reward_user_data_list: List[MaterialCommonRewardUserData]
|
||||||
|
|
||||||
|
self.material_common_reward_user_data_count = decode_int(data, off)
|
||||||
|
off += INT_OFF
|
||||||
|
|
||||||
|
for _ in range(self.material_common_reward_user_data_count):
|
||||||
|
mat = MaterialCommonRewardUserData(data, off)
|
||||||
|
off += mat.get_size()
|
||||||
|
self.material_common_reward_user_data_list.append(mat)
|
||||||
|
|
||||||
class SaoSynthesizeEnhancementEquipmentResponse(SaoBaseResponse):
|
class SaoSynthesizeEnhancementEquipmentResponse(SaoBaseResponse):
|
||||||
def __init__(self, cmd, synthesize_equipment_data) -> None:
|
def __init__(self, cmd, synthesize_equipment_data) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user