diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/ScavPrestigeFixPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/ScavPrestigeFixPatch.cs new file mode 100644 index 0000000..7a05686 --- /dev/null +++ b/project/SPT.SinglePlayer/Patches/ScavMode/ScavPrestigeFixPatch.cs @@ -0,0 +1,31 @@ +using System; +using System.Reflection; +using EFT; +using EFT.InventoryLogic; +using HarmonyLib; +using SPT.Reflection.Patching; +using SPT.Reflection.Utils; + +namespace SPT.SinglePlayer.Patches.ScavMode; + +/// +/// The game is not accepting Scav profiles for the PrestigeController, +/// as a workaround we give the PMC profile so we can get in-raid as a scav +/// this may cause issues with the Prestige system if/when implemented +/// +public class ScavPrestigeFixPatch : ModulePatch +{ + protected override MethodBase GetTargetMethod() + { + return AccessTools.Constructor(typeof(GClass3690), new Type[] { typeof(Profile), typeof(InventoryController), typeof(GClass3865), typeof(ISession) }, false); + } + + [PatchPrefix] + public static void PatchPrefix(GClass3690 __instance, ref Profile profile) + { + if (profile.Side == EPlayerSide.Savage) + { + profile = PatchConstants.BackEndSession.Profile; + } + } +} \ No newline at end of file diff --git a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs index 8e49783..4a7a7ab 100644 --- a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs +++ b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs @@ -65,6 +65,9 @@ namespace SPT.SinglePlayer new BotOwnerManualUpdatePatch().Enable(); new FirearmControllerShowIncompatibleNotificationClass().Enable(); new FixKeyAlreadyExistsErrorOnAchievementPatch().Enable(); + + // 4.0.0 + new ScavPrestigeFixPatch().Enable(); } catch (Exception ex)