Skip to content

Updated Mimic to v2.55.7.93054 #91

Updated Mimic to v2.55.7.93054

Updated Mimic to v2.55.7.93054 #91

name: create-release
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
jobs:
Release:
name: Creating a Release on Github
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download and Extract MPQEditor
run: |
Invoke-WebRequest -Uri "http://www.zezula.net/download/mpqeditor_en.zip" -OutFile "./mpqeditor_en.zip"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory("./mpqeditor_en.zip", "./mpqeditor")
Copy-Item "./mpqeditor/x64/MPQEditor.exe" -Destination "C:"
- name: Clone the Repo
run: |
& git clone "https://github.com/jamiephan/HeroesOfTheStorm_TryMode2.0.git" "C:/repo"
- name: Build the trymode20.stormmap
run: |
& echo "new C:/trymode20.stormmap" >> C:/script.mpqscript
& echo "add C:/trymode20.stormmap C:/repo/(10)trymemode.stormmap /r" >> C:/script.mpqscript
& echo close >> C:/script.mpqscript
& echo x >> C:/script.mpqscript
& "C:/MPQEditor.exe" /console "C:/script.mpqscript"
- name: Build Multiple Maps
run: |
git clone "https://github.com/jamiephan/HeroesOfTheStorm_S2MA.git" "C:/map_repo"
git clone "https://github.com/jamiephan/HeroesOfTheStorm_AIMaps.git" "C:/map_AI_repo"
Get-ChildItem C:/map_AI_repo/maps/5v5/ | Copy-Item -Destination { "C:/map_repo/maps/" + $_.Name.Replace(".stormmap", " AI.stormmap") }
Push-Location "C:/map_repo"
function PrepareInsertIntoMPQ($path, $mpq) {
if (Test-Path "_add_.mpqscript") {
Add-Content "_add_.mpqscript" "add `"$mpq`" `"$path`""
}
else {
Write-Output "add `"$mpq`" `"$path`"" | Set-Content "_add_.mpqscript" | Out-Null
}
}
function ExecuteInsertIntoMPQ() {
# .\MPQEditor.exe /console "_add_.mpqscript" | Out-Null
Start-Process -WindowStyle Hidden ".\MPQEditor.exe" -Wait -ArgumentList "/console `"_add_.mpqscript`""
Remove-Item "_add_.mpqscript" -Force -Confirm:$false
}
function CheckMPQFileExist($path, $mpq) {
New-Item -Confirm:$false -Force -ItemType Directory "./_checktemp_" | Out-Null
Start-Process -WindowStyle Hidden ".\MPQEditor.exe" -Wait -ArgumentList "extract `"$mpq`" `"$path`" `"./_checktemp_`""
# .\MPQEditor.exe extract "$mpq" "$path" "./_checktemp_" | Out-Null
$result = Test-Path "./_checktemp_/*"
Remove-Item -Confirm:$false -Force -Recurse "./_checktemp_"
return $result
}
function GetMPQFileContent($path, $mpq) {
New-Item -Confirm:$false -Force -ItemType Directory "./_gettemp_" | Out-Null
Start-Process -WindowStyle Hidden ".\MPQEditor.exe" -Wait -ArgumentList "extract `"$mpq`" `"$path`" `"./_gettemp_`""
# .\MPQEditor.exe extract "$mpq" "$path" "./_checktemp_" | Out-Null
$result = Get-ChildItem "./_gettemp_" -Force -Recurse -File | Select-Object -First 1 | Get-Content
Remove-Item -Confirm:$false -Force -Recurse "./_gettemp_"
return $result
}
# Copy required files
Copy-Item "C:\repo\(10)trymemode.stormmap\base.stormassets" . -Recurse -Force
Copy-Item "C:\repo\(10)trymemode.stormmap\base.stormdata" . -Recurse -Force
# Remove extra files from try mode
Remove-Item "./base.stormdata/ai" -Recurse -Force -Confirm:$false
Remove-Item "./base.stormdata/cutscenes" -Recurse -Force -Confirm:$false
Remove-Item "./base.stormdata/gamedata" -Recurse -Force -Confirm:$false
Remove-Item "./base.stormdata/ui" -Recurse -Force -Confirm:$false
# Replacing the MapScript.galaxy File
Get-ChildItem "./maps" -Filter "*.stormmap" | Foreach-Object {
$mapName = "$($_.BaseName).stormmap"
$mapPath = "maps/$mapName"
Write-Output "Patching MapScript.galaxy in $mapName"
Start-Process -WindowStyle Hidden ".\MPQEditor.exe" -Wait -ArgumentList "extract `"$mapPath`" MapScript.galaxy"
(Get-Content .\MapScript.galaxy) -replace 'include "TriggerLibs/SupportLib"', "$&`ninclude `"LibTryMeMode`"" | Set-Content .\MapScript.galaxy
(Get-Content .\MapScript.galaxy) -replace "libSprt_InitLib\(\);$", "$&`n libTRYM_InitLib();" | Set-Content .\MapScript.galaxy
(Get-Content .\MapScript.galaxy) -replace "libStEx_InitLib\(\);$", "//libStEx_InitLib();" | Set-Content .\MapScript.galaxy
PrepareInsertIntoMPQ "MapScript.galaxy" $mapPath
ExecuteInsertIntoMPQ
Remove-Item "./MapScript.galaxy" -Force -Confirm:$false
}
# Generate Insert Script and apply to the maps
Write-Output "Generating Insert Script for MPQ"
Start-Sleep -s 5
Get-ChildItem "./base.storm*" -Recurse | Where-Object { ! $_.PSIsContainer } | ForEach-Object {
$filePathPS = $_ | Resolve-Path -Relative
$filePath = $filePathPS -replace '\.\\', ''
# Special Case
if ($filePath -ieq "base.stormdata\includes.xml") {
return
}
if ($filePath -ieq "base.stormdata\gamedata.xml") {
return
}
Get-ChildItem "./maps" -Filter "*.stormmap" | Foreach-Object {
$mapName = "$($_.BaseName).stormmap"
$mapPath = "maps/$mapName"
PrepareInsertIntoMPQ $filePath $mapPath
}
}
ExecuteInsertIntoMPQ
Write-Output "Handing Special Case for Gamedata.xml and Includes.xml"
# Special case for GameData.xml and Include.xml
$originalIncludeXML = Get-Content "./base.stormdata/includes.xml"
$originalGamedataXML = Get-Content "./base.stormdata/gamedata.xml"
$IncludeXMLInnerXML = [regex]::Match($originalIncludeXML, '<Includes id="Mods/HeroesData.StormMod">(.*)</Includes>').Groups[1].Value
$GameDataXMLInnerXML = [regex]::Match($originalGamedataXML, '<Includes>(.*)</Includes>').Groups[1].Value
Get-ChildItem "./maps" -Filter "*.stormmap" | Foreach-Object {
$mapName = "$($_.BaseName).stormmap"
$mapPath = "maps/$mapName"
if(CheckMPQFileExist "base.stormdata\includes.xml" $mapPath ) {
Write-Output "$mapPath has includes"
$newIncludeXML = $(GetMPQFileContent "base.stormdata\includes.xml" $mapPath) -replace '</Includes>',"$IncludeXMLInnerXML</Includes>"
Set-Content -Path "./base.stormdata\includes.xml" -Value $newIncludeXML
PrepareInsertIntoMPQ "base.stormdata\includes.xml" $mapPath
} else {
Set-Content -Path "./base.stormdata\includes.xml" -Value $originalIncludeXML
PrepareInsertIntoMPQ "base.stormdata\includes.xml" $mapPath
}
if(CheckMPQFileExist "base.stormdata\gamedata.xml" $mapPath ) {
Write-Output "$mapPath has gamedata"
$newGameDataXML = $(GetMPQFileContent "base.stormdata\gamedata.xml" $mapPath) -replace '</Includes>',"$GameDataXMLInnerXML</Includes>"
Set-Content -Path "base.stormdata\gamedata.xml" -Value $newGameDataXML
PrepareInsertIntoMPQ "base.stormdata\gamedata.xml" $mapPath
} else {
Set-Content -Path "./base.stormdata\gamedata.xml" -Value $originalGamedataXML
PrepareInsertIntoMPQ "base.stormdata\gamedata.xml" $mapPath
}
ExecuteInsertIntoMPQ
Set-Content -Path "./base.stormdata\includes.xml" -Value $originalIncludeXML
Set-Content -Path "./base.stormdata\gamedata.xml" -Value $originalGamedataXML
}
Write-Output "All Maps Patching Completed"
Pop-Location
New-Item -Confirm:$false -Force -ItemType Directory "C:/maps" | Out-Null
Copy-Item "C:/map_repo/maps/*" "C:/maps"
Copy-Item "C:/trymode20.stormmap" "C:/maps"
Start-Sleep -s 5
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
tag_name: release-${{ github.event.head_commit.id }}
name: ${{ github.event.head_commit.message }}
body: |
Commit Message: `${{ github.event.head_commit.message }}`
Built time: `${{ github.event.head_commit.timestamp }}`
Maps with the name `.AI` indicates the map will be filled with AI players.
For instructions on how to run the maps below, Please refer to [installation guide](https://jamiephan.github.io/HeroesOfTheStorm_TryMode2.0/install.html).
draft: false
prerelease: false
files: "C:/maps/*"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}