Kyrluckechuck / TFT-Bot

Automate Teamfight Tactics (TFT) for token/mission farming. Updated for Set 8.5!
GNU Affero General Public License v3.0
50 stars 7 forks source link

Rito game client live data integration #111

Closed akshualy closed 1 year ago

akshualy commented 1 year ago

Description

Adds a second Rito API integration, directly communicating with the live game currently running.

As the comments already state, sadly, this live data API returns absolute nonsense for most of it. (There has been an open issue at the developer relations GitHub repository since 2020, so it is unlikely to return more at any point.) However, it is very reliable at detecting our level (currently not used) and our health.

The primary fix checks the API if the health is below or at 0, waits a bit for any death or exit buttons to appear, and finally makes a "last ditch effort" at closing the game if no button is found. Returning true here will also trigger a forceful kill of the league processes, should we, by whichever miracle, still stay in the game after all of this. This process-kill will force-exit the game and put us in a regular client again after restarting it.

Notes

Now creates a riotgames_root_certificate.pem file in the folder where the bot is run to no longer disable SSL. I've decided to put it there since I'm not a big fan of hiding stuff in an obscure AppData location, but this is very opinionated, and I'm open to a differing opinion :) I didn't have to do it in this PR, but I might as well follow the boy-scout rule.

I see some potential in checking the level for smarter main game loop decisions, but this should be a separate issue/PR.

Fixes #107

akshualy commented 1 year ago

Yup I've verified it writing to the correct location, forgot to read it from the new location though and fixed that in the above commit :)