101 lines
3.3 KiB
PowerShell
101 lines
3.3 KiB
PowerShell
# CHACHA 2023
|
|
# V1.0
|
|
# CC BY-NC-SA
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$MaxUniqueID=380000
|
|
|
|
$AppDataPath = [Environment]::GetFolderPath('ApplicationData') | split-path
|
|
|
|
$SavesPath = [IO.Path]::Combine($AppDataPath,"LocalLow","Endnight","SonsOfTheForest","Saves")
|
|
|
|
$SaveDirPartial = Get-ChildItem -Path $SavesPath | ?{ $_.PSIsContainer } | Sort-Object -Property LastWriteTime -Descending | Select Name -First 1 -ExpandProperty Name
|
|
$SaveDirPartial = [IO.Path]::Combine($SavesPath,$SaveDirPartial,"Multiplayer")
|
|
|
|
$SaveDir = Get-ChildItem -Path $SaveDirPartial| ?{ $_.PSIsContainer } | Sort-Object -Property LastWriteTime -Descending | Select Name -First 1 -ExpandProperty Name
|
|
$SaveDir = [IO.Path]::Combine($SaveDirPartial,$SaveDir)
|
|
|
|
############################
|
|
# GameStateSaveData.json
|
|
|
|
$GameStateSaveData = Get-Content -Raw -Path ([IO.Path]::Combine($SaveDir,"GameStateSaveData.json"))| ConvertFrom-Json
|
|
$GameStateSaveData_GameState = $GameStateSaveData.Data.GameState | ConvertFrom-Json
|
|
|
|
$GameStateSaveData_GameState.IsRobbyDead=$false
|
|
$GameStateSaveData_GameState.IsVirginiaDead=$false
|
|
|
|
$GameStateSaveData.Data.GameState = $GameStateSaveData_GameState | ConvertTo-Json -Compress -depth 32
|
|
$GameStateSaveData | ConvertTo-Json -Compress -depth 32| set-content ([IO.Path]::Combine($SaveDir,"GameStateSaveData.json"))
|
|
|
|
##################
|
|
# SaveData.json
|
|
|
|
$SaveData = Get-Content -Raw -Path ([IO.Path]::Combine($SaveDir,"SaveData.json"))| ConvertFrom-Json
|
|
$SaveData_Data_VailWorldSim = $SaveData.Data.VailWorldSim | ConvertFrom-Json
|
|
|
|
$Kelvin = Write-Output $SaveData_Data_VailWorldSim.Actors | ?{$_.TypeId -eq 9}
|
|
$Kelvin.State=2
|
|
$Kelvin.Stats.Health=100
|
|
|
|
|
|
|
|
$virginia = Write-Output $SaveData_Data_VailWorldSim.KillStatsList | ?{$_.TypeId -eq 10}
|
|
if(( Get-Member -inputobject $virginia -name "PlayerKilled" -Membertype Properties) -and ($virginia.PlayerKilled -eq 1))
|
|
{
|
|
$virginia.PlayerKilled=0
|
|
$Newvirginia = [PSCustomObject][ordered]@{
|
|
UniqueId = 0
|
|
TypeId = 10
|
|
FamilyId = 0
|
|
Position = [ordered]@{
|
|
x = -1020.34106
|
|
y = 115.534531
|
|
z = -15.7358093
|
|
}
|
|
Rotation = [ordered]@{
|
|
x = 0.0
|
|
y = 0.6798875
|
|
z = 0.0
|
|
w = 0.7333165
|
|
}
|
|
SpawnerId = -1797797444
|
|
ActorSeed = 1992705629
|
|
VariationId = 0
|
|
State = 2
|
|
GraphMask = 1
|
|
EquippedItems = $null
|
|
OutfitId = -1
|
|
NextGiftTime = 0
|
|
LastVisitTime = -100.0
|
|
Stats= [ordered]@{
|
|
Health = 120.0
|
|
Anger = 0.0
|
|
Fear = 0.0
|
|
Fullness = 44.789463
|
|
Hydration = 16.53295
|
|
Energy = 100.0
|
|
Affection = 0.0
|
|
}
|
|
StateFlags = 0
|
|
}
|
|
|
|
$NewUniqueId = 1
|
|
for (; $NewUniqueId -le $MaxUniqueID ; $NewUniqueId++)
|
|
{
|
|
if(-not ($SaveData_Data_VailWorldSim.Actors | ?{$_.UniqueId -eq $NewUniqueId} ))
|
|
{
|
|
break
|
|
}
|
|
}
|
|
$Newvirginia.UniqueId = $NewUniqueId
|
|
$SaveData_Data_VailWorldSim.Actors += $Newvirginia
|
|
}
|
|
|
|
|
|
$virginia = Write-Output $SaveData_Data_VailWorldSim.Actors | ?{$_.TypeId -eq 10}
|
|
$virginia.State=2
|
|
$virginia.Stats.Health=100
|
|
|
|
|
|
$SaveData.Data.VailWorldSim = $SaveData_Data_VailWorldSim | ConvertTo-Json -Compress -depth 32
|
|
$SaveData | ConvertTo-Json -Compress -depth 32| set-content ([IO.Path]::Combine($SaveDir,"SaveData.json")) |