0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 04:50:45 -05:00

Refactored patches to be public so people can disable if needed

This commit is contained in:
CWX 2024-08-02 16:57:59 +01:00
parent e3bc4e3210
commit 0986ebac2d
63 changed files with 86 additions and 95 deletions

View File

@ -26,7 +26,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref BotsGroup __result, IBotGame ____game, DeadBodiesController ____deadBodiesController, BotOwner bot, BotZone zone) public static bool PatchPrefix(ref BotsGroup __result, IBotGame ____game, DeadBodiesController ____deadBodiesController, BotOwner bot, BotZone zone)
{ {
if (!TraitorChancePercent.HasValue) if (!TraitorChancePercent.HasValue)
{ {

View File

@ -19,7 +19,7 @@ namespace SPT.Custom.Patches
/// This should fix that. /// This should fix that.
/// </summary> /// </summary>
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(BotsController __instance, IPlayer aggressor, IPlayer groupOwner, IPlayer target) public static bool PatchPrefix(BotsController __instance, IPlayer aggressor, IPlayer groupOwner, IPlayer target)
{ {
if (!groupOwner.IsAI) if (!groupOwner.IsAI)
{ {

View File

@ -28,7 +28,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(Profile profile) public static void PatchPrefix(Profile profile)
{ {
MonoBehaviourSingleton<PreloaderUI>.Instance.SetWatermarkStatus(profile, true); MonoBehaviourSingleton<PreloaderUI>.Instance.SetWatermarkStatus(profile, true);
} }
@ -42,7 +42,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(ref TextMeshProUGUI ____label, Profile ___profile_0) public static void PatchPostfix(ref TextMeshProUGUI ____label, Profile ___profile_0)
{ {
____label.text = $"{MenuNotificationManager.commitHash}"; ____label.text = $"{MenuNotificationManager.commitHash}";
} }
@ -57,7 +57,7 @@ namespace SPT.Custom.Patches
// Prefix so the logic isn't being duplicated. // Prefix so the logic isn't being duplicated.
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(int screenHeight, int screenWidth, int rectHeight, int rectWidth, ref Vector2 __result) public static bool PatchPrefix(int screenHeight, int screenWidth, int rectHeight, int rectWidth, ref Vector2 __result)
{ {
System.Random random = new System.Random(); System.Random random = new System.Random();

View File

@ -35,13 +35,13 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(BossLocationSpawn[] bossLocationSpawn) public static void PatchPrefix(BossLocationSpawn[] bossLocationSpawn)
{ {
_bossSpawnPercent = bossLocationSpawn.Select(s => s.BossChance).ToArray(); _bossSpawnPercent = bossLocationSpawn.Select(s => s.BossChance).ToArray();
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(ref BossLocationSpawn[] __result) public static void PatchPostfix(ref BossLocationSpawn[] __result)
{ {
if (__result.Length != _bossSpawnPercent.Length) if (__result.Length != _bossSpawnPercent.Length)
{ {

View File

@ -19,7 +19,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref string __result, BotDifficulty botDifficulty, WildSpawnType role) public static bool PatchPrefix(ref string __result, BotDifficulty botDifficulty, WildSpawnType role)
{ {
__result = DifficultyManager.Get(botDifficulty, role); __result = DifficultyManager.Get(botDifficulty, role);
var resultIsNullEmpty = string.IsNullOrWhiteSpace(__result); var resultIsNullEmpty = string.IsNullOrWhiteSpace(__result);

View File

@ -20,7 +20,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix() public static void PatchPostfix()
{ {
var pmcProfile = PatchConstants.BackEndSession.Profile; var pmcProfile = PatchConstants.BackEndSession.Profile;
var scavProfile = PatchConstants.BackEndSession.ProfileOfPet; var scavProfile = PatchConstants.BackEndSession.ProfileOfPet;

View File

@ -7,26 +7,26 @@ using SPT.Custom.Utils;
namespace SPT.Custom.Patches namespace SPT.Custom.Patches
{ {
public class CoreDifficultyPatch : ModulePatch public class CoreDifficultyPatch : ModulePatch
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
var methodName = "LoadCoreByString"; var methodName = "LoadCoreByString";
var flags = BindingFlags.Public | BindingFlags.Static; var flags = BindingFlags.Public | BindingFlags.Static;
return PatchConstants.EftTypes.SingleCustom(x => x.GetMethod(methodName, flags) != null) return PatchConstants.EftTypes.SingleCustom(x => x.GetMethod(methodName, flags) != null)
.GetMethod(methodName, flags); .GetMethod(methodName, flags);
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref string __result) public static bool PatchPrefix(ref string __result)
{ {
// fetch all bot difficulties to be used in BotDifficultyPatch // fetch all bot difficulties to be used in BotDifficultyPatch
// this is called here since core difficulties are fetched before bot-specific difficulties are // this is called here since core difficulties are fetched before bot-specific difficulties are
DifficultyManager.Update(); DifficultyManager.Update();
// update core difficulty // update core difficulty
__result = RequestHandler.GetJson("/singleplayer/settings/bot/difficulty/core/core"); __result = RequestHandler.GetJson("/singleplayer/settings/bot/difficulty/core/core");
return string.IsNullOrWhiteSpace(__result); return string.IsNullOrWhiteSpace(__result);
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace SPT.Custom.Patches
/// <param name="__instance">StandartBotBrain</param> /// <param name="__instance">StandartBotBrain</param>
/// <param name="___botOwner_0">botOwner_0 property</param> /// <param name="___botOwner_0">botOwner_0 property</param>
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(out WildSpawnType __state, StandartBotBrain __instance, BotOwner ___botOwner_0) public static bool PatchPrefix(out WildSpawnType __state, StandartBotBrain __instance, BotOwner ___botOwner_0)
{ {
___botOwner_0.Profile.Info.Settings.Role = FixAssaultGroupPmcsRole(___botOwner_0); ___botOwner_0.Profile.Info.Settings.Role = FixAssaultGroupPmcsRole(___botOwner_0);
__state = ___botOwner_0.Profile.Info.Settings.Role; // Store original type in state param to allow access in PatchPostFix() __state = ___botOwner_0.Profile.Info.Settings.Role; // Store original type in state param to allow access in PatchPostFix()
@ -130,7 +130,7 @@ namespace SPT.Custom.Patches
/// <param name="__state">Saved state from prefix patch</param> /// <param name="__state">Saved state from prefix patch</param>
/// <param name="___botOwner_0">botOwner_0 property</param> /// <param name="___botOwner_0">botOwner_0 property</param>
[PatchPostfix] [PatchPostfix]
private static void PatchPostFix(WildSpawnType __state, BotOwner ___botOwner_0) public static void PatchPostFix(WildSpawnType __state, BotOwner ___botOwner_0)
{ {
if (AiHelpers.BotIsSptPmc(__state, ___botOwner_0)) if (AiHelpers.BotIsSptPmc(__state, ___botOwner_0))
{ {

View File

@ -18,7 +18,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ESessionMode sessionMode, Profile profile, ref GameObject ____notAvailableState) public static bool PatchPrefix(ESessionMode sessionMode, Profile profile, ref GameObject ____notAvailableState)
{ {
____notAvailableState.SetActive(false); ____notAvailableState.SetActive(false);
return false; return false;

View File

@ -18,7 +18,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix() public static void PatchPostfix()
{ {
GameWorld gameWorld = Singleton<GameWorld>.Instance; GameWorld gameWorld = Singleton<GameWorld>.Instance;
Random random = new Random(); Random random = new Random();

View File

@ -40,7 +40,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref Task<EasyAssets> __result, GameObject gameObject, [CanBeNull] IBundleLock bundleLock, string defaultKey, string rootPath, public static bool PatchPrefix(ref Task<EasyAssets> __result, GameObject gameObject, [CanBeNull] IBundleLock bundleLock, string defaultKey, string rootPath,
string platformName, [CanBeNull] Func<string, bool> shouldExclude, [CanBeNull] Func<string, Task> bundleCheck) string platformName, [CanBeNull] Func<string, bool> shouldExclude, [CanBeNull] Func<string, Task> bundleCheck)
{ {
var easyAsset = gameObject.AddComponent<EasyAssets>(); var easyAsset = gameObject.AddComponent<EasyAssets>();

View File

@ -25,7 +25,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(object __instance, string key, string rootPath, CompatibilityAssetBundleManifest manifest, IBundleLock bundleLock) public static void PatchPostfix(object __instance, string key, string rootPath, CompatibilityAssetBundleManifest manifest, IBundleLock bundleLock)
{ {
var filepath = rootPath + key; var filepath = rootPath + key;
var dependencies = manifest.GetDirectDependencies(key) ?? Array.Empty<string>(); var dependencies = manifest.GetDirectDependencies(key) ?? Array.Empty<string>();

View File

@ -19,7 +19,7 @@ namespace SPT.Custom.Patches
return AccessTools.Method(typeof(BotsGroupMarkOfUnknown), nameof(BotsGroupMarkOfUnknown.Dispose)); return AccessTools.Method(typeof(BotsGroupMarkOfUnknown), nameof(BotsGroupMarkOfUnknown.Dispose));
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(BotsGroup ____groups) public static bool PatchPrefix(BotsGroup ____groups)
{ {
if (____groups == null) if (____groups == null)
{ {

View File

@ -13,7 +13,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(BotOwner bot) public static void PatchPrefix(BotOwner bot)
{ {
// Is a boss and not a follower and not a PMC // Is a boss and not a follower and not a PMC
if (!bot.Profile.Info.Settings.IsBoss() && !CustomAI.AiHelpers.BotIsSptPmc(bot.Profile.Info.Settings.Role, bot)) if (!bot.Profile.Info.Settings.IsBoss() && !CustomAI.AiHelpers.BotIsSptPmc(bot.Profile.Info.Settings.Role, bot))

View File

@ -20,7 +20,7 @@ namespace SPT.Custom.Patches
/// Needed to ensure bot checks the enemy side, not just its botType /// Needed to ensure bot checks the enemy side, not just its botType
/// </summary> /// </summary>
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref bool __result, BotsGroup __instance, IPlayer requester) public static bool PatchPrefix(ref bool __result, BotsGroup __instance, IPlayer requester)
{ {
if (requester == null) if (requester == null)
{ {

View File

@ -23,7 +23,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPreFix(ref IEnumerable<QuestDataClass> quests) public static void PatchPreFix(ref IEnumerable<QuestDataClass> quests)
{ {
var gameWorld = Singleton<GameWorld>.Instance; var gameWorld = Singleton<GameWorld>.Instance;

View File

@ -40,7 +40,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(BotOwner ___botOwner_0) public static bool PatchPrefix(BotOwner ___botOwner_0)
{ {
if (___botOwner_0.IsRole(WildSpawnType.pmcUSEC) || ___botOwner_0.IsRole(WildSpawnType.pmcBEAR)) if (___botOwner_0.IsRole(WildSpawnType.pmcUSEC) || ___botOwner_0.IsRole(WildSpawnType.pmcBEAR))
{ {

View File

@ -22,7 +22,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void Prefix() public static void PatchPrefix()
{ {
CheckForNonWhitelistedPlugins(Logger); CheckForNonWhitelistedPlugins(Logger);
} }

View File

@ -14,7 +14,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(HideoutPlayerOwner __instance) public static void PatchPostfix(HideoutPlayerOwner __instance)
{ {
RequestHandler.PutJson("/client/hideout/workout", new RequestHandler.PutJson("/client/hideout/workout", new
{ {

View File

@ -19,7 +19,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
internal static void PatchPrefix(ref string ___string_0, ref string ___string_1) public static void PatchPrefix(ref string ___string_0, ref string ___string_1)
{ {
if (!Directory.Exists(_sptPath)) if (!Directory.Exists(_sptPath))
{ {

View File

@ -34,7 +34,7 @@ namespace SPT.Custom.Patches
/// <param name="___double_0">RequirementsPrice</param> /// <param name="___double_0">RequirementsPrice</param>
/// <param name="___bool_0">SellInOnePiece</param> /// <param name="___bool_0">SellInOnePiece</param>
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref Item ___item_0, ref RagfairOfferSellHelperClass ___ragfairOfferSellHelperClass, ref double ___double_0, ref bool ___bool_0) public static void PatchPrefix(ref Item ___item_0, ref RagfairOfferSellHelperClass ___ragfairOfferSellHelperClass, ref double ___double_0, ref bool ___bool_0)
{ {
RequestHandler.PutJson("/client/ragfair/offerfees", new RequestHandler.PutJson("/client/ragfair/offerfees", new
{ {

View File

@ -20,7 +20,7 @@ namespace SPT.Custom.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(object controller, UpdatableToggle ____offlineModeToggle) public static void PatchPrefix(object controller, UpdatableToggle ____offlineModeToggle)
{ {
//var raidSettings = Traverse.Create(controller).Field<RaidSettings>("RaidSettings").Value; //var raidSettings = Traverse.Create(controller).Field<RaidSettings>("RaidSettings").Value;
var offlineRaidSettings = Traverse.Create(controller).Field<RaidSettings>("OfflineRaidSettings").Value; var offlineRaidSettings = Traverse.Create(controller).Field<RaidSettings>("OfflineRaidSettings").Value;
@ -38,15 +38,6 @@ namespace SPT.Custom.Patches
return; return;
} }
//raidSettings.BotSettings.BotAmount = settings.AiAmount;
//raidSettings.WavesSettings.BotAmount = settings.AiAmount;
//raidSettings.WavesSettings.BotDifficulty = settings.AiDifficulty;
//raidSettings.WavesSettings.IsBosses = settings.BossEnabled;
//raidSettings.BotSettings.IsScavWars = false;
//raidSettings.WavesSettings.IsTaggedAndCursed = settings.TaggedAndCursed;
//raidSettings.TimeAndWeatherSettings.IsRandomWeather = settings.RandomWeather;
//raidSettings.TimeAndWeatherSettings.IsRandomTime = settings.RandomTime;
// We use PVE mode from Tarkov now we need to modify PVE MODE instead of ONLINE Mode // We use PVE mode from Tarkov now we need to modify PVE MODE instead of ONLINE Mode
offlineRaidSettings.BotSettings.BotAmount = settings.AiAmount; offlineRaidSettings.BotSettings.BotAmount = settings.AiAmount;
@ -60,7 +51,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(MatchmakerOfflineRaidScreen __instance, DefaultUIButton ____changeSettingsButton, UiElementBlocker ____onlineBlocker) public static void PatchPostfix(MatchmakerOfflineRaidScreen __instance, DefaultUIButton ____changeSettingsButton, UiElementBlocker ____onlineBlocker)
{ {
____onlineBlocker.gameObject.SetActive(false); ____onlineBlocker.gameObject.SetActive(false);
____changeSettingsButton.Interactable = true; ____changeSettingsButton.Interactable = true;

View File

@ -22,7 +22,7 @@ namespace SPT.Custom.Patches
} }
[PatchPostfix] [PatchPostfix]
internal static void PatchPostfix(object __result) public static void PatchPostfix(object __result)
{ {
if (string.IsNullOrEmpty(_versionLabel)) if (string.IsNullOrEmpty(_versionLabel))
{ {

View File

@ -18,7 +18,7 @@ namespace SPT.Debugging.Patches
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(BaseLocalGame<EftGamePlayerOwner> __instance) public static void PatchPrefix(BaseLocalGame<EftGamePlayerOwner> __instance)
{ {
if (!Input.GetKeyDown(KeyCode.LeftControl)) return; if (!Input.GetKeyDown(KeyCode.LeftControl)) return;

View File

@ -13,7 +13,7 @@ namespace SPT.Debugging.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPrefix(ref string __result) public static void PatchPrefix(ref string __result)
{ {
Console.WriteLine($"response json: ${__result}"); Console.WriteLine($"response json: ${__result}");
} }

View File

@ -16,7 +16,7 @@ namespace SPT.Debugging.Patches
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPreFix(ref LocalizedText ____nickName, ref TMP_Text ____standing, public static bool PatchPreFix(ref LocalizedText ____nickName, ref TMP_Text ____standing,
ref RankPanel ____rankPanel, ref Profile.TraderInfo ___traderInfo_0) ref RankPanel ____rankPanel, ref Profile.TraderInfo ___traderInfo_0)
{ {
if (____nickName.LocalizationKey == null) if (____nickName.LocalizationKey == null)

View File

@ -18,7 +18,7 @@ namespace SPT.Debugging.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(string nlogFormat, string unityFormat, LogLevel logLevel, object[] args) public static void PatchPostfix(string nlogFormat, string unityFormat, LogLevel logLevel, object[] args)
{ {
var bsgLevel = LogLevel.FromOrdinal(logLevel.Ordinal); var bsgLevel = LogLevel.FromOrdinal(logLevel.Ordinal);
var sptLevel = LogLevel.FromOrdinal(SPTDebuggingPlugin.logLevel.verbosity); var sptLevel = LogLevel.FromOrdinal(SPTDebuggingPlugin.logLevel.verbosity);

View File

@ -16,7 +16,7 @@ namespace SPT.Debugging.Patches
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix() public static void PatchPostfix()
{ {
ConsoleScreen.Processor.RegisterCommandGroup<ReloadClientPatch>(); ConsoleScreen.Processor.RegisterCommandGroup<ReloadClientPatch>();
} }

View File

@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(Player __instance) public static void PatchPostfix(Player __instance)
{ {
if (__instance.IsYourPlayer) if (__instance.IsYourPlayer)
{ {

View File

@ -20,7 +20,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1) public static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1)
{ {
// If Raidsettingswindow is never opened it will soft lock game // If Raidsettingswindow is never opened it will soft lock game
if (___raidSettings_0 == null) if (___raidSettings_0 == null)

View File

@ -16,7 +16,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(DamageInfo damageInfo) public static void PatchPostfix(DamageInfo damageInfo)
{ {
if (damageInfo.Player == null || damageInfo.Player.iPlayer == null || !damageInfo.Player.iPlayer.IsYourPlayer) if (damageInfo.Player == null || damageInfo.Player.iPlayer == null || !damageInfo.Player.iPlayer.IsYourPlayer)
{ {

View File

@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref GClass3114 contextInteractions) public static void PatchPrefix(ref GClass3114 contextInteractions)
{ {
// clear with a null to stop "looking for group/create group" buttons // clear with a null to stop "looking for group/create group" buttons
// they handle nulls so dont worry // they handle nulls so dont worry

View File

@ -17,7 +17,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(DefaultUIButton ____readyButton) public static void PatchPostfix(DefaultUIButton ____readyButton)
{ {
____readyButton.Interactable = false; ____readyButton.Interactable = false;
} }

View File

@ -21,7 +21,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchTranspiler] [PatchTranspiler]
private static IEnumerable<CodeInstruction> PatchTranspile(IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> PatchTranspile(IEnumerable<CodeInstruction> instructions)
{ {
var codes = new List<CodeInstruction>(instructions); var codes = new List<CodeInstruction>(instructions);
var searchCode = new CodeInstruction(OpCodes.Ldstr, "6617beeaa9cfa777ca915b7c"); var searchCode = new CodeInstruction(OpCodes.Ldstr, "6617beeaa9cfa777ca915b7c");

View File

@ -16,7 +16,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref bool __result) public static bool PatchPrefix(ref bool __result)
{ {
__result = false; __result = false;
return false; // Do not run original method return false; // Do not run original method

View File

@ -31,7 +31,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPrefix] [PatchPrefix]
private static void PrefixPatch(RaidSettings ___raidSettings_0) public static void PrefixPatch(RaidSettings ___raidSettings_0)
{ {
___raidSettings_0.RaidMode = ERaidMode.Online; ___raidSettings_0.RaidMode = ERaidMode.Online;
} }

View File

@ -19,7 +19,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostFix(ref DefaultUIButton ____readyButton) public static void PatchPostFix(ref DefaultUIButton ____readyButton)
{ {
____readyButton?.GameObject?.SetActive(false); ____readyButton?.GameObject?.SetActive(false);
} }

View File

@ -12,7 +12,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref bool __result, string variable) public static bool PatchPrefix(ref bool __result, string variable)
{ {
if (variable == "pve_first_time") if (variable == "pve_first_time")
{ {

View File

@ -26,7 +26,7 @@ namespace SPT.SinglePlayer.Patches.MainMenu
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix() public static void PatchPostfix()
{ {
var failedPluginCount = Chainloader.DependencyErrors.Count; var failedPluginCount = Chainloader.DependencyErrors.Count;

View File

@ -20,14 +20,14 @@ namespace SPT.SinglePlayer.Patches.Progression
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController) public static void PatchPrefix(ref AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
{ {
__state = ____questController; __state = ____questController;
____questController = null; ____questController = null;
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController) public static void PatchPostfix(AbstractQuestControllerClass __state, ref AbstractQuestControllerClass ____questController)
{ {
____questController = __state; ____questController = __state;
} }

View File

@ -38,7 +38,7 @@ namespace SPT.SinglePlayer.Patches.Progression
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref Profile activeProfile,ref EPlayerSide side) public static bool PatchPrefix(ref Profile activeProfile,ref EPlayerSide side)
{ {
if (activeProfile.Side == EPlayerSide.Savage) if (activeProfile.Side == EPlayerSide.Savage)
{ {

View File

@ -32,7 +32,7 @@ namespace SPT.SinglePlayer.Patches.Quests
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref bool __result, WildSpawnType ___wildSpawnType_0, BotDifficulty ___botDifficulty_0, Profile x) public static bool PatchPrefix(ref bool __result, WildSpawnType ___wildSpawnType_0, BotDifficulty ___botDifficulty_0, Profile x)
{ {
if (x == null) if (x == null)
{ {

View File

@ -21,7 +21,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(List<WaveInfo> __result, List<WaveInfo> wavesProfiles, List<WaveInfo> delayed) public static void PatchPostfix(List<WaveInfo> __result, List<WaveInfo> wavesProfiles, List<WaveInfo> delayed)
{ {
/* /*
Method sums Limits by grouping wavesPropfiles collection by Role and Difficulty Method sums Limits by grouping wavesPropfiles collection by Role and Difficulty

View File

@ -44,7 +44,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
/// BotsPresets.GetNewProfile() /// BotsPresets.GetNewProfile()
/// </summary> /// </summary>
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, BotCreationDataClass data, ref bool withDelete) public static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, BotCreationDataClass data, ref bool withDelete)
{ {
/* /*
When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition) When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition)

View File

@ -20,7 +20,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix() public static void PatchPostfix()
{ {
var gameWorld = Singleton<GameWorld>.Instance; var gameWorld = Singleton<GameWorld>.Instance;
var player = gameWorld?.MainPlayer; var player = gameWorld?.MainPlayer;

View File

@ -35,7 +35,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPreFix(ref int maxCount) public static void PatchPreFix(ref int maxCount)
{ {
var gameWorld = Singleton<GameWorld>.Instance; var gameWorld = Singleton<GameWorld>.Instance;
var location = gameWorld.MainPlayer.Location; var location = gameWorld.MainPlayer.Location;

View File

@ -14,7 +14,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchPrefix] [PatchPrefix]
protected static void PatchPrefix(Profile.TraderInfo __instance) public static void PatchPrefix(Profile.TraderInfo __instance)
{ {
if (__instance.Settings == null) if (__instance.Settings == null)
{ {

View File

@ -19,7 +19,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
/// <summary> /// <summary>
/// BotsPresets.GetNewProfile() /// BotsPresets.GetNewProfile()
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref bool withDelete) public static bool PatchPrefix(ref bool withDelete)
{ {
withDelete = true; withDelete = true;

View File

@ -20,7 +20,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchTranspiler] [PatchTranspiler]
private static IEnumerable<CodeInstruction> PatchTranspile(IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> PatchTranspile(IEnumerable<CodeInstruction> instructions)
{ {
var codes = new List<CodeInstruction>(instructions); var codes = new List<CodeInstruction>(instructions);
var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(AudioClip), "get_length")); var searchCode = new CodeInstruction(OpCodes.Callvirt, AccessTools.Method(typeof(AudioClip), "get_length"));

View File

@ -24,7 +24,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPreFix(int wantSpawn, ref int toDelay, ref int toSpawn, ref int ____maxBots, int ____allBotsCount, int ____inSpawnProcess) public static bool PatchPreFix(int wantSpawn, ref int toDelay, ref int toSpawn, ref int ____maxBots, int ____allBotsCount, int ____inSpawnProcess)
{ {
// Set bots to delay if alive bots + spawning bots count > maxbots // Set bots to delay if alive bots + spawning bots count > maxbots
// ____inSpawnProcess can be negative, don't go below 0 when calculating // ____inSpawnProcess can be negative, don't go below 0 when calculating

View File

@ -17,7 +17,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
// checks on invoke whether the player is stunned before allowing tinnitus // checks on invoke whether the player is stunned before allowing tinnitus
[PatchPrefix] [PatchPrefix]
static bool PatchPrefix() public static bool PatchPrefix()
{ {
var baseMethod = AccessTools.Method(typeof(ActiveHealthController), nameof(ActiveHealthController.FindActiveEffect)); var baseMethod = AccessTools.Method(typeof(ActiveHealthController), nameof(ActiveHealthController.FindActiveEffect));

View File

@ -19,7 +19,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1, MainMenuController __instance) public static void PatchPrefix(ref RaidSettings ___raidSettings_0, ref RaidSettings ___raidSettings_1, MainMenuController __instance)
{ {
___raidSettings_0.RaidMode = ERaidMode.Local; ___raidSettings_0.RaidMode = ERaidMode.Local;
___raidSettings_0.IsPveOffline = true; ___raidSettings_0.IsPveOffline = true;
@ -29,7 +29,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(ref RaidSettings ___raidSettings_0) public static void PatchPostfix(ref RaidSettings ___raidSettings_0)
{ {
___raidSettings_0.RaidMode = ERaidMode.Local; ___raidSettings_0.RaidMode = ERaidMode.Local;
___raidSettings_0.IsPveOffline = true; ___raidSettings_0.IsPveOffline = true;

View File

@ -20,7 +20,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(LocalGame __instance) public static void PatchPrefix(LocalGame __instance)
{ {
GetProfileAtEndOfRaidPatch.Profile = __instance.Profile_0.ToJson(); GetProfileAtEndOfRaidPatch.Profile = __instance.Profile_0.ToJson();
} }
@ -37,7 +37,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref ISession ___iSession) public static void PatchPrefix(ref ISession ___iSession)
{ {
var profile = GetProfileAtEndOfRaidPatch.Profile.ParseJsonTo<Profile>(); var profile = GetProfileAtEndOfRaidPatch.Profile.ParseJsonTo<Profile>();

View File

@ -50,7 +50,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchTranspiler] [PatchTranspiler]
private static IEnumerable<CodeInstruction> PatchTranspiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> PatchTranspiler(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
{ {
/* The original msil looks something like this: /* The original msil looks something like this:
* 0 0000 ldarg.0 * 0 0000 ldarg.0

View File

@ -15,7 +15,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(Profile profile, ExfiltrationControllerClass __instance, ref ExfiltrationPoint[] __result) public static bool PatchPrefix(Profile profile, ExfiltrationControllerClass __instance, ref ExfiltrationPoint[] __result)
{ {
if (profile.Info.Side != EPlayerSide.Savage) if (profile.Info.Side != EPlayerSide.Savage)
{ {

View File

@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(GameWorld __instance) public static void PatchPrefix(GameWorld __instance)
{ {
var player = __instance.MainPlayer; var player = __instance.MainPlayer;

View File

@ -47,7 +47,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ref RaidSettings ____raidSettings) public static bool PatchPrefix(ref RaidSettings ____raidSettings)
{ {
var currentMapId = ____raidSettings.SelectedLocation.Id; var currentMapId = ____raidSettings.SelectedLocation.Id;

View File

@ -38,7 +38,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchTranspiler] [PatchTranspiler]
private static IEnumerable<CodeInstruction> PatchTranspile(ILGenerator generator, IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> PatchTranspile(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
{ {
var codes = new List<CodeInstruction>(instructions); var codes = new List<CodeInstruction>(instructions);

View File

@ -32,7 +32,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchTranspiler] [PatchTranspiler]
private static IEnumerable<CodeInstruction> PatchTranspile(ILGenerator generator, IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> PatchTranspile(ILGenerator generator, IEnumerable<CodeInstruction> instructions)
{ {
var codes = new List<CodeInstruction>(instructions); var codes = new List<CodeInstruction>(instructions);

View File

@ -16,7 +16,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(DamageInfo damage, string playerProfileId, out Tuple<Player, bool> __state) public static void PatchPrefix(DamageInfo damage, string playerProfileId, out Tuple<Player, bool> __state)
{ {
__state = new Tuple<Player, bool>(null, false); __state = new Tuple<Player, bool>(null, false);
var player = (Player)damage.Player.iPlayer; var player = (Player)damage.Player.iPlayer;

View File

@ -43,7 +43,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(ScavengerInventoryScreen __instance, IEnumerable<Item> items) public static void PatchPostfix(ScavengerInventoryScreen __instance, IEnumerable<Item> items)
{ {
ISession session = _sessionField.GetValue(__instance) as ISession; ISession session = _sessionField.GetValue(__instance) as ISession;
TraderClass traderClass = session.Traders.FirstOrDefault(x => x.Id == FENCE_ID); TraderClass traderClass = session.Traders.FirstOrDefault(x => x.Id == FENCE_ID);

View File

@ -29,7 +29,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(ProfileEndpointFactoryAbstractClass __instance, ref Task<IResult> __result, string playerId, string petId) public static bool PatchPrefix(ProfileEndpointFactoryAbstractClass __instance, ref Task<IResult> __result, string playerId, string petId)
{ {
// Build request with additional information // Build request with additional information
OwnerInfo fromOwner = new OwnerInfo OwnerInfo fromOwner = new OwnerInfo

View File

@ -32,7 +32,7 @@ namespace SPT.SinglePlayer
// Still need // Still need
//new SmokeGrenadeFuseSoundFixPatch().Enable(); TODO: refactor as it causes exceptions to be thrown when grenade is tossed by player // new SmokeGrenadeFuseSoundFixPatch().Enable(); TODO: refactor as it causes exceptions to be thrown when grenade is tossed by player
new ScavExperienceGainPatch().Enable(); new ScavExperienceGainPatch().Enable();
new DisablePMCExtractsForScavsPatch().Enable(); new DisablePMCExtractsForScavsPatch().Enable();
new ScavExfilPatch().Enable(); new ScavExfilPatch().Enable();
@ -60,7 +60,7 @@ namespace SPT.SinglePlayer
new GetProfileAtEndOfRaidPatch().Enable(); new GetProfileAtEndOfRaidPatch().Enable();
new FixSavageInventoryScreenPatch().Enable(); new FixSavageInventoryScreenPatch().Enable();
new InsuranceScreenPatch().Enable(); new InsuranceScreenPatch().Enable();
//new ApplyRaidSettingsPatch().Enable(); Should be no longer needed keeping here just to be safe. // new ApplyRaidSettingsPatch().Enable(); Should be no longer needed keeping here just to be safe.
new FixQuestAchieveControllersPatch().Enable(); new FixQuestAchieveControllersPatch().Enable();
} }
catch (Exception ex) catch (Exception ex)