Skip to content

Commit

Permalink
tools: tu-deck-grabber: fix dump decks for unset cards (rare case)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuchka committed Aug 11, 2024
1 parent 5bd7458 commit 7e18396
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tools/tu-deck-grabber.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def setDeckCards(self,
dominion_id: int,
commander_id: int,
card_ids: List[int],
active: bool = True
active: bool = False
):
card_map = {}
for cid in card_ids:
Expand Down Expand Up @@ -692,10 +692,12 @@ def _get_attr(d, name, typ=str):
dom_id = _get_attr(deck, 'dominion_id', typ=int)
if dom_id:
deck_txt += ', ' + card_id2name_resolver(dom_id)
for card_id, card_count in deck['cards'].items():
deck_txt += ', ' + card_id2name_resolver(int(card_id))
if int(card_count) > 1:
deck_txt += ' #' + str(card_count)
deck_cards = deck.get('cards', {})
if deck_cards:
for card_id, card_count in deck_cards.items():
deck_txt += ', ' + card_id2name_resolver(int(card_id))
if int(card_count) > 1:
deck_txt += ' #' + str(card_count)
txt += '{}.deck_{}: {}\n'.format(self.getUserName(), deck_id, deck_txt)
txt += '\n// End of decks dump\n'
return txt
Expand Down

0 comments on commit 7e18396

Please sign in to comment.