WIP
This commit is contained in:
parent
e44af68309
commit
6b8988ade4
77 changed files with 3033 additions and 391 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using jRandomSkills.src.player;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.Metrics;
|
||||
using static jRandomSkills.jRandomSkills;
|
||||
|
||||
namespace jRandomSkills
|
||||
|
|
@ -69,14 +68,37 @@ namespace jRandomSkills
|
|||
|
||||
public class ConfigModel
|
||||
{
|
||||
// Team: 2 - TT, 3 - CT
|
||||
|
||||
public Settings Settings { get; set; } = new Settings();
|
||||
public SkillInfo[] SkillsInfo = {
|
||||
new SkillInfo(Skills.None),
|
||||
new SkillInfo(Skills.Dwarf, chanceFrom : .6f, chanceTo : .95f),
|
||||
|
||||
new SkillInfo(Skills.NoRecoil),
|
||||
new SkillInfo(Skills.SecondLife),
|
||||
new SkillInfo(Skills.C4Camouflage),
|
||||
new SkillInfo(Skills.Ninja),
|
||||
new SkillInfo(Skills.SoundMaker, cooldown: 5),
|
||||
new SkillInfo(Skills.Prosthesis),
|
||||
new SkillInfo(Skills.OnlyHead),
|
||||
new SkillInfo(Skills.ReactiveArmor, cooldown: 15),
|
||||
new SkillInfo(Skills.ReturnToSender),
|
||||
new SkillInfo(Skills.Jammer),
|
||||
new SkillInfo(Skills.RobinHood),
|
||||
new SkillInfo(Skills.Hermit),
|
||||
new SkillInfo(Skills.AreaReaper, team: 3),
|
||||
new SkillInfo(Skills.Mute),
|
||||
new SkillInfo(Skills.HolyHandGrenade),
|
||||
new SkillInfo(Skills.Replicator, cooldown: 15),
|
||||
new SkillInfo(Skills.ToxicSmoke),
|
||||
new SkillInfo(Skills.Duplicator),
|
||||
new SkillInfo(Skills.Thief),
|
||||
new SkillInfo(Skills.Deactivator),
|
||||
new SkillInfo(Skills.Dwarf, chanceFrom: .6f, chanceTo : .95f),
|
||||
new SkillInfo(Skills.SwapPosition, cooldown: 30),
|
||||
new SkillInfo(Skills.FrozenDecoy),
|
||||
new SkillInfo(Skills.Soldier, chanceFrom: 1.15f, chanceTo: 1.35f),
|
||||
new SkillInfo(Skills.Armored, chanceFrom : .65f, chanceTo : .85f),
|
||||
new SkillInfo(Skills.Armored, chanceFrom: .65f, chanceTo : .85f),
|
||||
new SkillInfo(Skills.Aimbot, only1v1: true),
|
||||
new SkillInfo(Skills.Retreat, cooldown: 15),
|
||||
new SkillInfo(Skills.EnemySpawn, cooldown: 15),
|
||||
|
|
@ -91,7 +113,7 @@ namespace jRandomSkills
|
|||
new SkillInfo(Skills.RandomWeapon, cooldown: 15),
|
||||
new SkillInfo(Skills.WeaponsSwap, cooldown: 30),
|
||||
new SkillInfo(Skills.Wallhack),
|
||||
new SkillInfo(Skills.Flash, chanceFrom : 1.2f, chanceTo : 3.0f),
|
||||
new SkillInfo(Skills.Flash, chanceFrom: 1.2f, chanceTo: 3.0f),
|
||||
new SkillInfo(Skills.PawelJumper),
|
||||
new SkillInfo(Skills.BunnyHop),
|
||||
new SkillInfo(Skills.Impostor),
|
||||
|
|
@ -102,7 +124,7 @@ namespace jRandomSkills
|
|||
new SkillInfo(Skills.Medic),
|
||||
new SkillInfo(Skills.Ghost),
|
||||
new SkillInfo(Skills.Chicken),
|
||||
new SkillInfo(Skills.Astronaut, chanceFrom : .1f, chanceTo : .7f),
|
||||
new SkillInfo(Skills.Astronaut, chanceFrom: .1f, chanceTo: .7f),
|
||||
new SkillInfo(Skills.Disarmament, chanceFrom: .2f, chanceTo: .4f),
|
||||
new SkillInfo(Skills.AntyFlash),
|
||||
new SkillInfo(Skills.Behind, chanceFrom: .2f, chanceTo: .4f),
|
||||
|
|
|
|||
75
jRandomSkills - SRC Files/src/utils/SkillUtils.cs
Normal file
75
jRandomSkills - SRC Files/src/utils/SkillUtils.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities.Constants;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class SkillUtils
|
||||
{
|
||||
public static void PrintToChat(CCSPlayerController player, string msg, bool isError)
|
||||
{
|
||||
string checkIcon = isError ? $"{ChatColors.DarkRed}✖{ChatColors.LightRed}" : $"{ChatColors.Green}✔{ChatColors.Lime}";
|
||||
player.PrintToChat($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} jRadnomSkills {ChatColors.Green}] {checkIcon} {msg}");
|
||||
}
|
||||
|
||||
public static void RegisterSkill(Skills skill, string color, bool display = true)
|
||||
{
|
||||
if (!SkillData.Skills.Any(s => s.Skill == skill))
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(skill, color, display));
|
||||
}
|
||||
|
||||
public static void TryGiveWeapon(CCSPlayerController player, CsItem item, int count = 1)
|
||||
{
|
||||
string? itemString = EnumUtils.GetEnumMemberAttributeValue(item);
|
||||
if (string.IsNullOrWhiteSpace(itemString)) return;
|
||||
|
||||
var exists = player.PlayerPawn.Value.WeaponServices.MyWeapons.FirstOrDefault(w => w.Value.DesignerName == itemString);
|
||||
if (exists == null)
|
||||
for (int i = 0; i < count; i++)
|
||||
player.GiveNamedItem(item);
|
||||
}
|
||||
|
||||
public static Vector GetForwardVector(QAngle angles)
|
||||
{
|
||||
float pitch = angles.X * (float)(Math.PI / 180);
|
||||
float yaw = angles.Y * (float)(Math.PI / 180);
|
||||
|
||||
float x = (float)(Math.Cos(pitch) * Math.Cos(yaw));
|
||||
float y = (float)(Math.Cos(pitch) * Math.Sin(yaw));
|
||||
float z = (float)Math.Sin(pitch);
|
||||
|
||||
return new Vector(x, y, z);
|
||||
}
|
||||
|
||||
public static void TakeHealth(CCSPlayerPawn pawn, int damage)
|
||||
{
|
||||
if (pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
int newHealth = (int)(pawn.Health - damage);
|
||||
pawn.Health = newHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
|
||||
if (pawn.Health <= 0)
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
pawn?.CommitSuicide(false, true);
|
||||
});
|
||||
}
|
||||
|
||||
public static void AddHealth(CCSPlayerPawn pawn, int extraHealth, int maxHealth = 100)
|
||||
{
|
||||
if (pawn.LifeState != (byte)LifeState_t.LIFE_ALIVE)
|
||||
return;
|
||||
|
||||
int newHealth = (int)(pawn.Health + extraHealth);
|
||||
pawn.Health = Math.Min(newHealth, maxHealth);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
|
||||
pawn.MaxHealth = maxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using jRandomSkills.src.player;
|
||||
|
||||
namespace jRandomSkills
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static void PrintToChat(CCSPlayerController player, string msg, bool isError)
|
||||
{
|
||||
string checkIcon = isError ? $"{ChatColors.DarkRed}✖{ChatColors.LightRed}" : $"{ChatColors.Green}✔{ChatColors.Lime}";
|
||||
player.PrintToChat($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} jRadnomSkills {ChatColors.Green}] {checkIcon} {msg}");
|
||||
}
|
||||
|
||||
public static void RegisterSkill(Skills skill, string color, bool display = true)
|
||||
{
|
||||
if (!SkillData.Skills.Any(s => s.Skill == skill))
|
||||
{
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(skill, color, display));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue