0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 05:50:44 -05:00

Allow Scavs to enter raids and Raid setting should save correct now prayge

This commit is contained in:
Kaeno 2024-08-01 20:29:07 +01:00
parent edfe0451ac
commit 8e29dec47a
3 changed files with 54 additions and 32 deletions

View File

@ -22,7 +22,8 @@ namespace SPT.Custom.Patches
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(object controller, UpdatableToggle ____offlineModeToggle) private static void PatchPrefix(object controller, UpdatableToggle ____offlineModeToggle)
{ {
var raidSettings = Traverse.Create(controller).Field<RaidSettings>("RaidSettings").Value; //var raidSettings = Traverse.Create(controller).Field<RaidSettings>("RaidSettings").Value;
var offlineRaidSettings = Traverse.Create(controller).Field<RaidSettings>("OfflineRaidSettings").Value;
// Default checkbox to be unchecked so we're in PvE // Default checkbox to be unchecked so we're in PvE
____offlineModeToggle.isOn = false; ____offlineModeToggle.isOn = false;
@ -37,14 +38,25 @@ namespace SPT.Custom.Patches
return; return;
} }
raidSettings.BotSettings.BotAmount = settings.AiAmount; //raidSettings.BotSettings.BotAmount = settings.AiAmount;
raidSettings.WavesSettings.BotAmount = settings.AiAmount; //raidSettings.WavesSettings.BotAmount = settings.AiAmount;
raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty; //raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty;
raidSettings.WavesSettings.IsBosses = settings.BossEnabled; //raidSettings.WavesSettings.IsBosses = settings.BossEnabled;
raidSettings.BotSettings.IsScavWars = false; //raidSettings.BotSettings.IsScavWars = false;
raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed; //raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed;
raidSettings.TimeAndWeatherSettings.IsRandomWeather = settings.RandomWeather; //raidSettings.TimeAndWeatherSettings.IsRandomWeather = settings.RandomWeather;
raidSettings.TimeAndWeatherSettings.IsRandomTime = settings.RandomTime; //raidSettings.TimeAndWeatherSettings.IsRandomTime = settings.RandomTime;
// We use PVE mode from Tarkov now we need to modify PVE MODE instead of ONLINE Mode
offlineRaidSettings.BotSettings.BotAmount = settings.AiAmount;
offlineRaidSettings.WavesSettings.BotAmount = settings.AiAmount;
offlineRaidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty;
offlineRaidSettings.WavesSettings.IsBosses = settings.BossEnabled;
offlineRaidSettings.BotSettings.IsScavWars = false;
offlineRaidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed;
offlineRaidSettings.TimeAndWeatherSettings.IsRandomWeather = settings.RandomWeather;
offlineRaidSettings.TimeAndWeatherSettings.IsRandomTime = settings.RandomTime;
} }
[PatchPostfix] [PatchPostfix]

View File

@ -1,14 +1,19 @@
using EFT; using Comfort.Common;
using EFT;
using HarmonyLib; using HarmonyLib;
using SPT.Reflection.Patching; using SPT.Reflection.Patching;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
namespace SPT.SinglePlayer.Patches.ScavMode namespace SPT.SinglePlayer.Patches.ScavMode
{ {
public class EnablePlayerScavPatch : ModulePatch public class EnablePlayerScavPatch : ModulePatch
{ {
private static RaidSettings StoredRaidsettings { get; set; }
private static RaidSettings StoredRaidsettings1 { get; set; }
/// <summary> /// <summary>
/// Temporarily trick client into thinking we are PMC and in offline mode to allow loading of scavs in PVE mode /// Modifys the raidsettings to retain raidsettings options in menu and allows scav to load into raid
/// </summary> /// </summary>
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
@ -16,10 +21,15 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref RaidSettings ___raidSettings_0) private static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1, MainMenuController __instance)
{ {
StoredRaidsettings = ___raidSettings_0;
StoredRaidsettings1 = ___raidSettings_1;
___raidSettings_0.RaidMode = ERaidMode.Local; ___raidSettings_0.RaidMode = ERaidMode.Local;
___raidSettings_0.IsPveOffline = true; ___raidSettings_0.IsPveOffline = true;
___raidSettings_0.WavesSettings = ___raidSettings_1.WavesSettings;
___raidSettings_0.BotSettings = ___raidSettings_1.BotSettings;
___raidSettings_1.Apply(___raidSettings_0);
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(ref RaidSettings ___raidSettings_0) private static void PatchPostfix(ref RaidSettings ___raidSettings_0)

View File

@ -55,12 +55,12 @@ namespace SPT.SinglePlayer
new DisableMatchmakerPlayerPreviewButtonsPatch().Enable(); new DisableMatchmakerPlayerPreviewButtonsPatch().Enable();
new EnableRefForPVEPatch().Enable(); new EnableRefForPVEPatch().Enable();
new EnableRefIntermScreenPatch().Enable(); new EnableRefIntermScreenPatch().Enable();
//new EnablePlayerScavPatch().Enable(); new EnablePlayerScavPatch().Enable();
new ScavFoundInRaidPatch().Enable(); new ScavFoundInRaidPatch().Enable();
new GetProfileAtEndOfRaidPatch().Enable(); new GetProfileAtEndOfRaidPatch().Enable();
new FixSavageInventoryScreenPatch().Enable(); new FixSavageInventoryScreenPatch().Enable();
new InsuranceScreenPatch().Enable(); new InsuranceScreenPatch().Enable();
//new ApplyRaidSettingsPatch().Enable(); //new ApplyRaidSettingsPatch().Enable(); Should be no longer needed keeping here just to be safe.
new FixQuestAchieveControllersPatch().Enable(); new FixQuestAchieveControllersPatch().Enable();
} }
catch (Exception ex) catch (Exception ex)