Exemple #1
0
def find_enemy_actionset_data(output_name, check_condition, res_where=None):
    index = DBViewIndex()
    view = EnemyParam(index)
    all_data = {}
    all_res = view.get_all(where=res_where)
    for res in tqdm(all_res, desc="enemies"):
        res = view.process_result(res)
        sub_data = {}
        for as_key in EnemyParam.ACTION_SETS:
            if not (action_set := res.get(as_key)):
                continue
            if isinstance(action_set, int):
                if not (action_set := index["EnemyActionSet"].get(as_key)):
                    continue
            for key, value in action_set.items():
                if not isinstance(value, dict):
                    continue
                if not isinstance(
                    (action_group := value.get("_ActionGroupName")), dict):
                    continue
                is_data = False
                for hitattr in action_group.values():
                    if not isinstance(hitattr, dict) or not (
                            act_cond := hitattr.get("_ActionCondition")):
                        continue
                    if check_condition(act_cond):
                        is_data = True
Exemple #2
0
def export_skill_share_json():
    index = DBViewIndex()
    view = CharaData(index)
    all_res = view.get_all(exclude_falsy=False)
    skill_share_data = {}
    for res in all_res:
        res_data = {}
        if res['_HoldEditSkillCost'] != 10:
            res_data['limit'] = res['_HoldEditSkillCost']
        if res['_EditSkillRelationId'] > 1:
            modifiers = index['EditSkillCharaOffset'].get(
                res['_EditSkillRelationId'], by='_EditSkillRelationId')[0]
            if modifiers['_SpOffset'] > 1:
                res_data['mod_sp'] = modifiers['_SpOffset']
            if modifiers['_StrengthOffset'] != 0.699999988079071:
                res_data['mod_att'] = modifiers['_StrengthOffset']
            if modifiers['_BuffDebuffOffset'] != 1:
                res_data['mod_buff'] = modifiers['_BuffDebuffOffset']
        try:
            name = snakey(res['_Name']) if not res['_SecondName'] else snakey(
                res['_SecondName'])
        except:
            continue
        if res['_EditSkillId'] > 0 and res['_EditSkillCost'] > 0:
            skill = index['SkillData'].get(res['_EditSkillId'],
                                           exclude_falsy=False)
            if res['_EditSkillId'] == res['_Skill1']:
                res_data['s'] = 1
            elif res['_EditSkillId'] == res['_Skill2']:
                res_data['s'] = 2
            else:
                try:
                    res_data['s'] = SPECIAL_EDIT_SKILL[res['_EditSkillId']]
                except:
                    res_data['s'] = 99
            # res_data['name'] = snakey(skill['_Name'])
            res_data['cost'] = res['_EditSkillCost']
            res_data['type'] = skill['_SkillType']
            sp_s_list = [
                skill['_SpEdit'],
                skill['_SpLv2Edit'],
                skill['_SpLv3Edit'],
                skill['_SpLv4Edit'],
            ]
            res_data['sp'] = same(sp_s_list)
        else:
            continue

        skill_share_data[name] = res_data

    with open('../dl/conf/skillshare.json', 'w', newline='') as f:
        json.dump(skill_share_data, f, indent=2)
Exemple #3
0
    with open(os.path.join(out, outfile), "w") as f:
        json.dump(chara_lb, f)


