예제 #1
0
    def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache):
        root = {}
        for mod in relational_reader['Mods.dat']:
            domain = MOD_DOMAIN_FIX.get(mod['Id'], mod['Domain'])
            if ignore_mod_domain(domain):
                continue
            obj = {
                'required_level': mod['Level'],
                'stats': _convert_stats(mod['Stats']),
                'domain': domain.name.lower(),
                'name': mod['Name'],
                'type': mod['ModTypeKey']['Name'],
                'generation_type': mod['GenerationType'].name.lower(),
                'group': mod['CorrectGroup'],
                'spawn_weights': _convert_spawn_weights(mod['SpawnWeight']),
                'generation_weights': _convert_generation_weights(mod['GenerationWeight']),
                'grants_buff': _convert_buff(mod['BuffDefinitionsKey'], mod['BuffValue']),
                'grants_effects': _convert_granted_effects(mod['GrantedEffectsPerLevelKeys']),
                'is_essence_only': mod['IsEssenceOnlyModifier'] > 0,
                'adds_tags': _convert_tags_keys(mod['TagsKeys'])
            }
            if mod['Id'] in root:
                print("Duplicate mod id:", mod['Id'])
            else:
                root[mod['Id']] = obj

        write_json(root, data_path, 'mods')
예제 #2
0
    def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache):
        root = {}
        for mod in relational_reader["Mods.dat"]:
            domain = MOD_DOMAIN_FIX.get(mod["Id"], mod["Domain"])
            if ignore_mod_domain(domain):
                continue
            obj = {
                "required_level": mod["Level"],
                "stats": _convert_stats(mod["Stats"]),
                "domain": domain.name.lower(),
                "name": mod["Name"],
                "type": mod["ModTypeKey"]["Name"],
                "generation_type": mod["GenerationType"].name.lower(),
                "group": mod["CorrectGroup"],
                "spawn_weights": _convert_spawn_weights(mod["SpawnWeight"]),
                "generation_weights": _convert_generation_weights(mod["GenerationWeight"]),
                "grants_buff": _convert_buff(mod["BuffDefinitionsKey"], mod["BuffValue"]),
                "grants_effects": _convert_granted_effects(mod["GrantedEffectsPerLevelKeys"]),
                "is_essence_only": mod["IsEssenceOnlyModifier"] > 0,
                "adds_tags": _convert_tags_keys(mod["TagsKeys"]),
            }
            if mod["Id"] in root:
                print("Duplicate mod id:", mod["Id"])
            else:
                root[mod["Id"]] = obj

        write_json(root, data_path, "mods")
예제 #3
0
    def write(ggpk, data_path, relational_reader, translation_file_cache,
              **kwargs):
        gems = {}
        tooltips = {}
        converter = GemConverter(ggpk, relational_reader,
                                 translation_file_cache)

        # Skills from gems
        for gem in relational_reader['SkillGems.dat']:
            granted_effect = gem['GrantedEffectsKey']
            ge_id = granted_effect['Id']
            if ge_id in gems:
                print("Duplicate GrantedEffectsKey.Id '%s'" % ge_id)
            multipliers = {
                'str': gem['Str'],
                'dex': gem['Dex'],
                'int': gem['Int']
            }
            gems[ge_id], tooltips[ge_id] = converter.convert(
                gem['BaseItemTypesKey'], granted_effect,
                gem['GrantedEffectsKey2'], gem['GemTagsKeys'], multipliers)

        # Secondary skills from gems. This adds the support skill implicitly provided by Bane
        for gem in relational_reader['SkillGems.dat']:
            granted_effect = gem['GrantedEffectsKey2']
            if not granted_effect:
                continue
            ge_id = granted_effect['Id']
            if ge_id in gems:
                continue
            gems[ge_id], tooltips[ge_id] = converter.convert(
                None, granted_effect, None, None, None)

        # Skills from mods
        for mod in relational_reader['Mods.dat']:
            if mod['GrantedEffectsPerLevelKeys'] is None:
                continue
            if ignore_mod_domain(mod['Domain']):
                continue
            for granted_effect_per_level in mod['GrantedEffectsPerLevelKeys']:
                granted_effect = granted_effect_per_level['GrantedEffectsKey']
                ge_id = granted_effect['Id']
                if ge_id in gems:
                    # mod effects may exist as gems, those are handled above
                    continue
                gems[ge_id], tooltips[ge_id] = converter.convert(
                    None, granted_effect, None, None, None)

        # Default Attack/PlayerMelee is neither gem nor mod effect
        for granted_effect in relational_reader['GrantedEffects.dat']:
            ge_id = granted_effect['Id']
            if ge_id != 'PlayerMelee':
                continue
            gems[ge_id], tooltips[ge_id] = converter.convert(
                None, granted_effect, None, None, None)

        write_json(gems, data_path, 'gems')
        write_json(tooltips, data_path, 'gem_tooltips')
예제 #4
0
    def write(file_system, data_path, relational_reader,
              translation_file_cache, **kwargs):
        gems = {}
        converter = GemConverter(file_system, relational_reader)

        # Skills from gems
        for gem in relational_reader["SkillGems.dat"]:
            granted_effect = gem["GrantedEffectsKey"]
            ge_id = granted_effect["Id"]
            if ge_id in gems:
                print("Duplicate GrantedEffectsKey.Id '%s'" % ge_id)
            multipliers = {
                "str": gem["Str"],
                "dex": gem["Dex"],
                "int": gem["Int"]
            }
            gems[ge_id] = converter.convert(gem["BaseItemTypesKey"],
                                            granted_effect,
                                            gem["GrantedEffectsKey2"],
                                            gem["GemTagsKeys"], multipliers)

        # Secondary skills from gems. This adds the support skill implicitly provided by Bane
        for gem in relational_reader["SkillGems.dat"]:
            granted_effect = gem["GrantedEffectsKey2"]
            if not granted_effect:
                continue
            ge_id = granted_effect["Id"]
            if ge_id in gems:
                continue
            gems[ge_id] = converter.convert(None, granted_effect, None, None,
                                            None)

        # Skills from mods
        for mod in relational_reader["Mods.dat"]:
            if mod["GrantedEffectsPerLevelKeys"] is None:
                continue
            if ignore_mod_domain(mod["Domain"]):
                continue
            for granted_effect_per_level in mod["GrantedEffectsPerLevelKeys"]:
                granted_effect = granted_effect_per_level["GrantedEffectsKey"]
                ge_id = granted_effect["Id"]
                if ge_id in gems:
                    # mod effects may exist as gems, those are handled above
                    continue
                gems[ge_id] = converter.convert(None, granted_effect, None,
                                                None, None)

        # Default Attack/PlayerMelee is neither gem nor mod effect
        for granted_effect in relational_reader["GrantedEffects.dat"]:
            ge_id = granted_effect["Id"]
            if ge_id != "PlayerMelee":
                continue
            gems[ge_id] = converter.convert(None, granted_effect, None, None,
                                            None)

        write_json(gems, data_path, "gems")