def process_result(self, res, exclude_falsy=True, full_query=True): if not full_query: return res if res.get('_WeaponSeriesId'): res['_WeaponSeriesId'] = self.index['WeaponBodyGroupSeries'].get( res['_WeaponSeriesId'], exclude_falsy=exclude_falsy) if res.get('_WeaponType'): res['_WeaponType'] = WEAPON_TYPES.get(res['_WeaponType'], res['_WeaponType']) if res.get('_ElementalType'): res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) skill_ids = {0} for i in (3, 2, 1): key = f'_ChangeSkillId{i}' if key in res and res[key] not in skill_ids: skill_ids.add(res[key]) res[key] = self.index['SkillData'].get( res[key], exclude_falsy=exclude_falsy, full_abilities=True) ab_ids = {0} for i in (1, 2): for j in range(3, 2, 1): key = f'_Abilities{i}{j}' if key in res and res[key] not in ab_ids: ab_ids.add(res[key]) res[key] = self.index['AbilityData'].get( res[key], full_query=True, exclude_falsy=exclude_falsy) for skin in WeaponBody.WEAPON_SKINS: if res.get(skin): res[skin] = self.index['WeaponSkin'].get( res[skin], exclude_falsy=exclude_falsy) return res
def process_result(self, res, exclude_falsy=True, condense=True): self.index['ActionParts'].animation_reference = ('CharacterMotion', int(f'{res["_BaseId"]:06}{res["_VariationId"]:02}')) if '_WeaponType' in res: res['_WeaponType'] = WEAPON_TYPES.get(res['_WeaponType'], res['_WeaponType']) if '_ElementalType' in res: res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) if '_CharaType' in res: res['_CharaType'] = CLASS_TYPES.get(res['_CharaType'], res['_CharaType']) if condense: res = self.condense_stats(res) if '_ModeChangeType' in res and res['_ModeChangeType']: res['_ModeChangeType'] = MODE_CHANGE_TYPES.get(res['_ModeChangeType'], res['_ModeChangeType']) for m in ('_ModeId1', '_ModeId2', '_ModeId3'): if m in res: res[m] = self.index['CharaModeData'].get(res[m], exclude_falsy=exclude_falsy, full_query=True) for s in ('_Skill1', '_Skill2'): if s in res and res[s]: res[s] = self.index['SkillData'].get(res[s], exclude_falsy=exclude_falsy, full_query=True) if condense: res = self.last_abilities(res) else: res = self.all_abilities(res) if '_BurstAttack' in res and res['_BurstAttack'] and (ba := self.index['PlayerAction'].get(res['_BurstAttack'], exclude_falsy=exclude_falsy)): res['_BurstAttack'] = ba
class EnemyData(DBView): def __init__(self, index): super().__init__(index, 'EnemyData') def process_result(self, res, exclude_falsy=False): if '_BookId' in res and res['_BookId']: if (data := self.index['EnemyList'].get(res['_BookId'], exclude_falsy=exclude_falsy)): res['_BookId'] = data if '_ElementalType' in res and res['_ElementalType']: res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) return res
def process_result(self, res, condense=True): self.set_animation_reference(res) if "_WeaponType" in res: res["_WeaponType"] = WEAPON_TYPES.get(res["_WeaponType"], res["_WeaponType"]) if "_ElementalType" in res: res["_ElementalType"] = ELEMENTS.get(res["_ElementalType"], res["_ElementalType"]) if "_CharaType" in res: res["_CharaType"] = CLASS_TYPES.get(res["_CharaType"], res["_CharaType"]) if condense: res = self.condense_stats(res) if "_ModeChangeType" in res and res["_ModeChangeType"]: res["_ModeChangeType"] = MODE_CHANGE_TYPES.get(res["_ModeChangeType"], res["_ModeChangeType"]) for m in ("_ModeId1", "_ModeId2", "_ModeId3", "_ModeId4"): if m in res and (mode := self.index["CharaModeData"].get(res[m], full_query=True)): res[m] = mode
class DrgConf(DragonData): EXTRA_DRAGONS = ( 20050102, 20050202, 20050302, 20050402, 20050502, 20050507, ) def process_result(self, res, exclude_falsy=True): super().process_result(res, exclude_falsy) ab_lst = [] for i in (1, 2): if (ab := res.get(f'_Abilities{i}5')): ab_lst.append(ab) converted, skipped = convert_all_ability(ab_lst) conf = { 'd': { 'name': res.get('_SecondName', res['_Name']), 'icon': f'{res["_BaseId"]}_{res["_VariationId"]:02}', 'att': res['_MaxAtk'], 'hp': res['_MaxHp'], 'ele': ELEMENTS.get(res['_ElementalType']).lower(), 'a': converted } } if skipped: conf['d']['skipped'] = skipped # for act, key in [('dodge', '_AvoidActionFront'), ('dshift', '_Transform')]: # s, r = hit_sr(res[key]['_Parts']) # actconf = { # 'startup': fr(s), # 'recovery': fr(r) # } # actconf = hit_attr_adj(res[key], s, actconf, skip_nohitattr=False) # conf[act] = actconf dcombo = res['_DefaultSkill'] dcmax = res['_ComboMax'] for n, xn in enumerate(dcombo): n += 1 if dxconf := convert_x(xn['_Id'], xn, xlen=dcmax): conf[f'dx{n}'] = dxconf
def process_result(self, res, exclude_falsy=True, full_query=True): if not full_query: return res if '_Type' in res: res['_Type'] = WEAPON_TYPES.get(res['_Type'], res['_Type']) if '_ElementalType' in res: res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) if '_Skill' in res: res['_Skill'] = self.index['SkillData'].get( res['_Skill'], exclude_falsy=exclude_falsy, full_abilities=True) for k in ('_Abilities11', '_Abilities21'): if k in res and res[k]: res[k] = self.index['AbilityData'].get( res[k], full_query=True, exclude_falsy=exclude_falsy) return res
def process_result(self, res, full_actions=False): # if "_DataId" in res and res["_DataId"]: # if data := self.index["EnemyData"].get(res["_DataId"]): # res["_DataId"] = data if "_TribeType" in res and res["_TribeType"]: res["_TribeType"] = TRIBE_TYPES.get(res["_TribeType"], res["_TribeType"]) if "_ElementalType" in res and res["_ElementalType"]: res["_ElementalType"] = ELEMENTS.get(res["_ElementalType"], res["_ElementalType"]) if full_actions or EnemyParam.general_param_group( res) in EnemyParam.DO_FULL_ACTIONS: seen_actsets = set() for actset_key in EnemyParam.ACTION_SETS: if not (actset_id := res.get(actset_key)) or actset_id in seen_actsets: continue seen_actsets.add(actset_id) self.link(res, actset_key, "EnemyActionSet")
def process_result(self, res): try: ac_enum = AbilityCondition(res["_ConditionType"]) if ac_enum in AbilityData.MAP_COND_VALUE: self.link( res, "_ConditionValue", "ActionCondition", ) if ac_enum in AbilityData.MAP_COND_VALUE2: self.link( res, "_ConditionValue2", "ActionCondition", ) res["_ConditionType"] = ac_enum except (KeyError, ValueError): pass try: res["_TargetAction"] = AbilityTargetAction(res["_TargetAction"]) except (KeyError, ValueError): pass self.link(res, "_RequiredBuff", "ActionCondition") for i in (1, 2, 3): try: res[f"_TargetAction{i}"] = AbilityTargetAction( res[f"_TargetAction{i}"]) except (KeyError, ValueError): pass try: res[f"_AbilityType{i}"] = AbilityType(res[f"_AbilityType{i}"]) except (KeyError, ValueError): pass try: res = ABILITY_TYPES[res[f"_AbilityType{i}"]](self, res, i) except (KeyError, IndexError): pass if ele := res.get("_ElementalType"): res["_ElementalType"] = ELEMENTS.get(ele, ele)
def process_result(self, res, full_query=True, exclude_falsy=True): try: res['_ConditionType'] = ABILITY_CONDITION_TYPES.get( res['_ConditionType'], res['_ConditionType']) except: pass try: res[f'_TargetAction'] = TARGET_ACTION_TYPES[res[f'_TargetAction']] except: pass for i in (1, 2, 3): try: res[f'_TargetAction{i}'] = TARGET_ACTION_TYPES[ res[f'_TargetAction{i}']] except: pass try: res = ABILITY_TYPES[res[f'_AbilityType{i}']](self, res, i) except KeyError: pass if (ele := res.get('_ElementalType')): res['_ElementalType'] = ELEMENTS.get(ele, ele)
def process_result(self, res, exclude_falsy=True, condense=True): self.index['ActionParts'].animation_reference = ( 'CharacterMotion', int(f'{res["_BaseId"]:06}{res["_VariationId"]:02}')) if '_WeaponType' in res: res['_WeaponType'] = WEAPON_TYPES.get(res['_WeaponType'], res['_WeaponType']) if '_ElementalType' in res: res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) if '_CharaType' in res: res['_CharaType'] = CLASS_TYPES.get(res['_CharaType'], res['_CharaType']) if condense: res = self.condense_stats(res) if '_ModeChangeType' in res and res['_ModeChangeType']: res['_ModeChangeType'] = MODE_CHANGE_TYPES.get( res['_ModeChangeType'], res['_ModeChangeType']) for m in ('_ModeId1', '_ModeId2', '_ModeId3', '_ModeId4'): if m in res and (mode := self.index['CharaModeData'].get( res[m], exclude_falsy=exclude_falsy, full_query=True)): res[m] = mode
def process_result(self, res, exclude_falsy=True, condense=True): if '_WeaponType' in res: res['_WeaponType'] = WEAPON_TYPES.get(res['_WeaponType'], res['_WeaponType']) if '_ElementalType' in res: res['_ElementalType'] = ELEMENTS.get(res['_ElementalType'], res['_ElementalType']) if '_CharaType' in res: res['_CharaType'] = CLASS_TYPES.get(res['_CharaType'], res['_CharaType']) if condense: res = self.condense_stats(res) if '_ModeChangeType' in res and res['_ModeChangeType']: res['_ModeChangeType'] = MODE_CHANGE_TYPES.get( res['_ModeChangeType'], res['_ModeChangeType']) for m in ('_ModeId1', '_ModeId2', '_ModeId3'): if m in res: res[m] = self.mode.get(res[m], exclude_falsy=exclude_falsy, full_query=True) for s in ('_Skill1', '_Skill2'): if s in res and res[s]: res[s] = self.skills.get(res[s], exclude_falsy=exclude_falsy, full_query=True, full_hitattr=not condense) if condense: res = self.last_abilities(res) else: res = self.all_abilities(res) chara_id = f'{res["_BaseId"]}{res["_VariationId"]:02}' res['_Animations'] = self.motions.get(chara_id, by='ref') return res
def process_result(self, res, full_query=True): if not full_query: return res self.set_animation_reference(res) self.link(res, "_WeaponSeriesId", "WeaponBodyGroupSeries") if res.get("_WeaponPassiveAbilityGroupId"): res["_WeaponPassiveAbilityGroupId"] = self.index[ "WeaponPassiveAbility"].get( res["_WeaponPassiveAbilityGroupId"], by="_WeaponPassiveAbilityGroupId") if res.get("_WeaponType"): res["_WeaponType"] = WEAPON_TYPES.get(res["_WeaponType"], res["_WeaponType"]) if res.get("_ElementalType"): res["_ElementalType"] = ELEMENTS.get(res["_ElementalType"], res["_ElementalType"]) skill_ids = {0} for i in (3, 2, 1): key = f"_ChangeSkillId{i}" if key in res and res[key] not in skill_ids: skill_ids.add(res[key]) res[key] = self.index["SkillData"].get(res[key], full_abilities=True) ab_ids = {0} for i in (1, 2, 3): for j in (3, 2, 1): key = f"_Abilities{i}{j}" if key in res and res[key] not in ab_ids: ab_ids.add(res[key]) res[key] = self.index["AbilityData"].get(res[key], full_query=True) for skin in WeaponBody.WEAPON_SKINS: if res.get(skin): res[skin] = self.index["WeaponSkin"].get(res[skin]) self.index["ActionParts"].animation_reference = None return res
def count_fort_passives(include_album=True): dbm = DBManager() adv_ele_passives = {(idx, ele): [0, 0] for idx, ele in ELEMENTS.items()} if include_album: for mlb, factor in ALBUM_BONUS_ADV.items(): for res in dbm.query_many(COUNT_ADV_BY_MAX_LIMIT_BREAK, (mlb, ), dict): try: eletype = res["_ElementalType"] elename = ELEMENTS[eletype] except KeyError: continue adv_ele_passives[(eletype, elename)][0] += round( res["_Count"] * factor, 1) adv_ele_passives[(eletype, elename)][1] += round( res["_Count"] * factor, 1) adv_wep_passives = {(idx, wep): [0, 0] for idx, wep in WEAPON_TYPES.items()} for res in dbm.query_many(COUNT_WEAPON_BONUS, tuple(), dict): try: weptype = res["_WeaponType"] wepname = WEAPON_TYPES[weptype] except KeyError: continue adv_wep_passives[(weptype, wepname)][0] += res["_Bonus"] adv_wep_passives[(weptype, wepname)][1] += res["_Bonus"] drg_passives = {(idx, ele): [0, 0] for idx, ele in ELEMENTS.items()} if include_album: for mlb, factor in ALBUM_BONUS_DRG.items(): for res in dbm.query_many(COUNT_DRG_BY_MAX_LIMIT_BREAK, (mlb, ), dict): try: eletype = res["_ElementalType"] elename = ELEMENTS[eletype] except KeyError: continue drg_passives[(eletype, elename)][0] += round( res["_Count"] * factor["hp"], 1) drg_passives[(eletype, elename)][1] += round( res["_Count"] * factor["atk"], 1) for res in dbm.query_many(COUNT_HALIDOM, (), dict): if res["_EffectId"] == 1: passive_dict = adv_wep_passives passive_types = WEAPON_TYPES elif res["_EffectId"] == 2: passive_dict = adv_ele_passives passive_types = ELEMENTS elif res["_EffectId"] == 6: passive_dict = drg_passives passive_types = ELEMENTS mult = 1 if "Altar" in res["_Name"] or "Dojo" in res["_Name"]: mult = 2 for eff in (res["_EffType1"], res["_EffType2"]): if not eff: continue passive_dict[(eff, passive_types[eff])][0] += res["_EffArgs1"] * mult passive_dict[(eff, passive_types[eff])][1] += res["_EffArgs2"] * mult return adv_ele_passives, adv_wep_passives, drg_passives
def elemental_ability(ad, res, i): key, value = AbilityData.first_a_id(res, i) res[key] = ELEMENTS.get(value, value) return res