Kyrluckechuck / TFT-Bot

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

Added support for Deceive #220

Closed TriOCuBe closed 8 months ago

TriOCuBe commented 9 months ago

What is Deceive?

Deceive is a program used to mask a player's online status while playing Riot games. It's decently popular and I use it myself, which is why I wrote this pull request.

Additions

I've added two new settings to the config: use_deceive and install_location_deceive.

In tft.py, I've changed restart_league_client() to take these configs into consideration and it now runs the new function launch_league_client(), which does most of the job.

If no path to deceive is given, the bot will run determine_deceive_install_location(). This function first searches the Downloads folder, then looks through a specific registry key I've found to contain paths of .exe files. Something to note is that these entries don't get deleted, meaning if a file gets moved, the old entry for that file still exists despite becoming obsolete. Therefore the function finds all matches and then iterates through them until it finds a path pointing to an existing file.

If this still doesn't work, the config gets updated through update_deceive_config() to False and the bot won't try to open deceive again until restarted.

I've added logging and documentation to the places where it was needed.

TriOCuBe commented 8 months ago

I've now added Deceive.exe to processes in CONSTANTS so it gets terminated too in restart_league_client() Not sure if this is necessary, since Deceive should stop running when League closes, but this just makes sure of it.

Pylint is for some reason not ignoring those two line-too-long errors in tft.py Line 129 & 132, which are two logger messages. IMO those say exactly what needs to be said, so I don't want to change them up. Otherwise I'd say the integration is finished.

Kyrluckechuck commented 8 months ago

Fantastic, thanks for the PR!

Apologies for the delay, but I do plan on reviewing this, and am not against necessarily adding this, but want to be cautious when adding additional programs to the flow (even if optional), especially ones which emulate/change the client API!

As long as @akshualy doesn't have additional concerns / approves, I'll likely go ahead and merge this once I'm done reviewing 😃

akshualy commented 8 months ago

I haven't cross-checked this with a second client, but there is an endpoint in LCU as well. PUT /lol-chat/v1/me with a body of

{
  "availability": "offline"
}

Overall I have nothing against an additional integration with Deceive though.

Kyrluckechuck commented 8 months ago

I haven't cross-checked this with a second client, but there is an endpoint in LCU as well. PUT /lol-chat/v1/me with a body of

Interesting, would potentially be worth exploring us adding this directly in if it's as simple as that to toggle it off!

akshualy commented 8 months ago

If you have a few minutes, I can create an account in your region and could add you to test.

akshualy commented 8 months ago

I haven't cross-checked this with a second client, but there is an endpoint in LCU as well. PUT /lol-chat/v1/me with a body of

{
  "availability": "offline"
}

Overall I have nothing against an additional integration with Deceive though.

I had time to test this with a friend of mine, this does work and is shown on the other side as offline as well. However, it does still show that you are creating a normal game. To bypass that, you have to additionally send

{
  "availability": "offline",
  "lol": {
    "gameStatus": "outOfGame"
  }
}

after every action you take (creating lobby, going into queue, being in-game).

TriOCuBe commented 8 months ago

If you manage to replicate the effect of Deceive, I'm perfectly fine with using that instead of my code if you'd like - the real goal of my PR was just to add the functionality of masking your online status, after all 😄

Kyrluckechuck commented 8 months ago

I had time to test this with a friend of mine, this does work and is shown on the other side as offline as well. However, it does still show that you are creating a normal game. To bypass that, you have to additionally send

{
  "availability": "offline",
  "lol": {
    "gameStatus": "outOfGame"
  }
}

after every action you take (creating lobby, going into queue, being in-game).

@akshualy and/or @TriOCuBe did either of you feel up to implementing that in a PR directly, as opposed to adding this support and then removing it in the future if that were to be added to the client?

If not, I'm happy to go ahead with this as we had mentioned 😄

akshualy commented 8 months ago

Let's add both, Deceive achieves its goal by setting up a Proxy which inherently prevents any updates and thus is probably smoother at displaying the Offline status, but it'd be nice to have this feature in-built as a back-up as well :) But that should be done in a separate MR.