From 45746ddceca4b6bc5d2152ea7fd2db907be942e1 Mon Sep 17 00:00:00 2001 From: Lacyway <20912169+Lacyway@users.noreply.github.com> Date: Fri, 1 Nov 2024 23:12:10 +0100 Subject: [PATCH] Fix getting into raid --- Fika.Core/Coop/GameMode/CoopGame.cs | 13 +++++++++++- .../Coop/Patches/GClass3224_IsValid_Patch.cs | 20 ------------------- .../GameWorld/GameWorld_Create_Patch.cs | 4 ++-- ...arkovApplication_LocalGameCreator_Patch.cs | 4 ++-- Fika.Core/FikaPlugin.cs | 1 - .../UI/Patches/AchievementView_Show_Patch.cs | 2 +- 6 files changed, 17 insertions(+), 27 deletions(-) delete mode 100644 Fika.Core/Coop/Patches/GClass3224_IsValid_Patch.cs diff --git a/Fika.Core/Coop/GameMode/CoopGame.cs b/Fika.Core/Coop/GameMode/CoopGame.cs index 2afb3d6b..7cbc3a85 100644 --- a/Fika.Core/Coop/GameMode/CoopGame.cs +++ b/Fika.Core/Coop/GameMode/CoopGame.cs @@ -9,6 +9,7 @@ using EFT.Counters; using EFT.EnvironmentEffect; using EFT.Game.Spawning; +using EFT.GameTriggers; using EFT.HealthSystem; using EFT.Interactive; using EFT.InventoryLogic; @@ -1494,7 +1495,13 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I { BotsPresets botsPresets = new(iSession, wavesSpawnScenario_0.SpawnWaves, bossSpawnScenario.BossSpawnWaves, nonWavesSpawnScenario_0.GClass1622_0, false); - await botsPresets.TryLoadBotsProfilesOnStart(); + List waveInfos = []; + LocationSettingsClass.Location.GClass1336 halloween = Location_0.Events.Halloween2024; + if (halloween != null && halloween.InfectionPercentage > 0) + { + waveInfos.AddRange(BotHalloweenWithZombies.GetProfilesOnStart()); + } + await botsPresets.TryLoadBotsProfilesOnStart(waveInfos); GClass888 botCreator = new(this, botsPresets, CreateBot); BotZone[] botZones = LocationScene.GetAllObjects(false).ToArray(); @@ -1636,6 +1643,9 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I Logger.LogError("WeatherController was null!"); } + gameWorld.TriggersModule = gameObject.AddComponent(); + gameWorld.FillLampControllers(); + WeatherReady = true; OfflineRaidSettingsMenuPatch_Override.UseCustomWeather = false; @@ -1675,6 +1685,7 @@ public override async Task vmethod_1(BotControllerSettings controllerSettings, I } bossSpawnScenario.Run(EBotsSpawnMode.Anyway); + botsController_0.EventsController.SpawnAction(); FikaPlugin.DynamicAI.SettingChanged += DynamicAI_SettingChanged; FikaPlugin.DynamicAIRate.SettingChanged += DynamicAIRate_SettingChanged; diff --git a/Fika.Core/Coop/Patches/GClass3224_IsValid_Patch.cs b/Fika.Core/Coop/Patches/GClass3224_IsValid_Patch.cs deleted file mode 100644 index d4dde818..00000000 --- a/Fika.Core/Coop/Patches/GClass3224_IsValid_Patch.cs +++ /dev/null @@ -1,20 +0,0 @@ -using SPT.Reflection.Patching; -using System.Linq; -using System.Reflection; - -namespace Fika.Core.Coop.Patches -{ - public class GClass3224_IsValid_Patch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return typeof(GClass3224).GetMethods().FirstOrDefault(x => x.Name == "IsValid" && x.GetParameters().Length == 4); - } - - [PatchPrefix] - public static void Prefix(ref float distanceSqr) - { - distanceSqr = 500f; - } - } -} diff --git a/Fika.Core/Coop/Patches/GameWorld/GameWorld_Create_Patch.cs b/Fika.Core/Coop/Patches/GameWorld/GameWorld_Create_Patch.cs index 5f88888b..e1073a83 100644 --- a/Fika.Core/Coop/Patches/GameWorld/GameWorld_Create_Patch.cs +++ b/Fika.Core/Coop/Patches/GameWorld/GameWorld_Create_Patch.cs @@ -17,7 +17,7 @@ protected override MethodBase GetTargetMethod() } [PatchPrefix] - public static bool Prefix(ref GameWorld __result, GameObject gameObject, PoolManager objectsFactory, EUpdateQueue updateQueue, string currentProfileId) + public static bool Prefix(ref GameWorld __result, GameObject gameObject, PoolManager objectsFactory, EUpdateQueue updateQueue, MongoID? currentProfileId) { if (!FikaBackendUtils.RequestFikaWorld) @@ -37,7 +37,7 @@ public static bool Prefix(ref GameWorld __result, GameObject gameObject, PoolMan return false; } - private static GameWorld CreateHideoutWorld(GameObject gameObject, PoolManager objectsFactory, EUpdateQueue updateQueue, string currentProfileId) + private static GameWorld CreateHideoutWorld(GameObject gameObject, PoolManager objectsFactory, EUpdateQueue updateQueue, MongoID? currentProfileId) { HideoutGameWorld gameWorld = gameObject.AddComponent(); Traverse gameWorldTraverse = Traverse.Create(gameWorld); diff --git a/Fika.Core/Coop/Patches/LocalGame/TarkovApplication_LocalGameCreator_Patch.cs b/Fika.Core/Coop/Patches/LocalGame/TarkovApplication_LocalGameCreator_Patch.cs index 1258223f..a2958795 100644 --- a/Fika.Core/Coop/Patches/LocalGame/TarkovApplication_LocalGameCreator_Patch.cs +++ b/Fika.Core/Coop/Patches/LocalGame/TarkovApplication_LocalGameCreator_Patch.cs @@ -30,7 +30,7 @@ protected override MethodBase GetTargetMethod() } [PatchPrefix] - public static bool Prefix(ref Task __result, TarkovApplication __instance, TimeAndWeatherSettings timeAndWeather, MatchmakerTimeHasCome.TimeHasComeScreenClass timeHasComeScreenController, + public static bool Prefix(ref Task __result, TarkovApplication __instance, TimeAndWeatherSettings timeAndWeather, MatchmakerTimeHasCome.GClass3563 timeHasComeScreenController, RaidSettings ____raidSettings, InputTree ____inputTree, GameDateTime ____localGameDateTime, float ____fixedDeltaTime, string ____backendUrl, MetricsEventsClass metricsEvents, MetricsConfigClass metricsConfig, GameWorld gameWorld) { @@ -44,7 +44,7 @@ public static bool Prefix(ref Task __result, TarkovApplication __instance, TimeA return false; } - public static async Task CreateFikaGame(TarkovApplication instance, TimeAndWeatherSettings timeAndWeather, MatchmakerTimeHasCome.TimeHasComeScreenClass timeHasComeScreenController, + public static async Task CreateFikaGame(TarkovApplication instance, TimeAndWeatherSettings timeAndWeather, MatchmakerTimeHasCome.GClass3563 timeHasComeScreenController, RaidSettings raidSettings, InputTree inputTree, GameDateTime localGameDateTime, float fixedDeltaTime, string backendUrl, MetricsEventsClass metricsEvents, MetricsConfigClass metricsConfig, GameWorld gameWorld) { diff --git a/Fika.Core/FikaPlugin.cs b/Fika.Core/FikaPlugin.cs index 00212a9f..3bf75cab 100644 --- a/Fika.Core/FikaPlugin.cs +++ b/Fika.Core/FikaPlugin.cs @@ -321,7 +321,6 @@ private static void EnableFikaPatches() new GClass1350_Constructor_Patch().Enable(); new AchievementsScreen_Show_Patch().Enable(); new AchievementView_Show_Patch().Enable(); - new GClass3224_IsValid_Patch().Enable(); new GClass3299_ExceptAI_Patch().Enable(); new GClass1641_method_8_Patch().Enable(); new GrenadeClass_Init_Patch().Enable(); diff --git a/Fika.Core/UI/Patches/AchievementView_Show_Patch.cs b/Fika.Core/UI/Patches/AchievementView_Show_Patch.cs index 5e6ec7e1..344f8337 100644 --- a/Fika.Core/UI/Patches/AchievementView_Show_Patch.cs +++ b/Fika.Core/UI/Patches/AchievementView_Show_Patch.cs @@ -12,7 +12,7 @@ public class AchievementView_Show_Patch : ModulePatch { protected override MethodBase GetTargetMethod() { - return typeof(AchievementView).GetMethod("GInterface450.Show"); + return typeof(AchievementView).GetMethod("GInterface466.Show"); } [PatchPostfix]