Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from lem6ns/main
Browse files Browse the repository at this point in the history
Fix downloading assets & more, Merged.
  • Loading branch information
Aetopia committed Dec 27, 2021
2 parents 136ca25 + e2c4d9d commit f430df5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
GUI.exe
LauncherConfig.ini
Options.ini
logs/
.minecraft/
.minecraft_files/
.lunarclient_files/
scripts/__pycache__/
45 changes: 23 additions & 22 deletions LCFilesInstaller.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ $Version = cat "$env:Temp\Version.txt" | Select-Object -First 1
$Version = $Version.Trim("version: ")
$GameVersion = $args[0]
$params = @{
"hwid"=""
"hwid"="0";
"hwid_private"="0";
"os"="win32";
"arch"="x64";
"launcher_version"="$Version";
"version"="$GameVersion";
"branch"="master";
"launch_type"="ONLINE";
"classifier"="";
"launch_type"="0";
"classifier"="0";
}
$Index = iwr "https://api.lunarclientprod.com/launcher/launch" -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json"
$Files=($Index.Content | ConvertFrom-Json).launchTypeData.artifacts
$Licenses=($Index.Content | ConvertFrom-Json).licenses
$JRE=($Index.Content | ConvertFrom-Json).jre.download.url
$JRE_Name=($Index.Content | ConvertFrom-Json).jre.executablePathInArchive[0]
$Index = iwr "https://api.lunarclientprod.com/launcher/launch" -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json" -OutFile "$env:Temp\Index.txt"
$Index = cat "$env:Temp\index.txt"
$Files=($Index | ConvertFrom-Json).launchTypeData.artifacts
$Licenses=($Index | ConvertFrom-Json).licenses
$JRE=($Index | ConvertFrom-Json).jre.download.url
$JRE_Name=($Index | ConvertFrom-Json).jre.executablePathInArchive[0]

$null = New-Item -Path ".lunarclient_files" -ItemType "Directory"
$null = New-Item -Path ".lunarclient_files\licenses" -Type "Directory"
Expand All @@ -26,21 +28,20 @@ $null = New-Item -Path ".lunarclient_files\jre" -Type "Directory"
cls

Write-Output "Getting Licenses..."
curl.exe -# -L -o ".lunarclient_files\licenses\ReplayMod.md" $Licenses[0].url
curl.exe -# -L -o ".lunarclient_files\licenses\Blur.md" $Licenses[1].url
foreach ($file in $Licenses) {
curl.exe -# -L -o ".lunarclient_files\licenses\$($file.file)" $file.url
}
Write-Output "Downloading LC ($GameVersion)..."
Write-Output "Getting LC Jars..."
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\vpatcher-prod.jar" $Files[0].url
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\lunar-prod-optifine.jar" $Files[1].url
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\lunar-libs.jar" $Files[2].url
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\lunar-assets-prod-1-optifine.jar" $Files[3].url
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\lunar-assets-prod-2-optifine.jar" $Files[4].url
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\lunar-assets-prod-3-optifine.jar" $Files[5].url
Write-Output "Getting Natives..."
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\natives-win-x64.zip" $Files[6].url
Expand-Archive -Path ".lunarclient_files\offline\$GameVersion\natives-win-x64.zip" -DestinationPath ".lunarclient_files\offline\$GameVersion\natives" -Force
Write-Output "Getting OptiFine..."
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\OptiFine.jar" $Files[7].url
Write-Output "Getting LC Jars, Natives & Optifine..."
foreach ($file in $Files) {
if ($file.name.EndsWith(".jar")) {
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\$($file.name)" $file.url
}
if ($file.name.EndsWith(".zip")) {
curl.exe -# -L -o ".lunarclient_files\offline\$GameVersion\$($file.name)" $file.url
Expand-Archive -Path ".lunarclient_files\offline\$GameVersion\$($file.name)" -DestinationPath ".lunarclient_files\offline\$GameVersion\natives" -Force
}
}

if (!(Test-Path -LiteralPath ".lunarclient_files\jre\$JRE_Name")){
Remove-Item -Path ".lunarclient_files\jre" -Force -Recurse | Out-Null
Expand Down

0 comments on commit f430df5

Please sign in to comment.