fighting crashes #1

This commit is contained in:
Juzlus 2026-04-28 18:58:21 +02:00
parent 10dbf6629e
commit 0fb3d63cd8
145 changed files with 677278 additions and 1703 deletions

View file

Before

Width:  |  Height:  |  Size: 24 MiB

After

Width:  |  Height:  |  Size: 24 MiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 8.2 MiB

After

Width:  |  Height:  |  Size: 8.2 MiB

Before After
Before After

57
github/update_thanks.py Normal file
View file

@ -0,0 +1,57 @@
import requests
import os
# Konfiguracja
USER_IDS = ["284780352042434570"]
MARKER = "[THANKS]"
def get_html_for_user(user_id):
try:
url = f"https://pfpfinder.com/api/discord/user/{user_id}"
response = requests.get(url, timeout=10)
data = response.json()
name = data.get("global_name") or data.get("username")
avatar = data.get("avatar")
github_user = data.get("username")
return f"""
<a href="https://github.com/{github_user}" title="{name}">
<img src="{avatar}" alt="{name}" width="75" height="75" style="border-radius:50%">
</a>
"""
except Exception as e:
print(f"Błąd API: {e}")
return ""
def update_file(file_path, html_content):
if not os.path.exists(file_path):
print(f"❌ Plik {file_path} nie istnieje!")
return
with open(file_path, "r", encoding="utf-8") as f:
content = f.read()
if MARKER not in content:
print(f"⚠️ Marker {MARKER} nie został znaleziony w {file_path}")
return
# Zamiana markera na HTML
new_content = content.replace(MARKER, html_content)
with open(file_path, "w", encoding="utf-8") as f:
f.write(new_content)
print(f"✅ Zaktualizowano: {file_path}")
def main():
elements = "".join([get_html_for_user(uid) for uid in USER_IDS])
full_html = f'<div align="center">\n{elements}\n</div>'
files = ["../README.md", "../README-PL.md"]
for file in files:
update_file(file, full_html)
if __name__ == "__main__":
main()

View file

@ -3,6 +3,7 @@ using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Entities.Constants;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using src.menu; using src.menu;
using src.player; using src.player;

View file

@ -22,13 +22,13 @@ namespace src
public ConcurrentBag<jSkill_PlayerInfo> SkillPlayer { get; set; } = []; public ConcurrentBag<jSkill_PlayerInfo> SkillPlayer { get; set; } = [];
public Random Random { get; } = new Random(); public Random Random { get; } = new Random();
public CCSGameRules? GameRules { get; set; } public CCSGameRules? GameRules { get; set; }
private ConcurrentBag<string> ManifestResources { get; set; } = ["models/actors/ghost_speaker.vmdl"]; private ConcurrentBag<string> ManifestResources { get; set; } = ["models/sprays/spray_plane.vmdl"];
public IWasdMenuManager? MenuManager; public IWasdMenuManager? MenuManager;
public override string ModuleName => "[CS2] [ jRandomSkills ]"; public override string ModuleName => "[CS2] [ jRandomSkills ]";
public override string ModuleAuthor => "D3X, Juzlus"; public override string ModuleAuthor => "D3X, Juzlus";
public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus."; public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus.";
public override string ModuleVersion => "1.2.1.b8"; public override string ModuleVersion => "1.2.1.b9";
public override void Load(bool hotReload) public override void Load(bool hotReload)
{ {
@ -79,8 +79,21 @@ namespace src
internal object? SkillAction(string skill, string methodName, object[]? param = null) internal object? SkillAction(string skill, string methodName, object[]? param = null)
{ {
if (string.IsNullOrEmpty(skill))
return null;
string className = $"src.player.skills.{skill}"; string className = $"src.player.skills.{skill}";
Type? type = Type.GetType(className);
Type? type = Type.GetType(className)
?? Assembly.GetExecutingAssembly().GetType(className)
?? AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(a =>
{
try { return a.GetTypes(); }
catch (ReflectionTypeLoadException ex) { return ex.Types.Where(t => t!= null)!; }
catch { return []; }
})
.FirstOrDefault(t => t != null && string.Equals(t.FullName, className, StringComparison.Ordinal));
if (type != null && typeof(ISkill).IsAssignableFrom(type)) if (type != null && typeof(ISkill).IsAssignableFrom(type))
{ {
@ -89,6 +102,7 @@ namespace src
} }
else else
Server.PrintToConsole($"Could not find or load {className}"); Server.PrintToConsole($"Could not find or load {className}");
return null; return null;
} }

View file

@ -24,6 +24,7 @@ public interface ISkill
public static void PlayerHurt(EventPlayerHurt _) { } public static void PlayerHurt(EventPlayerHurt _) { }
public static void PlayerDeath(EventPlayerDeath _) { } public static void PlayerDeath(EventPlayerDeath _) { }
public static void PlayerJump(EventPlayerJump _) { } public static void PlayerJump(EventPlayerJump _) { }
public static void SwitchTeam(EventSwitchTeam _, GameEventInfo __) { }
public static void WeaponFire(EventWeaponFire _) { } public static void WeaponFire(EventWeaponFire _) { }
public static void WeaponEquip(EventItemEquip _) { } public static void WeaponEquip(EventItemEquip _) { }

View file

@ -2,7 +2,6 @@ using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes; using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Cvars;
using CounterStrikeSharp.API.Modules.Events; using CounterStrikeSharp.API.Modules.Events;
using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory;
@ -88,6 +87,55 @@ namespace src.player
DropWeaponFunc.Hook(WeaponDrop, HookMode.Pre); DropWeaponFunc.Hook(WeaponDrop, HookMode.Pre);
} }
private static jSkill_SkillInfo ChooseSkillByRarityAndMax(List<jSkill_SkillInfo> candidates, Dictionary<Skills, int> assignmentCounts, Config.GameModes gameMode)
{
if (candidates == null || candidates.Count == 0) return noneSkill;
bool ignoreMax = gameMode == Config.GameModes.SameSkills || gameMode == Config.GameModes.TeamSkills;
const int attempts = 6;
for (int attempt = 0; attempt < attempts; attempt++)
{
var rolled = RarityManager.RollRarity();
var filtered = candidates.Where(s =>
{
if (s == null) return false;
var def = SkillsInfo.LoadedConfig.FirstOrDefault(d => d.Name == s.Skill.ToString());
if (def == null) return false;
if (!string.Equals(def.Rarity ?? string.Empty, rolled.ToString(), StringComparison.OrdinalIgnoreCase))
return false;
if (!ignoreMax && def.MaxPerServer >= 0)
{
int current = assignmentCounts.TryGetValue(s.Skill, out var c) ? c : 0;
if (current >= def.MaxPerServer) return false;
}
return true;
}).ToList();
if (filtered.Count > 0)
return filtered[Instance.Random.Next(filtered.Count)];
}
var fallback = candidates.Where(s =>
{
var def = SkillsInfo.LoadedConfig.FirstOrDefault(d => d.Name == s.Skill.ToString());
if (def == null) return true;
if (ignoreMax) return true;
if (def.MaxPerServer < 0) return true;
int current = assignmentCounts.TryGetValue(s.Skill, out var c) ? c : 0;
return current < def.MaxPerServer;
}).ToList();
if (fallback.Count > 0)
return fallback[Instance.Random.Next(fallback.Count)];
return candidates[Instance.Random.Next(candidates.Count)];
}
private static HookResult PlayerMakeSound(UserMessage um) private static HookResult PlayerMakeSound(UserMessage um)
{ {
lock (setLock) lock (setLock)
@ -592,13 +640,15 @@ namespace src.player
{ {
lock (setLock) lock (setLock)
{ {
bool isWarmup = Instance.GameRules != null && Instance.GameRules.WarmupPeriod == true;
isTransmitRegistered = false; isTransmitRegistered = false;
Instance.AddTimer(.1f, () => DisableAll()); Instance.AddTimer(.1f, () => DisableAll());
foreach (var player in Utilities.GetPlayers().Where(p => p.IsValid && !p.IsBot && !p.IsHLTV && p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist)) foreach (var player in Utilities.GetPlayers().Where(p => p.IsValid && !p.IsBot && !p.IsHLTV && p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist))
{ {
var skillPlayer = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var skillPlayer = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (skillPlayer == null) continue; if (skillPlayer == null) continue;
skillPlayer.IsDrawing = true; skillPlayer.IsDrawing = !isWarmup;
skillPlayer.PrintHTML = null; skillPlayer.PrintHTML = null;
} }
@ -822,6 +872,12 @@ namespace src.player
setSkillTimer = null; setSkillTimer = null;
lock (setLock) lock (setLock)
{ {
if (Instance?.GameRules != null && Instance.GameRules.WarmupPeriod == true)
{
setSkillTimer?.Kill();
return;
}
var validPlayers = Utilities.GetPlayers() var validPlayers = Utilities.GetPlayers()
.Where(p => p != null && p.IsValid && !p.IsBot && !p.IsHLTV) .Where(p => p != null && p.IsValid && !p.IsBot && !p.IsHLTV)
.Where(p => { .Where(p => {
@ -848,6 +904,14 @@ namespace src.player
else if (Config.LoadedConfig.GameMode == (int)Config.GameModes.Debug && debugSkills.Count == 0) else if (Config.LoadedConfig.GameMode == (int)Config.GameModes.Debug && debugSkills.Count == 0)
debugSkills = [.. SkillData.Skills]; debugSkills = [.. SkillData.Skills];
Dictionary<Skills, int> assignmentCounts = new();
foreach (var sp in Instance.SkillPlayer)
{
if (sp == null) continue;
if (assignmentCounts.TryGetValue(sp.Skill, out var cnt)) assignmentCounts[sp.Skill] = cnt + 1;
else assignmentCounts[sp.Skill] = 1;
}
foreach (var player in validPlayers) foreach (var player in validPlayers)
{ {
if (player == null) continue; if (player == null) continue;
@ -866,12 +930,8 @@ namespace src.player
jSkill_SkillInfo randomSkill = noneSkill; jSkill_SkillInfo randomSkill = noneSkill;
if (Instance?.GameRules != null && Instance?.GameRules.WarmupPeriod == false)
{
Config.GameModes gameMode = (Config.GameModes)Config.LoadedConfig.GameMode; Config.GameModes gameMode = (Config.GameModes)Config.LoadedConfig.GameMode;
if (staticSkills.TryGetValue(player.SteamID, out var staticSkill)) if (gameMode == Config.GameModes.Normal || gameMode == Config.GameModes.FullRandom || gameMode == Config.GameModes.NoRepeat)
randomSkill = staticSkill;
else if (gameMode == Config.GameModes.Normal || gameMode == Config.GameModes.FullRandom || gameMode == Config.GameModes.NoRepeat)
{ {
List<jSkill_SkillInfo> skillList = [.. SkillData.Skills]; List<jSkill_SkillInfo> skillList = [.. SkillData.Skills];
skillList.RemoveAll(s => s?.Skill == Skills.None); skillList.RemoveAll(s => s?.Skill == Skills.None);
@ -897,7 +957,8 @@ namespace src.player
if (skillList.Count == 0) skills.Clear(); if (skillList.Count == 0) skills.Clear();
} }
randomSkill = skillList.Count == 0 ? noneSkill : skillList[Instance.Random.Next(skillList.Count)]; randomSkill = skillList.Count == 0 ? noneSkill : ChooseSkillByRarityAndMax(skillList, assignmentCounts, gameMode);
if (gameMode == Config.GameModes.NoRepeat) if (gameMode == Config.GameModes.NoRepeat)
{ {
if (playersSkills.TryGetValue(player.SteamID, out ConcurrentBag<jSkill_SkillInfo>? value)) if (playersSkills.TryGetValue(player.SteamID, out ConcurrentBag<jSkill_SkillInfo>? value))
@ -918,12 +979,17 @@ namespace src.player
debugSkills.RemoveAt(0); debugSkills.RemoveAt(0);
player.PrintToChat($"{SkillData.Skills.Count - debugSkills.Count}/{SkillData.Skills.Count}"); player.PrintToChat($"{SkillData.Skills.Count - debugSkills.Count}/{SkillData.Skills.Count}");
} }
}
Instance?.SkillAction(skillPlayer.Skill.ToString(), "DisableSkill", [player]); Instance?.SkillAction(skillPlayer.Skill.ToString(), "DisableSkill", [player]);
skillPlayer.Skill = randomSkill.Skill; skillPlayer.Skill = randomSkill.Skill;
skillPlayer.SpecialSkill = Skills.None; skillPlayer.SpecialSkill = Skills.None;
if (randomSkill != null && randomSkill.Skill != Skills.None)
{
if (assignmentCounts.TryGetValue(randomSkill.Skill, out var cnt)) assignmentCounts[randomSkill.Skill] = cnt + 1;
else assignmentCounts[randomSkill.Skill] = 1;
}
if (randomSkill.Skill == Skills.Illiterate) if (randomSkill.Skill == Skills.Illiterate)
Illiterate.Enable(); Illiterate.Enable();
@ -1043,19 +1109,28 @@ namespace src.player
if (skillList.Count == 0) skills.Clear(); if (skillList.Count == 0) skills.Clear();
} }
randomSkill = skillList.Count == 0 ? noneSkill : skillList[Instance.Random.Next(skillList.Count)]; var assignmentCounts = new Dictionary<Skills, int>();
if (gameMode == Config.GameModes.NoRepeat) foreach (var sp in Instance.SkillPlayer)
{ {
if (playersSkills.TryGetValue(player.SteamID, out ConcurrentBag<jSkill_SkillInfo>? value)) if (sp == null) continue;
value.Add(randomSkill); if (assignmentCounts.TryGetValue(sp.Skill, out var cnt)) assignmentCounts[sp.Skill] = cnt + 1;
else else assignmentCounts[sp.Skill] = 1;
playersSkills.TryAdd(player.SteamID, [randomSkill]);
} }
randomSkill = skillList.Count == 0 ? noneSkill : ChooseSkillByRarityAndMax(skillList, assignmentCounts, gameMode);
} }
else if (gameMode == Config.GameModes.TeamSkills) else if (gameMode == Config.GameModes.TeamSkills)
randomSkill = player.Team == CsTeam.Terrorist ? tSkill : ctSkill; randomSkill = player.Team == CsTeam.Terrorist ? tSkill : ctSkill;
else if (gameMode == Config.GameModes.SameSkills)
randomSkill = allSkill;
else if (gameMode == Config.GameModes.Debug) else if (gameMode == Config.GameModes.Debug)
return; {
if (debugSkills.Count == 0)
debugSkills = [.. SkillData.Skills];
randomSkill = debugSkills[0];
debugSkills.RemoveAt(0);
player.PrintToChat($"{SkillData.Skills.Count - debugSkills.Count}/{SkillData.Skills.Count}");
}
} }
if (randomSkill.Display && Config.LoadedConfig.YourSkillChatInfo) if (randomSkill.Display && Config.LoadedConfig.YourSkillChatInfo)

View file

@ -3,6 +3,7 @@ using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using src.utils; using src.utils;
using System.Linq;
using static CounterStrikeSharp.API.Core.Listeners; using static CounterStrikeSharp.API.Core.Listeners;
using static src.jRandomSkills; using static src.jRandomSkills;
@ -15,7 +16,8 @@ namespace src.player
Instance.RegisterListener<OnTick>(() => Instance.RegisterListener<OnTick>(() =>
{ {
UpdateGameRules(); UpdateGameRules();
foreach (var player in Utilities.GetPlayers()) var players = Utilities.GetPlayers().ToArray();
foreach (var player in players)
if (player != null && player.IsValid) if (player != null && player.IsValid)
UpdatePlayerHud(player); UpdatePlayerHud(player);
}); });
@ -47,32 +49,42 @@ namespace src.player
private static void UpdatePlayerHud(CCSPlayerController player) private static void UpdatePlayerHud(CCSPlayerController player)
{ {
if (player == null) return; if (player == null || !player.IsValid) return;
var skillPlayer = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (skillPlayer == null || !skillPlayer.DisplayHUD || (player.PawnIsAlive && skillPlayer.SkillHudExpired < DateTime.Now)) return;
string infoLine = ""; var now = DateTime.Now;
string skillLine = ""; var skillPlayer = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
string remainingLine = ""; if (skillPlayer == null || !skillPlayer.DisplayHUD) return;
bool showDescirptionHUD = skillPlayer.SkillDescriptionHudExpired >= DateTime.Now; if (player.PawnIsAlive && skillPlayer.SkillHudExpired < now) return;
string infoLine = string.Empty;
string skillLine = string.Empty;
string remainingLine = string.Empty;
bool showDescriptionHUD = skillPlayer.SkillDescriptionHudExpired >= now;
bool isDescription = true; bool isDescription = true;
if (SkillData.Skills.IsEmpty) var skills = SkillData.Skills;
if (skills == null || skills.IsEmpty)
{ {
infoLine = player.GetTranslation("your_skill"); infoLine = player.GetTranslation("your_skill");
skillLine = player.GetTranslation("none"); skillLine = player.GetTranslation("none");
} }
else if (skillPlayer.IsDrawing && player.PawnIsAlive) else if (skillPlayer.IsDrawing && player.PawnIsAlive)
{ {
var randomSkill = SkillData.Skills.ToArray()[Instance.Random.Next(SkillData.Skills.Count)]; int skillCount = skills.Count;
if (skillCount > 0)
{
var skillsArray = skills.ToArray();
var randomSkill = skillsArray[Instance.Random.Next(skillCount)];
infoLine = player.GetTranslation("drawing_skill"); infoLine = player.GetTranslation("drawing_skill");
skillLine = $"<font color='{randomSkill.Color}'>{player.GetSkillName(randomSkill.Skill)}</font>"; skillLine = $"<font color='{randomSkill.Color}'>{player.GetSkillName(randomSkill.Skill)}</font>";
} }
else if (!skillPlayer.IsDrawing) }
else
{ {
if (player?.IsValid == true && player?.PawnIsAlive == true) if (player.PawnIsAlive)
{ {
var skillInfo = SkillData.Skills.FirstOrDefault(s => s.Skill == skillPlayer.Skill); var skillInfo = skills.FirstOrDefault(s => s.Skill == skillPlayer.Skill);
if (skillInfo != null) if (skillInfo != null)
{ {
infoLine = player.GetTranslation("your_skill"); infoLine = player.GetTranslation("your_skill");
@ -80,46 +92,58 @@ namespace src.player
if (skillInfo.Skill != Skills.None) if (skillInfo.Skill != Skills.None)
{ {
remainingLine = string.IsNullOrEmpty(skillPlayer.PrintHTML) remainingLine = string.IsNullOrEmpty(skillPlayer.PrintHTML)
? showDescirptionHUD ? player.GetSkillDescription(skillInfo.Skill, skillPlayer.SkillChance) : "" ? (showDescriptionHUD ? player.GetSkillDescription(skillInfo.Skill, skillPlayer.SkillChance) : "")
: skillPlayer.PrintHTML; : skillPlayer.PrintHTML;
isDescription = string.IsNullOrEmpty(skillPlayer.PrintHTML); isDescription = string.IsNullOrEmpty(skillPlayer.PrintHTML);
} }
} }
} else if (player?.IsValid == true) }
else
{ {
if ((player.Team is CsTeam.Spectator or CsTeam.None && Config.LoadedConfig.DisableSpectateHUD) || AdminManager.PlayerHasPermissions(player, Config.LoadedConfig.DisableHUDOnDeathPermission)) if ((player.Team is CsTeam.Spectator or CsTeam.None && Config.LoadedConfig.DisableSpectateHUD) || AdminManager.PlayerHasPermissions(player, Config.LoadedConfig.DisableHUDOnDeathPermission))
return; return;
var pawn = player.Pawn.Value; var pawn = player.Pawn.Value;
if (pawn == null) return; if (pawn == null || pawn.ObserverServices == null) return;
var observedPlayer = Utilities.GetPlayers().FirstOrDefault(p => p?.Pawn?.Value?.Handle == pawn?.ObserverServices?.ObserverTarget?.Value?.Handle); var observerTarget = pawn.ObserverServices.ObserverTarget?.Value;
if (observerTarget == null || !observerTarget.IsValid) return;
var players = Utilities.GetPlayers();
var targetHandle = observerTarget.Handle;
var observedPlayer = players.FirstOrDefault(p => p?.IsValid == true && p?.Pawn?.Value?.Handle == targetHandle);
if (observedPlayer == null) return; if (observedPlayer == null) return;
var observeredPlayerSkill = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == observedPlayer.SteamID); var observeredPlayerSkill = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == observedPlayer.SteamID);
if (observeredPlayerSkill == null) return; if (observeredPlayerSkill == null) return;
var observeredPlayerSkillInfo = SkillData.Skills.FirstOrDefault(s => s.Skill == observeredPlayerSkill.Skill); var observeredPlayerSkillInfo = skills.FirstOrDefault(s => s.Skill == observeredPlayerSkill.Skill);
if (observeredPlayerSkillInfo == null) return; var observeredPlayerSpecialSkillInfo = observeredPlayerSkill.SpecialSkill != Skills.None ? skills.FirstOrDefault(s => s.Skill == observeredPlayerSkill.SpecialSkill) : null;
var observeredPlayerSpecialSkillInfo = SkillData.Skills.FirstOrDefault(s => s.Skill == observeredPlayerSkill.SpecialSkill); string primaryName = player.GetSkillName(observeredPlayerSkill.Skill, observeredPlayerSkill.SkillChance);
if (observeredPlayerSpecialSkillInfo == null) return; string primaryColor = observeredPlayerSkillInfo?.Color ?? SkillsInfo.GetValue<string>(Skills.None, "color");
string pName = System.Net.WebUtility.HtmlEncode(observeredPlayerSkill.PlayerName); string pName = System.Net.WebUtility.HtmlEncode(observeredPlayerSkill.PlayerName);
if (pName.Length > 18) if (pName.Length > 18)
pName = $"{pName[..17]}..."; pName = $"{pName[..17]}...";
var observerSkill = player.GetTranslation("observer_skill"); var observerSkill = player.GetTranslation("observer_skill");
infoLine = string.IsNullOrEmpty(observerSkill) ? pName : $"{observerSkill} {pName}"; infoLine = string.IsNullOrEmpty(observerSkill) ? pName : $"{observerSkill} {pName}";
skillLine = $"<font color='{observeredPlayerSkillInfo.Color}'>{(observeredPlayerSkill.SpecialSkill == Skills.None
? player.GetSkillName(observeredPlayerSkillInfo.Skill, observeredPlayerSkill.SkillChance) if (observeredPlayerSkill.SpecialSkill == Skills.None || observeredPlayerSpecialSkillInfo == null)
: $"{player.GetSkillName(observeredPlayerSpecialSkillInfo.Skill)}({player.GetSkillName(observeredPlayerSkillInfo.Skill)})")}</font>"; skillLine = $"<font color='{primaryColor}'>{primaryName}</font>";
if (showDescirptionHUD) else
{
string specialName = player.GetSkillName(observeredPlayerSpecialSkillInfo.Skill);
skillLine = $"<font color='{observeredPlayerSpecialSkillInfo.Color}'>{specialName}({primaryName})</font>";
}
if (showDescriptionHUD)
remainingLine = player.GetSkillDescription(observeredPlayerSkill.Skill, observeredPlayerSkill.SkillChance); remainingLine = player.GetSkillDescription(observeredPlayerSkill.Skill, observeredPlayerSkill.SkillChance);
} }
} }
if (string.IsNullOrEmpty(skillLine)) return; if (string.IsNullOrEmpty(skillLine)) return;
if (player == null || !player.IsValid) return;
if (SkillUtils.HasMenu(player)) return; if (SkillUtils.HasMenu(player)) return;
Event.UpdateSkillHUD(player, infoLine, skillLine, remainingLine, isDescription); Event.UpdateSkillHUD(player, infoLine, skillLine, remainingLine, isDescription);

View file

@ -151,7 +151,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#fa7b48", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 20f, float duration = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#fa7b48", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 20f, float duration = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float Duration { get; set; } = duration; public float Duration { get; set; } = duration;

View file

@ -23,43 +23,66 @@ namespace src.player.skills
CEntityInstance param = h.GetParam<CEntityInstance>(0); CEntityInstance param = h.GetParam<CEntityInstance>(0);
CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1); CTakeDamageInfo param2 = h.GetParam<CTakeDamageInfo>(1);
if (param == null || param.Entity == null || param2 == null || param2.Attacker == null || param2.Attacker.Value == null) if (param == null || !param.IsValid || param.Entity == null)
return; return;
CCSPlayerPawn attackerPawn = new(param2.Attacker.Value.Handle); if (param2 == null || param2.Handle == nint.Zero || param2.Attacker == null || !param2.Attacker.IsValid)
CCSPlayerPawn victimPawn = new(param.Handle); return;
var attackerHandle = param2.Attacker;
if (attackerHandle.Value == null || !attackerHandle.IsValid)
return;
var attackerEnt = attackerHandle.Value;
var victimEnt = param;
if (attackerEnt == null || victimEnt == null || !victimEnt.IsValid || !attackerEnt.IsValid)
return;
CCSPlayerPawn attackerPawn = new(attackerEnt.Handle);
CCSPlayerPawn victimPawn = new(victimEnt.Handle);
if (attackerPawn == null || !attackerPawn.IsValid || victimPawn == null || !victimPawn.IsValid)
return;
if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player") if (attackerPawn.DesignerName != "player" || victimPawn.DesignerName != "player")
return; return;
if (attackerPawn == null || attackerPawn.Controller?.Value == null || victimPawn == null || victimPawn.Controller?.Value == null) var attackerController = attackerPawn.Controller?.Value;
var victimController = victimPawn.Controller?.Value;
if (!attackerController.IsValid() || !victimController.IsValid())
return; return;
CCSPlayerController attacker = attackerPawn.Controller.Value.As<CCSPlayerController>(); CCSPlayerController attacker = attackerController!.As<CCSPlayerController>();
CCSPlayerController victim = victimPawn.Controller.Value.As<CCSPlayerController>(); CCSPlayerController victim = victimController!.As<CCSPlayerController>();
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID); var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
if (playerInfo == null) return; if (playerInfo == null) return;
if (attacker.PawnIsAlive) if (!attacker.CheckPlayer())
{ return;
nint hitGroupPointer = Marshal.ReadIntPtr(param2.Handle, GameData.GetOffset("CTakeDamageInfo_HitGroup"));
if (hitGroupPointer != nint.Zero) int offset = GameData.GetOffset("CTakeDamageInfo_HitGroup");
{ if (offset <= 0)
return;
nint hitGroupPointer = Marshal.ReadIntPtr(param2.Handle, offset);
if (hitGroupPointer == nint.Zero)
return;
nint hitGroupOffset = Marshal.ReadIntPtr(hitGroupPointer, 16); nint hitGroupOffset = Marshal.ReadIntPtr(hitGroupPointer, 16);
if (hitGroupOffset != nint.Zero) if (hitGroupOffset == nint.Zero)
{ return;
if (playerInfo.Skill == skillName) if (playerInfo.Skill == skillName)
{ {
int oldValue = Marshal.ReadInt32(hitGroupOffset, 56); hitGroups[hitGroupOffset] = Marshal.ReadInt32(hitGroupOffset, 56);
hitGroups.TryAdd(hitGroupOffset, Marshal.ReadInt32(hitGroupOffset, 56));
Marshal.WriteInt32(hitGroupOffset, 56, (int)HitGroup_t.HITGROUP_HEAD); Marshal.WriteInt32(hitGroupOffset, 56, (int)HitGroup_t.HITGROUP_HEAD);
} else if (hitGroups.TryGetValue(hitGroupOffset, out var hitGroup)) }
else if (hitGroups.TryGetValue(hitGroupOffset, out var hitGroup))
Marshal.WriteInt32(hitGroupOffset, 56, hitGroup); Marshal.WriteInt32(hitGroupOffset, 56, hitGroup);
} }
}
}
}
public static void DisableSkill(CCSPlayerController _) public static void DisableSkill(CCSPlayerController _)
{ {
@ -67,7 +90,7 @@ namespace src.player.skills
Marshal.WriteInt32(hit.Key, 56, hit.Value); Marshal.WriteInt32(hit.Key, 56, hit.Value);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Epic) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -123,7 +123,7 @@ namespace src.player.skills
public ConcurrentQueue<QAngle>? LastRotations { get; set; } public ConcurrentQueue<QAngle>? LastRotations { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int secondsInBack = 5, float cooldown = 15) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int secondsInBack = 5, float cooldown = 15) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int SecondsInBack { get; set; } = secondsInBack; public int SecondsInBack { get; set; } = secondsInBack;
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;

View file

@ -39,7 +39,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade); SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#D6E6FF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float flashDuration = 7f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#D6E6FF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float flashDuration = 7f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float FlashDuration { get; set; } = flashDuration; public float FlashDuration { get; set; } = flashDuration;
} }

View file

@ -26,7 +26,7 @@ namespace src.player.skills
SkillUtils.RestoreHealth(victim); SkillUtils.RestoreHealth(victim);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8B4513", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -103,7 +103,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#edf5b5", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#edf5b5", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -58,7 +58,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .65f, float chanceTo = .85f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .65f, float chanceTo = .85f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -62,7 +62,7 @@ namespace src.player.skills
return (target >= a || target <= b); return (target >= a || target <= b);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d9d9d9", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float damageMultiplier = 2f, float toleranceDeg = 45f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d9d9d9", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float damageMultiplier = 2f, float toleranceDeg = 45f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float DamageMultiplier { get; set; } = damageMultiplier; public float DamageMultiplier { get; set; } = damageMultiplier;
public float ToleranceDeg { get; set; } = toleranceDeg; public float ToleranceDeg { get; set; } = toleranceDeg;

View file

@ -48,7 +48,7 @@ namespace src.player.skills
player.PlayerPawn.Value.ActualGravityScale = gravityModifier; player.PlayerPawn.Value.ActualGravityScale = gravityModifier;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7E10AD", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .1f, float chanceTo = .7f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7E10AD", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .1f, float chanceTo = .7f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -96,7 +96,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#abab33", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#abab33", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -64,17 +64,23 @@ namespace src.player.skills
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return; if (playerInfo?.Skill != skillName) return;
if (decoys.ContainsKey((uint)@event.Entityid)) uint key = (uint)@event.Entityid;
if (decoys.ContainsKey(key))
{ {
var decoy = Utilities.GetEntityFromIndex<CDecoyProjectile>(@event.Entityid); var decoy = Utilities.GetEntityFromIndex<CDecoyProjectile>(@event.Entityid);
if (decoy != null && decoy.IsValid) if (decoy != null && decoy.IsValid)
decoy.AcceptInput("Kill"); decoy.AcceptInput("Kill");
decoys.TryRemove(key, out _);
} }
} }
public static void OnTick() public static void OnTick()
{ {
foreach (var decoyIndex in decoys.Keys) if (Server.TickCount % 8 != 0) return;
var keys = decoys.Keys.ToArray();
foreach (var decoyIndex in keys)
{ {
var decoy = Utilities.GetEntityFromIndex<CDecoyProjectile>((int)decoyIndex); var decoy = Utilities.GetEntityFromIndex<CDecoyProjectile>((int)decoyIndex);
@ -85,7 +91,6 @@ namespace src.player.skills
} }
decoy.Bounces = 0; decoy.Bounces = 0;
if (Server.TickCount % 8 != 0) continue;
var vel = decoy.AbsVelocity; var vel = decoy.AbsVelocity;
float speed = vel.Length(); float speed = vel.Length();
@ -108,7 +113,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade); SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effc7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float speedMultipier = 2f, float maxSpeed = 900f, int damageDeal = 9999) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#2effc7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float speedMultipier = 2f, float maxSpeed = 900f, int damageDeal = 9999) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float SpeedMultipier { get; set; } = speedMultipier; public float SpeedMultipier { get; set; } = speedMultipier;
public float MaxSpeed { get; set; } = maxSpeed; public float MaxSpeed { get; set; } = maxSpeed;

View file

@ -49,7 +49,7 @@ namespace src.player.skills
pawn.Look(look); pawn.Look(look);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00FF00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00FF00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -69,7 +69,7 @@ namespace src.player.skills
SkillUtils.RestoreHealth(victim); SkillUtils.RestoreHealth(victim);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#cc7504", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float torseReflectionChance = .95f, float legReflectionChance = .80f, float velocityModifier = .85f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#cc7504", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float torseReflectionChance = .95f, float legReflectionChance = .80f, float velocityModifier = .85f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float TorseReflectionChance { get; set; } = torseReflectionChance; public float TorseReflectionChance { get; set; } = torseReflectionChance;
public float LegReflectionChance { get; set; } = legReflectionChance; public float LegReflectionChance { get; set; } = legReflectionChance;

View file

@ -65,7 +65,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxSpeed = 500f, float jumpVelocity = 300f, float jumpBoost = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1430a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float maxSpeed = 500f, float jumpVelocity = 300f, float jumpBoost = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MaxSpeed { get; set; } = maxSpeed; public float MaxSpeed { get; set; } = maxSpeed;
public float JumpVelocity { get; set; } = jumpVelocity; public float JumpVelocity { get; set; } = jumpVelocity;

View file

@ -152,7 +152,7 @@ namespace src.player.skills
return bomb.Index; return bomb.Index;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00911f", CsTeam onlyTeam = CsTeam.Terrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00911f", CsTeam onlyTeam = CsTeam.Terrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Uncommon) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -169,7 +169,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#db6c35", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int damageAfterMiss = 5) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#db6c35", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int damageAfterMiss = 5) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int DamageAfterMiss { get; set; } = damageAfterMiss; public int DamageAfterMiss { get; set; } = damageAfterMiss;
} }

View file

@ -42,7 +42,7 @@ namespace src.player.skills
border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t"); border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -11,7 +11,7 @@ namespace src.player.skills
public class Chicken : ISkill public class Chicken : ISkill
{ {
private const Skills skillName = Skills.Chicken; private const Skills skillName = Skills.Chicken;
private static readonly string[] disabledWeapons = private static readonly HashSet<string> disabledWeapons =
[ [
"weapon_ak47", "weapon_m4a4", "weapon_m4a1", "weapon_m4a1_silencer", "weapon_ak47", "weapon_m4a4", "weapon_m4a1", "weapon_m4a1_silencer",
"weapon_famas", "weapon_galilar", "weapon_aug", "weapon_sg553", "weapon_famas", "weapon_galilar", "weapon_aug", "weapon_sg553",
@ -22,9 +22,6 @@ namespace src.player.skills
"weapon_negev" "weapon_negev"
]; ];
private static readonly ConcurrentDictionary<uint, uint> chickens = []; private static readonly ConcurrentDictionary<uint, uint> chickens = [];
private static readonly string defaultCTModel = "agents/models/ctm_sas/ctm_sas.vmdl";
private static readonly string defaultTModel = "agents/models/tm_phoenix/tm_phoenix.vmdl";
private static readonly ConcurrentDictionary<ulong, string> originalModels = [];
public static void LoadSkill() public static void LoadSkill()
{ {
@ -36,23 +33,21 @@ namespace src.player.skills
foreach (var player in Utilities.GetPlayers()) foreach (var player in Utilities.GetPlayers())
SetWeaponAttack(player, false); SetWeaponAttack(player, false);
foreach (var valuePair in chickens) var chickenIndices = chickens.Values.ToArray();
{ foreach (var idx in chickenIndices)
var chicken = Utilities.GetEntityFromIndex<CBaseModelEntity>((int)valuePair.Value); SkillUtils.SafeKillEntity<CBaseModelEntity>(idx);
if (chicken != null && chicken.IsValid)
chicken.AcceptInput("Kill");
}
chickens.Clear(); chickens.Clear();
originalModels.Clear();
} }
public static void WeaponPickup(EventItemPickup @event) public static void WeaponPickup(EventItemPickup @event)
{ {
var player = @event.Userid; var player = @event.Userid;
if (player == null || !player.IsValid) return; if (player == null || !player.IsValid) return;
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID); var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
if (playerInfo?.Skill != skillName) return; if (playerInfo?.Skill != skillName) return;
SetWeaponAttack(player, true); SetWeaponAttack(player, true);
} }
@ -73,9 +68,6 @@ namespace src.player.skills
playerPawn.ShadowStrength = 0f; playerPawn.ShadowStrength = 0f;
Utilities.SetStateChanged(playerPawn, "CBaseModelEntity", "m_clrRender"); Utilities.SetStateChanged(playerPawn, "CBaseModelEntity", "m_clrRender");
if (playerPawn.CBodyComponent != null && playerPawn.CBodyComponent.SceneNode != null)
originalModels.TryAdd(player.SteamID, playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().ModelState.ModelName);
SetWeaponAttack(player, true); SetWeaponAttack(player, true);
CreateChicken(player); CreateChicken(player);
} }
@ -85,6 +77,7 @@ namespace src.player.skills
{ {
SkillUtils.ResetPrintHTML(player); SkillUtils.ResetPrintHTML(player);
var playerPawn = player.PlayerPawn?.Value; var playerPawn = player.PlayerPawn?.Value;
if (playerPawn != null) if (playerPawn != null)
{ {
playerPawn.VelocityModifier = 1f; playerPawn.VelocityModifier = 1f;
@ -102,32 +95,7 @@ namespace src.player.skills
} }
if (chickens.TryRemove(player.Index, out var chickenIndex)) if (chickens.TryRemove(player.Index, out var chickenIndex))
{ SkillUtils.SafeKillEntity<CBaseModelEntity>(chickenIndex);
var chicken = Utilities.GetEntityFromIndex<CBaseModelEntity>((int)chickenIndex);
if (chicken != null && chicken.IsValid)
chicken.AcceptInput("Kill");
}
if (originalModels.TryGetValue(player.SteamID, out var model))
{
var pawn = player.PlayerPawn?.Value;
if (pawn == null) return;
Server.NextFrame(() =>
{
if (player == null || !player.IsValid) return;
if (pawn == null || !pawn.IsValid) return;
if (string.IsNullOrEmpty(model))
model = player.Team == CsTeam.Terrorist ? defaultTModel : defaultCTModel;
pawn.SetModel(model);
var originalRender = pawn.Render;
pawn.Render = Color.FromArgb(255, originalRender.R, originalRender.G, originalRender.B);
originalModels.TryRemove(player.SteamID, out _);
});
}
} }
private static void SetWeaponAttack(CCSPlayerController player, bool disableWeapon) private static void SetWeaponAttack(CCSPlayerController player, bool disableWeapon)
@ -178,7 +146,8 @@ namespace src.player.skills
public static void OnTick() public static void OnTick()
{ {
foreach (var valuePair in chickens) var pairs = chickens.ToArray();
foreach (var valuePair in pairs)
{ {
var playerIndex = valuePair.Key; var playerIndex = valuePair.Key;
var chickenIndex = valuePair.Value; var chickenIndex = valuePair.Value;
@ -216,7 +185,7 @@ namespace src.player.skills
playerInfo.PrintHTML = $"<font color='#FF0000'>{player.GetTranslation("disabled_weapon")}</font>"; playerInfo.PrintHTML = $"<font color='#FF0000'>{player.GetTranslation("disabled_weapon")}</font>";
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF8B42", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF8B42", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -91,7 +91,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#343deb", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float bombArmedTime = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#343deb", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common, float bombArmedTime = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float BombArmedTime { get; set; } = bombArmedTime; public float BombArmedTime { get; set; } = bombArmedTime;
} }

View file

@ -29,7 +29,7 @@ namespace src.player.skills
SkillUtils.TakeHealth(victim!.PlayerPawn.Value, 9999); SkillUtils.TakeHealth(victim!.PlayerPawn.Value, 9999);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#88a31a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#88a31a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -16,11 +16,11 @@ namespace src.player.skills
public class Cypher : ISkill public class Cypher : ISkill
{ {
private const Skills skillName = Skills.Cypher; private const Skills skillName = Skills.Cypher;
private static readonly ConcurrentDictionary<uint, PlayerSkill> playersInfo = []; private static readonly ConcurrentDictionary<uint, PlayerSkill> playersInfo = new();
private static readonly object setLock = new(); private static readonly object setLock = new();
private const string cameraPropModel = "models/props/de_train/hr_train_s2/train_electronics/train_electronics_security_camera_01.vmdl"; private const string cameraPropModel = "models/props/de_train/hr_train_s2/train_electronics/train_electronics_security_camera_01.vmdl";
private const string cameraViewModel = "models/actors/ghost_speaker.vmdl"; private const string cameraViewModel = "models/sprays/spray_plane.vmdl";
public static void LoadSkill() public static void LoadSkill()
{ {
@ -73,22 +73,21 @@ namespace src.player.skills
private static void KillCamera(PlayerSkill playerSkill) private static void KillCamera(PlayerSkill playerSkill)
{ {
if (playerSkill.CameraView != null && playerSkill.CameraView != 0) if (playerSkill == null) return;
if (playerSkill.CameraView.HasValue && playerSkill.CameraView.Value != 0)
{ {
var cameraView = Utilities.GetEntityFromIndex<CDynamicProp>((int)playerSkill.CameraView); SkillUtils.SafeKillEntity<CDynamicProp>(playerSkill.CameraView);
if (cameraView != null && cameraView.IsValid)
cameraView.AcceptInput("Kill");
playerSkill.CameraView = null; playerSkill.CameraView = null;
} }
if (playerSkill.CameraProp != null && playerSkill.CameraProp != 0) if (playerSkill.CameraProp.HasValue && playerSkill.CameraProp.Value != 0)
{ {
var cameraProp = Utilities.GetEntityFromIndex<CDynamicProp>((int)playerSkill.CameraProp); var cameraProp = Utilities.GetEntityFromIndex<CDynamicProp>((int)playerSkill.CameraProp);
if (cameraProp != null && cameraProp.IsValid) if (cameraProp != null && cameraProp.IsValid)
{
cameraProp.EmitSound("SolidMetal.BulletImpact"); cameraProp.EmitSound("SolidMetal.BulletImpact");
cameraProp.AcceptInput("Kill");
} SkillUtils.SafeKillEntity<CDynamicProp>(playerSkill.CameraProp);
playerSkill.CameraProp = null; playerSkill.CameraProp = null;
} }
@ -230,7 +229,6 @@ namespace src.player.skills
camera.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags = (uint)(camera.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags & ~(1 << 2)); camera.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags = (uint)(camera.CBodyComponent!.SceneNode!.Owner!.Entity!.Flags & ~(1 << 2));
camera.Entity!.Name = camera.Globalname = $"CypherCamera_{Server.TickCount}_{player.SteamID}"; camera.Entity!.Name = camera.Globalname = $"CypherCamera_{Server.TickCount}_{player.SteamID}";
if (camera == null || !camera.IsValid) return null;
camera.SetModel(cameraPropModel); camera.SetModel(cameraPropModel);
camera.Teleport(cameraVector, new QAngle(0, playerPawn.V_angle.Y + 180, 0)); camera.Teleport(cameraVector, new QAngle(0, playerPawn.V_angle.Y + 180, 0));
camera.DispatchSpawn(); camera.DispatchSpawn();
@ -253,7 +251,7 @@ namespace src.player.skills
{ {
if (camera == null || !camera.IsValid) return; if (camera == null || !camera.IsValid) return;
camera.SetModel(cameraViewModel); camera.SetModel(cameraViewModel);
camera.Render = Color.FromArgb(0, 255, 255, 255); camera.Render = Color.FromArgb(1, 255, 255, 255);
camera.Teleport(finalPos, cameraProp.AbsRotation); camera.Teleport(finalPos, cameraProp.AbsRotation);
camera.DispatchSpawn(); camera.DispatchSpawn();
@ -383,7 +381,7 @@ namespace src.player.skills
public required QAngle LastAngle { get; set; } public required QAngle LastAngle { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#34ebd5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#34ebd5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
} }

View file

@ -161,7 +161,7 @@ namespace src.player.skills
holdTime: 3000); holdTime: 3000);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#383838", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int r = 0, int g = 0, int b = 0, int a = 230) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#383838", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Uncommon, int r = 0, int g = 0, int b = 0, int a = 230) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int R { get; set; } = r; public int R { get; set; } = r;
public int G { get; set; } = g; public int G { get; set; } = g;

View file

@ -158,7 +158,7 @@ namespace src.player.skills
public PlayerButtons LastButtons { get; set; } public PlayerButtons LastButtons { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42bbfc", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float jumpVelocity = 150f, float pushVelocity = 600f, bool anyDirection = true, float cooldown = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42bbfc", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float jumpVelocity = 150f, float pushVelocity = 600f, bool anyDirection = true, float cooldown = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float JumpVelocity { get; set; } = jumpVelocity; public float JumpVelocity { get; set; } = jumpVelocity;
public float PushVelocity { get; set; } = pushVelocity; public float PushVelocity { get; set; } = pushVelocity;

View file

@ -118,7 +118,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#919191", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#919191", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -107,7 +107,7 @@ namespace src.player.skills
deafPlayers.TryRemove(player.Index, out _); deafPlayers.TryRemove(player.Index, out _);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -47,7 +47,7 @@ namespace src.player.skills
border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t"); border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .2f, float chanceTo = .35f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FF4500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .2f, float chanceTo = .35f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -68,7 +68,7 @@ namespace src.player.skills
SkillUtils.ResetPrintHTML(player); SkillUtils.ResetPrintHTML(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00f2ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00f2ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -41,7 +41,7 @@ namespace src.player.skills
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FA050D", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float healthRegainScale = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FA050D", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float healthRegainScale = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float HealthRegainScale { get; set; } = healthRegainScale; public float HealthRegainScale { get; set; } = healthRegainScale;
} }

View file

@ -158,7 +158,7 @@ namespace src.player.skills
player.PrintToChat($" {ChatColors.Green}" + player.GetTranslation("duplicator_player_info", enemy.PlayerName)); player.PrintToChat($" {ChatColors.Green}" + player.GetTranslation("duplicator_player_info", enemy.PlayerName));
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffb73b", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffb73b", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -55,7 +55,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffff00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float minScale = .6f, float maxScale = .95f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffff00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float minScale = .6f, float maxScale = .95f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MinScale { get; set; } = minScale; public float MinScale { get; set; } = minScale;
public float MaxScale { get; set; } = maxScale; public float MaxScale { get; set; } = maxScale;

View file

@ -132,7 +132,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = false, string color = "#42f59b", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float cooldown = 16f, float amplitude = 15f, float frequency = 500f, float duration = 8f, float radius = 50f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = false, string color = "#42f59b", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 16f, float amplitude = 15f, float frequency = 500f, float duration = 8f, float radius = 50f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float Amplitude { get; set; } = amplitude; public float Amplitude { get; set; } = amplitude;

View file

@ -101,7 +101,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff8c92", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 15f, float cooldownBeforeUse = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff8c92", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 15f, float cooldownBeforeUse = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float CooldownBeforeUse { get; set; } = cooldownBeforeUse; public float CooldownBeforeUse { get; set; } = cooldownBeforeUse;

View file

@ -76,7 +76,7 @@ namespace src.player.skills
SpawnExplosion(pos); SpawnExplosion(pos);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float damage = 25f, float damageRadius = 210f, float chanceFrom = .15f, float chanceTo = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float damage = 25f, float damageRadius = 210f, float chanceFrom = .15f, float chanceTo = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Damage { get; set; } = damage; public float Damage { get; set; } = damage;
public float DamageRadius { get; set; } = damageRadius; public float DamageRadius { get; set; } = damageRadius;

View file

@ -124,7 +124,7 @@ namespace src.player.skills
Server.NextFrame(() => Server.NextFrame(() =>
{ {
if (camera == null || !camera.IsValid) return; if (camera == null || !camera.IsValid) return;
camera.SetModel("models/actors/ghost_speaker.vmdl"); camera.SetModel("models/sprays/spray_plane.vmdl");
camera.Render = Color.FromArgb(0, 255, 255, 255); camera.Render = Color.FromArgb(0, 255, 255, 255);
camera.Teleport(pos, new QAngle(90, 0, 0)); camera.Teleport(pos, new QAngle(90, 0, 0));
camera.DispatchSpawn(); camera.DispatchSpawn();
@ -153,7 +153,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1f542", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float distance = 1000f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d1f542", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float distance = 1000f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Distance { get; set; } = distance; public float Distance { get; set; } = distance;
} }

View file

@ -40,7 +40,7 @@ namespace src.player.skills
Utilities.SetStateChanged(activeWeapon, "CBasePlayerWeapon", "m_iClip1"); Utilities.SetStateChanged(activeWeapon, "CBasePlayerWeapon", "m_iClip1");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -98,7 +98,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#A31912", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = 1.2f, float chanceTo = 3.0f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#A31912", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = 1.2f, float chanceTo = 3.0f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -135,9 +135,15 @@ namespace src.player.skills
if (barricades.TryGetValue(box.Index, out int health)) if (barricades.TryGetValue(box.Index, out int health))
{ {
health -= (int)param2.Damage; int newHealth = health - (int)param2.Damage;
barricades.AddOrUpdate(box.Index, health, (k, v) => health);
if (health <= 0) box.AcceptInput("Kill"); if (newHealth <= 0)
{
barricades.TryRemove(box.Index, out _);
box.AcceptInput("Kill");
}
else
barricades.AddOrUpdate(box.Index, newHealth, (k, v) => newHealth);
} }
else box.AcceptInput("Kill"); else box.AcceptInput("Kill");
} }
@ -149,7 +155,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1b04cc", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 2f, int barricadeHealth = 115, string propModel = "models/props/de_aztec/hr_aztec/aztec_scaffolding/aztec_scaffold_wall_support_128.vmdl") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1b04cc", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 5, Rarity rarity = Rarity.Common, float cooldown = 2f, int barricadeHealth = 115, string propModel = "models/props/de_aztec/hr_aztec/aztec_scaffolding/aztec_scaffold_wall_support_128.vmdl") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public int BarricadeHealth { get; set; } = barricadeHealth; public int BarricadeHealth { get; set; } = barricadeHealth;

View file

@ -71,7 +71,7 @@ namespace src.player.skills
Localization.PrintTranslationToChatAll($" {ChatColors.Gold}{{0}}: {ChatColors.Red}{bombHealth}{ChatColors.Gold}/{ChatColors.Green}{maxBombHealth}", ["fragilebomb_bomb_health"]); Localization.PrintTranslationToChatAll($" {ChatColors.Gold}{{0}}: {ChatColors.Red}{bombHealth}{ChatColors.Gold}/{ChatColors.Green}{maxBombHealth}", ["fragilebomb_bomb_health"]);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxBombHealth = 1000) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common, int maxBombHealth = 1000) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int MaxBombHealth { get; set; } = maxBombHealth; public int MaxBombHealth { get; set; } = maxBombHealth;
} }

View file

@ -42,7 +42,7 @@ namespace src.player.skills
SkillUtils.AddHealth(pawn, damage + (int)(damage * SkillsInfo.GetValue<float>(skillName, "healthMultiplier")), pawn.MaxHealth); SkillUtils.AddHealth(pawn, damage + (int)(damage * SkillsInfo.GetValue<float>(skillName, "healthMultiplier")), pawn.MaxHealth);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = true, string requiredPermission = "", float healthMultiplier = 1.5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff0000", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = true, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float healthMultiplier = 1.5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float HealthMultiplier { get; set; } = healthMultiplier; public float HealthMultiplier { get; set; } = healthMultiplier;
} }

View file

@ -68,7 +68,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade); SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00eaff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float triggerRadius = 180, int slownessMultiplier = 5) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#00eaff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float triggerRadius = 180, int slownessMultiplier = 5) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float TriggerRadius { get; set; } = triggerRadius; public float TriggerRadius { get; set; } = triggerRadius;
public int SlownessMultiplier { get; set; } = slownessMultiplier; public int SlownessMultiplier { get; set; } = slownessMultiplier;

View file

@ -127,7 +127,7 @@ namespace src.player.skills
return skillList.Count == 0 ? [Event.noneSkill] : skillList; return skillList.Count == 0 ? [Event.noneSkill] : skillList;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7eff47", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int refreshPrice = 150) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7eff47", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int refreshPrice = 150) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int RefreshPrice { get; set; } = refreshPrice; public int RefreshPrice { get; set; } = refreshPrice;
} }

View file

