mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:10:45 -05:00
Profile is now on its own interface, added new interfaceType to patchConstants and fixed the two scav patches (!80)
PR to fix transpiler patches, GInterface144 that was originally targeted no longer has get_Profile and has moved to GInterface146, so added patchconstants for it and fixed patches, get_ProfileOfPet has also moved there. Tested on both PMC and scav getting into raid, works fine, error was originally coming up on game start Co-authored-by: CWXDEV <CWXDEV@outlook.com> Reviewed-on: SPT-AKI/Modules#80 Co-authored-by: CWX <cwx@noreply.dev.sp-tarkov.com> Co-committed-by: CWX <cwx@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
c340023378
commit
55586c7828
@ -19,6 +19,7 @@ namespace Aki.Reflection.Utils
|
||||
public static Type ExfilPointManagerType { get; private set; }
|
||||
public static Type SessionInterfaceType { get; private set; }
|
||||
public static Type BackendSessionInterfaceType { get; private set; }
|
||||
public static Type BackendProfileInterfaceType { get; private set; }
|
||||
|
||||
private static ISession _backEndSession;
|
||||
public static ISession BackEndSession
|
||||
@ -47,6 +48,7 @@ namespace Aki.Reflection.Utils
|
||||
ExfilPointManagerType = EftTypes.SingleCustom(x => x.GetMethod("InitAllExfiltrationPoints") != null);
|
||||
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);
|
||||
BackendProfileInterfaceType = EftTypes.SingleCustom(x => x.GetMethods().Length == 2 && x.GetMethods().Select(y => y.Name).Contains("get_Profile") && x.IsInterface);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -36,7 +36,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// 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;
|
||||
|
||||
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.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
||||
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 CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.SessionInterfaceType, "get_ProfileOfPet"),
|
||||
new CodeWithLabel(OpCodes.Callvirt, brFalseLabel, PatchConstants.BackendProfileInterfaceType, "get_ProfileOfPet"),
|
||||
new CodeWithLabel(OpCodes.Ldc_I4_1, brLabel)
|
||||
});
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace Aki.SinglePlayer.Patches.ScavMode
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// 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;
|
||||
|
||||
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.Callvirt, typeof(RaidSettings), "get_IsPmc"),
|
||||
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 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")
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user