You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ARMY_LINK_SEPERATOR = re.compile(r"u(?P<units>[\d+x-]+)|s(?P<spells>[\d+x-]+)")
def parse_army_link(link: str) -> Tuple[List[Tuple[int, int]], List[Tuple[int, int]]]:
matches = ARMY_LINK_SEPERATOR.finditer(link)
units, spells = [], []
for match in matches:
if match.group("units"):
units = [
(4_000_000 + int(split[1]), int(split[0]))
for split in (troop.split('x') for troop in match.group("units").split('-'))
]
elif match.group("spells"):
spells = [
(26_000_000 + int(split[1]), int(split[0]))
for split in (spell.split('x') for spell in match.group("spells").split('-'))
]
return units, spells
parsed_cc = parse_army_link(link)
Returns: ([(4000058, 3), (4000001, 5)], [])
But doing:
for i in coc_client._troop_holder.items:
print(f"{i.id} {i.name}
Returns:
1000 Barbarian
1044 Ice Golem
So it looks like the IDs used in _troop_holder don't line up to the ones used by army URLs.
The text was updated successfully, but these errors were encountered:
There's a mismatch between the IDs used for parse_army_link and the ones in _troop_holder.
Link used for below examples: https://link.clashofclans.com/en?action=CopyArmy&army=u3x58-5x1
(3x Ice Golems + 5x Barbarian)
The
utils.parse_army_link
function:Returns:
([(4000058, 3), (4000001, 5)], [])
But doing:
Returns:
So it looks like the IDs used in _troop_holder don't line up to the ones used by army URLs.
The text was updated successfully, but these errors were encountered: