v1.0.4
This commit is contained in:
parent
a7009be3e0
commit
898f86f888
137 changed files with 3553 additions and 3780 deletions
|
|
@ -17,41 +17,36 @@ namespace jRandomSkills
|
|||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!Instance.IsPlayerValid(player)) continue;
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != skillName) continue;
|
||||
EnableSkill(player);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
foreach (var player in poisonedPlayers)
|
||||
DisableSkill(player);
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterListener<Listeners.OnTick>(OnTick);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
public static void NewRound()
|
||||
{
|
||||
if (Server.TickCount % (int)(64 * cooldown) != 0) return;
|
||||
foreach (var player in poisonedPlayers)
|
||||
poisonedPlayers.Clear();
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
{
|
||||
if (Server.TickCount % (int)(64 * cooldown) == 0)
|
||||
{
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (pawn == null || !pawn.IsValid) continue;
|
||||
SkillUtils.TakeHealth(pawn, healthToDamage);
|
||||
foreach (var player in poisonedPlayers)
|
||||
{
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (pawn == null || !pawn.IsValid) continue;
|
||||
SkillUtils.TakeHealth(pawn, healthToDamage);
|
||||
}
|
||||
}
|
||||
|
||||
if (Server.TickCount % 32 != 0) return;
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!SkillUtils.HasMenu(player)) continue;
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
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();
|
||||
SkillUtils.UpdateMenu(player, menuItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,23 +83,20 @@ namespace jRandomSkills
|
|||
if (playerInfo == null) return;
|
||||
playerInfo.SkillChance = 0;
|
||||
|
||||
SkillUtils.PrintToChat(player, Localization.GetTranslation("poison") + ":", false);
|
||||
|
||||
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("poison_select_info")}");
|
||||
var enemies = Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot && !p.IsHLTV && p.Team != CsTeam.Spectator).ToArray();
|
||||
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)
|
||||
{
|
||||
foreach (var enemy in enemies)
|
||||
player.PrintToChat($" {ChatColors.Green}⠀⠀⠀[{ChatColors.Red}{enemy.Index}{ChatColors.Green}] {enemy.PlayerName}");
|
||||
HashSet<(string, string)> menuItems = enemies.Select(e => (e.PlayerName, e.Index.ToString())).ToHashSet();
|
||||
SkillUtils.CreateMenu(player, menuItems);
|
||||
}
|
||||
else
|
||||
player.PrintToChat($" {ChatColors.Red}⠀⠀⠀{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
|
||||
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("selectplayerskill_command")} {ChatColors.Red}index");
|
||||
player.PrintToChat($" {ChatColors.Red}{Localization.GetTranslation("selectplayerskill_incorrect_enemy_index")}");
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
poisonedPlayers.Remove(player);
|
||||
SkillUtils.CloseMenu(player);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#902eff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float cooldown = 1, int damage = 1) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue