From 853a74a4490c59ccb2e9398e9b15a370b383edcc Mon Sep 17 00:00:00 2001 From: Kaeno Date: Tue, 20 Aug 2024 19:00:11 +0100 Subject: [PATCH] Patch updates --- .../SPT.Custom/CustomAI/PmcFoundInRaidEquipment.cs | 12 ++++++++---- project/SPT.Custom/Patches/IsEnemyPatch.cs | 4 ++-- .../Patches/PMCBotSpawnLocationPatch.cs | 2 +- project/SPT.Debugging/Patches/ReloadClientPatch.cs | 2 +- .../RaidFix/FixQuestAchieveControllersPatch.cs | 3 ++- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/project/SPT.Custom/CustomAI/PmcFoundInRaidEquipment.cs b/project/SPT.Custom/CustomAI/PmcFoundInRaidEquipment.cs index f3cfad7..7605262 100644 --- a/project/SPT.Custom/CustomAI/PmcFoundInRaidEquipment.cs +++ b/project/SPT.Custom/CustomAI/PmcFoundInRaidEquipment.cs @@ -43,6 +43,7 @@ namespace SPT.Custom.CustomAI public void ConfigurePMCFindInRaidStatus(BotOwner ___botOwner_0) { + // Must run before the container loot code, otherwise backpack loot is not FiR MakeEquipmentNotFiR(___botOwner_0); @@ -73,15 +74,18 @@ namespace SPT.Custom.CustomAI continue; } - // Don't add FiR to tacvest items PMC usually brings into raid (meds/mags etc) - if (container.Name == "TacticalVest" && nonFiRItems.Any(item.Template._parent.Contains)) + string parentId = item.Template.Parent._id; + // item.Template._parent.Contains is what it use to be. + + // Don't add FiR to tacvest items PMC usually brings into raid (meds/mags etc) + if (container.Name == "TacticalVest" && nonFiRItems.Any(parentId.Contains)) { //this.logger.LogError($"Skipping item {item.Id} {item.Name} as its on the item type blacklist"); continue; } // Don't add FiR to weapons in backpack (server sometimes adds pre-made weapons to backpack to simulate PMCs looting bodies) - if (container.Name == "Backpack" && weaponTypeIds.Any(item.Template._parent.Contains)) + if (container.Name == "Backpack" && weaponTypeIds.Any(parentId.Contains)) { // Add weapon root to list for later use nonFiRRootItems.Add(item); @@ -90,7 +94,7 @@ namespace SPT.Custom.CustomAI } // Don't add FiR to grenades/mags/ammo/meds in pockets - if (container.Name == "Pockets" && nonFiRPocketLoot.Exists(item.Template._parent.Contains)) + if (container.Name == "Pockets" && nonFiRPocketLoot.Exists(parentId.Contains)) { //this.logger.LogError($"Skipping item {item.Id} {item.Name} as its on the item type blacklist"); continue; diff --git a/project/SPT.Custom/Patches/IsEnemyPatch.cs b/project/SPT.Custom/Patches/IsEnemyPatch.cs index 35a6caf..382c1b6 100644 --- a/project/SPT.Custom/Patches/IsEnemyPatch.cs +++ b/project/SPT.Custom/Patches/IsEnemyPatch.cs @@ -109,7 +109,7 @@ namespace SPT.Custom.Patches return false; } - return requester.IsAI && requesterMind.DEFAULT_USEC_BEHAVIOUR == EWarnBehaviour.Attack && requester.Side == EPlayerSide.Usec; + return requester.IsAI && requesterMind.DEFAULT_USEC_BEHAVIOUR == EWarnBehaviour.AlwaysEnemies && requester.Side == EPlayerSide.Usec; } /// @@ -126,7 +126,7 @@ namespace SPT.Custom.Patches return false; } - return requester.IsAI && requesterMind.DEFAULT_BEAR_BEHAVIOUR == EWarnBehaviour.Attack && requester.Side == EPlayerSide.Bear; + return requester.IsAI && requesterMind.DEFAULT_BEAR_BEHAVIOUR == EWarnBehaviour.AlwaysEnemies && requester.Side == EPlayerSide.Bear; } } } diff --git a/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs b/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs index c7bdd39..8c80a97 100644 --- a/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs +++ b/project/SPT.Debugging/Patches/PMCBotSpawnLocationPatch.cs @@ -61,7 +61,7 @@ namespace SPT.Debugging.Patches } [PatchPrefix] - public static bool PatchPrefix(GClass1503 __instance, BotCreationDataClass data) + public static bool PatchPrefix(GClass1573 __instance, BotCreationDataClass data) { var firstBotRole = data.Profiles[0].Info.Settings.Role; if (firstBotRole != WildSpawnType.pmcBEAR || firstBotRole != WildSpawnType.pmcUSEC) diff --git a/project/SPT.Debugging/Patches/ReloadClientPatch.cs b/project/SPT.Debugging/Patches/ReloadClientPatch.cs index 59f743c..8096106 100644 --- a/project/SPT.Debugging/Patches/ReloadClientPatch.cs +++ b/project/SPT.Debugging/Patches/ReloadClientPatch.cs @@ -26,7 +26,7 @@ namespace SPT.Debugging.Patches "\nMay Cause Unexpected Behaviors inraid")] public static void Reload() { - Reflection.Utils.ClientAppUtils.GetMainApp().method_52().HandleExceptions(); + Reflection.Utils.ClientAppUtils.GetMainApp().method_51().HandleExceptions(); } } } diff --git a/project/SPT.SinglePlayer/Patches/RaidFix/FixQuestAchieveControllersPatch.cs b/project/SPT.SinglePlayer/Patches/RaidFix/FixQuestAchieveControllersPatch.cs index d5a3785..9d5a200 100644 --- a/project/SPT.SinglePlayer/Patches/RaidFix/FixQuestAchieveControllersPatch.cs +++ b/project/SPT.SinglePlayer/Patches/RaidFix/FixQuestAchieveControllersPatch.cs @@ -1,5 +1,6 @@ using System.Reflection; using EFT; +using EFT.InventoryLogic; using HarmonyLib; using SPT.Reflection.Patching; using SPT.Reflection.Utils; @@ -17,7 +18,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix } [PatchPostfix] - public static void PatchPostfix(Profile profile, InventoryControllerClass inventoryController, ref AbstractQuestControllerClass ____questController, ref AbstractAchievementControllerClass ____achievementsController) + public static void PatchPostfix(Profile profile, InventoryController inventoryController, ref AbstractQuestControllerClass ____questController, ref AbstractAchievementControllerClass ____achievementsController) { var questController = new LocalQuestControllerClass(profile, inventoryController, PatchConstants.BackEndSession, true); questController.Init();