Skip to content

☯ Java 8 library to decode/encode Legends of Runeterra deck codes

Notifications You must be signed in to change notification settings

Paul1365972/LoRDeckCoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☯ LoRDeckCoder

Build

Java 8 library port of RiotGames/LoRDeckCodes to decode/encode Legends of Runeterra deck codes. The project uses no external libraries and is highly configurable. Created following the guidelines from RiotGames/LoRDeckCodes.

Download

Download the latest release from Gradle:

repositories { 
    maven { url "https://jitpack.io" }
}

dependencies {
    implementation 'com.github.paul1365972:lordeckcoder:v1.0'
}

or Maven:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

<dependency>
    <groupId>com.github.paul1365972</groupId>
    <artifactId>lordeckcoder</artifactId>
    <version>v1.0</version>
</dependency>

Examples

Simple decoding and encoding:

LoRDeck deck = LoRDeckCoder.toDeck("CEBAIAIFB4WDANQIAEAQGDAUDAQSIJZUAIAQCBIFAEAQCBAA");

String code = LoRDeckCoder.toCode(deck, FormatVersion.LIVE);

Parsing and fetching card codes:

LoRCard card = LoRCard.fromCardCode("01PZ019");	
	
String cardCode = card.getCardCode();
LoRFaction faction = card.getFaction();

Deck manipulation and analysis:

deck.addCards(LoRCard.fromCardCode("01PZ019"), 2);

int freljordCards = deck.getCards().entrySet().stream()
        .filter(e -> e.getKey().getFaction() == LoRFaction.FRELJORD)
        .mapToInt(Map.Entry::getValue)
        .sum();

Custom decoder if you prefer your own implementation:

LoRDeck customDeck = LoRCoder.decode(code, LoRDecoder.from(
        LoRDeck::new,
        (deck, set, factionId, cardNumber, amount) ->
            deck.addCards(new LoRCard(set, factionId, cardNumber), amount)
));

Implementation Details

  • All operations on the default implementation objects (LoRDeck, LoRCard) are safe. This means a deck or card cannot be in an invalid state and is thus always encodable

About

☯ Java 8 library to decode/encode Legends of Runeterra deck codes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages