GithubHelp home page GithubHelp logo

thekevjames / league Goto Github PK

View Code? Open in Web Editor NEW
9.0 6.0 0.0 179 KB

League of Legends API interface -- dynamic item set generator, item efficiency API, and other data science experiments

Home Page: https://pypi.python.org/pypi/league-utils

Python 100.00%

league's Introduction

LeagueUtils

LeagueUtils is a set of utilities for interacting with League of Legends data. Currently, it contains the League ISG (Item Set Generator) and an API for item gold efficiency.

version build |coverage| codacy landscape requirements

ISG

The Item Set Generator is designed to build recommended pages for every champion in every viable role. It does this by pulling date from Riot's API and from some third party sites, determining which build paths work best, and updating your League config with the results.

Usage

The most common use case is to run

league-utils-isg

to install the item sets for every champion. The item sets will be installed beside the default Riot recommended pages, but if you have manually downloaded item sets into your config directory before, these may be overwritten. Make sure any such files have unique names before running this script! (eg. anything other than ${CHAMPION}_${ROLE}.json).

You can also run something like

league-utils-isg --champ Rumble

to load info on only one champion.

Gold Efficiency

The Gold Efficiency project automatically calculates the efficiency of all items by looking at the vallue of the stats they provide. This is a common form of theory crafting.

These stats are calculated in real-time, and thus will always be up-to-date when a new patch is released.

When using this data, keep in mind that some aspects of items such as unique abilities will not be taken into account in determining the worth of an item. The ignored stats or abilities will be returned in the result.

Usage

For now, this is available only as a REST API. You can access the results for any item by ID. For example, to get efficiency data on Overlord's Bloodmail, run

curl https://league.thekev.in/item/3084/efficiency

Setup

Install from PyPI

Simply run

pip3 install league-utils

Install from Source

After cloning this repo or downloading and un{zip,tar}ing the most recent zipfile or tarball.

python3 setup.py install

Run without installing

This project can also be run without installation. After cloning this repo or downloading and un{zip,tar}ing the most recent zipfile or tarball, run

pip3 install -r requirements.txt

and use the league-utils.py script in the root of this folder. Working in a virtualenv is recommended!

Note that when using this method, the sub-project must be provided as an argument. For example:

league-utils-isg [options]  # becomes: ./league-utils.py isg [options]

From a binary

Pre-compiled binaries are provided for some Operating Systems. If yours is supported, you can grab the binary for the latest release and just run that without installing anything. Note that using this method does not allow you to easily update your installation.

If you use a binary to run league-utils, make sure you use the league-utils.py syntax described above.

Running Your Own Server

So you want to run your own API server, eh? Well, there's a convenient docker file you can use for that, but it does require just a bit of setup.

You'll need to get yourself API keys for both Riot's API and champion.gg's. Once you do, simply export them to your shell and use docker-compose to run the server. Roughly speaking, you'll want to:

export CHAMPIONGG_TOKEN=foo-asdfasdfasdf
export LEAGUE_TOKEN=bar-fdsafdsafdsa
git clone [email protected]:thekevjames/league.git
cd league
docker-compose build
docker-compose up

You may also be interested in using the official docker image. If you are, the following might make your life easier:

curl https://raw.githubusercontent.com/TheKevJames/league/master/docker-compose.yml > docker-compose.yml
curl https://raw.githubusercontent.com/TheKevJames/league/master/docker-compose.override.yml > docker-compose.override.yml
docker-compose pull
docker-compose up -d

If you're looking for something a bit more production-ready, you can also deploy this project to a Docker Swarm cluster. In that case, you'll need to configure Docker secrets and deploy this to a stack:

echo "my-championgg-token" | docker secret create championgg_token -
echo "my-riot-token" | docker secret create riot_token -
echo "my-sentry-dsn" | docker secret create sentry_dsn_league -

curl https://raw.githubusercontent.com/TheKevJames/league/master/docker-compose.yml > league.yml
docker stack deploy -c league.yml thekevjames

# to force an update to the latest build
docker service update --force thekevjames_league_utils_api

Release Procedure

I love automating the shit out of things, but I'm still not done. CI takes care of a huge number of things in this repo, but it doesn't yet do everything. This section is meant to remind me of the parts I have to do manually and thus need to get around to automating.

# OLD_TAG=$(git tag --sort=version:refname | tail -n1)
find ./ -type f -exec sed -i "s/OLD_TAG/NEW_TAG/g" *.py {} \;  # OSX: -i ''
clog -C CHANGELOG.md -F --setversion NEW_TAG
git commit -am 'chore(release): release new version'
git tag NEW_TAG
git push

At some point, I may consider integrating an "unreleased" changelog:

clog -C CHANGELOG.md -F --setversion unreleased

Disclaimer

This project probably won't make your computer explode, make your girlfriend leave you, or get you fired from your job, but I make no guarantees that blindly following its advice won't drop your ELO. You've been warned.

league's People

Contributors

pyup-bot avatar thekevjames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

league's Issues

Use gold efficiency to help build item sets

Clearly, we should prefer more efficient items. This is somewhat blocked on #34, since we do not include all relevant aspects of items in gold efficiency calculations.

Note: we already include a superset of stats commonly used in efficiency theory-crafting. Maybe this is enough?

Include more stats in gold efficiency calculations

Every single ignored_stats should be covered, if possible. This includes pretty much all unique effects.

As a first step, this may involve returning efficiency with effects on or off, eg. Warmog's is a% efficient without "Warmog's Heart" and b% efficient with it active.

As second step, we might be able to consolidate these: eg. "Warmog's Heart" is active (on average) c% of the time, thus its efficiency ranges from a to b% with a mean of (bc + a(1-c))%.

Target itemsets to opponents

Should be able to at least take into account AD-heavy vs AP-heavy for defensive items. AD vs. Lethality depending on squishiness. Anything else?

Build Riot Chatbot

In-game chat with eg. danReynolds/SummonerExpert would be cool. Build a framework and plug into something like API.AI as a backend?

Bugs -- know of any

Hi,
Looking to contribute to this project.

Wanted to get my feet wet, still trying to decipher the code and learn asyncio at the same time

Got any issues you need contributors to look at?

Use more sources

Look into data sources other than champion.gg, which is effectively the league API for our case. Integrate that knowledge into building more informed datasets.

Pickban Guide

Suggest picks/bans. Back and forth system, update from enemy picks/bans, team picks.

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.