aboutsummaryrefslogtreecommitdiff
path: root/data/genbanlist.py
diff options
context:
space:
mode:
Diffstat (limited to 'data/genbanlist.py')
-rw-r--r--data/genbanlist.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/data/genbanlist.py b/data/genbanlist.py
new file mode 100644
index 0000000..65c668e
--- /dev/null
+++ b/data/genbanlist.py
@@ -0,0 +1,30 @@
+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']
+
+banlist = None
+with open('banlist.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)
+print(json.dumps(result, indent=4))
+