Name: npm-deckstrings
Owner: HearthSim
Description: ? Decode and encode Hearthstone Deckstrings.
Created: 2017-05-24 13:00:52.0
Updated: 2018-03-22 16:49:24.0
Pushed: 2018-02-09 16:44:49.0
Homepage: https://hearthsim.info/docs/deckstrings/
Size: 108
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
deckstrings
for HearthstoneDecode and encode Hearthstone deckstrings.
Any deckstring or deck definition returned by this library will be canonical. This means that the cards and heroes are sorted in ascending order by dbf id.
A mapping between dbf ids and cards can be found at HearthstoneJSON.
Install the package from npm using your favourite package manager:
rn add deckstrings
rt {encode, decode} from "deckstrings";
t deck = {
cards: [[1, 2], [2, 2], [3, 2], [4, 1]], // [dbfid, count] pairs
heroes: [7], // Garrosh Hellscream
format: 1, // 1 for Wild, 2 for Standard
t deckstring = encode(deck);
ole.log(deckstring); // AAEBAQcBBAMBAgMA
t decoded = decode(deckstring);
ole.log(JSON.stringify(deck) === JSON.stringify(decoded)); // true