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,25 +303,29 @@ class SaoBase:
req_data = SaoSynthesizeEnhancementEquipmentRequest(header, request) 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) 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): for x in req_data.material_common_reward_user_data_list:
equipment_exp = 0
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(x.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(x.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) equipmentList = self.game_data.static.get_equipment_id(x.user_common_reward_id)
if itemList: if itemList:
equipment_exp = 2000 + int(synthesize_equipment_data["enhancement_exp"]) 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: 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"]) 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: 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"]) 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) 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)

View File

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