Skip to content

Commit

Permalink
Merge pull request #2046 from LazyDope/dicecloud-library-tags
Browse files Browse the repository at this point in the history
Use library tags for finding certain properties
  • Loading branch information
SeanStoves committed May 20, 2024
2 parents e608020 + 812c626 commit 3f77d7c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cogs5e/sheets/dicecloudv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ async def load_character(self, ctx, args):
subrace = None
background = None
for prop in self._by_type["folder"] + self._by_type["feature"] + self._by_type["note"]:
if race is None and "race" in prop["tags"]:
tags = prop["tags"] + prop.get("libraryTags", [])
if race is None and "race" in tags:
race = prop.get("name")
elif subrace is None and "subrace" in prop["tags"]:
elif subrace is None and "subrace" in tags:
subrace = prop.get("name")
elif background is None and "background" in prop["tags"]:
elif background is None and "background" in tags:
background = prop.get("name")
if race is not None and subrace is not None and background is not None:
break
Expand Down Expand Up @@ -418,7 +419,7 @@ def get_attacks(self):
actions = []
consumables = []
for attack in self._by_type["action"]:
tags = attack["tags"]
tags = attack["tags"] + attack.get("libraryTags", [])
# we don't want to parse inactive actions
if not attack.get("inactive") and "avrae:no_import" not in tags:
try:
Expand Down Expand Up @@ -534,7 +535,7 @@ def get_resistances(self) -> Resistances:
def get_actions(self):
actions = []
for f in self._by_type["feature"]:
if not f.get("inactive") and "avrae:no_import" not in f["tags"]:
if not f.get("inactive") and "avrae:no_import" not in f["tags"] + f.get("libraryTags", []):
actions += self.persist_actions_for_name(f.get("name"))

return actions
Expand Down Expand Up @@ -572,7 +573,7 @@ def get_spellbook(self, slots):
actions = []

for spell in self._by_type["spell"]:
if "avrae:no_import" in spell["tags"]:
if "avrae:no_import" in spell["tags"] + spell.get("libraryTags", []):
continue

# an unnamed spell is not parsable
Expand Down

0 comments on commit 3f77d7c

Please sign in to comment.