diff --git a/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs b/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs deleted file mode 100644 index f2af68d..0000000 --- a/project/SPT.Custom/Patches/ExitWhileLootingPatch.cs +++ /dev/null @@ -1,40 +0,0 @@ -using SPT.Reflection.Patching; -using Comfort.Common; -using EFT; -using System.Reflection; -using HarmonyLib; - -namespace SPT.Custom.Patches -{ - /// - /// Fix a bsg bug that causes the game to soft-lock when you have a container opened when extracting - /// - public class ExitWhileLootingPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return AccessTools.Method(typeof(BaseLocalGame), nameof(BaseLocalGame.Stop)); - } - - // Look at BaseLocalGame and find a method named "Stop" - // once you find it, there should be a StartBlackScreenShow method with - // a callback method (on dnspy will be called @class.method_0) - // Go into that method. This will be part of the code: - // if (GClass2505.CheckCurrentScreen(EScreenType.Reconnect)) - // { - // GClass2505.CloseAllScreensForced(); - // } - // The code INSIDE the if needs to run - [PatchPrefix] - private static bool PatchPrefix(string profileId) - { - var player = Singleton.Instance.MainPlayer; - if (profileId == player?.Profile.Id) - { - CurrentScreenSingleton.Instance.CloseAllScreensForced(); - } - - return true; - } - } -} diff --git a/project/SPT.Custom/Patches/FixBrokenSpawnOnSandboxPatch.cs b/project/SPT.Custom/Patches/FixBrokenSpawnOnSandboxPatch.cs deleted file mode 100644 index 9937614..0000000 --- a/project/SPT.Custom/Patches/FixBrokenSpawnOnSandboxPatch.cs +++ /dev/null @@ -1,46 +0,0 @@ -using SPT.Common.Http; -using SPT.Reflection.Patching; -using Comfort.Common; -using EFT; -using HarmonyLib; -using Newtonsoft.Json; -using System.Linq; -using System.Reflection; - -namespace SPT.Custom.Patches -{ - /// - /// Fixes the map sandbox from only spawning 1 bot at start of game as well as fixing no spawns till all bots are dead. - /// Remove once BSG decides to fix their map - /// - public class FixBrokenSpawnOnSandboxPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted)); - } - - [PatchPrefix] - private static void PatchPrefix() - { - var gameWorld = Singleton.Instance; - if (gameWorld == null) - { - return; - } - - var playerLocation = gameWorld.MainPlayer.Location; - - if (playerLocation == "Sandbox" || playerLocation == "Sandbox_high") - { - LocationScene.GetAll().ToList().First(zone => zone.name == "ZoneSandbox").MaxPersonsOnPatrol = GetMaxPatrolValueFromServer(); - } - } - - public static int GetMaxPatrolValueFromServer() - { - string json = RequestHandler.GetJson("/singleplayer/sandbox/maxpatrol"); - return JsonConvert.DeserializeObject(json); - } - } -} diff --git a/project/SPT.Custom/SPTCustomPlugin.cs b/project/SPT.Custom/SPTCustomPlugin.cs index 1517414..0398151 100644 --- a/project/SPT.Custom/SPTCustomPlugin.cs +++ b/project/SPT.Custom/SPTCustomPlugin.cs @@ -23,8 +23,6 @@ namespace SPT.Custom new EasyBundlePatch().Enable(); // TODO: check if these patches are needed - new QTEPatch().Enable(); - new IsEnemyPatch().Enable(); new BotCalledDataTryCallPatch().Enable(); new BotCallForHelpCallBotPatch().Enable(); new BotOwnerDisposePatch().Enable(); @@ -32,19 +30,21 @@ namespace SPT.Custom new AddEnemyToAllGroupsInBotZonePatch().Enable(); new CustomAiPatch().Enable(); new AddTraitorScavsPatch().Enable(); - new ExitWhileLootingPatch().Enable(); new PmcFirstAidPatch().Enable(); new SettingsLocationPatch().Enable(); new SetLocationIdOnRaidStartPatch().Enable(); new RagfairFeePatch().Enable(); new ScavQuestPatch().Enable(); - new FixBrokenSpawnOnSandboxPatch().Enable(); new ResetTraderServicesPatch().Enable(); new ScavItemCheckmarkPatch().Enable(); new CultistAmuletRemovalPatch().Enable(); new HalloweenExtractPatch().Enable(); + // Needed but needs editing + new IsEnemyPatch().Enable(); + // Still need + new QTEPatch().Enable(); new FileCachePatch().Enable(); new BotSelfEnemyPatch().Enable(); new DisablePvEPatch().Enable(); diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs index 52a644d..976954c 100644 --- a/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs +++ b/project/SPT.SinglePlayer/Patches/ScavMode/EnablePlayerScavPatch.cs @@ -5,40 +5,21 @@ using System.Reflection; namespace SPT.SinglePlayer.Patches.ScavMode { - internal class EnablePlayerScavPatch : ModulePatch + public class EnablePlayerScavPatch : ModulePatch { - public static ERaidMode storedRaidMode; - public static ESideType storedSide; - public static bool storedOnlineRaidInPVE; - /// - /// Temporarily trick client into thinking we are PMC and in offline mode to allow loading of scavs in PVE mode + /// Change Raid Mode to local and ForceOnlineRaidInPVE to true to allow loading in as a scav /// protected override MethodBase GetTargetMethod() { return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_22)); } - [PatchPrefix] - private static void PatchPrefix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession) - { - // Store old settings to restore them later in postfix - storedRaidMode = ___raidSettings_0.RaidMode; - storedSide = ___raidSettings_0.Side; - storedOnlineRaidInPVE = ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE; - - - ___raidSettings_0.RaidMode = ERaidMode.Online; - ___raidSettings_0.Side = ESideType.Pmc; - ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = false; - } - [PatchPostfix] private static void PatchPostfix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession) { - ___raidSettings_0.RaidMode = storedRaidMode; - ___raidSettings_0.Side = storedSide; - ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = storedOnlineRaidInPVE; + ___raidSettings_0.RaidMode = ERaidMode.Local; + ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = true; } } } diff --git a/project/SPT.SinglePlayer/Patches/ScavMode/ScavFoundInRaidPatch.cs b/project/SPT.SinglePlayer/Patches/ScavMode/ScavFoundInRaidPatch.cs new file mode 100644 index 0000000..3b15127 --- /dev/null +++ b/project/SPT.SinglePlayer/Patches/ScavMode/ScavFoundInRaidPatch.cs @@ -0,0 +1,31 @@ +using EFT; +using HarmonyLib; +using SPT.Reflection.Patching; +using System.Reflection; + +namespace SPT.SinglePlayer.Patches.ScavMode +{ + public class ScavFoundInRaidPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted)); + } + + [PatchPrefix] + private static void PatchPrefix(GameWorld __instance) + { + var player = __instance.MainPlayer; + + if (player == null || player.Profile.Side != EPlayerSide.Savage) + { + return; + } + + foreach (var item in player.Profile.Inventory.AllRealPlayerItems) + { + item.SpawnedInSession = true; + } + } + } +}