1.0.15 • Published 6 years ago
@playfusion/warhammer-deck-sharing v1.0.15
Warhammer Age of Sigmar: Champions Deck Sharing
Generate and parse deck sharing codes.
Require
To require the module
npm install --save @playfusion/warhammer-deck-sharing
Then import/require using your module loader of choice.
This module is compatible with NodeJS and browser environments.
Browserify example
// main.js
var deckSharing = require("@playfusion/warhammer-deck-sharing")
deckSharing.generate([{id: 123, count: 1}, {id: 234, count: 2}])
then
browserify main.js -o dist.js
Generate deck codes
To create a deck code
import {generate} from "@playfusion/warhammer-deck-sharing"
const deck = [
{id: -276130957, count: 1},
{id: -1050439153, count: 1},
{id: -513512609, count: 2}
]
generate(deck) // => _wEBD5JjwQJfa2ThAXOTiu8=
Using a generated deck code to link to the app
<a href="warhammer-tcg://share-deck?_wEBD5JjwQJfa2ThAXOTiu8=&deepLinkTimestamp=1540311920029">Open in game</a>
Parse deck codes
To parse a deck code
import {parse} from "@playfusion/warhammer-deck-sharing"
const deck = parse("_wEBD5JjwQJfa2ThAXOTiu8=")
// =>
// [
// {id: -276130957, count: 1},
// {id: -1050439153, count: 1},
// {id: -513512609, count: 2}
// ]
You can then use these ids against the card data API to get full card data.
Bugs & Feedback
If you spot any issues or have any feedback, please get in touch via our official Discord channel using the #playfusion-feedback channel.