0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs

29 lines
964 B
C#
Raw Normal View History

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()
{
2025-01-30 12:18:13 +00:00
return AccessTools.Method(typeof(InventoryScreen.Class2752), nameof(InventoryScreen.Class2752.MoveNext));
}
[PatchPostfix]
2025-01-30 12:18:13 +00:00
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);
}
}
}