v1.1.7
This commit is contained in:
parent
ac53655184
commit
e5ead42dfa
34 changed files with 953 additions and 1333 deletions
|
|
@ -2,7 +2,6 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static src.jRandomSkills;
|
||||
using System.Collections.Concurrent;
|
||||
using src.utils;
|
||||
|
||||
namespace src.player.skills
|
||||
|
|
@ -58,9 +57,7 @@ namespace src.player.skills
|
|||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
playerInfo.SkillChance = 0;
|
||||
|
||||
ConcurrentBag<(string, string)> menuItems = [(player.GetTranslation("bombsite_a"), "a"), (player.GetTranslation("bombsite_b"), "b")];
|
||||
SkillUtils.CreateMenu(player, menuItems);
|
||||
SkillUtils.CreateMenu(player, [(player.GetTranslation("bombsite_a"), "a")], (player.GetTranslation("bombsite_b"), "b"));
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
|
||||
player.PlayerPawn.Value.ActualGravityScale = 1;
|
||||
playerInfo.SkillChance = 1;
|
||||
}
|
||||
|
||||
private static void ApplyGravityModifier(CCSPlayerController player)
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "ChanceTo") - SkillsInfo.GetValue<float>(skillName, "ChanceFrom")) + SkillsInfo.GetValue<float>(skillName, "ChanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "chanceTo") - SkillsInfo.GetValue<float>(skillName, "chanceFrom")) + SkillsInfo.GetValue<float>(skillName, "chanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ namespace src.player.skills
|
|||
"weapon_negev"
|
||||
];
|
||||
private static readonly ConcurrentDictionary<CCSPlayerController, CBaseModelEntity> chickens = [];
|
||||
private static readonly string defaultCTModel = "characters/models/ctm_sas/ctm_sas.vmdl";
|
||||
private static readonly string defaultTModel = "characters/models/tm_phoenix/tm_phoenix.vmdl";
|
||||
private static readonly ConcurrentDictionary<ulong, string> originalModels = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
|
|
@ -36,6 +39,7 @@ namespace src.player.skills
|
|||
if (valuePair.Value != null && valuePair.Value.IsValid)
|
||||
valuePair.Value.AcceptInput("Kill");
|
||||
chickens.Clear();
|
||||
originalModels.Clear();
|
||||
}
|
||||
|
||||
public static void WeaponPickup(EventItemPickup @event)
|
||||
|
|
@ -61,9 +65,12 @@ namespace src.player.skills
|
|||
SkillUtils.ChangePlayerScale(player, .2f);
|
||||
|
||||
playerPawn.Render = Color.FromArgb(0, 255, 255, 255);
|
||||
playerPawn.ShadowStrength = 0.0f;
|
||||
playerPawn.ShadowStrength = 0f;
|
||||
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);
|
||||
CreateChicken(player);
|
||||
}
|
||||
|
|
@ -77,7 +84,7 @@ namespace src.player.skills
|
|||
{
|
||||
playerPawn.VelocityModifier = 1f;
|
||||
|
||||
playerPawn.Health += 50;
|
||||
playerPawn.Health = Math.Min(playerPawn.Health + 50, 100);
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
|
||||
|
||||
SkillUtils.ChangePlayerScale(player, 1);
|
||||
|
|
@ -95,6 +102,23 @@ namespace src.player.skills
|
|||
chicken.AcceptInput("Kill");
|
||||
chickens.TryRemove(player, out _);
|
||||
}
|
||||
|
||||
if (originalModels.TryGetValue(player.SteamID, out var model))
|
||||
{
|
||||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ namespace src.player.skills
|
|||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
deafPlayers.TryRemove(player, out _);
|
||||
SkillUtils.CloseMenu(player);
|
||||
deafPlayers.TryRemove(player, out _);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#dae01f", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "chanceTo") - SkillsInfo.GetValue<float>(skillName, "chanceFrom")) + SkillsInfo.GetValue<float>(skillName, "chanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,6 @@ namespace src.player.skills
|
|||
var playerInfo = jRandomSkills.Instance.SkillPlayer.FirstOrDefault(s => s.SteamID == player?.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
|
||||
if (playerInfo.SkillDescriptionHudExpired >= DateTime.Now)
|
||||
{
|
||||
playerInfo.PrintHTML = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn == null || !playerPawn.IsValid) return;
|
||||
if (playerPawn.LifeState != (byte)LifeState_t.LIFE_ALIVE) return;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ namespace src.player.skills
|
|||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null && playerPawn?.CBodyComponent != null)
|
||||
{
|
||||
playerInfo.SkillChance = 1;
|
||||
SkillUtils.ChangePlayerScale(player, 1);
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_CBodyComponent");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "ChanceTo") - SkillsInfo.GetValue<float>(skillName, "ChanceFrom")) + SkillsInfo.GetValue<float>(skillName, "ChanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Concurrent;
|
||||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
|
@ -11,22 +12,33 @@ namespace src.player.skills
|
|||
{
|
||||
private const Skills skillName = Skills.Impostor;
|
||||
private static readonly string defaultCTModel = "characters/models/ctm_sas/ctm_sas.vmdl";
|
||||
private static readonly string defaultTModel = "characters/models/tm_phoenix_heavy/tm_phoenix_heavy.vmdl";
|
||||
private static readonly string defaultTModel = "characters/models/tm_phoenix/tm_phoenix.vmdl";
|
||||
private static readonly ConcurrentDictionary<ulong, string> originalModels = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
{
|
||||
originalModels.Clear();
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
string model = GetEnemyModel(player);
|
||||
if (player.PlayerPawn.Value != null && player.PlayerPawn.Value.IsValid && player.PlayerPawn.Value.CBodyComponent != null && player.PlayerPawn.Value.CBodyComponent.SceneNode != null)
|
||||
originalModels.TryAdd(player.SteamID, player.PlayerPawn.Value.CBodyComponent.SceneNode.GetSkeletonInstance().ModelState.ModelName);
|
||||
SetPlayerModel(player, model);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
SetPlayerModel(player, player.Team == CsTeam.Terrorist ? defaultTModel : defaultCTModel);
|
||||
var model = originalModels.TryGetValue(player.SteamID, out var originalModel) && !string.IsNullOrEmpty(originalModel) ? originalModel :
|
||||
player.Team == CsTeam.Terrorist ? defaultTModel : defaultCTModel;
|
||||
SetPlayerModel(player, model);
|
||||
originalModels.TryRemove(player.SteamID, out _);
|
||||
}
|
||||
|
||||
private static string GetEnemyModel(CCSPlayerController player)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace src.player.skills
|
|||
public class Jackal : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Jackal;
|
||||
private static readonly ConcurrentDictionary<ulong, byte> playersInAction = [];
|
||||
private static readonly ConcurrentDictionary<CCSPlayerController, ConcurrentQueue<CBeam>> stepBeams = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
|
|
@ -26,6 +27,7 @@ namespace src.player.skills
|
|||
if (beam != null && beam.IsValid)
|
||||
beam.AcceptInput("Kill");
|
||||
stepBeams.Clear();
|
||||
playersInAction.Clear();
|
||||
}
|
||||
|
||||
public static void OnTick()
|
||||
|
|
@ -102,9 +104,10 @@ namespace src.player.skills
|
|||
return beam;
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController _)
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
Event.EnableTransmit();
|
||||
playersInAction.TryAdd(player.SteamID, 0);
|
||||
foreach (var _player in Utilities.GetPlayers().Where(p => p.IsValid && !p.IsBot && !p.IsHLTV && p.PawnIsAlive && p.Team is CsTeam.CounterTerrorist or CsTeam.Terrorist))
|
||||
if (!stepBeams.ContainsKey(_player))
|
||||
stepBeams.TryAdd(_player, []);
|
||||
|
|
@ -112,11 +115,8 @@ namespace src.player.skills
|
|||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
|
||||
playerInfo.Skill = Skills.None;
|
||||
if (!Instance.SkillPlayer.Any(s => s.Skill == skillName))
|
||||
playersInAction.TryRemove(player.SteamID, out _);
|
||||
if (playersInAction.IsEmpty)
|
||||
NewRound();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using CounterStrikeSharp.API;
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using src.utils;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Drawing;
|
||||
using static src.jRandomSkills;
|
||||
|
||||
|
|
@ -12,6 +13,8 @@ namespace src.player.skills
|
|||
private const Skills skillName = Skills.Jester;
|
||||
private static bool jesterMode = false;
|
||||
private static bool jesterStarted = false;
|
||||
public static bool GetJesterMode() => jesterMode;
|
||||
private static readonly ConcurrentBag<CCSPlayerController> jesters = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
|
|
@ -21,11 +24,17 @@ namespace src.player.skills
|
|||
public static void NewRound()
|
||||
{
|
||||
jesterStarted = false;
|
||||
foreach (var jester in jesters)
|
||||
if (jester != null && jester.IsValid)
|
||||
DisableSkill(jester);
|
||||
jesters.Clear();
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
SkillUtils.ResetPrintHTML(player);
|
||||
if (player.PlayerPawn.Value == null || !player.PlayerPawn.Value.IsValid) return;
|
||||
SetPlayerColor(player.PlayerPawn.Value, true);
|
||||
}
|
||||
|
||||
public static void PlayerHurt(EventPlayerHurt @event)
|
||||
|
|
@ -35,10 +44,17 @@ namespace src.player.skills
|
|||
var victim = @event.Userid;
|
||||
int hitgroup = @event.Hitgroup;
|
||||
|
||||
if (!Instance.IsPlayerValid(attacker) || !Instance.IsPlayerValid(victim)) return;
|
||||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
if (!Instance.IsPlayerValid(victim)) return;
|
||||
var victimInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == victim?.SteamID);
|
||||
|
||||
if (!Instance.IsPlayerValid(attacker))
|
||||
{
|
||||
if (victimInfo?.Skill == skillName)
|
||||
RestoreHealth(victim!, @event.DmgHealth);
|
||||
return;
|
||||
}
|
||||
|
||||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
if (attackerInfo?.Skill == skillName || victimInfo?.Skill == skillName)
|
||||
RestoreHealth(victim!, @event.DmgHealth);
|
||||
}
|
||||
|
|
@ -89,9 +105,9 @@ namespace src.player.skills
|
|||
}
|
||||
}
|
||||
|
||||
private static void SetPlayerColor(CCSPlayerPawn pawn)
|
||||
private static void SetPlayerColor(CCSPlayerPawn pawn, bool forceDisable = false)
|
||||
{
|
||||
var color = jesterMode ? Color.FromArgb(255, 128, 0, 128) : Color.FromArgb(255, 255, 255, 255);
|
||||
var color = jesterMode && !forceDisable ? Color.FromArgb(255, 128, 0, 128) : Color.FromArgb(255, 255, 255, 255);
|
||||
pawn.Render = color;
|
||||
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using CS2TraceRay.Class;
|
|||
using CS2TraceRay.Enum;
|
||||
using CS2TraceRay.Struct;
|
||||
using src.utils;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Drawing;
|
||||
using System.Numerics;
|
||||
using static src.jRandomSkills;
|
||||
|
|
@ -20,6 +21,7 @@ namespace src.player.skills
|
|||
|
||||
private static bool hooked = false;
|
||||
private const int actionCode = 503;
|
||||
private static readonly ConcurrentDictionary<ulong, byte> playersInAction = [];
|
||||
private static readonly MemoryFunctionVoid<IntPtr, short> Shoot_Secondary = new(GameData.GetSignature("Shoot_Secondary"));
|
||||
|
||||
public static void LoadSkill()
|
||||
|
|
@ -29,23 +31,23 @@ namespace src.player.skills
|
|||
|
||||
public static void NewRound()
|
||||
{
|
||||
playersInAction.Clear();
|
||||
hooked = false;
|
||||
Shoot_Secondary.Unhook(ShootSecondary, HookMode.Pre);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController _)
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
if (hooked) return;
|
||||
hooked = true;
|
||||
Shoot_Secondary.Hook(ShootSecondary, HookMode.Pre);
|
||||
playersInAction.TryAdd(player.SteamID, 0);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
|
||||
playerInfo.Skill = Skills.None;
|
||||
if (!Instance.SkillPlayer.Any(p => p.Skill == skillName))
|
||||
playersInAction.TryRemove(player.SteamID, out _);
|
||||
if (playersInAction.IsEmpty)
|
||||
{
|
||||
Shoot_Secondary.Unhook(ShootSecondary, HookMode.Pre);
|
||||
hooked = false;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "ChanceTo") - SkillsInfo.GetValue<float>(skillName, "ChanceFrom")) + SkillsInfo.GetValue<float>(skillName, "ChanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,8 +37,6 @@ namespace src.player.skills
|
|||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "ChanceTo") - SkillsInfo.GetValue<float>(skillName, "ChanceFrom")) + SkillsInfo.GetValue<float>(skillName, "ChanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +54,7 @@ namespace src.player.skills
|
|||
player.PlayerPawn.Value.Teleport(currentPosition, currentAngles, newVelocity);
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1e9ab0", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float chanceFrom = 1f, float chanceTo = 1f, float jumpVelocity = 300f, float pushVelocity = 400f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#1e9ab0", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float chanceFrom = .3f, float chanceTo = .4f, float jumpVelocity = 300f, float pushVelocity = 400f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
{
|
||||
public float ChanceFrom { get; set; } = chanceFrom;
|
||||
public float ChanceTo { get; set; } = chanceTo;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace src.player.skills
|
|||
|
||||
public static void LoadSkill()
|
||||
{
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"));
|
||||
SkillUtils.RegisterSkill(skillName, SkillsInfo.GetValue<string>(skillName, "color"), false);
|
||||
}
|
||||
|
||||
public static void NewRound()
|
||||
|
|
@ -38,7 +38,17 @@ namespace src.player.skills
|
|||
var attackerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == attacker?.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == skillName)
|
||||
TeleportAttackerBehindVictim(attacker!, victim!);
|
||||
if (Instance.Random.NextDouble() <= attackerInfo.SkillChance)
|
||||
TeleportAttackerBehindVictim(attacker!, victim!);
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
float newChance = (float)Instance.Random.NextDouble() * (SkillsInfo.GetValue<float>(skillName, "ChanceTo") - SkillsInfo.GetValue<float>(skillName, "ChanceFrom")) + SkillsInfo.GetValue<float>(skillName, "ChanceFrom");
|
||||
playerInfo.SkillChance = newChance;
|
||||
SkillUtils.PrintToChat(player, $"{ChatColors.DarkRed}{player.GetSkillName(skillName)}{ChatColors.Lime}: {player.GetSkillDescription(skillName, newChance)}", false);
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
|
|
@ -109,9 +119,11 @@ namespace src.player.skills
|
|||
noSpace.AddOrUpdate(attacker, Server.TickCount + (64 * 2), (k, v) => Server.TickCount + (64 * 2));
|
||||
}
|
||||
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#4d4d4d", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float teleportDistance = 100f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
public class SkillConfig(Skills skill = skillName, bool active = true, string color = "#4d4d4d", CsTeam onlyTeam = CsTeam.None, bool disableOnFreezeTime = false, bool needsTeammates = false, float teleportDistance = 100f, float chanceFrom = .3f, float chanceTo = .45f) : SkillsInfo.DefaultSkillInfo(skill, active, color, onlyTeam, disableOnFreezeTime, needsTeammates)
|
||||
{
|
||||
public float TeleportDistance { get; set; } = teleportDistance;
|
||||
public float ChanceFrom { get; set; } = chanceFrom;
|
||||
public float ChanceTo { get; set; } = chanceTo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace src.player.skills
|
|||
public class Wallhack : ISkill
|
||||
{
|
||||
private const Skills skillName = Skills.Wallhack;
|
||||
private static readonly ConcurrentDictionary<ulong, byte> playersInAction = [];
|
||||
private static readonly ConcurrentBag<(CDynamicProp, CDynamicProp, CsTeam)> glows = [];
|
||||
|
||||
public static void LoadSkill()
|
||||
|
|
@ -50,22 +51,21 @@ namespace src.player.skills
|
|||
glow.Item2.AcceptInput("Kill");
|
||||
}
|
||||
glows.Clear();
|
||||
playersInAction.Clear();
|
||||
}
|
||||
|
||||
public static void EnableSkill(CCSPlayerController _)
|
||||
public static void EnableSkill(CCSPlayerController player)
|
||||
{
|
||||
Event.EnableTransmit();
|
||||
playersInAction.TryAdd(player.SteamID, 0);
|
||||
if (glows.IsEmpty)
|
||||
SetGlowEffectForAll();
|
||||
}
|
||||
|
||||
public static void DisableSkill(CCSPlayerController player)
|
||||
{
|
||||
var playerInfo = Instance.SkillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo == null) return;
|
||||
|
||||
playerInfo.Skill = Skills.None;
|
||||
if (!Instance.SkillPlayer.Any(s => s.Skill == skillName))
|
||||
playersInAction.TryRemove(player.SteamID, out _);
|
||||
if (playersInAction.IsEmpty)
|
||||
NewRound();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue