Updates & Fixes
# Updates & Fixes
- New Commands: Added `!health` and `!plantedbomb` for testing and server management.
- Config: Client commands are now fully registerable via configuration files.
- Jester (Rework):
- Refactored from a global mode to a per-player system.
- Improved timer logic to prevent crashes during round resets.
- Added special handling for bomb planting and defusing.
- SkillUtils: `AddHealth` now supports an optional `maxHealth` parameter.
- KillerFlash, LongKnife & LongZeus: Added `friendlyFire` options to skill configs.
This commit is contained in:
parent
97887118bf
commit
8634665983
12 changed files with 219 additions and 62 deletions
|
|
@ -40,6 +40,8 @@ namespace src.command
|
|||
{ SplitCommands(config.NormalCommands.UseSkillCommand.Alias), ("Use/Type skill", Command_UseTypeSkill) },
|
||||
{ SplitCommands(config.NormalCommands.ConsoleCommand.Alias), ("Console command", Command_CustomCommand) },
|
||||
{ SplitCommands(config.NormalCommands.HealCommand.Alias), ("Heal", Command_Heal) },
|
||||
{ SplitCommands(config.NormalCommands.HealthCommand.Alias), ("Set heath", Command_Health) },
|
||||
{ SplitCommands(config.NormalCommands.PlantedBomb.Alias), ("Spawn planted bomb", Command_PlantedBomb) },
|
||||
{ SplitCommands(config.NormalCommands.HudCommand.Alias), ("Enable/Disable HUD", Command_HUD) },
|
||||
{ SplitCommands(config.NormalCommands.SetStaticSkillCommand.Alias), ("Set static skill", Command_SetStaticSkill) },
|
||||
{ SplitCommands(config.NormalCommands.ChangeLanguageCommand.Alias), ("Change language", Command_ChangeLanguage) },
|
||||
|
|
@ -314,7 +316,7 @@ namespace src.command
|
|||
gamePaused = !gamePaused;
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
private static void Command_Heal(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_heal {command.ArgString} command.");
|
||||
|
|
@ -324,6 +326,41 @@ namespace src.command
|
|||
player.PrintToChat($" {ChatColors.Green}{player.GetTranslation("healed")}");
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 1, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
private static void Command_Health(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_health {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 (!string.IsNullOrEmpty(config.NormalCommands.HealthCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.HealthCommand.Permissions)) return;
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (int.TryParse(command.GetArg(1), out int health))
|
||||
SkillUtils.AddHealth(pawn, health - pawn.Health, health);
|
||||
|
||||
player.PrintToChat($" {ChatColors.Green}{player.GetTranslation("healed")}");
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
private static void Command_PlantedBomb(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
Debug.WriteToDebug($"Player {player?.PlayerName} used the css_plantedbomb {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 (!string.IsNullOrEmpty(config.NormalCommands.PlantedBomb.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.PlantedBomb.Permissions)) return;
|
||||
|
||||
CPlantedC4? bomb = Utilities.CreateEntityByName<CPlantedC4>("planted_c4");
|
||||
if (bomb == null || !bomb.IsValid) return;
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
bomb.Teleport(pawn.AbsOrigin, pawn.AbsRotation);
|
||||
bomb.DispatchSpawn();
|
||||
bomb.BombTicking = true;
|
||||
|
||||
if (!int.TryParse(command.GetArg(1), out int time))
|
||||
time = 40;
|
||||
|
||||
bomb.C4Blow = (float)Server.EngineTime + time;
|
||||
}
|
||||
|
||||
[CommandHelper(minArgs: 0, whoCanExecute: CommandUsage.CLIENT_ONLY)]
|
||||
private static void Command_HUD(CCSPlayerController? player, CommandInfo command)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@ using src.utils;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Drawing;
|
||||
using static src.jRandomSkills;
|
||||
using Timer = CounterStrikeSharp.API.Modules.Timers.Timer;
|
||||
|
||||
namespace src.player.skills
|
||||
{
|
||||
public class Jester : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Jester;
|
||||
private static bool jesterMode = false;
|
||||
private static bool jesterStarted = false;
|
||||
public static bool GetJesterMode() => jesterMode;
|
||||
private static readonly ConcurrentBag<CCSPlayerController> jesters = [];
|
||||
private static readonly ConcurrentBag<JesterInfo> jesters = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
|
|
@ -23,79 +21,166 @@ namespace src.player.skills
|
|||
|
||||
public static void NewRound()
|
||||
{
|
||||
jesterStarted = false;
|
||||
foreach (var jester in jesters)
|
||||
if (jester != null && jester.IsValid)
|
||||
DisableSkill(jester);
|
||||
jesters.Clear();
|
||||
Server.NextWorldUpdate(() =>
|
||||
{
|
||||
foreach (var jester in jesters.ToList())
|
||||
{
|
||||
if (jester.Timer != null)
|
||||
{
|
||||
jester.Timer?.Kill();
|
||||
jester.Timer = null;
|
||||
}
|
||||
|
||||
var player = Utilities.GetPlayerFromSteamId(jester.SteamId);
|
||||
if (player != null && player.IsValid)
|
||||
{
|
||||
SkillUtils.ResetPrintHTML(player);
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (pawn == null || !pawn.IsValid || !player.PawnIsAlive) return;
|
||||
|
||||
var color = Color.FromArgb(255, 255, 255, 255);
|
||||
pawn.Render = color;
|
||||
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
}
|
||||
jesters.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillUtils.ResetPrintHTML(player);
|
||||
if (player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid) return;
|
||||
SetPlayerColor(player.PlayerPawn.Value, true);
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
Server.NextWorldUpdate(() =>
|
||||
{
|
||||
if (jester.Timer != null)
|
||||
{
|
||||
jester.Timer?.Kill();
|
||||
jester.Timer = null;
|
||||
}
|
||||
|
||||
SkillUtils.ResetPrintHTML(player);
|
||||
SetPlayerColor(player, true);
|
||||
});
|
||||
}
|
||||
|
||||
public static void BombBegindefuse(EventBombBegindefuse @event)
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (player == null || !player.IsValid) return;
|
||||
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
if (jester.Timer != null)
|
||||
{
|
||||
jester.Timer?.Kill();
|
||||
jester.Timer = null;
|
||||
}
|
||||
|
||||
jester.Timer = Instance.AddTimer(1, () => {
|
||||
if (player != null && player.IsValid)
|
||||
ChangeMode(player.SteamID, false);
|
||||
});
|
||||
}
|
||||
|
||||
public static void BombBeginplant(EventBombBeginplant @event)
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (player == null || !player.IsValid) return;
|
||||
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
if (jester.Timer != null)
|
||||
{
|
||||
jester.Timer?.Kill();
|
||||
jester.Timer = null;
|
||||
}
|
||||
|
||||
jester.Timer = Instance.AddTimer(1, () => {
|
||||
if (player != null && player.IsValid)
|
||||
ChangeMode(player.SteamID, false);
|
||||
});
|
||||
}
|
||||
|
||||
public static void PlayerHurt(EventPlayerHurt @event)
|
||||
{
|
||||
if (!jesterMode) return;
|
||||
var attacker = @event.Attacker;
|
||||
var victim = @event.Userid;
|
||||
int hitgroup = @event.Hitgroup;
|
||||
|
||||
if (!Instance.IsPlayerValid(victim)) return;
|
||||
var victimInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == victim?.SteamID);
|
||||
var jesterVictim = GetJesterInfo(victim!.SteamID);
|
||||
|
||||
if (!Instance.IsPlayerValid(attacker))
|
||||
{
|
||||
if (victimInfo?.Skill == skillName)
|
||||
if (jesterVictim != null && jesterVictim.Active)
|
||||
SkillUtils.RestoreHealth(victim);
|
||||
return;
|
||||
}
|
||||
|
||||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
if (attackerInfo?.Skill == skillName || victimInfo?.Skill == skillName)
|
||||
var jesterAttacker = GetJesterInfo(attacker!.SteamID);
|
||||
if ((jesterVictim != null && jesterVictim.Active) || (jesterAttacker != null && jesterAttacker.Active))
|
||||
SkillUtils.RestoreHealth(victim);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController _)
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
if (!jesterStarted)
|
||||
{
|
||||
var minTime = SkillsInfo.GetValue<float>(skillName, "minTime");
|
||||
var maxTime = SkillsInfo.GetValue<float>(skillName, "maxTime");
|
||||
float wait = (float)Instance.Random.NextDouble() * (maxTime - minTime) + minTime;
|
||||
Instance.AddTimer(wait, ChangeMode);
|
||||
jesterStarted = true;
|
||||
}
|
||||
var minTime = SkillsInfo.GetValue<float>(skillName, "minTime");
|
||||
var maxTime = SkillsInfo.GetValue<float>(skillName, "maxTime");
|
||||
float wait = (float)Instance.Random.NextDouble() * (maxTime - minTime) + minTime;
|
||||
|
||||
jesters.Add(new JesterInfo {
|
||||
SteamId = player.SteamID,
|
||||
Active = false,
|
||||
Timer = Instance.AddTimer(wait, () => ChangeMode(player.SteamID))
|
||||
});
|
||||
}
|
||||
|
||||
private static void ChangeMode()
|
||||
private static void ChangeMode(ulong steamId, bool? forceActive = null)
|
||||
{
|
||||
if (Instance.SkillPlayer.Any(p => p.Skill == skillName))
|
||||
var player = Utilities.GetPlayerFromSteamId(steamId);
|
||||
if (player == null || !player.IsValid || !player.PawnIsAlive) return;
|
||||
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
if (jester.Timer != null)
|
||||
{
|
||||
jesterMode = !jesterMode;
|
||||
foreach (var player in Utilities.GetPlayers().Where(p => !p.IsBot && p.PawnIsAlive))
|
||||
{
|
||||
if (player == null || !player.IsValid || player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid) continue;
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player?.SteamID);
|
||||
if (playerInfo?.Skill == skillName)
|
||||
{
|
||||
SetPlayerColor(player.PlayerPawn.Value);
|
||||
player.ExecuteClientCommand("play sounds/weapons/taser/taser_charge_ready");
|
||||
}
|
||||
}
|
||||
var minTime = SkillsInfo.GetValue<float>(skillName, "minTime");
|
||||
var maxTime = SkillsInfo.GetValue<float>(skillName, "maxTime");
|
||||
float wait = (float)Instance.Random.NextDouble() * (maxTime - minTime) + minTime;
|
||||
Instance.AddTimer(wait, ChangeMode);
|
||||
jester.Timer?.Kill();
|
||||
jester.Timer = null;
|
||||
}
|
||||
|
||||
bool previousState = jester.Active;
|
||||
jester.Active = forceActive ?? !jester.Active;
|
||||
|
||||
if (jester.Active != previousState)
|
||||
{
|
||||
SetPlayerColor(player);
|
||||
player.ExecuteClientCommand("play sounds/weapons/taser/taser_charge_ready");
|
||||
}
|
||||
|
||||
var minTime = SkillsInfo.GetValue<float>(skillName, "minTime");
|
||||
var maxTime = SkillsInfo.GetValue<float>(skillName, "maxTime");
|
||||
float wait = (float)Instance.Random.NextDouble() * (maxTime - minTime) + minTime;
|
||||
|
||||
jester.Timer = Instance.AddTimer(wait, () => ChangeMode(player.SteamID));
|
||||
}
|
||||
|
||||
private static void SetPlayerColor(CCSPlayerPawn pawn, bool forceDisable = false)
|
||||
private static void SetPlayerColor(CCSPlayerController? player, bool forceDisable = false)
|
||||
{
|
||||
var color = jesterMode && !forceDisable ? Color.FromArgb(255, 128, 0, 128) : Color.FromArgb(255, 255, 255, 255);
|
||||
if (player == null || !player.IsValid) return;
|
||||
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
if (pawn == null || !pawn.IsValid) return;
|
||||
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
var color = jester.Active && !forceDisable ? Color.FromArgb(255, 128, 0, 128) : Color.FromArgb(255, 255, 255, 255);
|
||||
pawn.Render = color;
|
||||
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
|
|
@ -116,7 +201,20 @@ namespace src.player.skills
|
|||
{
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(s => s.SteamID == player?.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
playerInfo.PrintHTML = $"{player.GetTranslation("jester_mode")}: <font color='{(jesterMode ? "#00ff00" : "#ff0000")}'>{player.GetTranslation(jesterMode ? "jester_on" : "jester_off")}</font>";
|
||||
|
||||
var jester = GetJesterInfo(player.SteamID);
|
||||
if (jester == null) return;
|
||||
|
||||
playerInfo.PrintHTML = $"{player.GetTranslation("jester_mode")}: <font color='{(jester.Active ? "#00ff00" : "#ff0000")}'>{player.GetTranslation(jester.Active ? "jester_on" : "jester_off")}</font>";
|
||||
}
|
||||
|
||||
public static JesterInfo? GetJesterInfo(ulong steamID) => jesters.FirstOrDefault(j => j.SteamId == steamID);
|
||||
|
||||
public class JesterInfo()
|
||||
{
|
||||
public required ulong SteamId { get; set; }
|
||||
public bool Active { get; set; } = false;
|
||||
public Timer? Timer { get; set; } = null;
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8f108f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float minTime = 10f, float maxTime = 25f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Commands.Targeting;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using src.utils;
|
||||
|
|
@ -24,6 +25,8 @@ namespace src.player.skills
|
|||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player?.SteamID);
|
||||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
|
||||
if (!SkillsInfo.GetValue<bool>(skillName, "friendlyFire") && player!.Team == attacker!.Team) return;
|
||||
|
||||
if (attackerInfo?.Skill == skillName && playerInfo?.Skill != Skills.AntyFlash && player!.PlayerPawn.Value!.FlashDuration >= SkillsInfo.GetValue<float>(skillName, "flashDuration"))
|
||||
player?.PlayerPawn?.Value?.CommitSuicide(false, true);
|
||||
}
|
||||
|
|
@ -33,9 +36,10 @@ namespace src.player.skills
|
|||
SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#57bcff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float flashDuration = 1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#57bcff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float flashDuration = 1f, bool friendlyFire = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float FlashDuration { get; set; } = flashDuration;
|
||||
public bool FriendlyFire { get; set; } = friendlyFire;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -129,13 +129,16 @@ namespace src.player.skills
|
|||
return;
|
||||
|
||||
if (target.Handle == player.Handle || target.PlayerPawn.Value == null || !target.PlayerPawn.Value.IsValid || trace.Distance() <= 70) return;
|
||||
if (!SkillsInfo.GetValue<bool>(skillName, "friendlyFire") && player.Team == target.Team) return;
|
||||
|
||||
target.PlayerPawn.Value.EmitSound("Player.DamageBody.Onlooker");
|
||||
SkillUtils.TakeHealth(target.PlayerPawn.Value, heavyHit ? Instance.Random.Next(45, 55) : Instance.Random.Next(21, 34));
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#c9f8ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxDistance = 4096f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#c9f8ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxDistance = 4096f, bool friendlyFire = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float MaxDistance { get; set; } = maxDistance;
|
||||
public bool FriendlyFire { get; set; } = friendlyFire;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using CS2TraceRay.Class;
|
||||
|
|
@ -62,6 +61,8 @@ namespace src.player.skills
|
|||
return;
|
||||
|
||||
if (target.Handle == player.Handle) return;
|
||||
if (!SkillsInfo.GetValue<bool>(skillName, "friendlyFire") && player.Team == target.Team) return;
|
||||
|
||||
SkillUtils.TakeHealth(target.PlayerPawn.Value, 9999);
|
||||
}
|
||||
|
||||
|
|
@ -70,9 +71,10 @@ namespace src.player.skills
|
|||
SkillUtils.TryGiveWeapon(player, CsItem.Zeus);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#6effc7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxDistance = 4096f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#6effc7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxDistance = 4096f, bool friendlyFire = false) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float MaxDistance { get; set; } = maxDistance;
|
||||
public bool FriendlyFire { get; set; } = friendlyFire;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,10 +73,13 @@ namespace src.player.skills
|
|||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#F5CB42", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float explosionRadius = 500.0f, int explosionDamage = 999) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#F5CB42", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float explosionRadius = 500.0f, int explosionDamage = 999, float dmgReductionForTeamates = .5f, bool explosionAfterWorldDeath = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission)
|
||||
{
|
||||
public float ExplosionRadius { get; set; } = explosionRadius;
|
||||
public int ExplosionDamage { get; set; } = explosionDamage;
|
||||
public float DmgReductionForTeamates { get; set; } = dmgReductionForTeamates;
|
||||
public bool ExplosionAfterWorldDeath { get; set; } = explosionAfterWorldDeath;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -170,6 +170,8 @@ namespace src.utils
|
|||
SkillsListCommand = new NormalCommand("supermoc, skille, listamocy, supermoce, skills, listaHabilidades, habilidades, 技能列表, 超能力列表", "@jRandomSkills/admin"),
|
||||
UseSkillCommand = new NormalCommand("t, useSkill, usarHabilidade, 技能使用, 使用技能", "@jRandomSkills/admin"),
|
||||
HealCommand = new NormalCommand("heal, ulecz, curar, tratar, 治疗, 治愈", "@jRandomSkills/admin"),
|
||||
HealthCommand = new NormalCommand("sethealth, health", "@jRandomSkills/admin"),
|
||||
PlantedBomb = new NormalCommand("plantedbomb, bomb", "@jRandomSkills/admin"),
|
||||
ConsoleCommand = new NormalCommand("console, sv, 控制台, 服务器", "@jRandomSkills/owner"),
|
||||
HudCommand = new NormalCommand("hud, hood", ""),
|
||||
SetStaticSkillCommand = new NormalCommand("ustawstatycznyskill, ustaw_statyczny_skill, setstaticskill, set_static_skill", "@jRandomSkills/admin"),
|
||||
|
|
@ -246,6 +248,8 @@ namespace src.utils
|
|||
public required NormalCommand SkillsListCommand { get; set; }
|
||||
public required NormalCommand UseSkillCommand { get; set; }
|
||||
public required NormalCommand HealCommand { get; set; }
|
||||
public required NormalCommand HealthCommand { get; set; }
|
||||
public required NormalCommand PlantedBomb { get; set; }
|
||||
public required NormalCommand ConsoleCommand { get; set; }
|
||||
public required NormalCommand HudCommand { get; set; }
|
||||
public required NormalCommand SetStaticSkillCommand { get; set; }
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ namespace src.utils
|
|||
output = output.Replace("css_useSkill", $"css_useSkill/{Config.LoadedConfig.AlternativeSkillButton}");
|
||||
|
||||
if (Illiterate.CheckIlliterateSkill(player))
|
||||
return Illiterate.GetRandomText(output);
|
||||
return Illiterate.GetRandomText(output)!;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -187,12 +187,16 @@ namespace src.utils
|
|||
if (pawn == null || !pawn.IsValid || pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
if (pawn.Controller.Value != null && pawn.Controller.Value.IsValid)
|
||||
var player = pawn.Controller.Value;
|
||||
if (player != null && player.IsValid && player.SteamID != 0)
|
||||
{
|
||||
var playerInfo = jRandomSkills.Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == pawn.Controller.Value.SteamID);
|
||||
ulong steamId = player.SteamID;
|
||||
|
||||
var playerInfo = jRandomSkills.Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == steamId);
|
||||
if (playerInfo == null) return;
|
||||
if (playerInfo.Skill == Skills.Jester && Jester.GetJesterMode())
|
||||
return;
|
||||
|
||||
var jester = Jester.GetJesterInfo(steamId);
|
||||
if (jester?.Active == true) return;
|
||||
}
|
||||
|
||||
int newHealth = (int)(pawn.Health - damage);
|
||||
|
|
@ -245,16 +249,18 @@ namespace src.utils
|
|||
return trigger;
|
||||
}
|
||||
|
||||
public static void AddHealth(CCSPlayerPawn? pawn, int extraHealth, int maxHealth = 100)
|
||||
public static void AddHealth(CCSPlayerPawn? pawn, int extraHealth, int? maxHealth = null)
|
||||
{
|
||||
if (pawn == null || !pawn.IsValid || pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
maxHealth ??= pawn.MaxHealth;
|
||||
|
||||
int newHealth = (int)(pawn.Health + extraHealth);
|
||||
pawn.Health = Math.Min(newHealth, maxHealth);
|
||||
pawn.Health = Math.Min(newHealth, (int)maxHealth);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
|
||||
pawn.MaxHealth = maxHealth;
|
||||
pawn.MaxHealth = (int)maxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue