From 28225ad5a05aeb63ac41ed634965fa87424cd095 Mon Sep 17 00:00:00 2001 From: SuspiciousActivity <38253929+SuspiciousActivity@users.noreply.github.com> Date: Fri, 6 May 2022 16:01:35 +0200 Subject: [PATCH] Update vallc.ps1 --- vallc.ps1 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/vallc.ps1 b/vallc.ps1 index 0dcbe60..62b4d71 100644 --- a/vallc.ps1 +++ b/vallc.ps1 @@ -29,8 +29,13 @@ try { $patchConfig = ConvertFrom-Json (Invoke-WebRequest -Uri 'https://clientconfig.rpg.riotgames.com/api/v1/config/public?namespace=keystone.products.valorant.patchlines').Content $configs = $patchConfig.'keystone.products.valorant.patchlines.live'.platforms.win.configurations + $found = 0 + $availableLocales = '' + foreach ($config in $configs) { if ($config.valid_shards.live[0] -eq $region) { + $found = 1 + $availableLocales = $config.locale_data.available_locales $patchUrl = $config.patch_url if ($patchUrl -ne $lastPatchUrl) { @@ -41,9 +46,25 @@ try { } else { Write-Output 'Up to date!' } + + if (!($availableLocales.Contains($textLang))) { + Write-Error (-join('Invalid "textLang" value: ', $textLang)) + Write-Error (-join('Valid values are: ', [string]::Join(', ', $availableLocales))) + Exit + } + if (!($availableLocales.Contains($voiceLang))) { + Write-Error (-join('Invalid "voiceLang" value: ', $voiceLang)) + Write-Error (-join('Valid values are: ', [string]::Join(', ', $availableLocales))) + Exit + } break; } } + + if ($found -eq 0) { + Write-Error (-join('Invalid "region" value: ', $region)) + Exit + } } catch { Write-Error 'Can not contact public valorant config' Exit