|
| 1 | +using Exiled.API.Features; |
| 2 | +using MEC; |
| 3 | +using PlayerRoles; |
| 4 | +using SCP_600V.Extension; |
| 5 | +using System.Collections.Generic; |
| 6 | +using System.Linq; |
| 7 | +using Exiled.CustomRoles.API.Features; |
| 8 | + |
| 9 | + |
| 10 | +namespace SCP_600V.API.Role |
| 11 | +{ |
| 12 | + public class Role |
| 13 | + { |
| 14 | + /// <summary> |
| 15 | + /// gets a list of players with the Breeder role on the server |
| 16 | + /// </summary> |
| 17 | + /// <returns>Player list</returns> |
| 18 | + public static List<Player> Scp600Players() => Player.List.Where(x => x != null & x.SessionVariables.ContainsKey("IsSCP600")).ToList(); |
| 19 | + /// <summary> |
| 20 | + /// gets a list of players who have the Serpent's Hand role on the server |
| 21 | + /// </summary> |
| 22 | + /// <returns>Player list</returns> |
| 23 | + public static List<Player> SHPlayers() => Player.List.Where(x => x != null & x.SessionVariables.ContainsKey("IsSH")).ToList(); |
| 24 | + /// <summary> |
| 25 | + /// gets a list of players with the role of Mask of Obsession on the server |
| 26 | + /// </summary> |
| 27 | + /// <returns>Player list</returns> |
| 28 | + public static List<Player> Scp035Players() => Player.List.Where(x => x != null & x.SessionVariables.ContainsKey("IsScp035")).ToList(); |
| 29 | + /// <summary> |
| 30 | + /// Gets a player and defines their role |
| 31 | + /// </summary> |
| 32 | + /// <param name="player">Player to check</param> |
| 33 | + /// <returns>returns true if the player is SCP-600 or not null</returns> |
| 34 | + public static bool IsScp600(Player player) |
| 35 | + { |
| 36 | + if (player != null & player.SessionVariables.ContainsKey("IsSCP600")) |
| 37 | + { |
| 38 | + return true; |
| 39 | + } |
| 40 | + else |
| 41 | + { |
| 42 | + return false; |
| 43 | + } |
| 44 | + } |
| 45 | + /// <summary> |
| 46 | + /// Gives the role of SCP-600V to the player |
| 47 | + /// </summary> |
| 48 | + /// <param name="player">The player who will receive the role of SCP-600V</param> |
| 49 | + public static void Spawn(Player player) |
| 50 | + { |
| 51 | + if (player == null && player.IsDead) |
| 52 | + { |
| 53 | + return; |
| 54 | + } |
| 55 | + else |
| 56 | + { |
| 57 | + CustomRole.Get(typeof(Scp600CotumRoleBase)).AddRole(player); |
| 58 | + } |
| 59 | + } |
| 60 | + /// <summary> |
| 61 | + /// Gives the role of SCP-600V to the player |
| 62 | + /// </summary> |
| 63 | + /// <param name="player">The player who will receive the role of SCP-600V</param> |
| 64 | + /// <param name="MaxHealt">Assigning a custom MaxHealt parameter to a player</param> |
| 65 | + public static void Spawn(Player player, int MaxHealt = 400) |
| 66 | + { |
| 67 | + if (player == null && player.IsDead) |
| 68 | + { |
| 69 | + return; |
| 70 | + } |
| 71 | + else |
| 72 | + { |
| 73 | + CustomRole.Get(typeof(Scp600CotumRoleBase)).AddRole(player); |
| 74 | + Timing.CallDelayed(2f, () => |
| 75 | + { |
| 76 | + player.MaxHealth = MaxHealt; |
| 77 | + player.Health = MaxHealt; |
| 78 | + }); |
| 79 | + } |
| 80 | + } |
| 81 | + /// <summary> |
| 82 | + /// Allows you to get the number of people who do not have the role Breeder on the server |
| 83 | + /// </summary> |
| 84 | + /// <param name="team">Team to check</param> |
| 85 | + /// <returns>returns the number of players in the team excluding scp</returns> |
| 86 | + public static int AmountTeamNotScp(Team team) => Player.List.Count(x => x != null & !x.SessionVariables.ContainsKey("IsSCP600") & x.Role.Team == team); |
| 87 | + /// <summary> |
| 88 | + /// Determine if a player who is an SCP is in the team |
| 89 | + /// </summary> |
| 90 | + /// <param name="team">Team to check</param> |
| 91 | + /// <returns>returns true if the SCP player is on the team</returns> |
| 92 | + public static bool ScpInTeam(Team team) => Player.List.Any(x => x != null & x.Role.Team == team & x.SessionVariables.ContainsKey("IsSCP600")); |
| 93 | + |
| 94 | + } |
| 95 | +} |
0 commit comments