mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Add a patch to track when we place items at quest locations for use in insurance. Reviewed-on: SPT/Modules#131 Co-authored-by: Kaeno <kaeno@noreply.dev.sp-tarkov.com> Co-committed-by: Kaeno <kaeno@noreply.dev.sp-tarkov.com>
27 lines
678 B
C#
27 lines
678 B
C#
using HarmonyLib;
|
|
using SPT.Reflection.Patching;
|
|
using System.Reflection;
|
|
using static GetActionsClass;
|
|
|
|
namespace SPT.Custom.Patches
|
|
{
|
|
public class InsurancePlaceItem : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return AccessTools.Method(typeof(Class1492), nameof(Class1492.method_0));
|
|
}
|
|
|
|
[PatchPostfix]
|
|
private static void PatchPostfix(Class1492 __instance, bool successful)
|
|
{
|
|
if (!successful)
|
|
{
|
|
return;
|
|
}
|
|
|
|
SinglePlayer.Utils.Insurance.InsuredItemManager.Instance.SetPlacedItem(__instance.resultItem);
|
|
}
|
|
}
|
|
}
|