Deck Strings - HearthSim/python-hearthstone GitHub Wiki
hearthstone.deckstrings
Easily encode or decode a Hearthstone deckstring.
usage
parse_deckstring(str
)
deckstring = 'AAECAZICBvIFrqsClL0C+cACws4CmdMCDEBf/gHEBuQItLsCy7wCz7wC3b4CyccCoM0Ch84CAA=='
deckstrings.parse_deckstring(deckstring)
Returns:
(
[
(754, 1),
(38318, 1),
(40596, 1),
(41081, 1),
(42818, 1),
(43417, 1),
(64, 2),
(95, 2),
(254, 2),
(836, 2),
(1124, 2),
(40372, 2),
(40523, 2),
(40527, 2),
(40797, 2),
(41929, 2),
(42656, 2),
(42759, 2)
],
[274],
<FormatType.FT_STANDARD: 2>
)
OR
You can also parse deckstring as a deckstrings.Deck()
object, which gives you access to other methods.
deckstring = 'AAECAZICBvIFrqsClL0C+cACws4CmdMCDEBf/gHEBuQItLsCy7wCz7wC3b4CyccCoM0Ch84CAA=='
deck = deckstrings.Deck().from_deckstring(deckstring)
Then you can:
deck.as_deckstring
Which returns string AAECAZICBvIFrqsClL0C+cACws4CmdMCDEBf/gHEBuQItLsCy7wCz7wC3b4CyccCoM0Ch84CAA==
(the original deckstring)
deck.get_dbf_id_list()
Returns the deck cards tuple, ordered
[
(64, 2),
(95, 2),
(254, 2),
(754, 1),
(836, 2),
(1124, 2),
(38318, 1),
(40372, 2),
(40523, 2),
(40527, 2),
(40596, 1),
(40797, 2),
(41081, 1),
(41929, 2),
(42656, 2),
(42759, 2),
(42818, 1),
(43417, 1)
]
If a deckstring is invalid, the exceptions binascii.Error
or ValueError
will be raised.