diff --git a/RouletteRecorder/data/job.json b/RouletteRecorder/data/job.json index 5774a41..dcd5577 100644 --- a/RouletteRecorder/data/job.json +++ b/RouletteRecorder/data/job.json @@ -1,125 +1,131 @@ { - "0": { - "name": "冒险者" - }, - "1": { - "name": "剑术师" - }, - "2": { - "name": "格斗家" - }, - "3": { - "name": "斧术师" - }, - "4": { - "name": "枪术师" - }, - "5": { - "name": "弓箭手" - }, - "6": { - "name": "幻术师" - }, - "7": { - "name": "咒术师" - }, - "8": { - "name": "刻木匠" - }, - "9": { - "name": "锻铁匠" - }, - "10": { - "name": "铸甲匠" - }, - "11": { - "name": "雕金匠" - }, - "12": { - "name": "制革匠" - }, - "13": { - "name": "裁衣匠" - }, - "14": { - "name": "炼金术士" - }, - "15": { - "name": "烹调师" - }, - "16": { - "name": "采矿工" - }, - "17": { - "name": "园艺工" - }, - "18": { - "name": "捕鱼人" - }, - "19": { - "name": "骑士" - }, - "20": { - "name": "武僧" - }, - "21": { - "name": "战士" - }, - "22": { - "name": "龙骑士" - }, - "23": { - "name": "吟游诗人" - }, - "24": { - "name": "白魔法师" - }, - "25": { - "name": "黑魔法师" - }, - "26": { - "name": "秘术师" - }, - "27": { - "name": "召唤师" - }, - "28": { - "name": "学者" - }, - "29": { - "name": "双剑师" - }, - "30": { - "name": "忍者" - }, - "31": { - "name": "机工士" - }, - "32": { - "name": "暗黑骑士" - }, - "33": { - "name": "占星术士" - }, - "34": { - "name": "武士" - }, - "35": { - "name": "赤魔法师" - }, - "36": { - "name": "青魔法师" - }, - "37": { - "name": "绝枪战士" - }, - "38": { - "name": "舞者" - }, - "39": { - "name": "钐镰客" - }, - "40": { - "name": "贤者" - } + "0": { + "name": "冒险者" + }, + "1": { + "name": "剑术师" + }, + "2": { + "name": "格斗家" + }, + "3": { + "name": "斧术师" + }, + "4": { + "name": "枪术师" + }, + "5": { + "name": "弓箭手" + }, + "6": { + "name": "幻术师" + }, + "7": { + "name": "咒术师" + }, + "8": { + "name": "刻木匠" + }, + "9": { + "name": "锻铁匠" + }, + "10": { + "name": "铸甲匠" + }, + "11": { + "name": "雕金匠" + }, + "12": { + "name": "制革匠" + }, + "13": { + "name": "裁衣匠" + }, + "14": { + "name": "炼金术士" + }, + "15": { + "name": "烹调师" + }, + "16": { + "name": "采矿工" + }, + "17": { + "name": "园艺工" + }, + "18": { + "name": "捕鱼人" + }, + "19": { + "name": "骑士" + }, + "20": { + "name": "武僧" + }, + "21": { + "name": "战士" + }, + "22": { + "name": "龙骑士" + }, + "23": { + "name": "吟游诗人" + }, + "24": { + "name": "白魔法师" + }, + "25": { + "name": "黑魔法师" + }, + "26": { + "name": "秘术师" + }, + "27": { + "name": "召唤师" + }, + "28": { + "name": "学者" + }, + "29": { + "name": "双剑师" + }, + "30": { + "name": "忍者" + }, + "31": { + "name": "机工士" + }, + "32": { + "name": "暗黑骑士" + }, + "33": { + "name": "占星术士" + }, + "34": { + "name": "武士" + }, + "35": { + "name": "赤魔法师" + }, + "36": { + "name": "青魔法师" + }, + "37": { + "name": "绝枪战士" + }, + "38": { + "name": "舞者" + }, + "39": { + "name": "钐镰客" + }, + "40": { + "name": "贤者" + }, + "41": { + "name": "蝰蛇剑士" + }, + "42": { + "name": "绘灵法师" + } } \ No newline at end of file diff --git a/scripts/extract_job.py b/scripts/extract_job.py new file mode 100644 index 0000000..d5179cc --- /dev/null +++ b/scripts/extract_job.py @@ -0,0 +1,37 @@ +import csv +import json +from pathlib import Path + +import httpx +from utils import extract_header + +client = httpx.Client() + +if __name__ == "__main__": + data = {} + + dest = Path(__file__).parent / "data" / "ClassJob.csv" + dest.write_bytes( + client.get( + "https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/refs/heads/master/ClassJob.csv" + ).read() + ) + + with open(dest.resolve(), encoding="utf-8") as f: + headers = extract_header(f) + reader = csv.DictReader(f, fieldnames=headers) + for row in reader: + id_ = int(row["Key"]) + + if not data.get(id_): + if row["Name"]: + data[id_] = { + "name": row["Name"], + } + else: + print(f"Skipping {id_}") + + continue + + dest = Path(__file__).parent.parent.joinpath("RouletteRecorder", "data", "job.json") + dest.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")