Refactor command system and add static skill support

This commit is contained in:
Juzlus 2025-09-05 04:40:53 +02:00
parent e33975fe8b
commit c73473f0ed
22 changed files with 509 additions and 156 deletions

View file

@ -12,25 +12,25 @@ namespace jRandomSkills
public static class Command
{
private static bool gamePaused = false;
private static readonly Config.Settings config = Config.LoadedConfig.Settings;
public static void Load()
{
var config = Config.LoadedConfig?.Settings;
if (config == null || config == null) return;
var commands = new Dictionary<IEnumerable<string>, (string description, CommandInfo.CommandCallback handler)>
{
{ SplitCommands(config.SetSkillCommands), ("Set skill", Command_SetSkill) },
{ SplitCommands(config.SkillsListCommands), ("Delete all records", Command_SkillsListMenu) },
{ SplitCommands(config.UseSkillCommands), ("Use/Type skill", Command_UseTypeSkill) },
{ SplitCommands(config.ChangeMapCommands), ("Change map", Command_ChangeMap) },
{ SplitCommands(config.ConsoleCommands), ("Console command", Command_CustomCommand) },
{ SplitCommands(config.StartGameCommands), ("Start game", Command_StartGame) },
{ SplitCommands(config.SwapCommands), ("Swap team", Command_Swap) },
{ SplitCommands(config.ShuffleCommands), ("Shuffle team", Command_Shuffle) },
{ SplitCommands(config.PauseCommands), ("Pause game", Command_Pause) },
{ SplitCommands(config.HealCommands), ("Heal", Command_Heal) },
{ SplitCommands(config.SetScoreCommands), ("Set teams score", Command_SetScore) },
{ SplitCommands(config.SetSkillCommands.Alias), ("Set skill", Command_SetSkill) },
{ SplitCommands(config.SkillsListCommands.Alias), ("Delete all records", Command_SkillsListMenu) },
{ SplitCommands(config.UseSkillCommands.Alias), ("Use/Type skill", Command_UseTypeSkill) },
{ SplitCommands(config.ChangeMapCommands.Alias), ("Change map", Command_ChangeMap) },
{ SplitCommands(config.ConsoleCommands.Alias), ("Console command", Command_CustomCommand) },
{ SplitCommands(config.StartGameCommands.Alias), ("Start game", Command_StartGame) },
{ SplitCommands(config.SwapCommands.Alias), ("Swap team", Command_Swap) },
{ SplitCommands(config.ShuffleCommands.Alias), ("Shuffle team", Command_Shuffle) },
{ SplitCommands(config.PauseCommands.Alias), ("Pause game", Command_Pause) },
{ SplitCommands(config.HealCommands.Alias), ("Heal", Command_Heal) },
{ SplitCommands(config.SetScoreCommands.Alias), ("Set teams score", Command_SetScore) },
{ SplitCommands(config.SetStaticSkillCommands.Alias), ("Set static skill", Command_SetStaticSkill) },
};
foreach (var commandPair in commands)
@ -40,7 +40,7 @@ namespace jRandomSkills
private static IEnumerable<string> SplitCommands(string commands)
{
return commands.Split(',').Select(c => c.Trim());
return commands.Split(',').Select(c => c.Trim()).Where(c => !string.IsNullOrEmpty(c));
}
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
@ -62,11 +62,11 @@ namespace jRandomSkills
Instance.SkillAction(playerInfo.Skill.ToString(), "TypeSkill", [player, commands]);
}
[RequiresPermissions("@jRandmosSkills/admin")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_SetSkill(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_setskill {command.ArgString} command.");
if (player == null || !AdminManager.PlayerHasPermissions(player, config.SetSkillCommands.Permissions)) return;
var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => !p.IsBot
&& (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)
|| p.PlayerName.Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)) );
@ -103,6 +103,7 @@ namespace jRandomSkills
{
Instance.SkillAction(skillPlayer.Skill.ToString(), "DisableSkill", [targetPlayer]);
skillPlayer.Skill = skill.Skill;
skillPlayer.SpecialSkill = src.player.Skills.None;
Instance.SkillAction(skill.Skill.ToString(), "EnableSkill", [targetPlayer]);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
@ -120,16 +121,18 @@ namespace jRandomSkills
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
private static void Command_SkillsListMenu(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_skills {command.ArgString} command.");
if (player == null || !AdminManager.PlayerHasPermissions(player, config.SkillsListCommands.Permissions)) return;
Menu.DisplaySkillsList(player);
}
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_ChangeMap(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@TESTTEST/TESTAFD"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_map {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.ChangeMapCommands.Permissions))
{
if (!config.ChangeMapCommands.EnableVoting) return;
player.Vote(VoteType.ChangeMap, command.ArgString);
return;
}
@ -159,8 +162,10 @@ namespace jRandomSkills
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_StartGame(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@TESTTEST/TESTAFD"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_start {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.StartGameCommands.Permissions))
{
if (!config.StartGameCommands.EnableVoting) return;
player.Vote(VoteType.StartGame);
return;
}
@ -186,8 +191,10 @@ namespace jRandomSkills
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_Swap(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@TESTTEST/TESTAFD"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_swap {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.SwapCommands.Permissions))
{
if (!config.SwapCommands.EnableVoting) return;
player.Vote(VoteType.SwapTeam);
return;
}
@ -205,8 +212,10 @@ namespace jRandomSkills
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_Shuffle(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@TESTTEST/TESTAFD"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_shuffle {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.ShuffleCommands.Permissions))
{
if (!config.ShuffleCommands.EnableVoting) return;
player.Vote(VoteType.ShuffleTeam);
return;
}
@ -229,8 +238,10 @@ namespace jRandomSkills
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_Pause(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@TESTTEST/TESTAFD"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_pause {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.PauseCommands.Permissions))
{
if (!config.PauseCommands.EnableVoting) return;
player.Vote(VoteType.PauseGame);
return;
}
@ -244,11 +255,12 @@ namespace jRandomSkills
gamePaused = !gamePaused;
}
[RequiresPermissions("@jRandmosSkills/root")]
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_Heal(CCSPlayerController? player, CommandInfo command)
{
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_heal {command.ArgString} command.");
if (player == null || !player.IsValid || player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid || player.LifeState != (byte)LifeState_t.LIFE_ALIVE) return;
if (!AdminManager.PlayerHasPermissions(player, config.HealCommands.Permissions)) return;
SkillUtils.AddHealth(player.PlayerPawn.Value, 100);
player.PrintToChat($" {ChatColors.Green}{Localization.GetTranslation("healed")}");
}
@ -256,8 +268,10 @@ namespace jRandomSkills
[CommandHelper(minArgs: 2, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_SetScore(CCSPlayerController? player, CommandInfo command)
{
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, "@testset/testset"))
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_setscore {command.ArgString} command.");
if (player != null && player.IsValid && !AdminManager.PlayerHasPermissions(player, config.SetScoreCommands.Permissions))
{
if (!config.SetScoreCommands.EnableVoting) return;
player.Vote(VoteType.SetScore, command.ArgString);
return;
}
@ -276,13 +290,74 @@ namespace jRandomSkills
SkillUtils.SetTeamScores((short)ctScore, (short)tScore, RoundEndReason.RoundDraw);
}
[RequiresPermissions("@jRandmosSkills/root")]
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
private static void Command_CustomCommand(CCSPlayerController? player, CommandInfo command)
{
if (player == null) return;
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_console {command.ArgString} command.");
if (player == null || !AdminManager.PlayerHasPermissions(player, config.ConsoleCommands.Permissions)) return;
string param = command.ArgString;
Server.ExecuteCommand(param);
}
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
private static void Command_SetStaticSkill(CCSPlayerController? player, CommandInfo command)
{
Debug.WriteToDebug($"Player {player?.PlayerPawn} used the css_setstaticskill {command.ArgString} command.");
if (player == null || !AdminManager.PlayerHasPermissions(player, config.SetStaticSkillCommands.Permissions)) return;
var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => !p.IsBot
&& (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)
|| p.PlayerName.Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase)));
if (command.ArgCount < 2)
{
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
SkillUtils.PrintToChat(player, Localization.GetTranslation("correct_form_setskill"), true);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
return;
}
if (targetPlayer == null)
{
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
SkillUtils.PrintToChat(player, Localization.GetTranslation("player_not_found_setskill"), true);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
return;
}
var skillName = command.ArgCount > 3 ? $"{command.GetArg(2)} {command.GetArg(3)}" : command.GetArg(2);
var skill = SkillData.Skills.FirstOrDefault(s => s.Name.Equals(skillName, StringComparison.OrdinalIgnoreCase) || s.Skill.ToString().Equals(skillName, StringComparison.OrdinalIgnoreCase));
if (skill == null)
{
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
SkillUtils.PrintToChat(player, Localization.GetTranslation("skill_not_found_setskill"), true);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
return;
}
var skillPlayer = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == targetPlayer.SteamID);
if (skillPlayer != null)
{
Instance.SkillAction(skillPlayer.Skill.ToString(), "DisableSkill", [targetPlayer]);
skillPlayer.Skill = skill.Skill;
skillPlayer.SpecialSkill = src.player.Skills.None;
if (skill.Skill == src.player.Skills.None)
Event.staticSkills.Remove(targetPlayer.SteamID);
else
Event.staticSkills.Add(targetPlayer.SteamID, skill);
Instance.SkillAction(skill.Skill.ToString(), "EnableSkill", [targetPlayer]);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
SkillUtils.PrintToChat(player, $"{Localization.GetTranslation("done_setskill")}: {ChatColors.LightRed}{skill.Name} {ChatColors.Lime}{Localization.GetTranslation("for_setskill")} {ChatColors.LightRed}{targetPlayer.PlayerName}", false);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
}
else
{
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
SkillUtils.PrintToChat(player, Localization.GetTranslation("error_setskill"), true);
player.PrintToChat($" {ChatColors.Green}―――――――――――{ChatColors.DarkRed}◥◣◆◢◤{ChatColors.Green}―――――――――――");
}
}
}
}

View file

@ -31,6 +31,7 @@ namespace jRandomSkills
{
if (!votes.Contains(vote) || !vote.GetActive()) return;
vote.SetActive(false);
vote.TimeToNextSameVoting = vote.TimeToNextVoting;
Server.PrintToChatAll($" {ChatColors.Red}{Localization.GetTranslation("vote_timeout", commandName)}");
});

View file

@ -401,7 +401,7 @@
"skill_not_found_setskill": "No such CHATCOLORS.REDskill found",
"player_not_found_setskill": "No such CHATCOLORS.REDplayer found",
"correct_form_setskill": "Correct usage: CHATCOLORS.RED!setskill <nickname> <skill>",
"correct_form_setskill": "Correct usage: CHATCOLORS.RED!setscore <CT> <TT>",
"correct_form_setscore": "Correct usage: CHATCOLORS.RED!setscore <CT> <TT>",
"done_setskill": "skill set",
"error_setskill": "Failed to set CHATCOLORS.REDskill",
"for_setskill": "for",

View file

@ -3,6 +3,7 @@ using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
@ -80,6 +81,11 @@ namespace jRandomSkills
return HookResult.Continue;
});
Instance.RegisterListener<OnMapStart>((string mapName) =>
{
Debug.WriteToDebug($"Map changed: {mapName}.");
});
Instance.RegisterEventHandler<EventPlayerShoot>((@event, info) =>
{
var player = @event.Userid;

View file

@ -5,17 +5,23 @@ using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using jRandomSkills.src.utils;
using System.Text.RegularExpressions;
using static jRandomSkills.Config;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
{
public static partial class Event
{
private static jSkill_SkillInfo ctSkill = new(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static jSkill_SkillInfo tSkill = new(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static jSkill_SkillInfo allSkill = new(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static readonly jSkill_SkillInfo noneSkill = new(Skills.None, Config.GetValue<string>(Skills.None, "color"), false);
private static jSkill_SkillInfo ctSkill = noneSkill;
private static jSkill_SkillInfo tSkill = noneSkill;
private static jSkill_SkillInfo allSkill = noneSkill;
private static List<jSkill_SkillInfo> debugSkills = new(SkillData.Skills);
private static readonly Dictionary<ulong, List<jSkill_SkillInfo>> playersSkills = [];
public static readonly Dictionary<ulong, jSkill_SkillInfo> staticSkills = [];
public static void Load()
{
Instance.RegisterEventHandler<EventPlayerConnectFull>((@event, info) =>
@ -155,7 +161,10 @@ namespace jRandomSkills
if (Instance?.GameRules != null && Instance?.GameRules.WarmupPeriod == false)
{
if (Config.LoadedConfig.Settings.GameMode == (int)Config.GameModes.Normal)
Config.GameModes gameMode = (Config.GameModes)Config.LoadedConfig.Settings.GameMode;
if (staticSkills.TryGetValue(player.SteamID, out var staticSkill))
randomSkill = staticSkill;
else if (gameMode == Config.GameModes.Normal || gameMode == Config.GameModes.NoRepeat)
{
List<jSkill_SkillInfo> skillList = new(SkillData.Skills);
skillList.RemoveAll(s => s?.Skill == skillPlayer?.Skill || s?.Skill == skillPlayer?.SpecialSkill || s?.Skill == Skills.None);
@ -171,13 +180,26 @@ namespace jRandomSkills
else
skillList.RemoveAll(s => terroristSkills.Any(s2 => s2.Name == s.Skill.ToString()));
randomSkill = skillList.Count == 0 ? new jSkill_SkillInfo(Skills.None, Config.GetValue<string>(Skills.None, "color"), false) : skillList[Instance.Random.Next(skillList.Count)];
if (gameMode == Config.GameModes.NoRepeat && playersSkills.TryGetValue(player.SteamID, out List<jSkill_SkillInfo>? skills))
{
skillList.RemoveAll(s => skills.Any(s2 => s2.Skill == s.Skill));
if (skillList.Count == 0) skills.Clear();
}
randomSkill = skillList.Count == 0 ? noneSkill : skillList[Instance.Random.Next(skillList.Count)];
if (gameMode == Config.GameModes.NoRepeat)
{
if (playersSkills.TryGetValue(player.SteamID, out List<jSkill_SkillInfo>? value))
value.Add(randomSkill);
else
playersSkills.Add(player.SteamID, [randomSkill]);
}
}
else if (Config.LoadedConfig.Settings.GameMode == (int)Config.GameModes.TeamSkills)
else if (gameMode == Config.GameModes.TeamSkills)
randomSkill = player.Team == CsTeam.Terrorist ? tSkill : ctSkill;
else if (Config.LoadedConfig.Settings.GameMode == (int)Config.GameModes.SameSkills)
else if (gameMode == Config.GameModes.SameSkills)
randomSkill = allSkill;
else if (Config.LoadedConfig.Settings.GameMode == (int)Config.GameModes.Debug)
else if (gameMode == Config.GameModes.Debug)
{
if (debugSkills.Count == 0)
debugSkills = new List<jSkill_SkillInfo>(SkillData.Skills);

View file

@ -25,6 +25,7 @@ namespace jRandomSkills
private static void OnMapStart(string mapName)
{
Instance.GameRules = null;
Event.staticSkills.Clear();
}
private static void InitializeGameRules()

View file

@ -11,7 +11,7 @@ namespace jRandomSkills
public class Aimbot : ISkill
{
private const Skills skillName = Skills.Aimbot;
private static Dictionary<nint, int> hitGroups = new Dictionary<nint, int>();
private static readonly Dictionary<nint, int> hitGroups = [];
public static void LoadSkill()
{
@ -27,8 +27,8 @@ namespace jRandomSkills
if (param == null || param.Entity == null || param2 == null || param2.Attacker == null || param2.Attacker.Value == null)
return HookResult.Continue;
CCSPlayerPawn attackerPawn = new CCSPlayerPawn(param2.Attacker.Value.Handle);
CCSPlayerPawn victimPawn = new CCSPlayerPawn(param.Handle);
CCSPlayerPawn attackerPawn = new(param2.Attacker.Value.Handle);
CCSPlayerPawn victimPawn = new(param.Handle);
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return HookResult.Continue;
@ -64,11 +64,8 @@ namespace jRandomSkills
return HookResult.Continue;
}
public class SkillConfig : Config.DefaultSkillInfo
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -10,9 +10,9 @@ namespace jRandomSkills
public class BunnyHop : ISkill
{
private const Skills skillName = Skills.BunnyHop;
private static float maxSpeed = Config.GetValue<float>(skillName, "maxSpeed");
private static float bunnyHopVelocity = Config.GetValue<float>(skillName, "jumpVelocity");
private static float jumpBoost = Config.GetValue<float>(skillName, "jumpBoost");
private static readonly float maxSpeed = Config.GetValue<float>(skillName, "maxSpeed");
private static readonly float bunnyHopVelocity = Config.GetValue<float>(skillName, "jumpVelocity");
private static readonly float jumpBoost = Config.GetValue<float>(skillName, "jumpBoost");
public static void LoadSkill()
{
@ -60,17 +60,11 @@ namespace jRandomSkills
}
}
public class SkillConfig : Config.DefaultSkillInfo
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maxSpeed = 500f, float jumpVelocity = 300f, float jumpBoost = 2f) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
{
public float MaxSpeed { get; set; }
public float JumpVelocity { get; set; }
public float JumpBoost { get; set; }
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false, float maxSpeed = 500f, float jumpVelocity = 300f, float jumpBoost = 2f) : base(skill, active, color, onlyTeam, needsTeammates)
{
MaxSpeed = maxSpeed;
JumpVelocity = jumpVelocity;
JumpBoost = jumpBoost;
}
public float MaxSpeed { get; set; } = maxSpeed;
public float JumpVelocity { get; set; } = jumpVelocity;
public float JumpBoost { get; set; } = jumpBoost;
}
}
}

View file

@ -1,8 +1,10 @@
using System.Drawing;
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
namespace jRandomSkills
@ -10,6 +12,8 @@ namespace jRandomSkills
public class C4Camouflage : ISkill
{
private const Skills skillName = Skills.C4Camouflage;
private static bool exists = false;
private static readonly Dictionary<ulong, List<uint>> invisibleEntities = [];
public static void LoadSkill()
{
@ -77,10 +81,40 @@ namespace jRandomSkills
}
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
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)
DisableSkill(player);
}
Instance.RemoveListener<CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
{
foreach (var (info, player) in infoList)
{
if (player == null) continue;
foreach ((var playerId, var itemList) in invisibleEntities)
if (player.SteamID != playerId)
foreach (var item in itemList)
info.TransmitEntities.Remove(item);
}
}
public static void EnableSkill(CCSPlayerController player)
{
if (!exists)
Instance.RegisterListener<CheckTransmit>(CheckTransmit);
exists = true;
if (player == null || !player.IsValid) return;
var playerPawn = player.PlayerPawn.Value;
@ -100,6 +134,7 @@ namespace jRandomSkills
{
SetPlayerVisibility(player, true);
SetWeaponVisibility(player, true);
invisibleEntities.Remove(player.SteamID);
}
private static void SetPlayerVisibility(CCSPlayerController player, bool enabled)
@ -113,23 +148,32 @@ namespace jRandomSkills
}
}
private static void SetWeaponVisibility(CCSPlayerController player, bool enabled)
private static void SetWeaponVisibility(CCSPlayerController player, bool visible)
{
if (!Instance.IsPlayerValid(player)) return;
var playerPawn = player.PlayerPawn.Value;
if (playerPawn == null || !playerPawn.IsValid) return;
var weaponServices = playerPawn.WeaponServices;
if (weaponServices == null) return;
var playerPawn = player.PlayerPawn.Value!;
if (playerPawn.WeaponServices == null) return;
var color = Color.FromArgb(enabled ? 255 : 0, 255, 255, 255);
foreach (var weapon in weaponServices.MyWeapons)
invisibleEntities.Remove(player.SteamID);
foreach (var weapon in playerPawn.WeaponServices.MyWeapons)
{
if (weapon != null && weapon.IsValid && weapon.Value != null && weapon.Value.IsValid)
{
weapon.Value.Render = color;
Utilities.SetStateChanged(weapon.Value, "CBaseModelEntity", "m_clrRender");
if (!visible)
{
if (invisibleEntities.TryGetValue(player.SteamID, out var items))
{
if (!items.Contains(weapon.Index))
items.Add(weapon.Index);
}
else
invisibleEntities.Add(player.SteamID, [weapon.Index]);
}
}
}
if (visible)
invisibleEntities.Remove(player.SteamID);
}
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00911f", CsTeam onlyTeam = CsTeam.Terrorist, bool needsTeammates = false) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)

View file

@ -6,6 +6,7 @@ using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners;
using static jRandomSkills.jRandomSkills;
using jRandomSkills.src.utils;
using CounterStrikeSharp.API.Core.Attributes;
namespace jRandomSkills
{
@ -13,6 +14,7 @@ namespace jRandomSkills
{
private const Skills skillName = Skills.Chicken;
private static bool roundEnd = false;
private static bool exists = false;
private static readonly string[] disabledWeapons =
[
"weapon_ak47", "weapon_m4a4", "weapon_m4a1", "weapon_m4a1_silencer",
@ -57,6 +59,8 @@ namespace jRandomSkills
DisableSkill(player);
}
roundEnd = true;
Instance.RemoveListener<CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
@ -92,11 +96,26 @@ namespace jRandomSkills
Instance.RegisterListener<OnTick>(OnTick);
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
{
foreach (var (info, player) in infoList)
{
if (player == null) continue;
if (chickens.TryGetValue(player, out var chicken))
if (chicken != null && chicken.IsValid)
info.TransmitEntities.Remove(chicken.Index);
}
}
public static void EnableSkill(CCSPlayerController player)
{
var playerPawn = player.PlayerPawn?.Value;
if (playerPawn != null && playerPawn.IsValid)
{
if (!exists)
Instance.RegisterListener<CheckTransmit>(CheckTransmit);
exists = true;
playerPawn.VelocityModifier = 1.1f;
playerPawn.Health = 50;
@ -136,11 +155,11 @@ namespace jRandomSkills
SetWeaponAttack(player, false);
}
foreach (var chicken in chickens)
if (chickens.TryGetValue(player, out var chicken))
{
if (chicken.Value != null && chicken.Value.IsValid)
chicken.Value.Remove();
chickens.Remove(chicken.Key);
if (chicken != null && chicken.IsValid)
chicken.Remove();
chickens.Remove(player);
}
}

View file

@ -15,6 +15,7 @@ namespace jRandomSkills
{
private const Skills skillName = Skills.Ghost;
private static bool roundEnd = false;
private static bool exists = false;
private static readonly string[] disabledWeapons =
[
"weapon_deagle", "weapon_revolver", "weapon_glock", "weapon_usp_silencer",
@ -27,7 +28,7 @@ namespace jRandomSkills
"weapon_g3sg1", "weapon_nova", "weapon_xm1014", "weapon_mag7",
"weapon_sawedoff", "weapon_m249", "weapon_negev"
];
private static readonly HashSet<uint> invisibleEntities = [];
private static readonly Dictionary<ulong, List<uint>> invisibleEntities = [];
public static void LoadSkill()
{
@ -63,6 +64,8 @@ namespace jRandomSkills
DisableSkill(player);
}
roundEnd = true;
Instance.RemoveListener<CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
@ -86,7 +89,18 @@ namespace jRandomSkills
if (playerInfo?.Skill != skillName) return HookResult.Continue;
SetWeaponVisibility(player!, false);
SetWearablesVisibility(player!, false);
SetWeaponAttack(player!, true);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
{
var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player?.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
SetWeaponVisibility(player!, false);
SetWeaponAttack(player!, true);
return HookResult.Continue;
});
@ -99,7 +113,6 @@ namespace jRandomSkills
});
Instance.RegisterListener<OnTick>(OnTick);
Instance.RegisterListener<CheckTransmit>(CheckTransmit);
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
@ -107,16 +120,21 @@ namespace jRandomSkills
foreach (var (info, player) in infoList)
{
if (player == null) continue;
foreach (var entity in invisibleEntities)
info.TransmitEntities.Remove((int)entity);
foreach ((var playerId, var itemList) in invisibleEntities)
if (player.SteamID != playerId)
foreach (var item in itemList)
info.TransmitEntities.Remove(item);
}
}
public static void EnableSkill(CCSPlayerController player)
{
if (!exists)
Instance.RegisterListener<CheckTransmit>(CheckTransmit);
exists = true;
SetPlayerVisibility(player, false);
SetWeaponVisibility(player, false);
SetWearablesVisibility(player, false);
SetWeaponAttack(player, true);
}
@ -124,8 +142,8 @@ namespace jRandomSkills
{
SetPlayerVisibility(player, true);
SetWeaponVisibility(player, true);
SetWearablesVisibility(player, true);
SetWeaponAttack(player, false);
invisibleEntities.Remove(player.SteamID);
}
private static void OnTick()
@ -152,44 +170,39 @@ namespace jRandomSkills
}
}
private static void SetWearablesVisibility(CCSPlayerController player, bool visible)
{
if (!Instance.IsPlayerValid(player)) return;
var playerPawn = player.PlayerPawn.Value!;
var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
var shadowStrength = visible ? 1.0f : 0.0f;
foreach (var item in playerPawn.MyWearables)
{
if (item != null && item.IsValid && item.Value != null && item.Value.IsValid)
{
Server.PrintToChatAll($"NAME: {item.Value.DesignerName}");
item.Value.Render = color;
item.Value.ShadowStrength = shadowStrength;
Utilities.SetStateChanged(item.Value, "CBaseModelEntity", "m_clrRender");
}
}
}
private static void SetWeaponVisibility(CCSPlayerController player, bool visible)
{
if (!Instance.IsPlayerValid(player)) return;
var playerPawn = player.PlayerPawn.Value!;
if (playerPawn.WeaponServices == null) return;
var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
var shadowStrength = visible ? 1.0f : 0.0f;
// var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
// var shadowStrength = visible ? 1.0f : 0.0f;
invisibleEntities.Remove(player.SteamID);
foreach (var weapon in playerPawn.WeaponServices.MyWeapons)
{
if (weapon != null && weapon.IsValid && weapon.Value != null && weapon.Value.IsValid)
{
if (!visible)
{
if (invisibleEntities.TryGetValue(player.SteamID, out var items))
{
if (!items.Contains(weapon.Index))
items.Add(weapon.Index);
}
else
invisibleEntities.Add(player.SteamID, [weapon.Index]);
}
/*
weapon.Value.Render = color;
weapon.Value.ShadowStrength = shadowStrength;
Utilities.SetStateChanged(weapon.Value, "CBaseModelEntity", "m_clrRender");
Utilities.SetStateChanged(weapon.Value, "CBaseModelEntity", "m_clrRender");*/
}
}
if (visible)
invisibleEntities.Remove(player.SteamID);
}
private static void SetWeaponAttack(CCSPlayerController player, bool disableWeapon)

View file

@ -12,7 +12,7 @@ namespace jRandomSkills
{
private const Skills skillName = Skills.Glaz;
private static bool exists = false;
private static List<int> smokes = new List<int>();
private readonly static List<int> smokes = [];
public static void LoadSkill()
{
@ -80,11 +80,8 @@ namespace jRandomSkills
SkillUtils.TryGiveWeapon(player, CsItem.SmokeGrenade);
}
public class SkillConfig : Config.DefaultSkillInfo
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : Config.DefaultSkillInfo(skill, active, color, onlyTeam, needsTeammates)
{
public SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.None, bool needsTeammates = false) : base(skill, active, color, onlyTeam, needsTeammates)
{
}
}
}
}

View file

@ -73,8 +73,9 @@ namespace jRandomSkills
if (pawn == null || !pawn.IsValid || pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE) continue;
var beams = step.Value;
if (beams.Count == 0 || pawn.AbsOrigin == null) continue;
Vector lastBeamVector = beams.LastOrDefault()?.EndPos ?? pawn.AbsOrigin;
if (pawn.AbsOrigin == null) continue;
Vector lastBeamVector = beams.Count > 0
? beams.LastOrDefault()!.EndPos : pawn.AbsOrigin;
var newBeam = CreateBeamStep(step.Key.Team, lastBeamVector, pawn.AbsOrigin);
if (newBeam != null)

View file

@ -1,6 +1,7 @@
using System.Drawing;
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Utils;
using jRandomSkills.src.player;
using static CounterStrikeSharp.API.Core.Listeners;
@ -11,15 +12,36 @@ namespace jRandomSkills
public class Ninja : ISkill
{
private const Skills skillName = Skills.Ninja;
private static bool exists = false;
private static readonly float idlePercentInvisibility = Config.GetValue<float>(skillName, "idlePercentInvisibility");
private static readonly float duckPercentInvisibility = Config.GetValue<float>(skillName, "duckPercentInvisibility");
private static readonly float knifePercentInvisibility = Config.GetValue<float>(skillName, "knifePercentInvisibility");
private static readonly Dictionary<nint, float> invisibilityChanged = [];
private static readonly Dictionary<ulong, List<uint>> invisibleEntities = [];
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
{
Instance.AddTimer(0.1f, () =>
{
foreach (var player in Utilities.GetPlayers())
{
DisableSkill(player);
if (!Instance.IsPlayerValid(player)) continue;
var playerPawn = player.PlayerPawn?.Value;
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) continue;
EnableSkill(player);
}
});
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundStart>((@event, info) =>
{
foreach (var player in Utilities.GetPlayers())
@ -51,9 +73,46 @@ namespace jRandomSkills
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
{
var player = @event.Userid;
if (!Instance.IsPlayerValid(player)) return HookResult.Continue;
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player?.SteamID);
if (playerInfo?.Skill != skillName) return HookResult.Continue;
UpdateNinja(player);
return HookResult.Continue;
});
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
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)
DisableSkill(player);
}
Instance.RemoveListener<CheckTransmit>(CheckTransmit);
exists = false;
return HookResult.Continue;
});
Instance.RegisterListener<OnTick>(OnTick);
}
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
{
foreach (var (info, player) in infoList)
{
if (player == null) continue;
foreach ((var playerId, var itemList) in invisibleEntities)
if (player.SteamID != playerId)
foreach (var item in itemList)
info.TransmitEntities.Remove(item);
}
}
private static void OnTick()
{
foreach (var player in Utilities.GetPlayers())
@ -64,10 +123,18 @@ namespace jRandomSkills
}
}
public static void EnableSkill(CCSPlayerController player)
{
if (!exists)
Instance.RegisterListener<CheckTransmit>(CheckTransmit);
exists = true;
}
public static void DisableSkill(CCSPlayerController player)
{
SetPlayerVisibility(player, 0);
SetWeaponVisibility(player, 0);
invisibleEntities.Remove(player.SteamID);
}
private static void UpdateNinja(CCSPlayerController? player)
@ -92,13 +159,13 @@ namespace jRandomSkills
if (!buttons.HasFlag(PlayerButtons.Moveleft) && !buttons.HasFlag(PlayerButtons.Moveright) && !buttons.HasFlag(PlayerButtons.Forward) && !buttons.HasFlag(PlayerButtons.Back) && flags.HasFlag(PlayerFlags.FL_ONGROUND))
percentInvisibility += idlePercentInvisibility;
SetWeaponVisibility(player, percentInvisibility);
if (invisibilityChanged.TryGetValue(player.Handle, out float oldInvisibility))
if (percentInvisibility == oldInvisibility)
return;
invisibilityChanged[player.Handle] = percentInvisibility;
SetPlayerVisibility(player, percentInvisibility);
SetWeaponVisibility(player, percentInvisibility);
}
private static void SetPlayerVisibility(CCSPlayerController player, float percentInvisibility)
@ -115,17 +182,25 @@ namespace jRandomSkills
private static void SetWeaponVisibility(CCSPlayerController player, float percentInvisibility)
{
if (!Instance.IsPlayerValid(player)) return;
var playerPawn = player.PlayerPawn.Value;
if (playerPawn == null || !playerPawn.IsValid || playerPawn.WeaponServices == null) return;
var playerPawn = player.PlayerPawn.Value!;
if (playerPawn.WeaponServices == null) return;
var color = Color.FromArgb(Math.Max(255 - (int)(255 * percentInvisibility * 2), 0), 255, 255, 255);
invisibleEntities.Remove(player.SteamID);
if (color.A != 0) return;
foreach (var weapon in playerPawn.WeaponServices.MyWeapons)
{
if (weapon != null && weapon.IsValid && weapon.Value != null && weapon.Value.IsValid)
{
weapon.Value.Render = color;
Utilities.SetStateChanged(weapon.Value, "CBaseModelEntity", "m_clrRender");
if (invisibleEntities.TryGetValue(player.SteamID, out var items))
{
if (!items.Contains(weapon.Index))
items.Add(weapon.Index);
}
else
invisibleEntities.Add(player.SteamID, [weapon.Index]);
}
}
}

