Keep messages open after transfer

This commit is contained in:
Tyfon
2024-05-31 15:32:32 -07:00
parent fc948fff71
commit a9c60d33e7
4 changed files with 69 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
using Aki.Reflection.Patching;
using EFT.UI;
using EFT.UI.Chat;
using EFT.UI.Screens;
using HarmonyLib;
using System.Reflection;
namespace UIFixes
{
public static class KeepMessagesOpenPatches
{
private static bool ReopenMessages = false;
public static void Enable()
{
new SniffChatPanelClosePatch().Enable();
new ReopenMessagesPatch().Enable();
}
public class SniffChatPanelClosePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(ChatScreen), nameof(ChatScreen.method_6));
}
[PatchPostfix]
public static void Postfix()
{
if (Settings.KeepMessagesOpen.Value)
{
ReopenMessages = true;
}
}
}
public class ReopenMessagesPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_0));
}
[PatchPostfix]
public static void Postfix(MainMenuController __instance, EEftScreenType eftScreenType)
{
if (Settings.KeepMessagesOpen.Value && eftScreenType != EEftScreenType.TransferItems && ReopenMessages)
{
ReopenMessages = false;
__instance.ShowScreen(EMenuType.Chat, true);
}
}
}
}
}

View File

@@ -40,6 +40,7 @@ namespace UIFixes
InsureContextMenuPatches.Enable();
TradingAutoSwitchPatches.Enable();
AddOfferRememberAutoselectPatches.Enable();
KeepMessagesOpenPatches.Enable();
}
public static bool InRaid()

View File

@@ -32,6 +32,7 @@ namespace UIFixes
// General
public static ConfigEntry<WeaponPresetConfirmationOption> ShowPresetConfirmations { get; set; }
public static ConfigEntry<TransferConfirmationOption> ShowTransferConfirmations { get; set; }
public static ConfigEntry<bool> KeepMessagesOpen { get; set; }
public static ConfigEntry<bool> AutofillQuestTurnIns { get; set; }
public static ConfigEntry<bool> AutoSwitchTrading { get; set; }
@@ -93,6 +94,15 @@ namespace UIFixes
null,
new ConfigurationManagerAttributes { })));
configEntries.Add(KeepMessagesOpen = config.Bind(
GeneralSection,
"Keep Messages Window Open After Transfer",
true,
new ConfigDescription(
"After receiving items from a transfer, reopen the messages window where you left off",
null,
new ConfigurationManagerAttributes { })));
configEntries.Add(AutofillQuestTurnIns = config.Bind(
GeneralSection,
"Autofill Quest Item Turn-ins",

View File

@@ -33,6 +33,9 @@
<Reference Include="Comfort">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
</Reference>
<Reference Include="Comfort.Unity">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.Unity.dll</HintPath>
</Reference>
<Reference Include="ItemComponent.Types">
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
</Reference>