From 7cda91e0a800e10a53f40ab1f7ac2223b572caef Mon Sep 17 00:00:00 2001 From: Kaeno Date: Fri, 5 Jul 2024 16:46:11 +0000 Subject: [PATCH] Changed logic in how we check if they are a boss and if they are of a allowed wildtype (!146) Reviewed-on: https://dev.sp-tarkov.com/SPT/Modules/pulls/146 --- project/SPT.Custom/Patches/CustomAiPatch.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/project/SPT.Custom/Patches/CustomAiPatch.cs b/project/SPT.Custom/Patches/CustomAiPatch.cs index b8f2b10..5d3e84a 100644 --- a/project/SPT.Custom/Patches/CustomAiPatch.cs +++ b/project/SPT.Custom/Patches/CustomAiPatch.cs @@ -5,6 +5,9 @@ using Comfort.Common; using System.Reflection; using SPT.Custom.CustomAI; using HarmonyLib; +using System.Collections.Generic; +using Newtonsoft.Json; +using SPT.Common.Http; namespace SPT.Custom.Patches { @@ -12,6 +15,7 @@ namespace SPT.Custom.Patches { private static readonly PmcFoundInRaidEquipment pmcFoundInRaidEquipment = new PmcFoundInRaidEquipment(Logger); private static readonly AIBrainSpawnWeightAdjustment aIBrainSpawnWeightAdjustment = new AIBrainSpawnWeightAdjustment(Logger); + private static List BossConvertAllowedTypes = GetBossConvertFromServer(); protected override MethodBase GetTargetMethod() { @@ -62,11 +66,7 @@ namespace SPT.Custom.Patches } // Is a boss bot and not already handled above - if (___botOwner_0.Profile.Info.Settings.IsBoss() - && !BotHasAssaultGroupRole(___botOwner_0) - && !isPlayerScav - && !isNormalAssaultScav - && !isSptPmc) + if (BossConvertAllowedTypes.Contains(nameof(__state))) { if (___botOwner_0.Boss.BossLogic == null) { @@ -106,6 +106,12 @@ namespace SPT.Custom.Patches return botOwner.Profile.Info.Settings.Role; } + private static List GetBossConvertFromServer() + { + string json = RequestHandler.GetJson("/singleplayer/BossConvert"); + return JsonConvert.DeserializeObject>(json); + } + private static bool BotHasAssaultGroupRole(BotOwner botOwner) { return botOwner.Profile.Info.Settings.Role == WildSpawnType.assaultGroup;