Skip to main content

An api wrapper around the Legends of Runeterra Client API with deck encoder implementation

Project description

twisted_fate

A python api wrapper to for riot's Legends of Runterra client-api including a port of Riot Games C# implementation of the deck encoder/decoder

Install

pip install twisted_fate

Usage

Create Deck from deck code

from twisted_fate import Deck

draven_deck = Deck.decode("CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ")

# results
print(deck.cards)
#[
#    Card(01NX020, Name: Draven, Cost: 3), 
#    Card(01NX035, Name: Draven's Biggest Fan, Cost: 1), 
#    Card(01NX039, Name: Vision, Cost: 3), 
#    Card(01PZ001, Name: Rummage, Cost: 1), 
#    Card(01PZ012, Name: Flame Chompers!, Cost: 2), 
#    Card(01PZ013, Name: Augmented Experimenter, Cost: 6), #    Card(01PZ018, Name: Academy Prodigy, Cost: 2), 
#    Card(01PZ028, Name: Jury-Rig, Cost: 1), 
#    Card(01PZ038, Name: Sump Dredger, Cost: 2), 
#    Card(01PZ039, Name: Get Excited!, Cost: 3), 
#    Card(01PZ040, Name: Jinx, Cost: 4), 
#    Card(01PZ045, Name: Zaunite Urchin, Cost: 1), 
#    Card(01PZ052, Name: Mystic Shot, Cost: 2), 
#    Card(01NX011, Name: Whirling Death, Cost: 3)
# ]

Create Deck from cards list, (in the format of a response from the client api)

from twisted_fate import Deck
# client api response
deck = {
    "DeckCode":"CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ",
    "CardsInDeck": {
        "01NX020": 3,
        "01NX035": 3,
        "01NX039": 3,
        "01PZ001": 3,
        "01PZ012": 3,
        "01PZ013": 3,
        "01PZ018": 3,
        "01PZ028": 3,
        "01PZ038": 3,
        "01PZ039": 3,
        "01PZ040": 3,
        "01PZ045": 3,
        "01PZ052": 3,
        "01NX011": 1,
    },
}


draven_deck = Deck(cards=deck["CardsInDeck"])
print(draven_deck.encode().deck_code)
# result: CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ

# or

print(draven_deck.to_deck_code())
# result: CEBAGAIDCQRSOCQBAQAQYDISDQTCOKBNGQAACAIBAMFQ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twisted_fate-0.1.5.tar.gz (127.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twisted_fate-0.1.5-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

File details

Details for the file twisted_fate-0.1.5.tar.gz.

File metadata

  • Download URL: twisted_fate-0.1.5.tar.gz
  • Upload date:
  • Size: 127.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.0 Windows/10

File hashes

Hashes for twisted_fate-0.1.5.tar.gz
Algorithm Hash digest
SHA256 a9e9816eff88975de294b107fd7de08c42e06d5f5736011676a477b80f252497
MD5 98e2cb35b152fa24d4380fa452312cd3
BLAKE2b-256 87bc261abcb6efffc7c872d54c2c95b2a85614fe7de0498e759028d253418fd8

See more details on using hashes here.

File details

Details for the file twisted_fate-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: twisted_fate-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 133.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.0 Windows/10

File hashes

Hashes for twisted_fate-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a9fbdbbd6bea9acb0655d499bd0864c070f8632eaf57cb106bab843c8b4e24
MD5 10460f131cea4d76e827392c925fd9da
BLAKE2b-256 2dc310934ee29cf287f74a97e2f944615a86a206269a6b381f837eabfc7e7e19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page