2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Reflection.Patching;
|
2023-08-05 17:26:09 +00:00
|
|
|
|
using EFT;
|
|
|
|
|
using System.Reflection;
|
2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.SinglePlayer.Utils.Insurance;
|
2023-10-10 10:58:33 +00:00
|
|
|
|
using Comfort.Common;
|
2024-01-13 22:08:29 +00:00
|
|
|
|
using HarmonyLib;
|
2023-08-05 17:26:09 +00:00
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.SinglePlayer.Patches.RaidFix
|
2023-08-05 17:26:09 +00:00
|
|
|
|
{
|
|
|
|
|
public class InsuredItemManagerStartPatch : ModulePatch
|
|
|
|
|
{
|
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
|
|
|
{
|
2024-01-13 22:08:29 +00:00
|
|
|
|
return AccessTools.Method(typeof(GameWorld), nameof(GameWorld.OnGameStarted));
|
2023-08-05 17:26:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
|
public static void PatchPostFix()
|
|
|
|
|
{
|
2023-10-10 10:58:33 +00:00
|
|
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
|
|
|
|
|
|
|
|
// Starts tracking of insured items manager
|
2023-08-05 17:26:09 +00:00
|
|
|
|
InsuredItemManager.Instance.Init();
|
2023-10-10 10:58:33 +00:00
|
|
|
|
|
|
|
|
|
// Sets PlayerScavs items to FoundInRaid
|
|
|
|
|
ConfigurePlayerScavFindInRaidStatus(gameWorld.MainPlayer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void ConfigurePlayerScavFindInRaidStatus(Player player)
|
|
|
|
|
{
|
|
|
|
|
if (player == null || player.Profile.Side != EPlayerSide.Savage)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in player.Profile.Inventory.AllRealPlayerItems)
|
|
|
|
|
{
|
|
|
|
|
item.SpawnedInSession = true;
|
|
|
|
|
}
|
2023-08-05 17:26:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|