2024-05-21 19:10:17 +01:00
|
|
|
using SPT.Reflection.CodeWrapper;
|
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
using SPT.Reflection.Utils;
|
2023-03-03 18:52:31 +00:00
|
|
|
using Comfort.Common;
|
|
|
|
using EFT;
|
|
|
|
using HarmonyLib;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
namespace SPT.SinglePlayer.Patches.ScavMode
|
2023-03-03 18:52:31 +00:00
|
|
|
{
|
|
|
|
public class ScavProfileLoadPatch : ModulePatch
|
|
|
|
{
|
2024-07-12 14:49:25 +01:00
|
|
|
/// <summary>
|
|
|
|
/// This was changed from an IL Patch,
|
|
|
|
/// aim is just to replace loaded profile with the Scav profile when creating a game
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
2023-03-03 18:52:31 +00:00
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
{
|
2024-07-12 14:49:25 +01:00
|
|
|
return AccessTools.Method(typeof(LocalGame), nameof(LocalGame.smethod_6));
|
2023-03-03 18:52:31 +00:00
|
|
|
}
|
|
|
|
|
2024-07-12 14:49:25 +01:00
|
|
|
[PatchPrefix]
|
|
|
|
public static void PatchPrefix(ref Profile profile, LocalRaidSettings raidSettings)
|
2023-03-03 18:52:31 +00:00
|
|
|
{
|
2024-07-12 14:49:25 +01:00
|
|
|
// check raidsettings to see if its a pmc raid
|
|
|
|
if (raidSettings.playerSide == ESideType.Pmc)
|
2023-03-03 18:52:31 +00:00
|
|
|
{
|
2024-07-12 14:49:25 +01:00
|
|
|
Logger.LogInfo("Side was PMC, returning");
|
|
|
|
return;
|
2023-03-03 18:52:31 +00:00
|
|
|
}
|
|
|
|
|
2024-07-12 14:49:25 +01:00
|
|
|
// if not get scav profile
|
|
|
|
// load that into the profile param
|
|
|
|
Logger.LogInfo("Side was Scav, setting profile");
|
|
|
|
profile = PatchConstants.BackEndSession.ProfileOfPet;
|
2023-03-03 18:52:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|