0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 20:30:43 -05:00

Fixed various patch issues

This commit is contained in:
Dev 2024-10-31 21:27:32 +00:00
parent 39cbda1cc9
commit 22bd973bb5
4 changed files with 9 additions and 7 deletions

View File

@ -23,7 +23,7 @@ namespace SPT.Custom.Patches
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.method_1)); return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.method_5));
} }
/// <summary> /// <summary>

View File

@ -32,7 +32,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
_ = MatchmakerPlayerControllerClass.MAX_SCAV_COUNT; // UPDATE REFS TO THIS CLASS BELOW !!! _ = MatchmakerPlayerControllerClass.MAX_SCAV_COUNT; // UPDATE REFS TO THIS CLASS BELOW !!!
// `MatchmakerInsuranceScreen` OnShowNextScreen // `MatchmakerInsuranceScreen` OnShowNextScreen
_onReadyScreenMethod = AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_45)); _onReadyScreenMethod = AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_46));
_isLocalField = AccessTools.Field(typeof(MainMenuController), "bool_0"); _isLocalField = AccessTools.Field(typeof(MainMenuController), "bool_0");
_menuControllerField = typeof(TarkovApplication).GetFields(PatchConstants.PrivateFlags).FirstOrDefault(x => x.FieldType == typeof(MainMenuController)); _menuControllerField = typeof(TarkovApplication).GetFields(PatchConstants.PrivateFlags).FirstOrDefault(x => x.FieldType == typeof(MainMenuController));

View File

@ -25,7 +25,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
.GetNestedTypes(PatchConstants.PublicDeclaredFlags) .GetNestedTypes(PatchConstants.PublicDeclaredFlags)
.SingleCustom(x => x.GetField("timeAndWeather") != null .SingleCustom(x => x.GetField("timeAndWeather") != null
&& x.GetField("tarkovApplication_0") != null && x.GetField("tarkovApplication_0") != null
&& x.GetField("timeHasComeScreenController") == null && x.GetField("inTransition") != null
&& x.Name.Contains("Struct")); && x.Name.Contains("Struct"));
var desiredMethod = desiredType.GetMethods(PatchConstants.PublicDeclaredFlags) var desiredMethod = desiredType.GetMethods(PatchConstants.PublicDeclaredFlags)

View File

@ -16,11 +16,13 @@ namespace SPT.SinglePlayer.Patches.ScavMode
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
// Struct348 - 32128 // Struct348 - 32128
// Struct364 - 33374
var desiredType = typeof(TarkovApplication) var desiredType = typeof(TarkovApplication)
.GetNestedTypes(PatchConstants.PublicDeclaredFlags) .GetNestedTypes(PatchConstants.PublicDeclaredFlags)
.SingleCustom(x => x.GetField("timeAndWeather") != null .SingleCustom(x => x.GetField("timeAndWeather") != null
&& x.GetField("timeHasComeScreenController") != null && x.GetField("gameWorld") != null
&& x.Name.Contains("Struct")); && x.GetField("metricsConfig") != null
&& x.Name.Contains("Struct"));
var desiredMethod = AccessTools.Method(desiredType, "MoveNext"); var desiredMethod = AccessTools.Method(desiredType, "MoveNext");
@ -83,8 +85,8 @@ namespace SPT.SinglePlayer.Patches.ScavMode
private static bool IsTargetNestedType(Type nestedType) private static bool IsTargetNestedType(Type nestedType)
{ {
return nestedType.GetMethods(PatchConstants.PublicDeclaredFlags).Count() > 0 && return nestedType.GetMethods(PatchConstants.PublicDeclaredFlags).Any() &&
nestedType.GetFields().Length == 6 && nestedType.GetFields().Length == 5 &&
nestedType.GetField("savageProfile") != null && nestedType.GetField("savageProfile") != null &&
nestedType.GetField("profile") != null; nestedType.GetField("profile") != null;
} }