mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Make sure the patch only runs while ingame and on a scav
This commit is contained in:
parent
a798508ed1
commit
1759abd842
@ -3,6 +3,8 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Aki.Reflection.Patching;
|
using Aki.Reflection.Patching;
|
||||||
using Aki.Reflection.Utils;
|
using Aki.Reflection.Utils;
|
||||||
|
using Comfort.Common;
|
||||||
|
using EFT;
|
||||||
using EFT.UI.DragAndDrop;
|
using EFT.UI.DragAndDrop;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
|
||||||
@ -10,19 +12,30 @@ namespace Aki.Custom.Patches
|
|||||||
{
|
{
|
||||||
|
|
||||||
public class ScavItemCheckmarkPatch : ModulePatch
|
public class ScavItemCheckmarkPatch : ModulePatch
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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
|
||||||
|
/// </summary>
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(QuestItemViewPanel), nameof(QuestItemViewPanel.smethod_0));
|
return AccessTools.Method(typeof(QuestItemViewPanel), nameof(QuestItemViewPanel.smethod_0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void PatchPreFix(ref IEnumerable<QuestDataClass> quests)
|
private static void PatchPreFix(ref IEnumerable<QuestDataClass> quests)
|
||||||
{
|
{
|
||||||
var pmcQuests = PatchConstants.BackEndSession.Profile.QuestsData;
|
var gameWorld = Singleton<GameWorld>.Instance;
|
||||||
var scavQuests = PatchConstants.BackEndSession.ProfileOfPet.QuestsData;
|
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user