v.1.1.7
This commit is contained in:
parent
a36fdbf92d
commit
04a4fdce0d
143 changed files with 3565 additions and 2344 deletions
|
|
@ -5,22 +5,23 @@ using CounterStrikeSharp.API.Modules.Utils;
|
|||
using jRandomSkills.src.player;
|
||||
using jRandomSkills.src.utils;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public class Deaf : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Deaf;
|
||||
private static readonly HashSet<CCSPlayerController> deafPlayers = [];
|
||||
private static readonly ConcurrentDictionary<CCSPlayerController, byte> deafPlayers = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
{
|
||||
foreach (var player in deafPlayers)
|
||||
foreach (var player in deafPlayers.Keys)
|
||||
DisableSkill(player);
|
||||
deafPlayers.Clear();
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
|
|
@ -29,7 +30,7 @@ namespace jRandomSkills
|
|||
|
||||
public static void PlayerMakeSound(UserMessage um)
|
||||
{
|
||||
foreach (var player in deafPlayers)
|
||||
foreach (var player in deafPlayers.Keys)
|
||||
um.Recipients.Remove(player);
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +45,7 @@ namespace jRandomSkills
|
|||
if (playerInfo == null || playerInfo.Skill != skillName) continue;
|
||||
var enemies = Utilities.GetPlayers().Where(p => p.PawnIsAlive && p.Team != player.Team && p.IsValid && !p.IsBot && !p.IsHLTV && p.Team != CsTeam.Spectator && p.Team != CsTeam.None).ToArray();
|
||||
|
||||
HashSet<(string, string)> menuItems = enemies.Select(e => (e.PlayerName, e.Index.ToString())).ToHashSet();
|
||||
ConcurrentBag<(string, string)> menuItems = new(enemies.Select(e => (e.PlayerName, e.Index.ToString())));
|
||||
SkillUtils.UpdateMenu(player, menuItems);
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +71,7 @@ namespace jRandomSkills
|
|||
return;
|
||||
}
|
||||
|
||||
deafPlayers.Add(enemy);
|
||||
deafPlayers.TryAdd(enemy, 0);
|
||||
playerInfo.SkillChance = 1;
|
||||
player.PrintToChat($" {ChatColors.Green}" + player.GetTranslation("deaf_player_info", enemy.PlayerName));
|
||||
enemy.PrintToChat($" {ChatColors.Red}" + player.GetTranslation("deaf_enemy_info"));
|
||||
|
|
@ -85,7 +86,7 @@ namespace jRandomSkills
|
|||
var enemies = Utilities.GetPlayers().Where(p => p.PawnIsAlive && p.Team != player.Team && p.IsValid && !p.IsBot && !p.IsHLTV && p.Team != CsTeam.Spectator && p.Team != CsTeam.None).ToArray();
|
||||
if (enemies.Length > 0)
|
||||
{
|
||||
HashSet<(string, string)> menuItems = enemies.Select(e => (e.PlayerName, e.Index.ToString())).ToHashSet();
|
||||
ConcurrentBag<(string, string)> menuItems = new(enemies.Select(e => (e.PlayerName, e.Index.ToString())));
|
||||
SkillUtils.CreateMenu(player, menuItems);
|
||||
}
|
||||
else
|
||||
|
|
@ -94,11 +95,11 @@ namespace jRandomSkills
|
|||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
deafPlayers.Remove(player);
|
||||
deafPlayers.TryRemove(player, out _);
|
||||
SkillUtils.CloseMenu(player);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue