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