2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Custom.BTR.Patches;
|
|
|
|
|
using SPT.Reflection.Patching;
|
|
|
|
|
using SPT.SinglePlayer.Utils.TraderServices;
|
2024-01-08 08:53:35 +00:00
|
|
|
|
using EFT;
|
|
|
|
|
using EFT.UI;
|
|
|
|
|
using HarmonyLib;
|
|
|
|
|
using System.Reflection;
|
2024-06-13 14:25:36 +01:00
|
|
|
|
using DialogControlClass = GClass1973;
|
2024-01-08 08:53:35 +00:00
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.Debugging.Patches
|
2024-01-08 08:53:35 +00:00
|
|
|
|
{
|
|
|
|
|
// Enable the `debug_show_dialog_screen` command, and custom `btr_deliver_items` command
|
|
|
|
|
internal class BTRDebugCommandPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
|
|
|
|
return AccessTools.Method(typeof(ConsoleScreen), nameof(ConsoleScreen.InitConsole));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
internal static void PatchPostfix()
|
|
|
|
|
{
|
2024-01-24 11:08:16 +00:00
|
|
|
|
ConsoleScreen.Processor.RegisterCommandGroup<DialogControlClass>();
|
2024-01-08 08:53:35 +00:00
|
|
|
|
ConsoleScreen.Processor.RegisterCommand("btr_deliver_items", new System.Action(BtrDeliverItemsCommand));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Custom command to force item extraction sending
|
|
|
|
|
public static void BtrDeliverItemsCommand()
|
|
|
|
|
{
|
|
|
|
|
BTREndRaidItemDeliveryPatch.PatchPrefix();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// When running the `debug_show_dialog_screen` command, fetch the service data first, and force debug off
|
|
|
|
|
public class BTRDebugDataPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-01-24 11:08:16 +00:00
|
|
|
|
return AccessTools.Method(typeof(DialogControlClass), nameof(DialogControlClass.ShowDialogScreen));
|
2024-01-08 08:53:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPrefix]
|
|
|
|
|
internal static void PatchPrefix(Profile.ETraderServiceSource traderServiceSourceType, ref bool useDebugData)
|
|
|
|
|
{
|
|
|
|
|
useDebugData = false;
|
2024-01-15 09:09:31 +00:00
|
|
|
|
TraderServicesManager.Instance.GetTraderServicesDataFromServer(Profile.TraderInfo.TraderServiceToId[traderServiceSourceType]);
|
2024-01-08 08:53:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|