Keep messages open after transfer
This commit is contained in:
55
Patches/KeepMessagesOpenPatches.cs
Normal file
55
Patches/KeepMessagesOpenPatches.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,7 @@ namespace UIFixes
|
|||||||
InsureContextMenuPatches.Enable();
|
InsureContextMenuPatches.Enable();
|
||||||
TradingAutoSwitchPatches.Enable();
|
TradingAutoSwitchPatches.Enable();
|
||||||
AddOfferRememberAutoselectPatches.Enable();
|
AddOfferRememberAutoselectPatches.Enable();
|
||||||
|
KeepMessagesOpenPatches.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InRaid()
|
public static bool InRaid()
|
||||||
|
|||||||
10
Settings.cs
10
Settings.cs
@@ -32,6 +32,7 @@ namespace UIFixes
|
|||||||
// General
|
// General
|
||||||
public static ConfigEntry<WeaponPresetConfirmationOption> ShowPresetConfirmations { get; set; }
|
public static ConfigEntry<WeaponPresetConfirmationOption> ShowPresetConfirmations { get; set; }
|
||||||
public static ConfigEntry<TransferConfirmationOption> ShowTransferConfirmations { 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> AutofillQuestTurnIns { get; set; }
|
||||||
public static ConfigEntry<bool> AutoSwitchTrading { get; set; }
|
public static ConfigEntry<bool> AutoSwitchTrading { get; set; }
|
||||||
|
|
||||||
@@ -93,6 +94,15 @@ namespace UIFixes
|
|||||||
null,
|
null,
|
||||||
new ConfigurationManagerAttributes { })));
|
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(
|
configEntries.Add(AutofillQuestTurnIns = config.Bind(
|
||||||
GeneralSection,
|
GeneralSection,
|
||||||
"Autofill Quest Item Turn-ins",
|
"Autofill Quest Item Turn-ins",
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<Reference Include="Comfort">
|
<Reference Include="Comfort">
|
||||||
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Comfort.Unity">
|
||||||
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\Comfort.Unity.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="ItemComponent.Types">
|
<Reference Include="ItemComponent.Types">
|
||||||
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
<HintPath>$(PathToSPT)\EscapeFromTarkov_Data\Managed\ItemComponent.Types.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
Reference in New Issue
Block a user