mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 05:30:43 -05:00
Actually add a patch this time. Removed more redundant patches
This commit is contained in:
parent
7a26e9028a
commit
01631c6060
@ -1,40 +0,0 @@
|
|||||||
using SPT.Reflection.Patching;
|
|
||||||
using Comfort.Common;
|
|
||||||
using EFT;
|
|
||||||
using System.Reflection;
|
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Fix a bsg bug that causes the game to soft-lock when you have a container opened when extracting
|
|
||||||
/// </summary>
|
|
||||||
public class ExitWhileLootingPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(BaseLocalGame<EftGamePlayerOwner>), nameof(BaseLocalGame<EftGamePlayerOwner>.Stop));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Look at BaseLocalGame<TPlayerOwner> and find a method named "Stop"
|
|
||||||
// once you find it, there should be a StartBlackScreenShow method with
|
|
||||||
// a callback method (on dnspy will be called @class.method_0)
|
|
||||||
// Go into that method. This will be part of the code:
|
|
||||||
// if (GClass2505.CheckCurrentScreen(EScreenType.Reconnect))
|
|
||||||
// {
|
|
||||||
// GClass2505.CloseAllScreensForced();
|
|
||||||
// }
|
|
||||||
// The code INSIDE the if needs to run
|
|
||||||
[PatchPrefix]
|
|
||||||
private static bool PatchPrefix(string profileId)
|
|
||||||
{
|
|
||||||
var player = Singleton<GameWorld>.Instance.MainPlayer;
|
|
||||||
if (profileId == player?.Profile.Id)
|
|
||||||
{
|
|
||||||
CurrentScreenSingleton.Instance.CloseAllScreensForced();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
using SPT.Common.Http;
|
|
||||||
using SPT.Reflection.Patching;
|
|
||||||
using Comfort.Common;
|
|
||||||
using EFT;
|
|
||||||
using HarmonyLib;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace SPT.Custom.Patches
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Fixes the map sandbox from only spawning 1 bot at start of game as well as fixing no spawns till all bots are dead.
|
|
||||||
/// Remove once BSG decides to fix their map
|
|
||||||
/// </summary>
|
|
||||||
public class FixBrokenSpawnOnSandboxPatch : ModulePatch
|
|
||||||
{
|
|
||||||
protected override MethodBase GetTargetMethod()
|
|
||||||
{
|
|
||||||
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPrefix]
|
|
||||||
private static void PatchPrefix()
|
|
||||||
{
|
|
||||||
var gameWorld = Singleton<GameWorld>.Instance;
|
|
||||||
if (gameWorld == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var playerLocation = gameWorld.MainPlayer.Location;
|
|
||||||
|
|
||||||
if (playerLocation == "Sandbox" || playerLocation == "Sandbox_high")
|
|
||||||
{
|
|
||||||
LocationScene.GetAll<BotZone>().ToList().First(zone => zone.name == "ZoneSandbox").MaxPersonsOnPatrol = GetMaxPatrolValueFromServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetMaxPatrolValueFromServer()
|
|
||||||
{
|
|
||||||
string json = RequestHandler.GetJson("/singleplayer/sandbox/maxpatrol");
|
|
||||||
return JsonConvert.DeserializeObject<int>(json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -23,8 +23,6 @@ namespace SPT.Custom
|
|||||||
new EasyBundlePatch().Enable();
|
new EasyBundlePatch().Enable();
|
||||||
|
|
||||||
// TODO: check if these patches are needed
|
// TODO: check if these patches are needed
|
||||||
new QTEPatch().Enable();
|
|
||||||
new IsEnemyPatch().Enable();
|
|
||||||
new BotCalledDataTryCallPatch().Enable();
|
new BotCalledDataTryCallPatch().Enable();
|
||||||
new BotCallForHelpCallBotPatch().Enable();
|
new BotCallForHelpCallBotPatch().Enable();
|
||||||
new BotOwnerDisposePatch().Enable();
|
new BotOwnerDisposePatch().Enable();
|
||||||
@ -32,19 +30,21 @@ namespace SPT.Custom
|
|||||||
new AddEnemyToAllGroupsInBotZonePatch().Enable();
|
new AddEnemyToAllGroupsInBotZonePatch().Enable();
|
||||||
new CustomAiPatch().Enable();
|
new CustomAiPatch().Enable();
|
||||||
new AddTraitorScavsPatch().Enable();
|
new AddTraitorScavsPatch().Enable();
|
||||||
new ExitWhileLootingPatch().Enable();
|
|
||||||
new PmcFirstAidPatch().Enable();
|
new PmcFirstAidPatch().Enable();
|
||||||
new SettingsLocationPatch().Enable();
|
new SettingsLocationPatch().Enable();
|
||||||
new SetLocationIdOnRaidStartPatch().Enable();
|
new SetLocationIdOnRaidStartPatch().Enable();
|
||||||
new RagfairFeePatch().Enable();
|
new RagfairFeePatch().Enable();
|
||||||
new ScavQuestPatch().Enable();
|
new ScavQuestPatch().Enable();
|
||||||
new FixBrokenSpawnOnSandboxPatch().Enable();
|
|
||||||
new ResetTraderServicesPatch().Enable();
|
new ResetTraderServicesPatch().Enable();
|
||||||
new ScavItemCheckmarkPatch().Enable();
|
new ScavItemCheckmarkPatch().Enable();
|
||||||
new CultistAmuletRemovalPatch().Enable();
|
new CultistAmuletRemovalPatch().Enable();
|
||||||
new HalloweenExtractPatch().Enable();
|
new HalloweenExtractPatch().Enable();
|
||||||
|
|
||||||
|
// Needed but needs editing
|
||||||
|
new IsEnemyPatch().Enable();
|
||||||
|
|
||||||
// Still need
|
// Still need
|
||||||
|
new QTEPatch().Enable();
|
||||||
new FileCachePatch().Enable();
|
new FileCachePatch().Enable();
|
||||||
new BotSelfEnemyPatch().Enable();
|
new BotSelfEnemyPatch().Enable();
|
||||||
new DisablePvEPatch().Enable();
|
new DisablePvEPatch().Enable();
|
||||||
|
@ -5,40 +5,21 @@ using System.Reflection;
|
|||||||
|
|
||||||
namespace SPT.SinglePlayer.Patches.ScavMode
|
namespace SPT.SinglePlayer.Patches.ScavMode
|
||||||
{
|
{
|
||||||
internal class EnablePlayerScavPatch : ModulePatch
|
public class EnablePlayerScavPatch : ModulePatch
|
||||||
{
|
{
|
||||||
public static ERaidMode storedRaidMode;
|
|
||||||
public static ESideType storedSide;
|
|
||||||
public static bool storedOnlineRaidInPVE;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Temporarily trick client into thinking we are PMC and in offline mode to allow loading of scavs in PVE mode
|
/// Change Raid Mode to local and ForceOnlineRaidInPVE to true to allow loading in as a scav
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_22));
|
return AccessTools.Method(typeof(MainMenuController), nameof(MainMenuController.method_22));
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
|
||||||
private static void PatchPrefix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession)
|
|
||||||
{
|
|
||||||
// Store old settings to restore them later in postfix
|
|
||||||
storedRaidMode = ___raidSettings_0.RaidMode;
|
|
||||||
storedSide = ___raidSettings_0.Side;
|
|
||||||
storedOnlineRaidInPVE = ___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE;
|
|
||||||
|
|
||||||
|
|
||||||
___raidSettings_0.RaidMode = ERaidMode.Online;
|
|
||||||
___raidSettings_0.Side = ESideType.Pmc;
|
|
||||||
___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
private static void PatchPostfix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession)
|
private static void PatchPostfix(ref MainMenuController __instance, ref RaidSettings ___raidSettings_0, ref ISession ___iSession)
|
||||||
{
|
{
|
||||||
___raidSettings_0.RaidMode = storedRaidMode;
|
___raidSettings_0.RaidMode = ERaidMode.Local;
|
||||||
___raidSettings_0.Side = storedSide;
|
___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = true;
|
||||||
___raidSettings_0.SelectedLocation.ForceOnlineRaidInPVE = storedOnlineRaidInPVE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
using EFT;
|
||||||
|
using HarmonyLib;
|
||||||
|
using SPT.Reflection.Patching;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace SPT.SinglePlayer.Patches.ScavMode
|
||||||
|
{
|
||||||
|
public class ScavFoundInRaidPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
private static void PatchPrefix(GameWorld __instance)
|
||||||
|
{
|
||||||
|
var player = __instance.MainPlayer;
|
||||||
|
|
||||||
|
if (player == null || player.Profile.Side != EPlayerSide.Savage)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in player.Profile.Inventory.AllRealPlayerItems)
|
||||||
|
{
|
||||||
|
item.SpawnedInSession = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user