From 1759abd8420bf3b895f6cf9d4083dce7a1a10d51 Mon Sep 17 00:00:00 2001 From: Kaeno Date: Fri, 16 Feb 2024 15:49:18 +0000 Subject: [PATCH] Make sure the patch only runs while ingame and on a scav --- .../Patches/ScavItemCheckmarkPatch.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/project/Aki.Custom/Patches/ScavItemCheckmarkPatch.cs b/project/Aki.Custom/Patches/ScavItemCheckmarkPatch.cs index 7093524..0c85112 100644 --- a/project/Aki.Custom/Patches/ScavItemCheckmarkPatch.cs +++ b/project/Aki.Custom/Patches/ScavItemCheckmarkPatch.cs @@ -3,6 +3,8 @@ using System.Linq; using System.Reflection; using Aki.Reflection.Patching; using Aki.Reflection.Utils; +using Comfort.Common; +using EFT; using EFT.UI.DragAndDrop; using HarmonyLib; @@ -10,19 +12,30 @@ namespace Aki.Custom.Patches { public class ScavItemCheckmarkPatch : ModulePatch - { + { + /// + /// This patch runs both inraid and on main Menu everytime the inventory is loaded + /// Aim is to let Scavs see what required items your PMC needs for quests like Live using the FiR status + /// protected override MethodBase GetTargetMethod() { return AccessTools.Method(typeof(QuestItemViewPanel), nameof(QuestItemViewPanel.smethod_0)); } [PatchPrefix] - public static void PatchPreFix(ref IEnumerable quests) + private static void PatchPreFix(ref IEnumerable quests) { - var pmcQuests = PatchConstants.BackEndSession.Profile.QuestsData; - var scavQuests = PatchConstants.BackEndSession.ProfileOfPet.QuestsData; + var gameWorld = Singleton.Instance; - quests = pmcQuests.Concat(scavQuests); + if (gameWorld != null) + { + if (gameWorld.MainPlayer.Location != "hideout" && gameWorld.MainPlayer.Fraction == ETagStatus.Scav) + { + var pmcQuests = PatchConstants.BackEndSession.Profile.QuestsData; + var scavQuests = PatchConstants.BackEndSession.ProfileOfPet.QuestsData; + quests = pmcQuests.Concat(scavQuests); + } + } } } } \ No newline at end of file