diff options
| author | Mistivia <i@mistivia.com> | 2025-03-16 20:20:16 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-03-16 20:20:24 +0800 |
| commit | ed2619b17bad9cf6b9a2e21f49c4edc0349cfe3d (patch) | |
| tree | 9c3c1d43a4acdb5cb33ace7c3f9f6f1ba992da2e /data/tcg-genbanlist.py | |
| parent | fcaa119823d6937e29616e3da65131d295d12666 (diff) | |
add tcg banlist
Diffstat (limited to 'data/tcg-genbanlist.py')
| -rw-r--r-- | data/tcg-genbanlist.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/data/tcg-genbanlist.py b/data/tcg-genbanlist.py new file mode 100644 index 0000000..6bef1f6 --- /dev/null +++ b/data/tcg-genbanlist.py @@ -0,0 +1,33 @@ +import json + +cardId = dict() +cards = None +with open('cards.json', 'r') as fp: + cards = json.load(fp) + +result = dict() +result['ban'] = [] +result['limit'] = [] +result['semiLimit'] = [] + +for k in cards: + cardId[k] = cards[k]['id'] + if 'en_name' not in cards[k]: + result['ban'].append(str(cardId[k])) + +banlist = None +with open('banlist-tcg.json', 'r') as fp: + banlist = json.load(fp) + +regulation = banlist['regulation'] +for cid in regulation: + sid = str(cardId[cid]) + if regulation[cid] == 0: + result['ban'].append(sid) + if regulation[cid] == 1: + result['limit'].append(sid) + if regulation[cid] == 2: + result['semiLimit'].append(sid) +result['ban'] = list(set(result['ban'])) +print(json.dumps(result, indent=4)) + |
