diff --git a/project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs b/project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs new file mode 100644 index 0000000..c9825fb --- /dev/null +++ b/project/SPT.Custom/Patches/EnablePrestigeTabPatch.cs @@ -0,0 +1,40 @@ +using EFT.UI; +using HarmonyLib; +using SPT.Reflection.Patching; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; + +namespace SPT.Custom.Patches +{ + /// + /// This transpiler removes the call to to determine if it's
+ /// and forces a true instead + ///
+ internal class EnablePrestigeTabPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(InventoryScreen.Class2754), nameof(InventoryScreen.Class2754.MoveNext)); + } + + [PatchTranspiler] + public static IEnumerable Transpile(IEnumerable instructions) + { + CodeInstruction[] codeInstructions = instructions.ToArray(); + + // Remove all instructions that gets the gamemode from iSession + codeInstructions[259] = new(OpCodes.Nop); + codeInstructions[260] = new(OpCodes.Nop); + codeInstructions[261] = new(OpCodes.Nop); + codeInstructions[262] = new(OpCodes.Nop); + codeInstructions[263] = new(OpCodes.Nop); + + // Force a true on the stack instead + codeInstructions[264] = new(OpCodes.Ldc_I4_1); + + return codeInstructions; + } + } +} diff --git a/project/SPT.Custom/SPTCustomPlugin.cs b/project/SPT.Custom/SPTCustomPlugin.cs index 7dc8df0..9d16734 100644 --- a/project/SPT.Custom/SPTCustomPlugin.cs +++ b/project/SPT.Custom/SPTCustomPlugin.cs @@ -48,6 +48,9 @@ namespace SPT.Custom new AllowAirdropsInPvEPatch().Enable(); new MemoryCollectionPatch().Enable(); + // 4.0 + new EnablePrestigeTabPatch().Enable(); + HookObject.AddComponent(); } catch (Exception ex)