0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs
2024-07-08 18:52:57 +01:00

32 lines
1006 B
C#

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