"""This script is used to downlaod the skill palette data. The Guild Wars 2 chat links for build templates use a different skill ID than the API, so skills need to be mapped from their "skill ID" to the corresponding "palette ID". Some game updates may require this mapping to be updated as well, otherwise the chat link parsing/generating functionality might be broken. To use this script, pipe the output to src/skill_palette.json and rebuild kondou. """ import requests import json from lxml import html, etree data = requests.get("https://wiki.guildwars2.com/wiki/Chat_link_format") parsed = html.fromstring(data.content) body = parsed.find(".//table") iterator = iter(body) next(iterator) result = [] for row in iterator: if "-" in row[3].text: continue ids = row[3].text.strip().split(";") palette_id = int(row[4].text) for skill_id in ids: skill_id = int(skill_id) result.append((skill_id, palette_id)) print(json.dumps(result))