Skip to content

Commit

Permalink
updated json data to include card set
Browse files Browse the repository at this point in the history
  • Loading branch information
pramberg451 committed Aug 1, 2020
1 parent 2da80fa commit 383f74e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions GwentUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions gwentCardImageExporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 383f74e

Please sign in to comment.