from RePoE.parser.util import call_with_default_args, write_json from RePoE.parser import Parser_Module class tags(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): tags = [row["Id"] for row in relational_reader["Tags.dat"]] write_json(tags, data_path, "tags") if __name__ == "__main__": call_with_default_args(tags.write)
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") if __name__ == "__main__": call_with_default_args(gems.write)
return r class stats(Parser_Module): @staticmethod def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache): root = {} previous = set() for stat in relational_reader['Stats.dat']: if stat['Id'] in previous: print("Duplicate stat id %s" % stat['Id']) continue root[stat['Id']] = { 'is_local': stat['IsLocal'], 'is_aliased': stat['IsWeaponLocal'], 'alias': _convert_alias_stats(stat['MainHandAlias_StatsKey'], stat['OffHandAlias_StatsKey']), # 'is_on_character_panel': stat['Flag6'], # not sure # 'is_on_tooltip': stat['Flag7'], # not sure } write_json(root, data_path, 'stats') if __name__ == '__main__': call_with_default_args(stats.write)
from RePoE.parser import Parser_Module from RePoE.parser.util import write_json, call_with_default_args class default_monster_stats(Parser_Module): @staticmethod def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache): root = {} for row in relational_reader['DefaultMonsterStats.dat']: root[row['DisplayLevel']] = { 'physical_damage': row['Damage'], 'evasion': row['Evasion'], 'accuracy': row['Accuracy'], 'life': row['Life'], 'ally_life': row['AllyLife'], 'armour': row['Armour'], } write_json(root, data_path, 'default_monster_stats') if __name__ == '__main__': call_with_default_args(default_monster_stats.write)
item["Height"], "drop_level": item["DropLevel"], "implicits": [mod["Id"] for mod in item["Implicit_ModsKeys"]], "tags": [tag["Id"] for tag in item["TagsKeys"]] + inherited_tags, "visual_identity": { "id": item["ItemVisualIdentityKey"]["Id"], "dds_file": item["ItemVisualIdentityKey"]["DDSFile"], }, "requirements": _convert_requirements(attribute_requirements[item_id], item["DropLevel"]), "properties": properties, "release_state": get_release_state(item_id).name, "domain": item["ModDomainsKey"].name.lower(), } _convert_flask_buff(flask_types[item_id], root[item_id]) print( f"Skipped the following item classes for base_items {skipped_item_classes}" ) write_json(root, data_path, "base_items") if __name__ == "__main__": call_with_default_args(base_items.write)
from RePoE.parser.util import write_json, call_with_default_args from RePoE.parser import Parser_Module class flavour(Parser_Module): @staticmethod def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache): root = {} for flavour in relational_reader["FlavourText.dat"]: if flavour["Id"] in root: print("Duplicate flavour id:", flavour["Id"]) else: root[flavour["Id"]] = flavour["Text"] write_json(root, data_path, "flavour") if __name__ == "__main__": call_with_default_args(flavour.write)
translation_file_cache, ot_file_cache): essences = { row["BaseItemTypesKey"]["Id"]: { "name": row["BaseItemTypesKey"]["Name"], "spawn_level_min": row["DropLevelMinimum"], "spawn_level_max": row["DropLevelMaximum"], "level": row["Level"], "item_level_restriction": row["ItemLevelRestriction"] if row["ItemLevelRestriction"] > 0 else None, "type": { "tier": row["EssenceTypeKey"]["EssenceType"], "is_corruption_only": row["EssenceTypeKey"]["IsCorruptedEssence"], }, "mods": _convert_mods(row), } for row in relational_reader["Essences.dat"] } write_json(essences, data_path, "essences") if __name__ == "__main__": call_with_default_args(essences.write)
if len(actions) == 0: raise NotImplementedError(f"Crafting option {row['Name']} has an unknown action") return actions @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): root = [] for row in relational_reader["CraftingBenchOptions.dat"]: if row["RequiredLevel"] > 100 or row["IsDisabled"]: continue item_class_row_lists = [ categories["ItemClassesKeys"] for categories in row["CraftingItemClassCategoriesKeys"] ] item_class_rows = itertools.chain.from_iterable(item_class_row_lists) item_classes = [item_class["Id"] for item_class in item_class_rows] root.append( { "master": row["HideoutNPCsKey"]["NPCMasterKey"]["Id"], "bench_group": row["ModFamily"], "bench_tier": row["Tier"], "item_classes": item_classes, "cost": {base_item["Id"]: value for base_item, value in row["Cost"]}, "actions": crafting_bench_options._get_actions(row, relational_reader), } ) write_json(root, data_path, "crafting_bench_options") if __name__ == "__main__": call_with_default_args(crafting_bench_options.write)
from RePoE.parser.util import call_with_default_args, write_json, get_id_or_none from RePoE.parser import Parser_Module class item_classes(Parser_Module): @staticmethod def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache): item_classes = { row["Id"]: { "name": row["Name"], "elder_tag": get_id_or_none(row["Elder_TagsKey"]), "shaper_tag": get_id_or_none(row["Shaper_TagsKey"]), "crusader_tag": get_id_or_none(row["Crusader_TagsKey"]), "redeemer_tag": get_id_or_none(row["Eyrie_TagsKey"]), "hunter_tag": get_id_or_none(row["Basilisk_TagsKey"]), "warlord_tag": get_id_or_none(row["Adjudicator_TagsKey"]), } for row in relational_reader["ItemClasses.dat"] } write_json(item_classes, data_path, "item_classes") if __name__ == "__main__": call_with_default_args(item_classes.write)
charClass = reward_row["CharactersKey"]["Name"] else: charClass = "All" # Add an entry for the quest into the root node if questId not in root: root[questId] = { "name": reward_row["QuestKey"]["Name"], "act": reward_row["QuestKey"]["Act"], "rewards": {} } ##### This is for root->quest->rewards->class # Add an entry for the reward into the quest node if rewardName not in root[questId]["rewards"]: root[questId]["rewards"][rewardId] = { "classes": [], "name": rewardName, "type": reward_row["BaseItemTypesKey"]["ItemClassesKey"]["Id"] } if charClass == "All": root[questId]["rewards"][rewardId]["classes"] = all_classes else: if charClass not in root[questId]["rewards"][rewardId]["classes"]: root[questId]["rewards"][rewardId]["classes"].append(charClass) write_json(root, data_path, 'quest_rewards') if __name__ == '__main__': call_with_default_args(quest_rewards.write)
root[npcId]["rewards"][rewardId] = { "name": key["Name"], "classes": [], "quest_id": "" } if charClass == "All": root[npcId]["rewards"][rewardId][ "classes"] = all_classes else: if charClass not in root[npcId]["rewards"][rewardId][ "classes"]: root[npcId]["rewards"][rewardId]["classes"].append( charClass) if ((npcName != "Lilly Roth") and (npcName != "Siosa")): if reward_row["QuestState"] in all_quest_states: root[npcId]["rewards"][rewardId][ "quest_id"] = all_quest_states[ reward_row["QuestState"]] else: # BLATANT KLUDGE: Quest state 244 = a2q6, but isn't in QuestStates.dat if reward_row["QuestState"] == 244: root[npcId]["rewards"][rewardId][ "quest_id"] = "a2q6" write_json(root, data_path, 'vendor_rewards') if __name__ == '__main__': call_with_default_args(vendor_rewards.write)
from RePoE.parser.util import write_json, call_with_default_args from RePoE.parser import Parser_Module class cost_types(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): root = {} for row in relational_reader["CostTypes.dat"]: root[row["Id"]] = { "stat": row["StatsKey"]["Id"] if row["StatsKey"] else None, "format_text": row["FormatText"], } write_json(root, data_path, "cost_types") if __name__ == "__main__": call_with_default_args(cost_types.write)
from RePoE.parser.util import call_with_default_args, write_json from RePoE.parser import Parser_Module class active_skill_types(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): types = [row["Id"] for row in relational_reader["ActiveSkillType.dat"]] write_json(types, data_path, "active_skill_types") if __name__ == "__main__": call_with_default_args(active_skill_types.write)
class characters(Parser_Module): @staticmethod def write(ggpk, data_path, relational_reader, translation_file_cache, ot_file_cache): root = [] for row in relational_reader['Characters.dat']: root.append({ 'metadata_id': row['Id'], 'integer_id': row['IntegerId'], 'name': row['Name'], 'base_stats': { 'life': row['BaseMaxLife'], 'mana': row['BaseMaxMana'], 'strength': row['BaseStrength'], 'dexterity': row['BaseDexterity'], 'intelligence': row['BaseIntelligence'], 'unarmed': { 'attack_time': row['WeaponSpeed'], 'min_physical_damage': row['MinDamage'], 'max_physical_damage': row['MaxDamage'], 'range': row['MaxAttackDistance'], }, }, }) write_json(root, data_path, 'characters') if __name__ == '__main__': call_with_default_args(characters.write)
from RePoE.parser.util import write_json, call_with_default_args from RePoE.parser import Parser_Module class mod_types(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): mod_types = { row["Name"]: { "sell_price_types": [key["Id"] for key in row["ModSellPriceTypesKeys"]], "tags": [key["Id"] for key in row["TagsKeys"]], } for row in relational_reader["ModType.dat"] } write_json(mod_types, data_path, "mod_types") if __name__ == "__main__": call_with_default_args(mod_types.write)
'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') # a few unique item mods have the wrong mod domain so they wouldn't be added to the file without this MOD_DOMAIN_FIX = { "AreaDamageUniqueBodyDexInt1": MOD_DOMAIN.ITEM, "ElementalResistancePerEnduranceChargeDescentShield1": MOD_DOMAIN.ITEM, "LifeGainOnEndurangeChargeConsumptionUniqueBodyStrInt6": MOD_DOMAIN.ITEM, "ReturningProjectilesUniqueDescentBow1": MOD_DOMAIN.ITEM, } if __name__ == '__main__': call_with_default_args(mods.write)
from RePoE.parser.util import call_with_default_args, write_json from RePoE.parser import Parser_Module class cluster_jewel_notables(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): data = [] for row in relational_reader["PassiveTreeExpansionSpecialSkills.dat"]: data.append({ "id": row["PassiveSkillsKey"]["Id"], "name": row["PassiveSkillsKey"]["Name"], "jewel_stat": row["StatsKey"]["Id"], }) write_json(data, data_path, "cluster_jewel_notables") if __name__ == "__main__": call_with_default_args(cluster_jewel_notables.write)
skills[size] = [] skills[size].append({ 'id': row['PassiveSkillsKey']['Id'], 'name': row['PassiveSkillsKey']['Name'], 'stats': { stat['Id']: value for stat, value in row['PassiveSkillsKey']['Stats'] }, 'tag': row['TagsKey']['Id'] }) data = {} for row in relational_reader['PassiveTreeExpansionJewels.dat']: size = row['PassiveTreeExpansionJewelSizesKey']['Name'] data[row['BaseItemTypesKey']['Id']] = { 'name': row['BaseItemTypesKey']['Name'], 'size': size, 'min_skills': row['MinNodes'], 'max_skills': row['MaxNodes'], 'small_indices': row['SmallIndices'], 'notable_indices': row['NotableIndices'], 'socket_indices': row['SocketIndices'], 'total_indices': row['TotalIndices'], 'passive_skills': skills[size] } write_json(data, data_path, 'cluster_jewels') if __name__ == '__main__': call_with_default_args(cluster_jewels.write)
], "corrupted_essence_chance": row["CorruptedEssenceChance"], "mirrors": row["CanMirrorItem"], "changes_quality": row["CanImproveQuality"], "rolls_lucky": row["HasLuckyRolls"], "enchants": row["CanRollEnchant"], "rolls_white_sockets": row["CanRollWhiteSockets"], "sell_price_mods": [mod['Id'] for mod in row["SellPrice_ModsKeys"]], "descriptions": [ description["Description"] for description in row["DelveCraftingModifierDescriptionsKeys"] ], "blocked_descriptions": [ description["Id"] for description in row["BlockedDelveCraftingModifierDescriptionsKeys"] ] } write_json(root, data_path, 'fossils') if __name__ == '__main__': call_with_default_args(fossils.write)
continue previous.add(id_str) result = _convert(tr, tag_set) result["hidden"] = True root.append(result) return root class stat_translations(Parser_Module): @staticmethod def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache): missing_stat_descriptions = find_missing_stat_descriptions(file_system) if missing_stat_descriptions: raise ValueError( f"The following stat descriptions are currently not accounted for: {missing_stat_descriptions}," + " please add to WRITTEN_FILES in constants.py") tag_set = set() for in_file, out_file in STAT_TRANSLATION_DICT.items(): translations = translation_file_cache[in_file].translations result = _get_stat_translations( tag_set, translations, get_custom_translation_file().translations) write_json(result, data_path, out_file) print("Possible format tags: {}".format(tag_set)) if __name__ == "__main__": call_with_default_args(stat_translations.write)
'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') # a few unique item mods have the wrong mod domain so they wouldn't be added to the file without this MOD_DOMAIN_FIX = { "AreaDamageUniqueBodyDexInt1": MOD_DOMAIN.ITEM, "ElementalResistancePerEnduranceChargeDescentShield1": MOD_DOMAIN.ITEM, "LifeGainOnEndurangeChargeConsumptionUniqueBodyStrInt6": MOD_DOMAIN.ITEM, "ReturningProjectilesUniqueDescentBow1": MOD_DOMAIN.ITEM, } if __name__ == '__main__': call_with_default_args(write)