From 383f74eb11bee04232dabdfe2229c5b156c5537a Mon Sep 17 00:00:00 2001 From: Paul Ramberg <48144671+pramberg451@users.noreply.github.com> Date: Sat, 1 Aug 2020 12:37:12 -0500 Subject: [PATCH] updated json data to include card set --- GwentUtils.py | 18 ++++++++++++++++++ gwentCardImageExporter.py | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/GwentUtils.py b/GwentUtils.py index 3a33856..0af1f3b 100644 --- a/GwentUtils.py +++ b/GwentUtils.py @@ -65,6 +65,24 @@ "zh-TW": "Localization/zh-tw.csv" } +# Card sets, unreleased sets are placeholders incase this isn't updated when a new expansion releases +# Values are the identifiers used in the original xml file +CARD_SETS = { + 0: "Token", + 1: "Base", + 2: "Tutorial", + 3: "Thronebreaker", + 10: "Unmillable", + 11: "CrimsonCurse", + 12: "Novigrad", + 13: "IronJudgement", + 14: "MerchantsOfOfir", + 15: "MasterMirror", + 16: "Unreleased1", + 17: "Unreleased2", + 18: "Unreleased3" +} + def save_json(filepath, data): print("Saved JSON to: %s" % filepath) with open(filepath, "w", encoding="utf-8", newline="\n") as f: diff --git a/gwentCardImageExporter.py b/gwentCardImageExporter.py index ad91961..a2b117e 100644 --- a/gwentCardImageExporter.py +++ b/gwentCardImageExporter.py @@ -634,6 +634,11 @@ def generateCardData(self, filename, progressBar, jsonWindow, gwentPath): if category_id in categories_en_us: card['categories'].append(categories_en_us[category_id]) + # Card Set + setNumber = int(template.attrib.get('Availability')) + card['set'] = GwentUtils.CARD_SETS[setNumber] + # Is the card collectible + card['collectible'] = setNumber in {1, 3} or setNumber >= 10 # Rarity rarity = int(template.find('Rarity').text)