Skip to content

Instantly share code, notes, and snippets.

@MarkKoz
Created May 14, 2019 03:38
Show Gist options
  • Save MarkKoz/5dce778e3e374bbf8a6dfe8bcea3c426 to your computer and use it in GitHub Desktop.
Save MarkKoz/5dce778e3e374bbf8a6dfe8bcea3c426 to your computer and use it in GitHub Desktop.
LoL Client Region Changer
param(
[Parameter(Position=0, mandatory=$true)]
# [ValidateScript({$regions.ContainsKey($_)})]
[ValidateSet("NA", "LA1")]
[string]$Region,
[Parameter(Position=1, mandatory=$true)]
[ValidateScript({Test-Path $_})]
[string]$GameDir
)
if (-not (Get-Module -ListAvailable -Name powershell-yaml)) {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module powershell-yaml -AcceptLicense -Scope CurrentUser
}
Import-Module powershell-yaml
$Regions = @{
NA = 'en_US'
LA1 = 'es_MX'
}
$SettingsPath = Join-path -Path $GameDir -ChildPath "Config\LeagueClientSettings.yaml"
$ClientExePath = Join-path -Path $GameDir -ChildPath "LeagueClient.exe"
$fileContents = Get-Content $SettingsPath -Raw
$settings = ConvertFrom-Yaml $fileContents
$settings['install']['globals']['locale'] = $Regions[$Region]
$settings['install']['globals']['region'] = $Region
$fileContents = ConvertTo-Yaml $settings
Set-Content $SettingsPath -Value $fileContents
Start-Process -FilePath $ClientExePath -WorkingDirectory $GameDir -NoNewWindow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment