0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.SinglePlayer/Patches/Progression/MidRaidQuestChangePatch.cs
DrakiaXYZ e3bdf9c1fd Update for 28375 + fixes (!47)
- Update GClass references
- Fix incorrect method in InsuranceScreenPatch (Makes insurance screen actually show)
- Fix incorrect method in Scav offline raid screen patch (Makes "Ready" from the practice screen start the raid)
- Update hollowed.dll with one provided by Chomp

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: SPT-AKI/Modules#47
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
2023-12-29 09:43:15 +00:00

41 lines
1.3 KiB
C#

using Aki.Reflection.Patching;
using Comfort.Common;
using EFT;
using HarmonyLib;
using System.Linq;
using System.Reflection;
namespace Aki.SinglePlayer.Patches.Progression
{
/// <summary>
/// After picking up a quest item, trigger CheckForStatusChange() from the questController to fully update a quest subtasks to show (e.g. `survive and extract item from raid` task)
/// </summary>
public class MidRaidQuestChangePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Profile).GetMethod("AddToCarriedQuestItems", BindingFlags.Public | BindingFlags.Instance);
}
[PatchPostfix]
private static void PatchPostfix()
{
var gameWorld = Singleton<GameWorld>.Instance;
if (gameWorld != null)
{
var player = gameWorld.MainPlayer;
var questController = Traverse.Create(player).Field<GClass3201>("_questController").Value;
if (questController != null)
{
foreach (var quest in questController.Quests.ToList())
{
quest.CheckForStatusChange(true, true);
}
}
}
}
}
}