1
0
forked from Hay1tsme/artemis

sao: fix synthesize_enhancement_equipment

This commit is contained in:
Hay1tsme 2023-11-12 19:45:39 -05:00
parent ab3b6a9814
commit 3596f0f34c
2 changed files with 20 additions and 15 deletions

View File

@ -303,26 +303,30 @@ class SaoBase:
req_data = SaoSynthesizeEnhancementEquipmentRequest(header, request)
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_count):
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)
equipmentList = self.game_data.static.get_equipment_id(req_data.material_common_reward_user_data_list[i].user_common_reward_id)
for x in req_data.material_common_reward_user_data_list:
equipment_exp = 0
itemList = self.game_data.static.get_item_id(x.user_common_reward_id)
heroList = self.game_data.static.get_hero_id(x.user_common_reward_id)
equipmentList = self.game_data.static.get_equipment_id(x.user_common_reward_id)
if itemList:
equipment_exp = 2000 + int(synthesize_equipment_data["enhancement_exp"])
self.game_data.item.remove_item(req_data.user_id, req_data.material_common_reward_user_data_list[i].user_common_reward_id)
self.game_data.item.remove_item(req_data.user_id, x.user_common_reward_id)
if equipmentList:
equipment_data = self.game_data.item.get_user_equipment(req_data.user_id, req_data.material_common_reward_user_data_list[i].user_common_reward_id)
equipment_data = self.game_data.item.get_user_equipment(req_data.user_id, x.user_common_reward_id)
equipment_exp = int(equipment_data["enhancement_exp"]) + int(synthesize_equipment_data["enhancement_exp"])
self.game_data.item.remove_equipment(req_data.user_id, req_data.material_common_reward_user_data_list[i].user_common_reward_id)
self.game_data.item.remove_equipment(req_data.user_id, x.user_common_reward_id)
if heroList:
hero_data = self.game_data.item.get_hero_log(req_data.user_id, req_data.material_common_reward_user_data_list[i].user_common_reward_id)
hero_data = self.game_data.item.get_hero_log(req_data.user_id, x.user_common_reward_id)
equipment_exp = int(hero_data["log_exp"]) + int(synthesize_equipment_data["enhancement_exp"])
self.game_data.item.remove_hero_log(req_data.user_id, req_data.material_common_reward_user_data_list[i].user_common_reward_id)
self.game_data.item.remove_hero_log(req_data.user_id, x.user_common_reward_id)
if equipment_exp == 0:
self.logger.warn(f"Common reward {x.user_common_reward_id} (type {x.common_reward_type}) not found!")
continue
self.game_data.item.put_equipment_data(req_data.user_id, int(req_data.origin_user_equipment_id), synthesize_equipment_data["enhancement_value"], equipment_exp, 0, 0, 0)
profile = self.game_data.profile.get_profile(req_data.user_id)

View File

@ -73,12 +73,13 @@ class BaseHelper:
class MaterialCommonRewardUserData(BaseHelper):
def __init__(self, data: bytes, offset: int) -> None:
self.common_reward_type = decode_short(data, offset)
offset += SHORT_OFF
super().__init__(data, offset)
self.common_reward_type = decode_short(data, offset + self._sz)
self._sz += SHORT_OFF
self.user_common_reward_id = decode_short(data, offset)
self._sz = SHORT_OFF + SHORT_OFF
user_common_reward_id = decode_str(data, offset + self._sz)
self.user_common_reward_id = user_common_reward_id[0]
self._sz += user_common_reward_id[1]
class PartyTeamData(BaseHelper):
def __init__(self, data: bytes, offset: int) -> None: