0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 08:10:45 -05:00
modules/project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs
2025-01-30 12:18:13 +00:00

29 lines
964 B
C#

using EFT.UI;
using HarmonyLib;
using SPT.Reflection.Patching;
using System.Collections.Generic;
using System.Reflection;
namespace SPT.Custom.Patches
{
/// <summary>
/// This patch sets the Prestige Tab to be enabled in PvE mode
/// </summary>
internal class EnablePrestigeTabPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(InventoryScreen.Class2752), nameof(InventoryScreen.Class2752.MoveNext));
}
[PatchPostfix]
public static void Postfix(InventoryScreen.Class2752 __instance)
{
var inventoryScreen = __instance.inventoryScreen_0;
var tabDictionary = Traverse.Create(inventoryScreen).Field<IReadOnlyDictionary<EInventoryTab, Tab>>("_tabDictionary").Value;
var prestigeTab = tabDictionary[EInventoryTab.Prestige];
prestigeTab.gameObject.SetActive(true);
}
}
}