mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 07:10:44 -05:00
Profile is now on its own interface, added new interfaceType to patchConstants and fixed the two scav patches
This commit is contained in:
parent
c340023378
commit
a3684c8663
@ -19,6 +19,7 @@ namespace Aki.Reflection.Utils
|
|||||||
public static Type ExfilPointManagerType { get; private set; }
|
public static Type ExfilPointManagerType { get; private set; }
|
||||||
public static Type SessionInterfaceType { get; private set; }
|
public static Type SessionInterfaceType { get; private set; }
|
||||||
public static Type BackendSessionInterfaceType { get; private set; }
|
public static Type BackendSessionInterfaceType { get; private set; }
|
||||||
|
public static Type BackendProfileInterfaceType { get; private set; }
|
||||||
|
|
||||||
private static ISession _backEndSession;
|
private static ISession _backEndSession;
|
||||||
public static ISession BackEndSession
|
public static ISession BackEndSession
|
||||||
@ -47,6 +48,7 @@ namespace Aki.Reflection.Utils
|
|||||||
ExfilPointManagerType = EftTypes.SingleCustom(x => x.GetMethod("InitAllExfiltrationPoints") != null);
|
ExfilPointManagerType = EftTypes.SingleCustom(x => x.GetMethod("InitAllExfiltrationPoints") != null);
|
||||||
SessionInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Select(y => y.Name).Contains("GetPhpSessionId") && x.IsInterface);
|
SessionInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Select(y => y.Name).Contains("GetPhpSessionId") && x.IsInterface);
|
||||||
BackendSessionInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Select(y => y.Name).Contains("ChangeProfileStatus") && x.IsInterface);
|
BackendSessionInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Select(y => y.Name).Contains("ChangeProfileStatus") && x.IsInterface);
|
||||||
|
BackendProfileInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Length == 2 && x.GetMethods().Select(y => y.Name).Contains("get_Profile") && x.IsInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -36,7 +36,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
|||||||
var codes = new List<CodeInstruction>(instructions);
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
|
|
||||||
// Search for code where backend.Session.getProfile() is called.
|
// Search for code where backend.Session.getProfile() is called.
|
||||||
var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(PatchConstants.BackendSessionInterfaceType, "get_Profile"));
|
var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(PatchConstants.BackendProfileInterfaceType, "get_Profile"));
|
||||||
var searchIndex = -1;
|
var searchIndex = -1;
|
||||||
|
|
||||||
for (var i = 0; i < codes.Count; i++)
|
for (var i = 0; i < codes.Count; i++)
|
||||||
@ -69,9 +69,9 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
|||||||
new Code(OpCodes.Ldfld, typeof(TarkovApplication), "_raidSettings"),
|
new Code(OpCodes.Ldfld, typeof(TarkovApplication), "_raidSettings"),
|
||||||
new Code(OpCodes.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
new Code(OpCodes.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
||||||
new Code(OpCodes.Brfalse, brFalseLabel),
|
new Code(OpCodes.Brfalse, brFalseLabel),
|
||||||
new Code(OpCodes.Callvirt, PatchConstants.BackendSessionInterfaceType, "get_Profile"),
|
new Code(OpCodes.Callvirt, PatchConstants.BackendProfileInterfaceType, "get_Profile"),
|
||||||
new Code(OpCodes.Br, brLabel),
|
new Code(OpCodes.Br, brLabel),
|
||||||
new CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.SessionInterfaceType, "get_ProfileOfPet"),
|
new CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.BackendProfileInterfaceType, "get_ProfileOfPet"),
|
||||||
new CodeWithLabel(OpCodes.Ldc_I4_1, brLabel)
|
new CodeWithLabel(OpCodes.Ldc_I4_1, brLabel)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
|||||||
var codes = new List<CodeInstruction>(instructions);
|
var codes = new List<CodeInstruction>(instructions);
|
||||||
|
|
||||||
// Search for code where backend.Session.getProfile() is called.
|
// Search for code where backend.Session.getProfile() is called.
|
||||||
var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(PatchConstants.BackendSessionInterfaceType, "get_Profile"));
|
var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(PatchConstants.BackendProfileInterfaceType, "get_Profile"));
|
||||||
var searchIndex = -1;
|
var searchIndex = -1;
|
||||||
|
|
||||||
for (var i = 0; i < codes.Count; i++)
|
for (var i = 0; i < codes.Count; i++)
|
||||||
@ -69,9 +69,9 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
|||||||
new Code(OpCodes.Ldfld, typeof(TarkovApplication), "_raidSettings"),
|
new Code(OpCodes.Ldfld, typeof(TarkovApplication), "_raidSettings"),
|
||||||
new Code(OpCodes.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
new Code(OpCodes.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
||||||
new Code(OpCodes.Brfalse, brFalseLabel),
|
new Code(OpCodes.Brfalse, brFalseLabel),
|
||||||
new Code(OpCodes.Callvirt, PatchConstants.BackendSessionInterfaceType, "get_Profile"),
|
new Code(OpCodes.Callvirt, PatchConstants.BackendProfileInterfaceType, "get_Profile"),
|
||||||
new Code(OpCodes.Br, brLabel),
|
new Code(OpCodes.Br, brLabel),
|
||||||
new CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.SessionInterfaceType, "get_ProfileOfPet"),
|
new CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.BackendProfileInterfaceType, "get_ProfileOfPet"),
|
||||||
new CodeWithLabel(OpCodes.Stfld, brLabel, typeof(TarkovApplication).GetNestedTypes(BindingFlags.Public).SingleCustom(IsTargetNestedType), "profile")
|
new CodeWithLabel(OpCodes.Stfld, brLabel, typeof(TarkovApplication).GetNestedTypes(BindingFlags.Public).SingleCustom(IsTargetNestedType), "profile")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user