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