View file

@ -20,7 +20,7 @@ namespace jRandomSkills
public static void LoadSkill()
{
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"));
SkillUtils.RegisterSkill(skillName, Config.GetValue<string>(skillName, "color"), false);
Instance.RegisterListener<OnTick>(() =>
{

View file

@ -140,52 +140,54 @@ namespace jRandomSkills
public bool TeamMateSkillInfo { get; set; }
public bool SummaryAfterTheRound { get; set; }
public bool DebugMode { get; set; }
public string SetSkillCommands { get; set; }
public string SkillsListCommands { get; set; }
public string UseSkillCommands { get; set; }
public string ChangeMapCommands { get; set; }
public string StartGameCommands { get; set; }
public string ConsoleCommands { get; set; }
public string SwapCommands { get; set; }
public string ShuffleCommands { get; set; }
public string PauseCommands { get; set; }
public string HealCommands { get; set; }
public string SetScoreCommands { get; set; }
public VotingCommand[] VotingCommand { get; set; }
public NormalCommand SetSkillCommands { get; set; }
public NormalCommand SkillsListCommands { get; set; }
public NormalCommand UseSkillCommands { get; set; }
public NormalCommand HealCommands { get; set; }
public NormalCommand ConsoleCommands { get; set; }
public NormalCommand SetStaticSkillCommands { get; set; }
public VotingCommand StartGameCommands { get; set; }
public VotingCommand ChangeMapCommands { get; set; }
public VotingCommand SwapCommands { get; set; }
public VotingCommand ShuffleCommands { get; set; }
public VotingCommand PauseCommands { get; set; }
public VotingCommand SetScoreCommands { get; set; }
public Settings()
{
LangCode = "en";
GameMode = (int)GameModes.Normal;
GameMode = (int)GameModes.NoRepeat;
KillerSkillInfo = true;
TeamMateSkillInfo = true;
SummaryAfterTheRound = true;
DebugMode = true;
SetSkillCommands = "ustawskill, setskill, definirhabilidade, configurarhabilidade, 设置技能, 配置技能";
SkillsListCommands = "supermoc, skille, listamocy, supermoce, skills, listaHabilidades, habilidades, 技能列表, 超能力列表";
UseSkillCommands = "t, useSkill, usarHabilidade, 技能使用, 使用技能";
HealCommands = "heal, ulecz, curar, tratar, 治疗, 治愈";
ConsoleCommands = "console, sv, 控制台, 服务器";
SetSkillCommands = new NormalCommand("ustawskill, ustaw_skill, setskill, set_skill, definirhabilidade, configurarhabilidade, 设置技能, 配置技能", "@jRandmosSkills/admin");
SkillsListCommands = new NormalCommand("supermoc, skille, listamocy, supermoce, skills, listaHabilidades, habilidades, 技能列表, 超能力列表", "@jRandmosSkills/admin");
UseSkillCommands = new NormalCommand("t, useSkill, usarHabilidade, 技能使用, 使用技能", "@jRandmosSkills/admin");
HealCommands = new NormalCommand("heal, ulecz, curar, tratar, 治疗, 治愈", "@jRandmosSkills/admin");
ConsoleCommands = new NormalCommand("console, sv, 控制台, 服务器", "@jRandmosSkills/root");
SetStaticSkillCommands = new NormalCommand("ustawstatycznyskill, ustaw_statyczny_skill, setstaticskill, set_static_skill", "@jRandmosSkills/admin");
VotingCommand = [
new VotingCommand("StartGameCommands", true, "start, go, começar, iniciar, 开始, 启动", "@jRandmosSkills/admin", 15, 60, 15, 500, 2),
new VotingCommand("ChangeMapCommands", true, "map, mapa, changemap, zmienmape, zmienmape, mudarMapa, trocarMapa, 更换地图, 更改地图", "@jRandmosSkills/admin", 25, 90, 15, 500, 2),
new VotingCommand("SwapCommands", true, "swap, zmiana, trocar, 交换, 切换", "@jRandmosSkills/admin", 15, 90, 15, 20, 2),
new VotingCommand("ShuffleCommands", true, "shuffle, embaralhar, 随机排序, 洗牌", "@jRandmosSkills/admin", 15, 90, 15, 90, 2),
new VotingCommand("PauseCommands", true, "pause, unpause, pausar, despausar, 暂停, 恢复", "@jRandmosSkills/admin", 15, 60, 15, 90, 2),
new VotingCommand("SetScoreCommands", true, "setscore, wynik, definirPontuacao, configurarPontos, 设置分数, 调整分数", "@jRandmosSkills/root", 15, 90, 15, 90, 2),
];
StartGameCommands = new VotingCommand(true, "start, go, começar, iniciar, 开始, 启动", "@jRandmosSkills/admin", 15, 60, 15, 500, 2);
ChangeMapCommands = new VotingCommand( true, "map, mapa, changemap, zmienmape, zmienmape, mudarMapa, trocarMapa, 更换地图, 更改地图", "@jRandmosSkills/admin", 25, 90, 15, 500, 2);
SwapCommands = new VotingCommand(true, "swap, zmiana, trocar, 交换, 切换", "@jRandmosSkills/admin", 15, 90, 15, 20, 2);
ShuffleCommands = new VotingCommand(true, "shuffle, embaralhar, 随机排序, 洗牌", "@jRandmosSkills/admin", 15, 90, 15, 20, 2);
PauseCommands = new VotingCommand(true, "pause, unpause, pausar, despausar, 暂停, 恢复", "@jRandmosSkills/admin", 15, 60, 15, 2, 2);
SetScoreCommands = new VotingCommand(true, "setscore, wynik, definirPontuacao, configurarPontos, 设置分数, 调整分数", "@jRandmosSkills/root", 15, 90, 15, 90, 2);
}
}
public class VotingCommand(string name, bool enableVoting, string alias, string permissions, float timeToVote, float percentagesToSuccess, float timeToNextVoting, float timeToNextSameVoting, int minimumPlayersToStartVoting)
public class NormalCommand(string alias, string permissions)
{
public string Name { get; set; } = name;
public bool EnableVoting { get; set; } = enableVoting;
public string Alias { get; set; } = alias;
public string Permissions { get; set; } = permissions;
}
public class VotingCommand(bool enableVoting, string alias, string permissions, float timeToVote, float percentagesToSuccess, float timeToNextVoting, float timeToNextSameVoting, int minimumPlayersToStartVoting) : NormalCommand(alias, permissions)
{
public bool EnableVoting { get; set; } = enableVoting;
public float TimeToVote { get; set; } = timeToVote;
public float PercentagesToSuccess { get; set; } = percentagesToSuccess;
public float TimeToNextVoting { get; set; } = timeToNextVoting;
@ -207,7 +209,8 @@ namespace jRandomSkills
Normal = 0,
TeamSkills = 1,
SameSkills = 2,
Debug = 3,
NoRepeat = 3,
Debug = 4
}
}
}