Update for SPT 3.9.0

This commit is contained in:
dvize
2024-07-08 10:48:45 -07:00
parent c2686f3a38
commit 344ff7bb42
4 changed files with 133 additions and 18 deletions

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>dvize.ASS</RootNamespace> <RootNamespace>dvize.ASS</RootNamespace>
<AssemblyName>dvize.ASS</AssemblyName> <AssemblyName>dvize.ASS</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
@@ -39,17 +39,6 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>BepInEx\core\0Harmony.dll</HintPath> <HintPath>BepInEx\core\0Harmony.dll</HintPath>
</Reference> </Reference>
<Reference Include="Aki.Build">
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Build.dll</HintPath>
</Reference>
<Reference Include="Aki.Common, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Common.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Aki.Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath> <HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\Assembly-CSharp.dll</HintPath>
@@ -77,6 +66,12 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath> <HintPath>F:\SPT-AKI-DEV\EscapeFromTarkov_Data\Managed\ItemTemplate.Types.dll</HintPath>
</Reference> </Reference>
<Reference Include="spt-common">
<HintPath>F:\SPT-AKI-DEV\BepInEx\plugins\spt\spt-common.dll</HintPath>
</Reference>
<Reference Include="spt-reflection">
<HintPath>F:\SPT-AKI-DEV\BepInEx\plugins\spt\spt-reflection.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@@ -110,11 +105,14 @@
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).dll" <PostBuildEvent>copy "$(TargetPath)" "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).dll"
if $(ConfigurationName) == Debug ( if "$(ConfigurationName)" == "Debug" (
copy "$(TargetDir)$(TargetName).pdb" "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).pdb" copy "$(TargetDir)$(TargetName).pdb" "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).pdb"
) else ( ) else (
del "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).pdb" del "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).pdb"
) )
</PostBuildEvent>
if "$(ConfigurationName)" == "Release" (
powershell -ExecutionPolicy Bypass -NoProfile -NonInteractive -File "$(ProjectDir)PackageMods.ps1" -ConfigurationName "$(ConfigurationName)" -TargetPath "F:\SPT-AKI-DEV\BepInEx\plugins\$(TargetName).dll" -TargetName "$(TargetName)" -TargetDir "F:\SPT-AKI-DEV\BepInEx\plugins"
)</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

117
PackageMods.ps1 Normal file
View File

@@ -0,0 +1,117 @@
param (
[string]$ConfigurationName,
[string]$TargetPath,
[string]$TargetName,
[string]$TargetDir
)
# Define the base directory
$baseDir = "F:\SPT-AKI-DEV\BepInEx\plugins"
# Function to log messages to the console
function Log {
param (
[string]$message
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Host "$timestamp - $message"
}
Log "Script started"
Log "ConfigurationName: $ConfigurationName"
Log "TargetPath: $TargetPath"
Log "TargetName: $TargetName"
Log "TargetDir: $TargetDir"
# Get the assembly version
$assembly = [System.Reflection.Assembly]::LoadFile($TargetPath)
$version = $assembly.GetName().Version.ToString()
Log "Assembly version: $version"
# Determine the directory of the deployed DLL
$deployDir = Split-Path -Parent $TargetPath
Log "DeployDir: $deployDir"
# Check if the deploy directory is the base directory or one level further
if ($deployDir -ne $baseDir) {
$relativePath = $deployDir.Substring($baseDir.Length + 1) # Get the relative path beyond the base directory
Log "RelativePath: $relativePath"
if (($relativePath -split '\\').Count -eq 1) { # Check if it's exactly one directory level further
$directoryName = (Get-Item $deployDir).Name
$zipPath = "F:\SPT-AKI-DEV\BepInEx\plugins\$directoryName-v$version.zip"
Log "DirectoryName: $directoryName"
Log "ZipPath: $zipPath"
# Remove existing zip file if it exists
if (Test-Path $zipPath) {
Log "ZipPath exists, removing"
Remove-Item $zipPath -Force
}
# Create the temp directory structure
$tempZipDir = "F:\SPT-AKI-DEV\tempZip"
if (Test-Path $tempZipDir) {
Log "TempZipDir exists, removing"
Remove-Item $tempZipDir -Recurse -Force
}
New-Item -ItemType Directory -Path $tempZipDir
Log "TempZipDir created: $tempZipDir"
$newZipStructure = Join-Path $tempZipDir "Bepinex\plugins\$directoryName"
New-Item -ItemType Directory -Path $newZipStructure -Force
Log "New zip structure directory created: $newZipStructure"
# Copy files to the new zip structure
Copy-Item -Path "$TargetDir\*" -Destination $newZipStructure -Recurse -Force
Log "Files copied to new zip structure"
# Create the final zip file
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($tempZipDir, $zipPath)
Log "Final zip file created: $zipPath"
# Clean up temp directory
Remove-Item $tempZipDir -Recurse -Force
Log "TempZipDir removed"
} else {
Log "RelativePath is not one directory level further"
}
} else {
$zipPath = "F:\SPT-AKI-DEV\BepInEx\plugins\$TargetName-v$version.zip"
Log "ZipPath: $zipPath"
# Remove existing zip file if it exists
if (Test-Path $zipPath) {
Log "ZipPath exists, removing"
Remove-Item $zipPath -Force
}
# Create the temp directory structure
$tempZipDir = "F:\SPT-AKI-DEV\tempZip"
if (Test-Path $tempZipDir) {
Log "TempZipDir exists, removing"
Remove-Item $tempZipDir -Recurse -Force
}
New-Item -ItemType Directory -Path $tempZipDir
Log "TempZipDir created: $tempZipDir"
# Create the required folder structure within the temp directory
$bepinexPluginsDir = Join-Path $tempZipDir "Bepinex\plugins"
New-Item -ItemType Directory -Path $bepinexPluginsDir -Force
Log "Bepinex\plugins directory created: $bepinexPluginsDir"
# Copy the single DLL to the new structure
Copy-Item -Path $TargetPath -Destination $bepinexPluginsDir -Force
Log "DLL copied to Bepinex\plugins directory"
# Create the final zip file
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory($tempZipDir, $zipPath)
Log "Final zip file created: $zipPath"
# Clean up temp directory
Remove-Item $tempZipDir -Recurse -Force
Log "TempZipDir removed"
}
Log "Script finished"

View File

@@ -1,13 +1,13 @@
using System; using System;
using System.Reflection; using System.Reflection;
using Aki.Reflection.Patching; using SPT.Reflection.Patching;
using BepInEx; using BepInEx;
using BepInEx.Configuration; using BepInEx.Configuration;
using EFT; using EFT;
namespace armorMod namespace armorMod
{ {
[BepInPlugin("com.dvize.ASS", "dvize.ASS", "1.6.0")] [BepInPlugin("com.dvize.ASS", "dvize.ASS", "1.7.0")]
public class AssPlugin : BaseUnityPlugin public class AssPlugin : BaseUnityPlugin
{ {
internal static ConfigEntry<Boolean> ArmorServiceMode internal static ConfigEntry<Boolean> ArmorServiceMode

View File

@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.0.0")] [assembly: AssemblyVersion("1.7.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")] [assembly: AssemblyFileVersion("1.7.0.0")]