@ -202,7 +202,7 @@ namespace src.player.skills
return bomb.Index; return bomb.Index;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Epic) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -62,7 +62,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.SmokeGrenade); SkillUtils.TryGiveWeapon(player, CsItem.SmokeGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#5d00ff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -102,7 +102,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -34,7 +34,7 @@ namespace src.player.skills
grenade.Bounces = 555; grenade.Bounces = 555;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#fff52e", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#fff52e", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -116,7 +116,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#e0d83a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 30f, float duration = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#e0d83a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 30f, float duration = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float Duration { get; set; } = duration; public float Duration { get; set; } = duration;

View file

@ -33,7 +33,7 @@ namespace src.player.skills
player!.GiveNamedItem($"weapon_{weapon}"); player!.GiveNamedItem($"weapon_{weapon}");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#4a6e21", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#4a6e21", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -74,7 +74,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#b5ab8f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int amount = 3, int heal = 2, int tickCooldown = 16) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#b5ab8f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int amount = 3, int heal = 2, int tickCooldown = 16) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int Amount { get; set; } = amount; public int Amount { get; set; } = amount;
public int Heal { get; set; } = heal; public int Heal { get; set; } = heal;

View file

@ -109,7 +109,7 @@ namespace src.player.skills
Utilities.SetStateChanged(player, "CBaseEntity", "m_iHealth"); Utilities.SetStateChanged(player, "CBaseEntity", "m_iHealth");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1fe070", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int smokeHeal = 1, float smokeRadius = 180, int tickCooldown = 16) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1fe070", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int smokeHeal = 1, float smokeRadius = 180, int tickCooldown = 16) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int SmokeHeal { get; set; } = smokeHeal; public int SmokeHeal { get; set; } = smokeHeal;
public float SmokeRadius { get; set; } = smokeRadius; public float SmokeRadius { get; set; } = smokeRadius;

View file

@ -52,7 +52,7 @@ namespace src.player.skills
SkillUtils.AddHealth(pawn, SkillsInfo.GetValue<int>(skillName, "healthToAdd")); SkillUtils.AddHealth(pawn, SkillsInfo.GetValue<int>(skillName, "healthToAdd"));
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ded678", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int healthToAdd = 100) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ded678", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int healthToAdd = 100) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int HealthToAdd { get; set; } = healthToAdd; public int HealthToAdd { get; set; } = healthToAdd;
} }

View file

@ -45,7 +45,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade); SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffdd00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float damageMultiplier = 2f, float damageRadiusMultiplier = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffdd00", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float damageMultiplier = 2f, float damageRadiusMultiplier = 2f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float DamageMultiplier { get; set; } = damageMultiplier; public float DamageMultiplier { get; set; } = damageMultiplier;
public float DamageRadiusMultiplier { get; set; } = damageRadiusMultiplier; public float DamageRadiusMultiplier { get; set; } = damageRadiusMultiplier;

View file

@ -146,7 +146,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade); SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#384728", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float strength = 150, float maxVelocity = 2000, float detonationRange = 130) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#384728", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float strength = 150, float maxVelocity = 2000, float detonationRange = 130) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Strength { get; set; } = strength; public float Strength { get; set; } = strength;
public float MaxVelocity { get; set; } = maxVelocity; public float MaxVelocity { get; set; } = maxVelocity;

View file

@ -93,7 +93,7 @@ namespace src.player.skills
players.TryRemove(player.Index, out _); players.TryRemove(player.Index, out _);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#baf081", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float cooldown = 1, int damage = 2) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#baf081", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common, float cooldown = 1, int damage = 2) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public int Damage { get; set; } = damage; public int Damage { get; set; } = damage;

View file

@ -57,6 +57,7 @@ namespace src.player.skills
{ {
UpdateWeapons(player, playerSkill); UpdateWeapons(player, playerSkill);
CreateClone(playerSkill); CreateClone(playerSkill);
SkillUtils.SetPlayerCollisions(player, false);
} }
else if (playerSkill.CloneProp != null) else if (playerSkill.CloneProp != null)
KillClone(playerSkill); KillClone(playerSkill);
@ -123,6 +124,7 @@ namespace src.player.skills
} }
SkillUtils.ApplyScreenColor(player, 0, 0, 0, 0, 10, 0, 2); SkillUtils.ApplyScreenColor(player, 0, 0, 0, 0, 10, 0, 2);
SkillUtils.SetPlayerCollisions(player, true);
BlockWeapon(player, false); BlockWeapon(player, false);
playerSkill.NextUse = Server.TickCount + SkillsInfo.GetValue<float>(skillName, "Cooldown") * 64; playerSkill.NextUse = Server.TickCount + SkillsInfo.GetValue<float>(skillName, "Cooldown") * 64;
playerSkill.UseTime = 0; playerSkill.UseTime = 0;
@ -407,7 +409,7 @@ namespace src.player.skills
public List<ulong> Weapons { get; set; } = []; public List<ulong> Weapons { get; set; } = [];
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d0d930", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 30, float duration = 10) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#d0d930", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 30, float duration = 10) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float Duration { get; set; } = duration; public float Duration { get; set; } = duration;

View file

@ -9,16 +9,23 @@ namespace src.player.skills
{ {
private const Skills skillName = Skills.Illiterate; private const Skills skillName = Skills.Illiterate;
private static bool isActive = false; private static bool isActive = false;
private static int offset = jRandomSkills.Instance.Random.Next(1, 26); private static int offset = 5;
private static readonly object offsetLock = new();
public static void LoadSkill() public static void LoadSkill()
{ {
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color")); SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
EnsureOffset();
} }
public static void NewRound() public static void NewRound()
{ {
isActive = false; isActive = false;
lock (offsetLock)
{
offset = jRandomSkills.Instance?.Random?.Next(1, 26) ?? new Random().Next(1, 26);
if (offset == 13) offset = 14;
}
} }
public static void EnableSkill(CCSPlayerController player) public static void EnableSkill(CCSPlayerController player)
@ -41,11 +48,13 @@ namespace src.player.skills
if (!isActive || player == null || !player.IsValid) return false; if (!isActive || player == null || !player.IsValid) return false;
if (player.Team == CsTeam.Spectator) return false; if (player.Team == CsTeam.Spectator) return false;
var playersWithSkill = jRandomSkills.Instance.SkillPlayer.Where(p => p.Skill == skillName).Select(p => p.SteamID); var playersWithSkill = jRandomSkills.Instance.SkillPlayer.Where(p => p.Skill == skillName).Select(p => p.SteamID).ToHashSet();
if (!playersWithSkill.Any()) return false; if (playersWithSkill.Count == 0) return false;
return Utilities.GetPlayers().Any( return Utilities.GetPlayers().Any(
p => p.IsValid && p => p != null &&
p.IsValid &&
p.Pawn?.Value != null &&
p.PawnIsAlive && p.PawnIsAlive &&
p.Team != player.Team && p.Team != player.Team &&
playersWithSkill.Contains(p.SteamID)); playersWithSkill.Contains(p.SteamID));
@ -56,24 +65,40 @@ namespace src.player.skills
if (string.IsNullOrEmpty(input)) return null; if (string.IsNullOrEmpty(input)) return null;
if (Server.TickCount % 64 == 0 || offset == 0) if (Server.TickCount % 64 == 0 || offset == 0)
{ EnsureOffset();
offset = jRandomSkills.Instance.Random.Next(1, 26);
if (offset == 13) offset = 14;
}
return new string([.. input.Select(c => var chars = input.Select(c =>
{ {
if (char.IsDigit(c)) return '?'; if (char.IsDigit(c)) return '?';
if (!char.IsLetter(c)) return c; if (!char.IsLetter(c)) return c;
char baseChar = char.IsUpper(c) ? 'A' : 'a'; char baseChar = char.IsUpper(c) ? 'A' : 'a';
int shifted = (c - baseChar + offset) % 26; int shifted = (c - baseChar + offset) % 26;
return (char)(baseChar + shifted); return (char)(baseChar + shifted);
})]); }).ToArray();
return new string(chars);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1466F5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float maximumFuel = 150f, float fuelConsumption = .64f, float refuelling = .1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) private static void EnsureOffset()
{
lock (offsetLock)
{
if (offset != 0) return;
try
{
offset = jRandomSkills.Instance?.Random?.Next(1, 26) ?? new Random().Next(1, 26);
}
catch
{
offset = new Random().Next(1, 26);
}
if (offset == 13) offset = 14;
}
}
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1466F5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -205,7 +205,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42f5ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 30f, float durationRun = 5, float durationCrouch = 12, int yourTeamDamage = 10, int enemyTeamDamage = 20) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42f5ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 2, Rarity rarity = Rarity.Common, float cooldown = 30f, float durationRun = 5, float durationCrouch = 12, int yourTeamDamage = 10, int enemyTeamDamage = 20) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float DurationRun { get; set; } = durationRun; public float DurationRun { get; set; } = durationRun;

View file

