Created
June 9, 2018 00:05
-
-
Save jleclanche/a5e3f8b02d28a76b4f0b1b1e7527ca97 to your computer and use it in GitHub Desktop.
Take deckstrings and validate them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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