Giter Site home page Giter Site logo

thefractured / riven-rater Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 33 KB

Some Python for pulling data on your lane opponent(s) for League of Legends. Heavily uses the Riot Games API, Champion.gg API, and the RiotWatcher library.

Python 100.00%

riven-rater's Introduction

riven-rater

Some Python for pulling data on your lane opponent(s) for League of Legends. Heavily uses the Riot Games API, Champion.gg API, and the RiotWatcher library. Relies on requests library for API calls, and on scipy for some statistical analysis.

The whole thing over-all is far from pythonic, to be frank. My variable/class/file naming conventions are all over the place. I'm doing this in bursts during lunch breaks and free time. The main idea is to be able to use statistical analysis consisting of:

  • Comparing a player's win-rate on a champion to the average winrate of the champion.
  • Comparing a player's win-rate on a champion to the average winrate of the champion at their elo.
  • Analysing this difference to determine proficiency on a champion (ideally here would be something like seeing where on the bell curve they fall for win-rate).
  • Pulling champion health, armor, and damage statistics to provide an appropriate estimate of damage they could deal at different points in the laning phase.

These are the main points - analysing champion proficiency - are where I'd be doing anything even remotely new. A lot of guys who like to code like to play League of Legends, and there's a plethora of websites and applications to pull and present basic matchup data, and even more advanced analysis like checking item winrates on individual champions or across elo divisions.

Ideally, getting this to a prototype would help ALOT. Riot's API limits the number of requests you can make until you register a product, and getting access to the most recent ranked data is out of my reach for now. Riot does provide 1000 ranked games' worth of data, so I'll develop my stat-chewing on that to build a prototype, register it, and hopefully get access to the useful stuff.

Index:

consts.py file holding constant values for easier access, imported as "CONSTS" whenever needed. contents: - URL formats for making API calls to Riot and Champion.gg - Version numbers of the Riot API for various sections, required for API calls currently - Region names required for Riot API calls - Location names for Riot API calls (only champion mastery) - Summoner ID's. I included my own and that of a friend for testing purposes. - Season name required for match history Riot API calls - Mastery ID's paired with brief descriptions. Heavily truncuated from the Riot API's output and saved locally to minimize API calls. - Champion ID's paired with champion names, required for champion stat Riot API calls, and saved locally to minimize calls.

request_champion_mastery.py RiotWatcher at the moment does not support Riot's Champion Mastery API, so this I implement it myself here. For some reason the Champion Mastery API handles calls completely differently from all others, so this helps to keep calls consistent in the main Uses RiotWatcher's LoLException to handle requests errors.

Mastery_page_parser.py Small class used to parse RiotAPI's JSON output of mastery page ID's into a list of mastery names and descriptions from consts.py The JSON is taken from the current mastery page of an input summoner ID.

rune_page_parser.py Small class used to parse RiotAPI's JSON output of runeIDs into a count of each type of rune and name/description.

champgg_scraper.py Simple class that implements calling champion.gg's API. The necessary URL formats are stored in consts.py, and errors are handled by LoLException. It is used to return a JSON that's assigned to a variable so data can be pulled from it.

winrate_difference_calculator.py The supposed heart of the project. Object class that takes a playername to make a print statement look nicer (why did I do this?) It accepts two winrates (player and public) in percent notation (aka 56 not 0.56) and uses them to calculate two values: A percent difference between the two and a pvalue obtainied from a Fisher's Exact Test (scipy used here). The idea is to give a clue as to a player's skill on a champion compared to the population. Problem is, without modern ranked data, I'm forced to approximate numbers of games won/lost by using the winrate and multiplying it by a nice, fat multiple of 10. There's for sure a less horrific way to do it, but this one took 5 minutes to implement and it let me keep testing and I haven't looked back yet.

main.py The meaty bit. I assign RiotWatcher and my implementation of the championggAPI to variables which I use to call on them. The user inputs summoner data which is used to gather data with the API calls, and it is presented to them. Most of the JSON processing is done here, as the JSON's are saved to variables once gathered and used periodically for relevent data.

riven-rater's People

Contributors

thefractured avatar

Watchers

 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.