0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 01:30:45 -05:00

Changed logic in how we check if they are a boss and if they are of a allowed wildtype (!146)

Reviewed-on: SPT/Modules#146
This commit is contained in:
Kaeno 2024-07-05 16:46:11 +00:00 committed by Dev
parent 46a6d0b3d6
commit 7cda91e0a8

View File

@ -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<string> 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<string> GetBossConvertFromServer()
{
string json = RequestHandler.GetJson("/singleplayer/BossConvert");
return JsonConvert.DeserializeObject<List<string>>(json);
}
private static bool BotHasAssaultGroupRole(BotOwner botOwner)
{
return botOwner.Profile.Info.Settings.Role == WildSpawnType.assaultGroup;