1 Commits

Author SHA1 Message Date
8cca6e3464 Implement names for stat 107 and 188 2025-09-28 12:08:51 +02:00

View File

@@ -85,7 +85,9 @@ class Stat:
if self.id == 107: # +X to [Skill] ([Class] only) if self.id == 107: # +X to [Skill] ([Class] only)
return re.sub(r"\[[^\]]*\]", lookup_skill_name(self.parameter), subst_text, 1) return re.sub(r"\[[^\]]*\]", lookup_skill_name(self.parameter), subst_text, 1)
elif self.id == 188: # +X to [Skill] elif self.id == 188: # +X to [Skill]
return re.sub(r"\[[^\]]*\]", lookup_talent_tree(self.parameter) + f"({self.parameter})", subst_text, 1) if '[' in subst_text:
return subst_text[:subst_text.find('[')] + lookup_random_skill_tab(self.parameter)
return re.sub(r"\[[^\]]*\]", lookup_random_skill_tab(self.parameter), subst_text, 1)
else: else:
return re.sub(r"\[[^\]]*\]", str(self.parameter), subst_text, 1) return re.sub(r"\[[^\]]*\]", str(self.parameter), subst_text, 1)
@@ -566,9 +568,8 @@ def _get_skills_map():
def lookup_skill_name(id: int) -> str: def lookup_skill_name(id: int) -> str:
# NOTE: The mapping seems not straight forward # FIXME: This hackish way of calculating the key is because we directly index into local/lng/strings/skills.json
# for Powerstrike and Impale the id given is 14 and 19 and the key is "skillname14" and "skillname19" # but the actual ID points to global/excel/skills.txt
# for Feral Rage id 232 is given but the key is "Skillname233"
skills_map = _get_skills_map() skills_map = _get_skills_map()
try: try:
try: try:
@@ -579,16 +580,19 @@ def lookup_skill_name(id: int) -> str:
return f"<Invalid key: skillname{id} or Skillname{id + 1}>" return f"<Invalid key: skillname{id} or Skillname{id + 1}>"
def lookup_talent_tree(id: int) -> str: def lookup_random_skill_tab(id: int) -> str:
# TODO: I do not know how to translate this Id to e.g. SkillCategoryBa1 # (ClassId * 8) is the id of the first tab for that class
class_guess = lookup_class(int(id / 10) + 1, id) skills_map = _get_skills_map()
class_name = lookup_class(int(id / 8))
two_letter_class_code = lookup_class(int(id / 8))[:2]
tab_index = 3 - id % 8 # for some reason local/lng/strings/skills.json index backwards (0 -> 3, 1 -> 2, ...)
try: try:
return f"<TODO: Talent Tree of {class_guess}?>" return skills_map[f"SkillCategory{two_letter_class_code}{tab_index}"] + f" ({class_name} only)"
except AssertionError: except KeyError:
return "<TODO: Talent Tree Name>" return f"<Invalid random skill tab: {id}>"
def lookup_class(id: int, dbg) -> str: def lookup_class(id: int) -> str:
match id: match id:
case 0: case 0:
return "Amazon" return "Amazon"
@@ -606,4 +610,4 @@ def lookup_class(id: int, dbg) -> str:
return "Assassin" return "Assassin"
case _: case _:
# TODO: In 3.11 replace this with assert_never # TODO: In 3.11 replace this with assert_never
assert False, f"{id} Should be unreachable: {dbg}" assert False, f"{id} Should be unreachable"