-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSuperheroUtilities.cs
More file actions
66 lines (56 loc) · 2.11 KB
/
SuperheroUtilities.cs
File metadata and controls
66 lines (56 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Memory;
using SuperheroPlugin.Abilities;
namespace SuperheroPlugin;
public static class SuperheroUtilities
{
public static List<int> generateXpLevelCurve(int maxLevel)
{
int baseXp = 10;
List<int> result = new List<int>();
for (int level = 1; level <= maxLevel; level++) {
result.Add((int) Math.Floor(baseXp * Math.Pow(level, 1.1f)));
}
return result;
}
public static void RefreshUI(SuperheroPlayer shPlayer)
{
if (shPlayer?.Player?.PlayerPawn?.Value == null) { return; }
CCSPlayerPawn pawn = shPlayer.Player.PlayerPawn.Value;
if (pawn.WeaponServices == null || pawn.ItemServices == null) { return; }
string healthShot = "weapon_healthshot";
VirtualFunctions.GiveNamedItem(pawn.ItemServices.Handle, healthShot, 0, 0, 0, 0);
foreach (var wep in pawn.WeaponServices.MyWeapons)
{
if (wep?.IsValid == true && wep.Value?.IsValid == true &&
!string.IsNullOrWhiteSpace(wep.Value.DesignerName) && wep.Value.DesignerName.Equals(healthShot))
{
wep.Value.Remove();
}
}
}
public static List<SuperheroAbility> filterExistingPlayerAbilities(List<SuperheroAbility> allAbilities, List<SuperheroAbility> playerAbilities)
{
return allAbilities
.Where(ability => !playerAbilities.Any(playerAbility => playerAbility.abilityName == ability.abilityName))
.ToList();
}
public static List<SuperheroAbility> filterMinimumLevelAbilities(List<SuperheroAbility> allAbilities, int playerLevel)
{
return allAbilities
.Where(ability => playerLevel >= ability.minLevel)
.ToList();
}
public static readonly string[] secondaryWeaponsList = new string[]{
"weapon_glock",
"weapon_elite",
"weapon_p250",
"weapon_tec9",
"weapon_cz75a",
"weapon_deagle",
"weapon_revolver",
"weapon_usp_silencer",
"weapon_hkp2000",
"weapon_fiveseven"
};
}