genbanlist.py 795 B

123456789101112131415161718192021222324252627282930313233
  1. import json
  2. cardId = dict()
  3. cards = None
  4. with open('cards.json', 'r') as fp:
  5. cards = json.load(fp)
  6. result = dict()
  7. result['ban'] = []
  8. result['limit'] = []
  9. result['semiLimit'] = []
  10. for k in cards:
  11. cardId[k] = cards[k]['id']
  12. if 'jp_name' not in cards[k] and 'jp_ruby' not in cards[k]:
  13. result['ban'].append(str(cards[k]['id']))
  14. banlist = None
  15. with open('banlist.json', 'r') as fp:
  16. banlist = json.load(fp)
  17. regulation = banlist['regulation']
  18. for cid in regulation:
  19. sid = str(cardId[cid])
  20. if regulation[cid] == 0:
  21. result['ban'].append(sid)
  22. if regulation[cid] == 1:
  23. result['limit'].append(sid)
  24. if regulation[cid] == 2:
  25. result['semiLimit'].append(sid)
  26. result['ban'] = list(set(result['ban']))
  27. print(json.dumps(result, indent=4))