def find_waldo(db_file): tbl = "Parts_HIT_ATTRIBUTE" db = DBManager(db_file) meta = db.check_table(tbl) results = db.query_many( f"SELECT * FROM {tbl} WHERE act=202800 OR act=202801 OR act=202802 OR act=202803", tuple(), dict) common = {} for res in results: for k, v in res.items(): if k == "pk" or k in meta.foreign_keys: continue if k not in common: common[k] = {v} else: common[k].add(v) results = db.query_many( f"SELECT * FROM {tbl} WHERE act!=202800 AND act!=202801 AND act!=202802 AND act!=202803", tuple(), dict) for res in results: for k, v in res.items(): if k == "pk" or k in meta.foreign_keys: continue if k in common and v in common[k]: common[k].remove(v) if not common[k]: del common[k] pprint(common)
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