using SPT.Reflection.Patching; using Comfort.Common; using EFT; using EFT.Interactive; using HarmonyLib; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; namespace SPT.Custom.Patches { public class DisableNonHalloweenExitsDuringEventPatch : ModulePatch { protected override MethodBase GetTargetMethod() { return AccessTools.Method(typeof(BotHalloweenEvent), nameof(BotHalloweenEvent.RitualCompleted)); } [PatchPostfix] private static void PatchPostfix() { GameWorld gameWorld = Singleton.Instance; Random random = new Random(); // Get all extracts the player has List EligiblePoints = ExfiltrationControllerClass.Instance.EligiblePoints(gameWorld.MainPlayer.Profile).ToList(); List PointsToPickFrom = new List(); foreach (var ExfilPoint in EligiblePoints) { if (ExfilPoint.Status == EExfiltrationStatus.RegularMode) { // Only add extracts that we want exludes car and timed extracts i think? PointsToPickFrom.Add(ExfilPoint); //ConsoleScreen.Log(ExfilPoint.Settings.Name + " Added to pool"); } } // Randomly pick a extract from the list int index = random.Next(PointsToPickFrom.Count); string selectedExtract = PointsToPickFrom[index].Settings.Name; //ConsoleScreen.Log(selectedExtract + " Picked for Extract"); ExfiltrationControllerClass.Instance.EventDisableAllExitsExceptOne(selectedExtract); } } }