@ -11,7 +11,7 @@ namespace src.player.skills
public class Impostor : ISkill public class Impostor : ISkill
{ {
private const Skills skillName = Skills.Impostor; private const Skills skillName = Skills.Impostor;
private static readonly string defaultCTModel = "agents//models/ctm_sas/ctm_sas.vmdl"; private static readonly string defaultCTModel = "agents/models/ctm_sas/ctm_sas.vmdl";
private static readonly string defaultTModel = "agents/models/tm_phoenix/tm_phoenix.vmdl"; private static readonly string defaultTModel = "agents/models/tm_phoenix/tm_phoenix.vmdl";
private static readonly ConcurrentDictionary<ulong, string> originalModels = []; private static readonly ConcurrentDictionary<ulong, string> originalModels = [];
@ -71,7 +71,7 @@ namespace src.player.skills
}); });
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#99140B", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#99140B", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -53,7 +53,7 @@ namespace src.player.skills
activeWeaponHandle.Value.Clip1 = 100; activeWeaponHandle.Value.Clip1 = 100;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#0000FF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#0000FF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -1,9 +1,9 @@
using CounterStrikeSharp.API; using System.Collections.Concurrent;
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes; using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using src.utils; using src.utils;
using System.Collections.Concurrent;
using static src.jRandomSkills; using static src.jRandomSkills;
using Timer = CounterStrikeSharp.API.Modules.Timers.Timer; using Timer = CounterStrikeSharp.API.Modules.Timers.Timer;
@ -12,9 +12,9 @@ namespace src.player.skills
public class Jackal : ISkill public class Jackal : ISkill
{ {
private const Skills skillName = Skills.Jackal; private const Skills skillName = Skills.Jackal;
private static readonly ConcurrentDictionary<ulong, byte> playersInAction = []; private static readonly ConcurrentDictionary<ulong, byte> playersInAction = new();
private static readonly ConcurrentDictionary<uint, uint?> playersStep = []; private static readonly ConcurrentDictionary<uint, uint?> playersStep = new();
private static readonly ConcurrentDictionary<ulong, Timer?> activeTimers = []; private static readonly ConcurrentDictionary<ulong, Timer?> activeTimers = new();
public static void LoadSkill() public static void LoadSkill()
{ {
@ -24,17 +24,17 @@ namespace src.player.skills
public static void NewRound() public static void NewRound()
{ {
foreach (var particleIndex in playersStep.Values) var particleIds = playersStep.Values.Where(v => v.HasValue).Select(v => v!.Value).ToArray();
{ foreach (var pid in particleIds)
if (particleIndex == null) continue; SkillUtils.SafeKillEntity<CParticleSystem>(pid);
var particle = Utilities.GetEntityFromIndex<CParticleSystem>((int)particleIndex);
if (particle != null && particle.IsValid) var timers = activeTimers.Values.ToArray();
particle.AcceptInput("Kill"); foreach (var t in timers)
} t?.Kill();
playersStep.Clear(); playersStep.Clear();
playersInAction.Clear(); playersInAction.Clear();
activeTimers.Clear();
} }
public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList) public static void CheckTransmit([CastFrom(typeof(nint))] CCheckTransmitInfoList infoList)
@ -56,11 +56,10 @@ namespace src.player.skills
bool hasSkill = playerInfo?.Skill == skillName || isObservingJackal; bool hasSkill = playerInfo?.Skill == skillName || isObservingJackal;
foreach (var param in playersStep) foreach (var kv in playersStep.ToArray())
{ {
var enemyIndex = param.Key; var enemyIndex = kv.Key;
var particleIndex = param.Value; var particleIndex = kv.Value;
if (particleIndex == null) continue; if (particleIndex == null) continue;
var enemy = Utilities.GetPlayerFromIndex((int)enemyIndex); var enemy = Utilities.GetPlayerFromIndex((int)enemyIndex);
@ -100,17 +99,21 @@ namespace src.player.skills
particle.AcceptInput("Start"); particle.AcceptInput("Start");
uint particleId = particle.Index; uint particleId = particle.Index;
playersStep.AddOrUpdate(player.Index, particle.Index, (k, v) => particle.Index); playersStep.AddOrUpdate(player.Index, particle.Index, (k, v) => particle.Index);
activeTimers[player.SteamID] = Instance.AddTimer(2.5f, () => { var timer = Instance.AddTimer(2.5f, () =>
var particle = Utilities.GetEntityFromIndex<CParticleSystem>((int)particleId); {
if (particle != null && particle.IsValid) SkillUtils.SafeKillEntity<CParticleSystem>(particleId);
particle.AcceptInput("Kill");
var player = Utilities.GetPlayerFromSteamId(steamID); var pl = Utilities.GetPlayerFromSteamId(steamID);
if (player != null && player.IsValid && playersStep.ContainsKey(player.Index)) if (pl != null && pl.IsValid && playersStep.ContainsKey(pl.Index))
CreatePlayerTrail(player); CreatePlayerTrail(pl);
});
activeTimers.AddOrUpdate(player.SteamID, timer, (_, prev) =>
{
prev?.Kill();
return timer;
}); });
} }
@ -118,9 +121,18 @@ namespace src.player.skills
{ {
Event.EnableTransmit(); Event.EnableTransmit();
playersInAction.TryAdd(player.SteamID, 0); playersInAction.TryAdd(player.SteamID, 0);
foreach (var _player in Utilities.GetPlayers().Where(p => p.Team != player.Team && p.IsValid && !p.IsBot && !p.IsHLTV && p.PawnIsAlive && p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist))
var opponents = Utilities.GetPlayers()
.Where(p => p.Team != player.Team
&& p.IsValid
&& !p.IsBot
&& !p.IsHLTV
&& p.PawnIsAlive
&& (p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist))
.ToArray();
foreach (var _player in opponents)
{ {
if (!playersStep.ContainsKey(_player.Index))
playersStep.TryAdd(_player.Index, null); playersStep.TryAdd(_player.Index, null);
CreatePlayerTrail(_player); CreatePlayerTrail(_player);
} }
@ -132,16 +144,17 @@ namespace src.player.skills
if (playersStep.TryRemove(player.Index, out var particleIndex) && particleIndex != null) if (playersStep.TryRemove(player.Index, out var particleIndex) && particleIndex != null)
{ {
var particle = Utilities.GetEntityFromIndex<CParticleSystem>((int)particleIndex); SkillUtils.SafeKillEntity<CParticleSystem>(particleIndex);
if (particle != null && particle.IsValid)
particle.AcceptInput("Kill");
} }
if (activeTimers.TryRemove(player.SteamID, out var t))
t?.Kill();
if (playersInAction.IsEmpty) if (playersInAction.IsEmpty)
NewRound(); NewRound();
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", string particleName = "particles/ui/hud/ui_map_def_utility_trail.vpcf") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f542ef", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common, string particleName = "particles/ui/hud/ui_map_def_utility_trail.vpcf") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public string ParticleName { get; set; } = particleName; public string ParticleName { get; set; } = particleName;
} }

View file

@ -111,7 +111,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42f5a7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#42f5a7", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -229,7 +229,7 @@ namespace src.player.skills
public Timer? Timer { get; set; } = null; 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) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8f108f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float minTime = 10f, float maxTime = 25f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MinTime { get; set; } = minTime; public float MinTime { get; set; } = minTime;
public float MaxTime { get; set; } = maxTime; public float MaxTime { get; set; } = maxTime;

View file

@ -113,7 +113,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#b01e5d", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#b01e5d", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -24,7 +24,7 @@ namespace src.player.skills
SkillUtils.AddHealth(player.PlayerPawn.Value, SkillsInfo.GetValue<int>(skillName, "healthToAdd")); SkillUtils.AddHealth(player.PlayerPawn.Value, SkillsInfo.GetValue<int>(skillName, "healthToAdd"));
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int healthToAdd = 3) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a86eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int healthToAdd = 3) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int HealthToAdd { get; set; } = healthToAdd; public int HealthToAdd { get; set; } = healthToAdd;
} }

View file

@ -36,7 +36,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.FlashbangGrenade); 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, bool friendlyFire = true) : 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 = "", int maxPerServer = 1, Rarity rarity = Rarity.Epic, float flashDuration = 1f, bool friendlyFire = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float FlashDuration { get; set; } = flashDuration; public float FlashDuration { get; set; } = flashDuration;
public bool FriendlyFire { get; set; } = friendlyFire; public bool FriendlyFire { get; set; } = friendlyFire;

View file

@ -99,7 +99,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a3651a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a3651a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -110,7 +110,7 @@ namespace src.player.skills
SkillUtils.TakeHealth(target.PlayerPawn.Value, heavyHit ? Instance.Random.Next(45, 55) : Instance.Random.Next(21, 34)); 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, bool friendlyFire = true) : 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 = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float maxDistance = 4096f, bool friendlyFire = true) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MaxDistance { get; set; } = maxDistance; public float MaxDistance { get; set; } = maxDistance;
public bool FriendlyFire { get; set; } = friendlyFire; public bool FriendlyFire { get; set; } = friendlyFire;

View file

@ -47,7 +47,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.Zeus); 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, bool friendlyFire = false) : 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 = "", int maxPerServer = -1, Rarity rarity = Rarity.Uncommon, float maxDistance = 4096f, bool friendlyFire = false) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MaxDistance { get; set; } = maxDistance; public float MaxDistance { get; set; } = maxDistance;
public bool FriendlyFire { get; set; } = friendlyFire; public bool FriendlyFire { get; set; } = friendlyFire;

View file

@ -77,7 +77,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade); SkillUtils.TryGiveWeapon(player, CsItem.DecoyGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#81f0c4", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float triggerRadius = 180, float strenght = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#81f0c4", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float triggerRadius = 180, float strenght = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float TriggerRadius { get; set; } = triggerRadius; public float TriggerRadius { get; set; } = triggerRadius;
public float Strenght { get; set; } = strenght; public float Strenght { get; set; } = strenght;

View file

@ -79,7 +79,7 @@ namespace src.player.skills
players.TryRemove(player.Index, out _); players.TryRemove(player.Index, out _);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f081ec", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float radius = 100) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#f081ec", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float radius = 100) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Radius { get; set; } = radius; public float Radius { get; set; } = radius;
} }

View file

@ -22,7 +22,7 @@ namespace src.player.skills
foreach (var playerIndex in playersFOV.Keys) foreach (var playerIndex in playersFOV.Keys)
{ {
var player = Utilities.GetPlayerFromIndex((int)playerIndex); var player = Utilities.GetPlayerFromIndex((int)playerIndex);
if (player == null || player.IsValid) continue; if (player == null || !player.IsValid) continue;
DisableSkill(player); DisableSkill(player);
} }
@ -112,7 +112,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9ba882", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", uint customFOV = 50) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9ba882", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, uint customFOV = 50) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public uint CustomFOV { get; set; } = customFOV; public uint CustomFOV { get; set; } = customFOV;
} }

View file

@ -105,7 +105,7 @@ namespace src.player.skills
public DateTime Cooldown { get; set; } public DateTime Cooldown { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#10c212", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int healthToAdd = 50, int healthShotLimit = 3, float cooldown = 1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#10c212", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int healthToAdd = 50, int healthShotLimit = 3, float cooldown = 1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int HealthToAdd { get; set; } = healthToAdd; public int HealthToAdd { get; set; } = healthToAdd;
public int HealthShotLimit { get; set; } = healthShotLimit; public int HealthShotLimit { get; set; } = healthShotLimit;

View file

@ -105,7 +105,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade); SkillUtils.TryGiveWeapon(player, CsItem.HEGrenade);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#adf542", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float detonationRange = 130) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#adf542", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float detonationRange = 130) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float DetonationRange { get; set; } = detonationRange; public float DetonationRange { get; set; } = detonationRange;
} }

View file

@ -102,7 +102,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#52f54c", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#52f54c", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -124,7 +124,7 @@ namespace src.player.skills
return player != null && player.IsValid && player.PlayerPawn?.Value != null; 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, float dmgReductionForTeamates = .5f) : 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 = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float explosionRadius = 500.0f, int explosionDamage = 999, float dmgReductionForTeamates = .5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ExplosionRadius { get; set; } = explosionRadius; public float ExplosionRadius { get; set; } = explosionRadius;
public int ExplosionDamage { get; set; } = explosionDamage; public int ExplosionDamage { get; set; } = explosionDamage;

View file

@ -198,7 +198,7 @@ namespace src.player.skills
return bomb.Index; return bomb.Index;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dedede", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float idlePercentInvisibility = .3f, float duckPercentInvisibility = .3f, float knifePercentInvisibility = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dedede", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float idlePercentInvisibility = .3f, float duckPercentInvisibility = .3f, float knifePercentInvisibility = .3f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float IdlePercentInvisibility { get; set; } = idlePercentInvisibility; public float IdlePercentInvisibility { get; set; } = idlePercentInvisibility;
public float DuckPercentInvisibility { get; set; } = duckPercentInvisibility; public float DuckPercentInvisibility { get; set; } = duckPercentInvisibility;

View file

@ -29,7 +29,7 @@ namespace src.player.skills
SkillUtils.RestoreHealth(player); SkillUtils.RestoreHealth(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a38c1a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#a38c1a", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -17,17 +17,21 @@ namespace src.player.skills
public static void NewRound() public static void NewRound()
{ {
Server.ExecuteCommand("weapon_accuracy_nospread 0"); var players = Utilities.GetPlayers();
foreach (var player in players)
DisableSkill(player);
} }
public static void EnableSkill(CCSPlayerController _) public static void EnableSkill(CCSPlayerController player)
{ {
Server.ExecuteCommand("weapon_accuracy_nospread 1"); if (player == null || !player.IsValid) return;
player.ReplicateConVar("weapon_accuracy_nospread", "1");
} }
public static void DisableSkill(CCSPlayerController _) public static void DisableSkill(CCSPlayerController player)
{ {
Server.ExecuteCommand("weapon_accuracy_nospread 0"); if (player == null || !player.IsValid) return;
player.ReplicateConVar("weapon_accuracy_nospread", "0");
} }
public static void OnTick() public static void OnTick()
@ -40,7 +44,7 @@ namespace src.player.skills
if (playerInfo?.Skill == skillName) if (playerInfo?.Skill == skillName)
{ {
var pawn = player.PlayerPawn.Value; var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid || pawn.CameraServices == null) continue; if (pawn == null || !pawn.IsValid) continue;
if (pawn.AimPunchServices != null) if (pawn.AimPunchServices != null)
{ {
@ -49,13 +53,16 @@ namespace src.player.skills
pawn.AimPunchServices.UnpredictableBaseTick = 0; pawn.AimPunchServices.UnpredictableBaseTick = 0;
} }
if (pawn.CameraServices != null)
{
pawn.CameraServices.CsViewPunchAngleTick = 0; pawn.CameraServices.CsViewPunchAngleTick = 0;
pawn.CameraServices.CsViewPunchAngleTickRatio = 0f; pawn.CameraServices.CsViewPunchAngleTickRatio = 0f;
} }
} }
} }
}
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -227,7 +227,7 @@ namespace src.player.skills
public Timer? Timer { get; set; } public Timer? Timer { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#44ebd4", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = 30f, float duration = 2f, float cooldownWhenStuck = 5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#44ebd4", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float cooldown = 30f, float duration = 2f, float cooldownWhenStuck = 5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;
public float CooldownWhenStuck { get; set; } = cooldownWhenStuck; public float CooldownWhenStuck { get; set; } = cooldownWhenStuck;

View file

@ -12,7 +12,7 @@ namespace src.player.skills
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"), false); SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"), false);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFFFFF", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -42,7 +42,7 @@ namespace src.player.skills
param2.Damage = 1000f; param2.Damage = 1000f;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5CD9", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5CD9", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -31,7 +31,7 @@ namespace src.player.skills
SkillUtils.RestoreHealth(victim); SkillUtils.RestoreHealth(victim);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -73,7 +73,7 @@ namespace src.player.skills
LB[player.Slot] = buttons; LB[player.Slot] = buttons;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFA500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int extraJumpsMin = 1, int extraJumpsMax = 4) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#FFA500", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, int extraJumpsMin = 1, int extraJumpsMax = 4) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int ExtraJumpsMin { get; set; } = extraJumpsMin; public int ExtraJumpsMin { get; set; } = extraJumpsMin;
public int ExtraJumpsMax { get; set; } = extraJumpsMax; public int ExtraJumpsMax { get; set; } = extraJumpsMax;

View file

@ -1,9 +1,11 @@
using CounterStrikeSharp.API; using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Timers;
using CounterStrikeSharp.API.Modules.Utils; using CounterStrikeSharp.API.Modules.Utils;
using src.utils; using src.utils;
using System.Collections.Concurrent;
using static src.jRandomSkills; using static src.jRandomSkills;
using Timer = CounterStrikeSharp.API.Modules.Timers.Timer;
namespace src.player.skills namespace src.player.skills
{ {
@ -11,6 +13,7 @@ namespace src.player.skills
{ {
private const Skills skillName = Skills.Phoenix; private const Skills skillName = Skills.Phoenix;
private static readonly object setLock = new(); private static readonly object setLock = new();
private static readonly ConcurrentDictionary<ulong, Timer> timers = [];
public static void LoadSkill() public static void LoadSkill()
{ {
@ -29,14 +32,75 @@ namespace src.player.skills
{ {
lock (setLock) lock (setLock)
{ {
ulong steamID = player.SteamID;
int team = player.TeamNum;
if (team != 2 && team != 3) return;
player.Respawn(); player.Respawn();
Server.NextFrame(() => {
lock (setLock)
{
var player = Utilities.GetPlayerFromSteamId(steamID);
if (player == null || !player.IsValid || !player.PlayerPawn.IsValid) return;
var pawn = player.PlayerPawn.Value;
if (pawn == null || !pawn.IsValid) return;
bool isBlock = team != player.TeamNum || player.TeamChanged;
player.Respawn();
if (isBlock)
{
pawn.Flags |= (uint)Flags_t.FL_FROZEN;
pawn.Teleport(new Vector(0, 0, -1000), new QAngle(90, 0, 0));
bool isFreezeTime = Instance.GameRules != null && Instance.GameRules.FreezePeriod == true;
if (!isFreezeTime)
{
Server.NextFrame(() =>
{
if (pawn == null || !pawn.IsValid) return;
pawn.CommitSuicide(false, true);
});
return;
}
ulong steamId = player.SteamID; ulong steamId = player.SteamID;
Instance.AddTimer(.2f, () => { if (!timers.ContainsKey(player.SteamID))
var player = Utilities.GetPlayerFromSteamId(steamId); {
if (player == null || !player.IsValid) return; var timer = Instance.AddTimer(1f, () =>
{
if (player == null || !player.IsValid || pawn == null || !pawn.IsValid)
{
if (timers.TryRemove(steamId, out var t))
t.Kill();
return;
}
player.Respawn(); bool isFreezeTime = Instance.GameRules != null && Instance.GameRules.FreezePeriod == true;
if (!isFreezeTime)
{
if (timers.TryRemove(steamId, out var t))
t.Kill();
pawn.CommitSuicide(false, true);
return;
}
}, TimerFlags.STOP_ON_MAPCHANGE | TimerFlags.REPEAT);
timers.TryAdd(player.SteamID, timer);
}
return;
}
}
}); });
SkillUtils.PrintToChat(player, player.GetTranslation("phoenix_respawn")); SkillUtils.PrintToChat(player, player.GetTranslation("phoenix_respawn"));
@ -55,7 +119,7 @@ namespace src.player.skills
border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t"); border: !Utilities.GetPlayers().Any(p => p.Team == player.Team && !p.IsBot && p != player) ? "tb" : "t");
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5C0A", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ff5C0A", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .2f, float chanceTo = .4f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -170,7 +170,7 @@ namespace src.player.skills
public bool IsFlying { get; set; } = false; public bool IsFlying { get; set; } = false;
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1466F5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float maximumFuel = 150f, float fuelConsumption = .64f, float refuelling = .1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1466F5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float maximumFuel = 150f, float fuelConsumption = .64f, float refuelling = .1f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MaximumFuel { get; set; } = maximumFuel; public float MaximumFuel { get; set; } = maximumFuel;
public float FuelConsumption { get; set; } = fuelConsumption; public float FuelConsumption { get; set; } = fuelConsumption;

View file

@ -102,7 +102,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7d7d7d", CsTeam onlyTeam = CsTeam.Terrorist, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int extraC4BlowTime = 60) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#7d7d7d", CsTeam onlyTeam = CsTeam.Terrorist, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 1, Rarity rarity = Rarity.Common, int extraC4BlowTime = 60) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int ExtraC4BlowTime { get; set; } = extraC4BlowTime; public int ExtraC4BlowTime { get; set; } = extraC4BlowTime;
} }

View file

@ -104,7 +104,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#902eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", float cooldown = .85f, int damage = 1, int minHealth = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#902eff", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = true, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = 2, Rarity rarity = Rarity.Common, float cooldown = .85f, int damage = 1, int minHealth = 30) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public int Damage { get; set; } = damage; public int Damage { get; set; } = damage;
public float Cooldown { get; set; } = cooldown; public float Cooldown { get; set; } = cooldown;

View file

@ -118,7 +118,7 @@ namespace src.player.skills
SkillUtils.CloseMenu(player); SkillUtils.CloseMenu(player);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#ffc061", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -31,7 +31,7 @@ namespace src.player.skills
SkillUtils.RestoreHealth(victim); SkillUtils.RestoreHealth(victim);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c9c9c", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#9c9c9c", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

View file

@ -128,7 +128,7 @@ namespace src.player.skills
public float DefusingTime { get; set; } public float DefusingTime { get; set; }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#507529", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float maxDefusingRange = 80f, float defusingTime = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#507529", CsTeam onlyTeam = CsTeam.CounterTerrorist, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float maxDefusingRange = 80f, float defusingTime = 10f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float MaxDefusingRange { get; set; } = maxDefusingRange; public float MaxDefusingRange { get; set; } = maxDefusingRange;
public float DefusingTime { get; set; } = defusingTime; public float DefusingTime { get; set; } = defusingTime;

View file

@ -56,7 +56,7 @@ namespace src.player.skills
playerPawn.Teleport(currentPosition, null, newVelocity); playerPawn.Teleport(currentPosition, null, newVelocity);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1e9ab0", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float chanceFrom = .3f, float chanceTo = .4f, float jumpVelocity = 300f, float pushVelocity = 400f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1e9ab0", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float chanceFrom = .3f, float chanceTo = .4f, float jumpVelocity = 300f, float pushVelocity = 400f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float ChanceFrom { get; set; } = chanceFrom; public float ChanceFrom { get; set; } = chanceFrom;
public float ChanceTo { get; set; } = chanceTo; public float ChanceTo { get; set; } = chanceTo;

View file

@ -35,7 +35,7 @@ namespace src.player.skills
SkillUtils.TryGiveWeapon(player, player.Team == CsTeam.CounterTerrorist ? CsItem.IncendiaryGrenade : CsItem.Molotov); SkillUtils.TryGiveWeapon(player, player.Team == CsTeam.CounterTerrorist ? CsItem.IncendiaryGrenade : CsItem.Molotov);
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", float regenerationMultiplier = 1.5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#3c47de", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common, float regenerationMultiplier = 1.5f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
public float RegenerationMultiplier { get; set; } = regenerationMultiplier; public float RegenerationMultiplier { get; set; } = regenerationMultiplier;
} }

View file

@ -47,7 +47,7 @@ namespace src.player.skills
} }
} }
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "") : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission) public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#8a42f5", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, string requiredPermission = "", int maxPerServer = -1, Rarity rarity = Rarity.Common) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates, requiredPermission, maxPerServer, rarity)
{ {
} }
} }

Some files were not shown because too many files have changed in this diff Show more