Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions RePoE/parser/poe2/characters.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
from RePoE.parser.util import write_json, call_with_default_args
from RePoE.parser.util import call_with_default_args, write_json
from RePoE.parser import Parser_Module


class characters(Parser_Module):
def write(self):
root = []
for row in self.relational_reader["Characters.dat64"]:
root.append(
{
"metadata_id": row["Id"],
"integer_id": row["IntegerId"],
"name": row["Name"],
"description": row["Description"],
"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"],
},
character = {
"metadata_id": row["Id"],
"integer_id": row["IntegerId"],
"name": row["Name"],
"description": row["Description"],
"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"],
},
}
)
},
}
if row["PassiveTreeImage"]:
character["passive_tree_image"] = row["PassiveTreeImage"]
root.append(character)
write_json(root, self.data_path, "characters")


Expand Down
9 changes: 8 additions & 1 deletion RePoE/parser/poe2/passives.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def write(self) -> None:
{
"title": tree["Name"]["Text"],
"roots": psg.root_passives,
"skills_per_orbit": psg.skills_per_orbit,
"skills_per_orbit": self.skills_per_orbit(psg),
"orbit_radii": [0, 82, 162, 335, 493, 662, 846, 251, 1080, 1332],
"groups": groups,
"passives": nodes,
Expand All @@ -148,6 +148,13 @@ def psg(self, filename):
psg.read(self.file_system.get_file(filename + ".psg"))
return psg

def skills_per_orbit(self, psg):
skills_per_orbit = {}
for group in psg.groups:
for node in group.nodes:
skills_per_orbit[node.radius] = max(skills_per_orbit.get(node.radius, 0), node.position + 1)
return [skills_per_orbit[i] for i in sorted(skills_per_orbit)]


if __name__ == "__main__":
call_with_default_args(passives)