Skip to content
Open
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
4 changes: 2 additions & 2 deletions lolstaticdata/items/modelitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class Active(object):
unique: bool
name: str
effects: str
range: int
cooldown: float
range: str
cooldown: str


@dataclasses_json.dataclass_json(letter_case=dataclasses_json.LetterCase.CAMEL)
Expand Down
16 changes: 5 additions & 11 deletions lolstaticdata/items/pull_items_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def _parse(passive: dict,) -> Passive:

@classmethod
def _parse_actives(cls, item_data: dict) -> List[Active]:
get_cooldown = re.compile(r"(\d+ second cooldown)|(\d+ seconds cooldown)")
effects = []
passive = None
if "effects" in item_data:
Expand All @@ -108,30 +107,25 @@ def _parse_actives(cls, item_data: dict) -> List[Active]:
if passive:
(
unique,
mythic,
mythic,
passive_name,
passive_effects,
item_range,
cd,
) = cls._parse_passive_info(passive)
if get_cooldown.search(passive_effects):
cooldown = get_cooldown.search(passive_effects).group(0).split(" ", 1)
cooldown = cls._parse_float(cooldown[0])
else:
cooldown = None
effect = Active(
unique=unique,
name=passive_name,
effects=passive_effects,
cooldown=cooldown,
cooldown=cd,
range=item_range,
) # This is hacky...

effects.append(effect)
return effects

@classmethod
def _parse_passive_info(cls, passive: dict) -> Tuple[bool, bool, Optional[str], str, Optional[int], Optional[str]]:
def _parse_passive_info(cls, passive: dict) -> Tuple[bool, bool, Optional[str], str, Optional[str], Optional[str]]:
if "unique" in passive:
unique = True
mythic = False
Expand All @@ -155,9 +149,9 @@ def _parse_passive_info(cls, passive: dict) -> Tuple[bool, bool, Optional[str],
passive = passive

if "radius" in passive:
item_range = cls._parse_int(passive["radius"])
item_range = passive["radius"]
elif "range" in passive:
item_range = cls._parse_int(passive["range"])
item_range = passive["range"]
else:
item_range = None
return unique, mythic, name, passive["description"], item_range, cd
Expand Down