mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
Add patch to allow raids with DevMask on any profile
This commit is contained in:
parent
8242f66024
commit
fafa54db32
@ -0,0 +1,56 @@
|
|||||||
|
using SPT.Reflection.CodeWrapper;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using SPT.Reflection.Utils;
|
||||||
|
using EFT;
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
|
||||||
|
namespace SPT.SinglePlayer.Patches.RaidFix;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// BSG now block the use of the DevBalaclava on anything but a Dev Profile
|
||||||
|
/// this will replace the string it checks for to a bogus string,
|
||||||
|
/// allowing us entry.
|
||||||
|
/// TODO: change to remove the whole check as its expensive for no reason. Thanks BSG
|
||||||
|
/// </summary>
|
||||||
|
public class DisableDevMaskCheckPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(LocalPlayer.Struct520), nameof(LocalPlayer.Struct520.MoveNext));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchTranspiler]
|
||||||
|
private static IEnumerable<CodeInstruction> Transpiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
|
||||||
|
{
|
||||||
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
|
|
||||||
|
// Search for the code where the string "58ac60eb86f77401897560ff Name" is
|
||||||
|
var searchCode = new CodeInstruction(OpCodes.Ldstr, "58ac60eb86f77401897560ff Name");
|
||||||
|
var searchIndex = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < codes.Count; i++)
|
||||||
|
{
|
||||||
|
if (codes[i].opcode == searchCode.opcode && codes[i].operand == searchCode.operand)
|
||||||
|
{
|
||||||
|
searchIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Patch Failed
|
||||||
|
if (searchIndex == -1)
|
||||||
|
{
|
||||||
|
Logger.LogError($"Patch {MethodBase.GetCurrentMethod().Name} Failed: Could not find reference Code");
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newCodeToUse = new CodeInstruction(OpCodes.Ldstr, "FuCkOfFbSg");
|
||||||
|
codes[searchIndex] = newCodeToUse;
|
||||||
|
|
||||||
|
return codes.AsEnumerable();
|
||||||
|
}
|
||||||
|
}
|
@ -68,7 +68,7 @@ namespace SPT.SinglePlayer
|
|||||||
|
|
||||||
// 4.0.0
|
// 4.0.0
|
||||||
new ScavPrestigeFixPatch().Enable();
|
new ScavPrestigeFixPatch().Enable();
|
||||||
|
new DisableDevMaskCheckPatch().Enable();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user