Created
April 19, 2023 17:56
-
-
Save ManuelBlanc/4728120699f3b413287c0b3864a6bee8 to your computer and use it in GitHub Desktop.
League of Legends - Unequip challenge tokens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## PowerShell script to remove all equipped challenge tokens. | |
## (2023-04-19) Donated to the public domain | |
## Method credit: https://www.reddit.com/r/leagueoflegends/comments/w91xqk/comment/iip126n/ | |
## | |
# Obtain the port & auth code of the LCU local server. | |
$command_line = (Get-WmiObject Win32_Process -Filter "name = 'LeagueClientUx.exe'").CommandLine | |
$command_line -match '--remoting-auth-token=(\w+)' | |
$LOL_AUTH = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("riot:$($matches[1])")) | |
$command_line -match '--app-port=(\d+)' | |
$LOL_PORT = $matches[1] | |
# Send the request to clear the challenge tokens. | |
$ReqParams = @{ | |
Uri = "https://127.0.0.1:${LOL_PORT}/lol-challenges/v1/update-player-preferences/" | |
Method = 'POST' | |
ContentType = 'application/json' | |
Body = '{"challengeIds":[]}' | |
SkipCertificateCheck = $true # Not available on PowerShell 5. Workaround: https://stackoverflow.com/a/59924223 | |
UserAgent = 'ChallengesAreEvil' | |
Headers = @{ | |
Accept = 'application/json' | |
Authorization = "Basic ${LOL_AUTH}" | |
} | |
} | |
Invoke-WebRequest @ReqParams |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment