GithubHelp home page GithubHelp logo

schmich / hearthstone-deckstrings Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 101 KB

(Archived, see below) Ruby library for encoding and decoding Hearthstone deckstrings

Home Page: http://www.rubydoc.info/github/schmich/hearthstone-deckstrings

License: MIT License

Ruby 97.47% Makefile 2.53%
hearthstone deckstrings cards blizzard hs wow world-of-warcraft deck-codes decklist ccg tcg

hearthstone-deckstrings's Introduction

Archival Notice

Due directly to the decisions and actions of Blizzard Entertainment, Inc., I will no longer be maintaining this project. The community is free to fork and continue it, but I do not wish to be involved.

Hearthstone Deckstrings Gem Version Build Status

Ruby library for encoding and decoding Hearthstone deckstrings. See documentation for help.

Usage

gem install deckstrings
require 'deckstrings'

Hearthstone deckstrings encode a Hearthstone deck in a compact format.

The IDs used in deckstrings and in this library refer to Hearthstone DBF IDs which uniquely define Hearthstone entities like cards and heroes.

For additional entity metadata (e.g. hero class, card cost, card name), the DBF IDs can be used in conjunction with the HearthstoneJSON database.

Decoding

Deckstrings::decode decodes a deckstring with basic validation.

deckstring = 'AAECAZICCPIF+Az5DK6rAuC7ApS9AsnHApnTAgtAX/4BxAbkCLS7Asu8As+8At2+AqDNAofOAgA='
puts Deckstrings::decode(deckstring)
{:format=>2, :heroes=>[274], :cards=>{754=>1, 1656=>1, 1657=>1, 38318=>1, 40416=>1, 40596=>1, 41929=>1, 43417=>1, 64=>2, 95=>2, 254=>2, 836=>2, 1124=>2, 40372=>2, 40523=>2, 40527=>2, 40797=>2, 42656=>2, 42759=>2}}

Deckstrings::Deck.decode decodes a deckstring with extended validation and additional deck information including card names and costs.

deckstring = 'AAECAZICCPIF+Az5DK6rAuC7ApS9AsnHApnTAgtAX/4BxAbkCLS7Asu8As+8At2+AqDNAofOAgA='
puts Deckstrings::Deck.decode(deckstring)
Format: Standard
Class: Druid
Hero: Malfurion Stormrage

2× Innervate
2× Jade Idol
2× Wild Growth
2× Wrath
2× Jade Blossom
2× Swipe
2× Jade Spirit
1× Fandral Staghelm
1× Spellbreaker
2× Nourish
1× Big Game Hunter
2× Spreading Plague
1× The Black Knight
1× Aya Blackpaw
2× Jade Behemoth
1× Malfurion the Pestilent
1× Primordial Drake
2× Ultimate Infestation
1× Kun the Forgotten King

Encoding

Deckstrings::encode encodes deck information in a deckstring with basic validation.

puts Deckstrings::encode(
  format: Deckstrings::Format.standard,
  heroes: [Deckstrings::Hero.malfurion],
  cards: {
    254 => 2,
    40372 => 2,
    1124 => 2,
    836 => 2,
    40523 => 2,
    64 => 2,
    40527 => 2,
    38318 => 1,
    754 => 1,
    95 => 2,
    1657 => 1,
    42656 => 2,
    1656 => 1,
    40596 => 1,
    40797 => 2,
    43417 => 1,
    41929 => 1,
    42759 => 2,
    40416 => 1    
  }
)
AAECAZICCPIF+Az5DK6rAuC7ApS9AsnHApnTAgtAX/4BxAbkCLS7Asu8As+8At2+AqDNAofOAgA=

Deckstrings::Deck.encode encodes deck information in a deckstring with extended validation.

puts Deckstrings::Deck.encode(
  format: 2,
  heroes: [274],
  cards: {
    254 => 2,
    40372 => 2,
    1124 => 2,
    836 => 2,
    40523 => 2,
    64 => 2,
    40527 => 2,
    38318 => 1,
    754 => 1,
    95 => 2,
    1657 => 1,
    42656 => 2,
    1656 => 1,
    40596 => 1,
    40797 => 2,
    43417 => 1,
    41929 => 1,
    42759 => 2,
    40416 => 1    
  }
)
AAECAZICCPIF+Az5DK6rAuC7ApS9AsnHApnTAgtAX/4BxAbkCLS7Asu8As+8At2+AqDNAofOAgA=

License

Copyright © 2017 Chris Schmich
MIT License. See LICENSE for details.

hearthstone-deckstrings's People

Contributors

schmich avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jeisen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.