mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
- Reads service list from server - Properly calculates cost of taxi and delivery service - Only allows sending items to stash once per raid - Enable service debug commands `debug_show_dialog_screen` and `btr_deliver_items` (Only usable in raid) - Implements delivery of items via the BTR to stash Does not currently implement usage of taxi service Requires server PR: SPT-AKI/Server#187 Opening a PR at this point because the next processes can be built on top of this as separate tasks, and this is at a good usable state Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: SPT-AKI/Modules#53 Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com> Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
47 lines
1.5 KiB
C#
47 lines
1.5 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), "Close");
|
|
}
|
|
|
|
[PatchPostfix]
|
|
public static async 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;
|
|
}
|
|
|
|
// NOTE: This is just here so I remember how to get the items the player transfered
|
|
gameWorld.BtrController.GetOrAddTransferContainer(player.Profile.Id);
|
|
|
|
// Update the trader services information now that we've used this service
|
|
btrManager.SetServicePurchased(ETraderServiceType.BtrItemsDelivery, BTRUtil.BTRTraderId);
|
|
BTRUtil.UpdateTraderServices(BTRUtil.BTRTraderId);
|
|
}
|
|
}
|
|
}
|