diff --git a/Install Guide.txt b/Install Guide.txt deleted file mode 100644 index 47b0970..0000000 --- a/Install Guide.txt +++ /dev/null @@ -1,17 +0,0 @@ -Download the files if you have not already and extract them to any folder you want that you can remember in case things break. - -Run Install_LRZ.bat file, this file makes needed folders and copies files to correct folders - -Next you can run "Start Plutonium without update.bat" file to open plutonium without removing needed files. - -You are done. - -(original plutonium launcher updates all files when opened and this replaces "privategamelobby_project.lua" which is used to show LRZ & CUSTOM SURVIVAL MAPS option in private game lobby.) - -IF YOU USED UPDATER LAUNCHER TO UPDATE FILES OR BY MISTAKE RUN "Install_LRZ.bat" AGAIN. - -"Start Plutonium without update.bat" opens "%localappdata%\Plutonium\bin\plutonium-launcher-win32.exe" instead of the original launcher which updates all files. - - Survival maps can be chosen by selecting map in MAP and then selecting CUSTOM SURVIVAL MAP. - - After selecting custom survival map you can use START MATCH to play. diff --git a/Update_LRZ.ps1 b/Update_LRZ.ps1 new file mode 100644 index 0000000..ab21f44 --- /dev/null +++ b/Update_LRZ.ps1 @@ -0,0 +1,118 @@ +param ( + [Parameter(HelpMessage = "Do not prompt for any user input")] + [switch]$Silent = $True, + + [Parameter(HelpMessage = "Clean unneeded files listed in _delete.txt after update")] + [switch]$Clean = $False, + + [Parameter(HelpMessage = "Only update releases in the verified stream")] + [switch]$Verified = $False, + + [Parameter(HelpMessage = "Directory to install to")] + [ValidateScript({ + if (-Not($_ | Test-Path)) + { + throw "File or folder does not exist" + } return $true + })] + [System.IO.FileInfo]$Directory +) + +Write-Output "=======================================" +Write-Output " LRZ++ Updater v1 " +Write-Output " by TheFantasticLoki " +Write-Output "=======================================" + +$stopwatch = [system.diagnostics.stopwatch]::StartNew() +$repoName = "TheFantasticLoki/LokisRagnarokZombies" +$assetPattern = "LokisRagnarok*.zip" + +if ($Verified) +{ + $releasesUri = "https://api.github.com/repos/$repoName/releases/latest" +} + +else +{ + $releasesUri = "https://api.github.com/repos/$repoName/releases" +} + +Write-Output "Retrieving latest version info..." + +$releaseInfo = (Invoke-WebRequest $releasesUri | ConvertFrom-Json) | Select -First 1 +$asset = $releaseInfo.assets | Where-Object name -like $assetPattern | Select -First 1 +$downloadUri = $asset.browser_download_url +$filename = Split-Path $downloadUri -leaf + +Write-Output "The latest version is $( $releaseInfo.tag_name ) released $( $releaseInfo.published_at )" + +if (!$Silent) +{ + $stopwatch.Stop() + Write-Warning "All LRZ++ files will be updated. Are you sure you want to continue?" -WarningAction Inquire + $stopwatch.Start() +} + +Write-Output "Downloading update. This might take a moment..." + +$fileDownload = Invoke-WebRequest -Uri $downloadUri +if ($fileDownload.StatusDescription -ne "OK") +{ + throw "Could not update LRZ++. ($fileDownload.StatusDescription)" +} + +$remoteHash = $fileDownload.Headers['Content-MD5'] +$decodedHash = [System.BitConverter]::ToString([System.Convert]::FromBase64String($remoteHash)).replace('-', '') +$directoryPath = Get-Location +$fullPath = "$directoryPath\$filename" +$outputFile = [System.IO.File]::Open($fullPath, 2) +$stream = [System.IO.BinaryWriter]::new($outputFile) + +if ($Directory) +{ + $outputDir = $Directory +} + +else +{ + $outputDir = Get-Location +} + +try +{ + $stream.Write($fileDownload.Content) +} +finally +{ + $stream.Dispose() + $outputFile.Dispose() +} + +$localHash = (Get-FileHash -Path $fullPath -Algorithm MD5).Hash + +if ($localHash -ne $decodedHash) +{ + throw "Failed to update. File hashes don't match!" +} + +Write-Output "Extracting $filename to $outputDir" +Expand-Archive -Path $fullPath -DestinationPath $outputDir -Force + +if ($Clean) +{ + Write-Output "Running post-update clean..." + $DeleteList = Get-Content -Path ./_delete.txt + ForEach ($file in $DeleteList) + { + Write-Output "Deleting $file" + Remove-Item -Path $file + } +} + +Write-Output "Removing temporary files..." +Remove-Item -Force $fullPath + +$stopwatch.Stop() +$executionTime = [math]::Round($stopwatch.Elapsed.TotalSeconds, 0) + +Write-Output "Update completed successfully in $executionTime seconds!" diff --git a/install_LRZ.bat b/install_LRZ.bat index 28287d4..fdcb0eb 100644 --- a/install_LRZ.bat +++ b/install_LRZ.bat @@ -1,9 +1,18 @@ @echo off +setlocal +:PROMPT +SET /P UPDATELRZ=Would you like to update LRZ++ before Installing (Y/[N])? +IF /I "%UPDATELRZ%" NEQ "Y" GOTO END + +powershell -ExecutionPolicy ByPass -command ". '%CD%\Update_LRZ.ps1' + +:END xcopy /i "%CD%\" "%localappdata%\Plutonium\storage\t6\mods\Lokis-Ragnarok" /E /y xcopy /i "%CD%\menus\privategamelobby_project.lua" "%localappdata%\Plutonium\storage\t6\ui_mp\t6\menus" /y +powershell -command "& '%CD%\installscripts\updatechecklrzexists.ps1'" xcopy /i "%CD%\scripts" "%localappdata%\Plutonium\storage\t6\scripts" /E /y xcopy /i "%CD%\images" "%localappdata%\Plutonium\storage\t6\images" /E /y @@ -17,5 +26,5 @@ xcopy /i "%CD%\shortcuts\Uninstall LRZ++.lnk" "%appdata%\Microsoft\Windows\Start @echo Loki's Ragnarok ++ Install Completed! timeout 3 - +endlocal end \ No newline at end of file diff --git a/installscripts/updatechecklrzexists.ps1 b/installscripts/updatechecklrzexists.ps1 new file mode 100644 index 0000000..6890300 --- /dev/null +++ b/installscripts/updatechecklrzexists.ps1 @@ -0,0 +1,13 @@ +if(Test-Path -Path $env:LOCALAPPDATA\Plutonium\storage\t6\scripts\zm\Loki-RagnarokV*.gsc) +{ + Write-Output "Found Existing Version of Loki's Ragnarok Zombies, Removing..." + Remove-Item $env:LOCALAPPDATA\Plutonium\storage\t6\scripts\zm\Loki-RagnarokV*.gsc + Write-Output "Removed Old Version of Loki's Ragnarok Zombies" +} + +if(Test-Path -Path $env:LOCALAPPDATA\Plutonium\storage\t6\scripts\mp\Loki-RagnarokMPV*.gsc) +{ + Write-Output "Found Existing Version of Loki's Ragnarok Multiplayer, Removing..." + Remove-Item $env:LOCALAPPDATA\Plutonium\storage\t6\scripts\mp\Loki-RagnarokMPV*.gsc + Write-Output "Removed Old Version of Loki's Ragnarok Multiplayer" +} \ No newline at end of file diff --git a/scripts/zm/Loki-RagnarokV1.5.1.gsc b/scripts/zm/Loki-RagnarokV1.5.1.gsc deleted file mode 100644 index bec914a..0000000 Binary files a/scripts/zm/Loki-RagnarokV1.5.1.gsc and /dev/null differ diff --git a/scripts/zm/Loki-RagnarokV1.5.1.gsc.bak b/scripts/zm/Loki-RagnarokV1.5.1.gsc.bak index 66a977b..fd1d84c 100644 Binary files a/scripts/zm/Loki-RagnarokV1.5.1.gsc.bak and b/scripts/zm/Loki-RagnarokV1.5.1.gsc.bak differ diff --git a/scripts/zm/Loki-RagnarokV1.5.2.gsc b/scripts/zm/Loki-RagnarokV1.5.2.gsc new file mode 100644 index 0000000..ee0c621 Binary files /dev/null and b/scripts/zm/Loki-RagnarokV1.5.2.gsc differ