2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
2024-02-10 08:31:18 +00:00
|
|
|
|
using EFT;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.SinglePlayer.Patches.Progression
|
2024-02-10 08:31:18 +00:00
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* There is no reason to update quest counters when exiting the hideout, so set the
|
|
|
|
|
* player's QuestController to null while calling HideoutPlayer.OnGameSessionEnd to
|
|
|
|
|
* avoid the quest controller counters from being triggered
|
|
|
|
|
*
|
|
|
|
|
* Note: Player.OnGameSessionEnd handles the player's quest controller not being set gracefully
|
|
|
|
|
*/
|
|
|
|
|
public class HideoutQuestIgnorePatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(HideoutPlayer), nameof(HideoutPlayer.OnGameSessionEnd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static void PatchPrefix(ref AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
|
2024-02-10 08:31:18 +00:00
|
|
|
|
{
|
|
|
|
|
__state = ____questController;
|
|
|
|
|
____questController = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
2024-08-02 16:57:59 +01:00
|
|
|
|
public static void PatchPostfix(AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
|
2024-02-10 08:31:18 +00:00
|
|
|
|
{
|
|
|
|
|
____questController = __state;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|