HearthSim/npm-deckstrings

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

deckstrings for Hearthstone

Travis npm

Decode 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

Install the package from npm using your favourite package manager:

rn add deckstrings
Usage
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

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.