2024-07-05 22:41:13 +01:00
|
|
|
|
using EFT;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
namespace SPT.SinglePlayer.Patches.ScavMode
|
|
|
|
|
{
|
2024-07-08 15:44:45 +01:00
|
|
|
|
public class EnablePlayerScavPatch : ModulePatch
|
2024-07-05 22:41:13 +01:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2024-07-08 18:52:57 +01:00
|
|
|
|
/// Temporarily trick client into thinking we are PMC and in offline mode to allow loading of scavs in PVE mode
|
2024-07-05 22:41:13 +01:00
|
|
|
|
/// </summary>
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_22));
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-08 18:52:57 +01:00
|
|
|
|
[PatchPrefix]
|
|
|
|
|
private static void PatchPrefix(ref RaidSettings ___raidSettings_0)
|
2024-07-05 22:41:13 +01:00
|
|
|
|
{
|
2024-07-08 15:44:45 +01:00
|
|
|
|
___raidSettings_0.RaidMode = ERaidMode.Local;
|
2024-07-08 18:52:57 +01:00
|
|
|
|
___raidSettings_0.IsPveOffline = true;
|
|
|
|
|
}
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
private static void PatchPostfix(ref RaidSettings ___raidSettings_0)
|
|
|
|
|
{
|
|
|
|
|
___raidSettings_0.RaidMode = ERaidMode.Online;
|
|
|
|
|
___raidSettings_0.IsPveOffline = true;
|
2024-07-05 22:41:13 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|