if __name__ == "__main__":
    all_avail = {
        "Chara": set(),
        "Dragon": {"Gacha", "Essence"},
        "Amulet": set(),
        "Weapon": set()
    }
    outdir = os.path.join(
        pathlib.Path(__file__).parent.absolute(), "..", "..", "dl-collection")
    imgdir = os.path.join(outdir, "public")
    datadir = os.path.join(outdir, "src", "data")
    index = DBViewIndex()

    check_target_path(outdir)

    playable = "_ElementalType != 99 AND _IsPlayable = 1"
    make_json(
        datadir,
        "chara.json",
        CharaData(index),
        make_bv_id,
        make_chara_json,
        chara_availability_data,
        where=playable,
    )
    make_json(
        datadir,
Exemple #4
0
import os
from loader.Database import DBManager, DBViewIndex, check_target_path
from exporter.Mappings import ELEMENTS, WEAPON_TYPES
from exporter.AdvConf import fmt_conf
from exporter.Shared import FortPlantData

# hax
FortPlantData(DBViewIndex())

COUNT_WEAPON_BONUS = "SELECT _WeaponType, SUM(_WeaponPassiveEffAtk) AS _Bonus FROM WeaponBody GROUP BY _WeaponType"

COUNT_ADV_BY_MAX_LIMIT_BREAK = "SELECT _ElementalType, COUNT(_Id) as _Count FROM CharaData WHERE _MaxLimitBreakCount=? AND _IsPlayable GROUP BY _ElementalType"
COUNT_DRG_BY_MAX_LIMIT_BREAK = "SELECT _ElementalType, COUNT(_Id) as _Count FROM DragonData WHERE _MaxLimitBreakCount=? AND _IsPlayable GROUP BY _ElementalType"

COUNT_HALIDOM = """SELECT View_FortPlantData._Name,
FortPlantDetail._AssetGroup, FortPlantDetail._EffectId, FortPlantDetail._EffType1, FortPlantDetail._EffType2,
MAX(FortPlantDetail._EffArgs1) AS _EffArgs1, MAX(FortPlantDetail._EffArgs2) AS _EffArgs2, MAX(FortPlantDetail._EffArgs3) AS _EffArgs3
FROM FortPlantDetail
INNER JOIN View_FortPlantData ON View_FortPlantData._Id=FortPlantDetail._AssetGroup
WHERE _EffectId=1 OR _EffectId=2 OR _EffectId=6
GROUP BY (_AssetGroup)"""

ALBUM_BONUS_ADV = {4: 0.2, 5: 0.3}
ALBUM_BONUS_DRG = {4: {"hp": 0.2, "atk": 0.2}, 5: {"hp": 0.3, "atk": 0.2}}

# SELECT View_FortPlantData._Name, FortPlantDetail._EffectId, FortPlantDetail._EffType1, FortPlantDetail._EffType2, FortPlantDetail._EffArgs1, FortPlantDetail._EffArgs2, FortPlantDetail._EffArgs3
# FROM View_FortPlantData
# INNER JOIN FortPlantDetail ON View_FortPlantData._DetailId=FortPlantDetail._Id


def count_fort_passives(include_album=True):
Exemple #5
0
def make_amulet_buildup_group(out, index):
    

def make_weapon_jsons(out, index):
    view = WeaponBodyBuildupGroup(index)
    all_res = view.get_all(exclude_falsy=True)
    processed = defaultdict(lambda: defaultdict(lambda: []))
    for res in all_res:
        mats = {}
        for i in range(1, 11):
            k1 = f'_BuildupMaterialId{i}'
            k2 = f'_BuildupMaterialQuantity{i}'
            try:
                mats[res[k1]] = res[k2]
                material_icons.add(res[k1])
            except KeyError:
                continue
        processed[res['_WeaponBodyBuildupGroupId']][res['_BuildupPieceType']].append({
            'Step': res['_Step'],
            'UnbindReq': res.get('_UnlockConditionLimitBreakCount', 0),
            'SkinId': res.get('_RewardWeaponSkinNo', 0),
            'Cost': res['_BuildupCoin'],
            'Mats': mats
        })
    processed = dict(processed)
    outfile = 'weaponbuild.json'
    check_target_path(out)
    with open(os.path.join(out, outfile), 'w') as f:
        json.dump(processed, f)

    view = WeaponBody(index)
    all_res = view.get_all(exclude_falsy=True)
    processed = {}
    for res in all_res:
        if not res.get('_Name') or (not res.get('_WeaponBodyBuildupGroupId') and not res.get('_WeaponPassiveAbilityGroupId')):
            continue

        skins = {}
        for i, sid in enumerate(WeaponBody.WEAPON_SKINS):
            try:
                skin = index['WeaponSkin'].get(res[sid], exclude_falsy=True)
                skins[i] = make_wpn_id(skin)
            except (KeyError, TypeError):
                continue
        prereqcreate = [res.get(need) for need in ('_NeedCreateWeaponBodyId1', '_NeedCreateWeaponBodyId2') if res.get(need)]
        prereqfull = res.get('_NeedAllUnlockWeaponBodyId1')
        mats = {}
        for i in range(1, 6):
            k1 = f'_CreateEntityId{i}'
            k2 = f'_CreateEntityQuantity{i}'
            try:
                mats[res[k1]] = res[k2]
                material_icons.add(res[k1])
            except KeyError:
                continue
        passive = None
        if res.get('_WeaponPassiveAbilityGroupId'):
            passive_ab_group = index['WeaponPassiveAbility'].get(res['_WeaponPassiveAbilityGroupId'], by='_WeaponPassiveAbilityGroupId', exclude_falsy=True)
            passive = {}
            for p in passive_ab_group:
                ab = index['AbilityData'].get(p['_AbilityId'], full_query=False)
                ability_icons.add(ab['_AbilityIconName'].lower())
                ab_skins = {}
                for i in (1, 2):
                    sid = f'_RewardWeaponSkinId{i}'
                    try:
                        skin = index['WeaponSkin'].get(p[sid], exclude_falsy=True)
                        ab_skins[i] = make_wpn_id(skin)
                    except (KeyError, TypeError):
                        continue
                ab_mats = {}
                for i in range(1, 6):
                    k1 = f'_UnlockMaterialId{i}'
                    k2 = f'_UnlockMaterialQuantity{i}'
                    try:
                        ab_mats[p[k1]] = p[k2]
                        material_icons.add(p[k1])
                    except KeyError:
                        continue
                ability_val0 = int(ab.get('_AbilityType1UpValue', 0))
                ability_info = {
                    'Icon': ab['_AbilityIconName'],
                    'NameEN': ab['_Name'].format(ability_val0=ability_val0).strip(),
                    'NameJP': ab['_NameJP'].format(ability_val0=ability_val0).strip(),
                    'NameCN': ab['_NameCN'].format(ability_val0=ability_val0).strip(),
                }
                    
                passive[p['_WeaponPassiveAbilityNo']] = {
                    'UnbindReq': p.get('_UnlockConditionLimitBreakCount', 0),
                    'Ability': ability_info,
                    'Cost': p.get('_UnlockCoin', 0),
                    'Mats': ab_mats,
                    'Skins': ab_skins
                }

        processed[res['_Id']] = {
            'NameEN': res['_Name'],
            'NameJP': res['_NameJP'],
            'NameCN': res['_NameCN'],
            'Series': res['_WeaponSeriesId'],
            'Build': res.get('_WeaponBodyBuildupGroupId'),
            'Passive': passive,
            'Element': res['_ElementalType'],
            'Weapon': res['_WeaponType'],
            'Rarity': res['_Rarity'],
            'Prereq': {
                'Create': prereqcreate,
                'FullUp': prereqfull
            },
            'Cost': res.get('_CreateCoin', 0),
            'Mats': mats,
            'Skins': skins,
            # 'Bonus': any([res.get('_WeaponPassiveEffHp'), res.get('_WeaponPassiveEffAtk')]),
        }
    outfile = 'weapon.json'
    check_target_path(out)
    with open(os.path.join(out, outfile), 'w') as f:
        json.dump(processed, f)


if __name__ == '__main__':
    all_avail = {
        'Chara': set(),
        'Dragon': {'Gacha'},
        'Amulet': set(),
        'Weapon': set()
    }
    outdir = os.path.join(pathlib.Path(__file__).parent.absolute(), '..', '..', 'dl-collection')
    imgdir = os.path.join(outdir, 'public')
    # download_all_icons(imgdir)
    datadir = os.path.join(outdir, 'src', 'data')
    index = DBViewIndex()
    make_json(datadir, 'chara.json', CharaData(index), make_bv_id, make_chara_json, chara_availability_data, where='_ElementalType != 99')
    make_json(datadir, 'dragon.json', DragonData(index), make_bv_id, make_dragon_json, dragon_availability_data)
    make_json(datadir, 'amulet.json', AbilityCrest(index), make_base_id, make_amulet_json, amulet_availability_data)
    with open(os.path.join(datadir, 'availabilities.json'), 'w') as f:
        json.dump({k: sorted(list(v)) for k, v in all_avail.items()}, f)
    make_json(datadir, 'material.json', MaterialData(index), make_id, make_material_json)
    make_json(datadir, 'weaponseries.json', WeaponBodyGroupSeries(index), make_id, make_weapon_series_json, name_key='_GroupSeriesName')
    make_weapon_jsons(datadir, index)
Exemple #6
0
import os
import itertools
from glob import glob
from tqdm import tqdm
import shutil

from loader.Database import DBManager, DBTableMetadata, DBViewIndex
from exporter.Shared import AbnormalStatusType
from exporter.FortPassives import count_fort_passives

AbnormalStatusType(DBViewIndex())  # just to create the view bolb

SIM_TABLE_LIST = (
    "AbilityCrest",
    "AbilityData",
    "ExAbilityData",
    "ActionCondition",
    "ActionGrant",
    "AuraData",
    "CharaData",
    "CharaModeData",
    "CharaUniqueCombo",
    "DragonData",
    "SkillData",
    "WeaponBody",
    "WeaponType",
    "PlayerAction",
    "PlayerActionHitAttribute",
    "UnionAbility",
    "EnemyParam",
    "MotionData",