Skip to content

Instantly share code, notes, and snippets.

@jleclanche
Created June 9, 2018 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jleclanche/a5e3f8b02d28a76b4f0b1b1e7527ca97 to your computer and use it in GitHub Desktop.
Save jleclanche/a5e3f8b02d28a76b4f0b1b1e7527ca97 to your computer and use it in GitHub Desktop.
Take deckstrings and validate them
import sys
from hearthstone.cardxml import load_dbf
from hearthstone.deckstrings import parse_deckstring
from hearthstone.enums import ZodiacYear
YEAR = ZodiacYear.RAVEN
def main():
db, _ = load_dbf()
for deckstring in sys.argv[1:]:
print(deckstring)
cards, heroes, format = parse_deckstring(deckstring)
for dbf_id, count in cards:
if dbf_id not in db:
print(f"{dbf_id} is not a valid card DBF id")
continue
card = db[dbf_id]
if card.card_set not in YEAR.standard_card_sets:
print(f"{card} is not Standard for {YEAR.name}")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment