mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Should make the BTR work again. I've also switched named methods to use "nameof" where it made sense. And removed an unnecessary method call and fixed an incorrect async on one of my patches Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: SPT-AKI/Modules#59 Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com> Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using Aki.Debugging.BTR.Utils;
|
|
using Aki.Reflection.Patching;
|
|
using Comfort.Common;
|
|
using EFT;
|
|
using EFT.UI;
|
|
using HarmonyLib;
|
|
using System.Reflection;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aki.Debugging.BTR.Patches
|
|
{
|
|
public class BTRTransferItemsPatch : ModulePatch
|
|
{
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
|
|
return AccessTools.Method(typeof(TransferItemsInRaidScreen), nameof(TransferItemsInRaidScreen.Close));
|
|
}
|
|
|
|
[PatchPostfix]
|
|
public static void PatchPostfix(bool ___bool_1)
|
|
{
|
|
// Didn't extract items
|
|
if (!___bool_1)
|
|
{
|
|
return;
|
|
}
|
|
|
|
GameWorld gameWorld = Singleton<GameWorld>.Instance;
|
|
var player = gameWorld?.MainPlayer;
|
|
var btrManager = gameWorld?.GetComponent<BTRManager>();
|
|
if (gameWorld == null || player == null || btrManager == null)
|
|
{
|
|
Logger.LogError("[AKI-BTR] BTRTransferItemsPatch - Error fetching game objects");
|
|
return;
|
|
}
|
|
|
|
// Update the trader services information now that we've used this service
|
|
btrManager.SetServicePurchased(ETraderServiceType.BtrItemsDelivery, BTRUtil.BTRTraderId);
|
|
BTRUtil.UpdateTraderServices(BTRUtil.BTRTraderId);
|
|
}
|
|
}
|
|
}
|