A restful API for returning champion and item stats for League of Legends. The database holds all the info you could ever want to know about LoL champions. It's updated from a bunch of jsons that I maintain. You can see the live version at lolapi.herokuapp.com.
This code is actually 2 products side by side:
I’ve always loved coding and working with databases, so the natural idea was a simulator to test champion builds. Unfortunately, routinely maintained champ data is hard to come by and/or hard to parse. So, I decided that I needed to make my own dataset if I was going to have any sort of stability. After typing the first couple of .json files manually, I recognized that an automated algorithm was the way to go. Processing what I scraped from both the lolwiki source and the league site itself yielded nicely formatted results. Those files in hand, I could easily edit them and patch to a cloud database so that anyone using my API would have current data.
With my database in hand, I turned my focus to the simulator. It grew rapidly in both size and complexity when I realized I not only wanted to test builds, but champion matchups as well. I fervently coded an entire LoL engine complete with abilities, buffs, items, stat caps, resistances, and champions (which became dramatically harder than I had initially expected). It was quite the journey- realizing every 10 lines that I needed another feature or function, which kept me on my toes throughout.
All of the data about champion base stats is scraped from Riot's Champion info section using the python library Beautiful Soup.
All of the ability descriptions, damage, and scaling is pulled from the LoLWiki source and parsed using Python's Regex library (re).
All of the code from both can be found in
Cool! You can download current files from the webapp (http://lolapi.herokuapp.com). Make sure to install requirements (
pip install requirements.txt) and then just run
Firstly, the sandbox is commandline. One second passes per actual action taken. You can reduce cooldowns to non-whole numbers, but you still can't use the ability until the cooldown is < 0.
The big change is in attack speed- since there wasn't a great way to adjust the time frame, each attack is your AD*your attack speed. So, if your attack speed is only .7, you would have only launched most of your attack, so you don't get the full value.
Also, slow's (while accounted for), don't really do much, as there's no motion.
Maybe at some point. As it stands, there's an Akali that just auto attacks you until one of you is dead. I've got a plan for AI, but as of today (Feb 20, 2013), I'm too busy to do something that non-essential.
Q: Why did you make this?
A: First and foremost, I love League and wanted to enable other developers to make great things with conveniently available datasets. Secondly, I really want to work at Riot and thought the best way to get my foot in the door was to make a totally badass project and get it shipped, so I did.
Q: Can I count on you to keep the database stay updated?
A: It should! Now that all the data is in, it should be quite easy to maintain. If I'm going to be indisposed for an inordinate amount of time, I'll make sure it gets seen to.
Q: What's in it for you?
A: Personally, not much. It was a fun puzzle and I learned a lot. Hopefully other devs in the LoL community will utilize it and make some awesome apps! Also, see 'job at Riot'.
Q: Where do you go from here? A: Well, I'd like to flesh out the sandbox. I've got a buglist of things that don't yet work that I'll work though, plus adding a bunch more champs. From there, who knows? It's a time intensive activity, but it's fun. Hopefully Riot'll add their own sandbox and I wont even need to use this, haha. Only time will tell, I suppose.
Awesome! I encourage it. Hopefully I've made it easy enough to understand and it can be used to answer some mid level python/tornado questions.
python main.pyin the appropriate directory (default port is 8888, you can change it on the command line if you're so inclined).
routes.pyunder the comment header "#Where they fight!".
pymongo.connection()to the default. You may be able to just leave those parens blank and it'll use 27017. For reference, you can check their site here.