Code Monkey home page Code Monkey logo

lordeckcodes's Introduction

LoRDeckCodes

The LorDeckCodes library can be used to encode/decode Legends of Runeterra decks to/from simple strings. Below is an example code for a Ionia/Piltover & Zaun deck.

CEAAECABAQJRWHBIFU2DOOYIAEBAMCIMCINCILJZAICACBANE4VCYBABAILR2HRL

These strings can be used to share decks across Legends of Runeterra clients. Just remember: you can't netdeck skill.

Cards & Decks

Every Legends of Runeterra card has a corresponding card code. Card codes are seven character strings comprised of two characters for card set, two characters for faction identifier, and three characters for card number.

01DE123
│ │ └ card number - 123
│ └ faction - DE
└ set - 01

The deck code library accepts a Legends of Runeterra deck as a list of CardCodeAndCount objects. This is simply the code and an associated integer for the number of occurences of the card in the deck.

Process

Decks are encoding via arranging VarInts into an array and then base 32 encoding into a string.

All encodings begin with 4 bits for format and 4 bits for version.

Version Date Patch About
1 Oct 18, 2019 - Closed alpha. Supports original set.
2 April 28, 2020 1.0 Launch. Supports second set with the Bilgewater faction.

The list of cards are then encoded according to the following scheme:

  1. Cards are grouped together based on how many copies of the card are in the deck (e.g., cards with three copies are grouped together, cards with two copies are grouped together, and cards with a single copy are grouped together).
  2. Within those groups, lists of cards are created which share the same set AND faction.
  3. The set/faction lists are ordered by increasing length. The contents of the set/faction lists are ordered alphanumerically.
  4. Variable length integer (varints) bytes for each ordered group of cards are written into the byte array according to the following convention:
    • [how many lists of set/faction combination have three copies of a card]
      • [how many cards within this set/faction combination follow]
      • [set]
      • [faction]
        • [card number]
        • [card number]
        • ...
      • [how many cards in this next set/faction combination follow]
      • [set]
      • [faction]
        • [card number]
        • [card number]
        • ...
    • [repeat for the groups of two copies of a card]
    • [repeat for the groups of a single copy of a card]
  5. The resulting byte array is base32 encoded into a string.

Faction Identifiers

Factions are mapped as follows:

Integer Identifier Faction Identifier Faction Name
0 DE Demacia
1 FR Freljord
2 IO Ionia
3 NX Noxus
4 PZ Piltover & Zaun
5 SI Shadow Isles
6 BW Bilgewater

Implementations

Members of the community have graciously created implementations of this library in various languages. The following is intended to assist in choosing the implementation that works best for you. If you're a developer and would like to include your implementation in this list, please create a pull request and add a row to the README.

Name Language Version* Maintainer
LoRDeckCodes Java 8 1 stelar7
LoRDeckCodesPython Python 3 2 Rafalonso
runeterra JavaScript 2 SwitchbladeBot
lordeckoder Golang 2 MarekSalgovic
RuneTerraPHP PHP 7.2 2 Mike-Reinders
LoRDeckCodes.jl Julia 1 wookay
lordeckcodes-rs Rust 1 iulianR
twisted_fate Python 3 1 snowcola
LoRDeckCodes Android 1 Pole
lor-deckcode TypeScript 1 icepeng
CardGameFr-LoRDeckCode Ruby 1 Yohan-Frmt
LoRDeckCoder Java 8 1 Paul1365972
lor_deck_codes_dart Dart 2 edenizk
lor_deckcodes_dart Dart 2 1 exts
lor-deckcodes Swift 1 tomaszbak
ForDeckmacia Scala 2 Billzabob
LoRDeck++ C++ 2 EvanKaraf

*Version refers to the MAX_KNOWN_VERSION supported by the implementation.

License

Apache 2 (see LICENSE for details)

lordeckcodes's People

Contributors

riottuxedo avatar jeberemus avatar billzabob avatar pole458 avatar rafalonso avatar mareksalgovic avatar stelar7 avatar pedrofracassi avatar mike-reinders avatar edenizk avatar bamiji avatar snowcola avatar evankaraf avatar paul1365972 avatar yohan-frmt avatar tomaszbak avatar wookay avatar exts avatar icepeng avatar

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.