2024-07-04 14:11:11 +00:00
|
|
|
|
using EFT;
|
2024-08-15 08:45:47 +00:00
|
|
|
|
using System.Collections.Generic;
|
2023-10-10 10:58:33 +00:00
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.Custom.CustomAI
|
2023-10-10 10:58:33 +00:00
|
|
|
|
{
|
|
|
|
|
public static class AiHelpers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2024-06-06 16:59:53 +00:00
|
|
|
|
/// Bot is a PMC when it has IsStreamerModeAvailable flagged and has a wildspawn type of 'pmcBEAR' or 'pmcUSEC'
|
2023-10-10 10:58:33 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="botRoleToCheck">Bots role</param>
|
|
|
|
|
/// <param name="___botOwner_0">Bot details</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool BotIsSptPmc(WildSpawnType botRoleToCheck, BotOwner ___botOwner_0)
|
|
|
|
|
{
|
|
|
|
|
if (___botOwner_0.Profile.Info.IsStreamerModeAvailable)
|
|
|
|
|
{
|
2024-09-16 15:02:51 +01:00
|
|
|
|
// PMCs can sometimes have their role changed to 'assaultGroup' by the client, we need an alternate way to figure out if they're a spt pmc
|
2023-10-10 10:58:33 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-03 10:29:33 +01:00
|
|
|
|
return botRoleToCheck is WildSpawnType.pmcBEAR or WildSpawnType.pmcUSEC;
|
2023-10-10 10:58:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-02-11 10:33:59 +00:00
|
|
|
|
public static bool BotIsPlayerScav(WildSpawnType role, string nickname)
|
2023-10-10 10:58:33 +00:00
|
|
|
|
{
|
2024-10-03 10:29:33 +01:00
|
|
|
|
// Check bot is pscav by looking for the opening parentheses of their nickname e.g. scavname (pmc name)
|
|
|
|
|
return role == WildSpawnType.assault && nickname.Contains("(");
|
2023-10-10 10:58:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-16 12:13:12 +01:00
|
|
|
|
public static bool BotIsSimulatedPlayerScav(WildSpawnType role, BotOwner botOwner)
|
2023-10-10 10:58:33 +00:00
|
|
|
|
{
|
2024-09-16 12:13:12 +01:00
|
|
|
|
// Assault and has "(" character in name = simulated p scav
|
|
|
|
|
var nicknameContainsPScvCharacter = botOwner.Profile.Info.Nickname?.Contains("(");
|
|
|
|
|
return nicknameContainsPScvCharacter.HasValue && nicknameContainsPScvCharacter.Value && role == WildSpawnType.assault;
|
2023-10-10 10:58:33 +00:00
|
|
|
|
}
|
2024-08-15 08:45:47 +00:00
|
|
|
|
|
|
|
|
|
public static List<BotOwner> GetAllMembers(this BotsGroup group)
|
|
|
|
|
{
|
|
|
|
|
List<BotOwner> members = new List<BotOwner>();
|
2024-08-16 17:35:35 +00:00
|
|
|
|
|
2024-08-15 08:45:47 +00:00
|
|
|
|
if (group != null)
|
|
|
|
|
{
|
|
|
|
|
for (int m = 0; m < group.MembersCount; m++)
|
|
|
|
|
{
|
|
|
|
|
members.Add(group.Member(m));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return members;
|
|
|
|
|
}
|
2024-08-16 17:35:35 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Returns true if the player is found in the collection by searching for matching player Id's
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="players"></param>
|
|
|
|
|
/// <param name="playerToCheck"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public static bool ContainsPlayer(this IEnumerable<IPlayer> players, IPlayer playerToCheck)
|
|
|
|
|
{
|
|
|
|
|
if (playerToCheck == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (IPlayer player in players)
|
|
|
|
|
{
|
2024-08-17 07:05:43 +00:00
|
|
|
|
if (player != null && player.Id == playerToCheck.Id)
|
2024-08-16 17:35:35 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2023-10-10 10:58:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|