1.0.2
This commit is contained in:
parent
68f26a22f4
commit
68776c3382
28 changed files with 819 additions and 116 deletions
63
[ D3X ] dRandomSkills - SRC Files/Properties/Resources.Designer.cs
generated
Normal file
63
[ D3X ] dRandomSkills - SRC Files/Properties/Resources.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Ten kod został wygenerowany przez narzędzie.
|
||||
// Wersja wykonawcza:4.0.30319.42000
|
||||
//
|
||||
// Zmiany w tym pliku mogą spowodować nieprawidłowe zachowanie i zostaną utracone, jeśli
|
||||
// kod zostanie ponownie wygenerowany.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace dRandomSkills.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Klasa zasobu wymagająca zdefiniowania typu do wyszukiwania zlokalizowanych ciągów itd.
|
||||
/// </summary>
|
||||
// Ta klasa została automatycznie wygenerowana za pomocą klasy StronglyTypedResourceBuilder
|
||||
// przez narzędzie, takie jak ResGen lub Visual Studio.
|
||||
// Aby dodać lub usunąć składową, edytuj plik ResX, a następnie ponownie uruchom narzędzie ResGen
|
||||
// z opcją /str lub ponownie utwórz projekt VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Zwraca buforowane wystąpienie ResourceManager używane przez tę klasę.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("dRandomSkills.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Przesłania właściwość CurrentUICulture bieżącego wątku dla wszystkich
|
||||
/// przypadków przeszukiwania zasobów za pomocą tej klasy zasobów wymagającej zdefiniowania typu.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
[ D3X ] dRandomSkills - SRC Files/Properties/Resources.resx
Normal file
101
[ D3X ] dRandomSkills - SRC Files/Properties/Resources.resx
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"dRandomSkills": {
|
||||
"commandName": "Project",
|
||||
"nativeDebugging": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,23 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.264" />
|
||||
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.305" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
25
[ D3X ] dRandomSkills - SRC Files/dRandomSkills.sln
Normal file
25
[ D3X ] dRandomSkills - SRC Files/dRandomSkills.sln
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34728.123
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dRandomSkills", "dRandomSkills.csproj", "{1412DD25-558C-425A-A7F6-347C970136E5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1412DD25-558C-425A-A7F6-347C970136E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1412DD25-558C-425A-A7F6-347C970136E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1412DD25-558C-425A-A7F6-347C970136E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1412DD25-558C-425A-A7F6-347C970136E5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A00F62BC-56A4-45B7-8843-2B0292BA710D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -12,7 +12,7 @@ namespace dRandomSkills
|
|||
public override string ModuleName => "[CS2] D3X - [ Random Skills ]";
|
||||
public override string ModuleAuthor => "D3X";
|
||||
public override string ModuleDescription => "Plugin dodaje na serwer losowe moce co runde na serwery CS2 by D3X";
|
||||
public override string ModuleVersion => "1.0.1";
|
||||
public override string ModuleVersion => "1.0.2";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
|
@ -23,30 +23,35 @@ namespace dRandomSkills
|
|||
PlayerOnTick.Load();
|
||||
Command.Load();
|
||||
|
||||
// ==== NOWE ====
|
||||
MiniMajk.LoadMiniMajk();
|
||||
ZamianaMiejsc.LoadZamianaMiejsc();
|
||||
|
||||
// ==== POPRAWIONE/NAPRAWIONE ====
|
||||
Flash.LoadFlash();
|
||||
PawelJumper.LoadPawelJumper();
|
||||
Duszek.LoadDuszek();
|
||||
BunnyHop.LoadBunnyHop();
|
||||
Impostor.LoadImpostor();
|
||||
Phoenix.LoadPhoenix();
|
||||
Muhammed.LoadMuhammed();
|
||||
Pilot.LoadPilot();
|
||||
Rambo.LoadRambo();
|
||||
Bogacz.LoadBogacz();
|
||||
Flash.LoadFlash();
|
||||
Astronauta.LoadAstronauta();
|
||||
Medyk.LoadMedyk();
|
||||
Kurczak.LoadKurczak();
|
||||
OneShot.LoadOneShot();
|
||||
Drakula.LoadDrakula();
|
||||
AntyFlash.LoadAntyFlash();
|
||||
Muhammed.LoadMuhammed();
|
||||
Bogacz.LoadBogacz();
|
||||
Rambo.LoadRambo();
|
||||
Medyk.LoadMedyk();
|
||||
Duszek.LoadDuszek();
|
||||
Kurczak.LoadKurczak();
|
||||
Astronauta.LoadAstronauta();
|
||||
Rozbrojenie.LoadRozbrojenie();
|
||||
ZelaznaGlowa.LoadZelaznaGlowa();
|
||||
AntyFlash.LoadAntyFlash();
|
||||
ObrotWroga.LoadObrotWroga();
|
||||
NieskonczoneAmmo.LoadNieskonczoneAmmo();
|
||||
Katapulta.LoadKatapulta();
|
||||
ObrotWroga.LoadObrotWroga();
|
||||
Cien.LoadCien();
|
||||
Drakula.LoadDrakula();
|
||||
Teleporter.LoadTeleporter();
|
||||
Eliminator.LoadEliminator();
|
||||
Saper.LoadEliminator();
|
||||
Phoenix.LoadPhoenix();
|
||||
Pilot.LoadPilot();
|
||||
Cien.LoadCien();
|
||||
ZelaznaGlowa.LoadZelaznaGlowa();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +60,7 @@ namespace dRandomSkills
|
|||
public required ulong SteamID { get; set; }
|
||||
public required string PlayerName { get; set; }
|
||||
public string? Skill { get; set; }
|
||||
public float? SkillChance { get; set; }
|
||||
public bool IsDrawing { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -64,11 +70,14 @@ namespace dRandomSkills
|
|||
public string Description { get; }
|
||||
public string Color { get; }
|
||||
|
||||
public dSkill_SkillInfo(string name, string description, string color)
|
||||
public bool Display { get; }
|
||||
|
||||
public dSkill_SkillInfo(string name, string description, string color, bool display)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
Color = color;
|
||||
Display = display;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace dRandomSkills
|
|||
PlayerName = player.PlayerName,
|
||||
Skill = "",
|
||||
IsDrawing = false,
|
||||
SkillChance = 1,
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
|
|
@ -73,7 +74,8 @@ namespace dRandomSkills
|
|||
var randomSkill = SkillData.Skills[Instance.Random.Next(SkillData.Skills.Count)];
|
||||
skillPlayer.Skill = randomSkill.Name;
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{randomSkill.Name}{ChatColors.Lime}: {randomSkill.Description}", false);
|
||||
if (randomSkill.Display)
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}{randomSkill.Name}{ChatColors.Lime}: {randomSkill.Description}", false);
|
||||
|
||||
if(Config.config.Settings.TeamMateSkillInfo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace dRandomSkills
|
|||
{
|
||||
public static void LoadAntyFlash()
|
||||
{
|
||||
Utils.RegisterSkill("Anty Flash", "Posiadasz odporność na flashe", "#D6E6FF");
|
||||
Utils.RegisterSkill("Anty Flash", "Posiadasz odporność na flashe i 7 sekund trwają twoje flash'e", "#D6E6FF");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerBlind>((@event, info) =>
|
||||
{
|
||||
|
|
@ -19,12 +19,11 @@ namespace dRandomSkills
|
|||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
var sameTeam = attacker.Team == player.Team;
|
||||
|
||||
if (playerInfo?.Skill == "Anty Flash")
|
||||
{
|
||||
playerPawn.FlashDuration = 0.0f;
|
||||
}
|
||||
else if (Instance.skillPlayer.Any(s => s.Skill == "Anty Flash"))
|
||||
playerPawn.FlashDuration = 7.0f;
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Entities;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -8,7 +10,7 @@ namespace dRandomSkills
|
|||
{
|
||||
public static void LoadAstronauta()
|
||||
{
|
||||
Utils.RegisterSkill("Astronauta", "Otrzymujesz losową ilość grawitacji na start rundy", "#7E10AD");
|
||||
Utils.RegisterSkill("Astronauta", "Otrzymujesz losową ilość grawitacji na start rundy", "#7E10AD", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -21,7 +23,7 @@ namespace dRandomSkills
|
|||
|
||||
if (playerInfo?.Skill == "Astronauta" && playerPawn != null)
|
||||
{
|
||||
ApplyGravityModifier(playerPawn);
|
||||
ApplyGravityModifier(player);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -29,10 +31,11 @@ namespace dRandomSkills
|
|||
});
|
||||
}
|
||||
|
||||
private static void ApplyGravityModifier(CCSPlayerPawn playerPawn)
|
||||
private static void ApplyGravityModifier(CCSPlayerController player)
|
||||
{
|
||||
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (0.7f - 0.2f) + 0.2f, 1);
|
||||
playerPawn.GravityScale = gravityModifier;
|
||||
float gravityModifier = (float)Math.Round(Instance.Random.NextDouble() * (0.7f - 0.1f) + 0.1f, 1);
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Astronauta\"{ChatColors.Lime}: Twoja losowa grawitacja wynosi: {gravityModifier}x", false);
|
||||
player.Pawn.Value.GravityScale = gravityModifier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ namespace dRandomSkills
|
|||
|
||||
public static void LoadCien()
|
||||
{
|
||||
Utils.RegisterSkill("Cień", "Teleportujesz się za plecy losowego wroga", "#18171A");
|
||||
Utils.RegisterSkill("Cień", "Teleportujesz się za plecy trafionego wroga", "#18171A");
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ namespace dRandomSkills
|
|||
{
|
||||
public static class Drakula
|
||||
{
|
||||
const float VampirePercentage = 0.3f;
|
||||
|
||||
public static void LoadDrakula()
|
||||
{
|
||||
Utils.RegisterSkill("Drakula", "Po trafieniu ofiary otrzymujesz zwrot zdrowia w postaci danego procentu zadanych obrażeń", "#FA050D");
|
||||
|
|
@ -34,11 +32,12 @@ namespace dRandomSkills
|
|||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
if (attackerPawn == null) return;
|
||||
|
||||
int healing = (int)(damage * VampirePercentage);
|
||||
int newHealth = Math.Min(attackerPawn.Health + healing, attackerPawn.MaxHealth);
|
||||
int newHealth = (int)(attackerPawn.Health + (damage * 0.3));
|
||||
|
||||
attackerPawn.MaxHealth = Math.Max(newHealth, 100);
|
||||
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iMaxHealth");
|
||||
|
||||
attackerPawn.Health = newHealth;
|
||||
|
||||
Utilities.SetStateChanged(attackerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -36,13 +37,42 @@ namespace dRandomSkills
|
|||
if (!IsValidPlayer(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
{
|
||||
SetPlayerVisibility(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventItemEquip>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill != "Duszek") return HookResult.Continue;
|
||||
SetWeaponVisibility(player, false);
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Duszek")
|
||||
{
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid && activeWeapon.Clip1 != 0)
|
||||
{
|
||||
activeWeapon.Clip1 = 0;
|
||||
activeWeapon.Clip2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
|
|
@ -62,26 +92,37 @@ namespace dRandomSkills
|
|||
playerPawn.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseModelEntity", "m_clrRender");
|
||||
|
||||
var activeWeapon = playerPawn.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid)
|
||||
{
|
||||
activeWeapon.Render = color;
|
||||
activeWeapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(activeWeapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
SetWeaponVisibility(player, visible);
|
||||
}
|
||||
}
|
||||
|
||||
var myWeapons = playerPawn.WeaponServices?.MyWeapons;
|
||||
if (myWeapons != null)
|
||||
private static void SetWeaponVisibility(CCSPlayerController player, bool visible)
|
||||
{
|
||||
if (!IsValidPlayer(player)) return;
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
|
||||
var color = visible ? Color.FromArgb(255, 255, 255, 255) : Color.FromArgb(0, 255, 255, 255);
|
||||
var shadowStrength = visible ? 1.0f : 0.0f;
|
||||
|
||||
var activeWeapon = playerPawn.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid)
|
||||
{
|
||||
activeWeapon.Render = color;
|
||||
activeWeapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(activeWeapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
|
||||
var myWeapons = playerPawn.WeaponServices?.MyWeapons;
|
||||
if (myWeapons != null)
|
||||
{
|
||||
foreach (var gun in myWeapons)
|
||||
{
|
||||
foreach (var gun in myWeapons)
|
||||
var weapon = gun.Value;
|
||||
if (weapon != null)
|
||||
{
|
||||
var weapon = gun.Value;
|
||||
if (weapon != null)
|
||||
{
|
||||
weapon.Render = color;
|
||||
weapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(weapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
weapon.Render = color;
|
||||
weapon.ShadowStrength = shadowStrength;
|
||||
Utilities.SetStateChanged(weapon, "CBaseModelEntity", "m_clrRender");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -8,7 +9,7 @@ namespace dRandomSkills
|
|||
{
|
||||
public static void LoadFlash()
|
||||
{
|
||||
Utils.RegisterSkill("Flash", "Otrzymujesz losową ilość speed na start rundy", "#A31912");
|
||||
Utils.RegisterSkill("Flash", "Losowa prędkośc postaci na początku rundy", "#A31912", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -16,18 +17,20 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return;
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Flash") return;
|
||||
if (playerInfo?.Skill != "Flash") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
|
||||
if (playerPawn != null)
|
||||
{
|
||||
float velocityModifier = (float)Instance.Random.NextDouble() * (2.5f - 1.2f) + 1.2f;
|
||||
playerPawn.VelocityModifier = velocityModifier;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
float newSpeed = (float)Instance.Random.NextDouble() * (3.0f - 1.2f) + 1.2f;
|
||||
newSpeed = (float)Math.Round(newSpeed, 2);
|
||||
playerPawn.VelocityModifier = newSpeed;
|
||||
Utilities.SetStateChanged(playerPawn, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Flash\"{ChatColors.Lime}: Twój mnożnik prędkości to {newSpeed}x", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -8,7 +10,30 @@ namespace dRandomSkills
|
|||
|
||||
public static void LoadKatapulta()
|
||||
{
|
||||
Utils.RegisterSkill("Katapulta", "Masz 25% szans na podrzucenie wroga", "#FF4500");
|
||||
Utils.RegisterSkill("Katapulta", "Masz losow¹ szanse na podrzucenie wroga", "#FF4500");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Katapulta") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Katapulta\"{ChatColors.Lime}: Twoje szanse na podrzucenie wroga po trafieniu to: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
|
|
@ -23,7 +48,7 @@ namespace dRandomSkills
|
|||
|
||||
if (attackerInfo?.Skill == "Katapulta" && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
if (Instance.Random.NextDouble() <= attackerInfo.SkillChance)
|
||||
{
|
||||
var victimPawn = victim.PlayerPawn?.Value;
|
||||
if (victimPawn != null)
|
||||
|
|
@ -36,5 +61,9 @@ namespace dRandomSkills
|
|||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,30 @@
|
|||
using System.Drawing;
|
||||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Kurczak
|
||||
{
|
||||
private static string[] pistols =
|
||||
{
|
||||
"weapon_deagle",
|
||||
"weapon_revolver",
|
||||
"weapon_glock",
|
||||
"weapon_usp_silencer",
|
||||
"weapon_cz75a",
|
||||
"weapon_fiveseven",
|
||||
"weapon_p250",
|
||||
"weapon_tec9",
|
||||
"weapon_elite",
|
||||
"weapon_hkp2000"
|
||||
};
|
||||
|
||||
public static void LoadKurczak()
|
||||
{
|
||||
Utils.RegisterSkill("Kurczak", "Otrzymujesz model kurczaka + jesteś o 10% szybszy", "#FF8B42");
|
||||
Utils.RegisterSkill("Kurczak", "Otrzymujesz model kurczaka + jesteś o 10% szybszy - 50hp", "#FF8B42");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
@ -17,10 +32,10 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return;
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Kurczak") return;
|
||||
if (playerInfo?.Skill != "Kurczak") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
if (playerPawn != null)
|
||||
|
|
@ -29,12 +44,35 @@ namespace dRandomSkills
|
|||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().MaterialGroup.Value = (uint)Instance.Random.Next(1, 4);
|
||||
playerPawn.VelocityModifier = 1.1f;
|
||||
Utilities.SetStateChanged(player, "CCSPlayerPawn", "m_flVelocityModifier");
|
||||
|
||||
playerPawn.Health = 50;
|
||||
Utilities.SetStateChanged(playerPawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterListener<OnTick>(OnTick);
|
||||
}
|
||||
|
||||
private static void OnTick()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Kurczak")
|
||||
{
|
||||
var activeWeapon = player.Pawn.Value.WeaponServices?.ActiveWeapon.Value;
|
||||
if (activeWeapon != null && activeWeapon.IsValid && activeWeapon.Clip1 != 0 && !pistols.Contains(activeWeapon?.DesignerName))
|
||||
{
|
||||
activeWeapon.Clip1 = 0;
|
||||
activeWeapon.Clip2 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetPlayerModel(CCSPlayerController player, string model)
|
||||
|
|
|
|||
|
|
@ -16,15 +16,14 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return;
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Medyk") return;
|
||||
if (playerInfo?.Skill != "Medyk") continue;
|
||||
|
||||
int healthshot = Instance.Random.Next(1, 10);
|
||||
for (int i = 0; i < healthshot; i++)
|
||||
{
|
||||
player.GiveNamedItem("weapon_healthshot");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -36,10 +35,6 @@ namespace dRandomSkills
|
|||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Medyk") return HookResult.Continue;
|
||||
|
||||
player.RemoveItemByDesignerName("weapon_healthshot");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class MiniMajk
|
||||
{
|
||||
public static void LoadMiniMajk()
|
||||
{
|
||||
string defaultCT = "characters/models/ctm_sas/ctm_sas.vmdl";
|
||||
string defaultTT = "characters/models/tm_phoenix/tm_phoenix.vmdl";
|
||||
Utils.RegisterSkill("MiniMajk", "Losowa wielkość postaci na początku rundy", "#ffff00", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "MiniMajk") continue;
|
||||
|
||||
var playerPawn = player.PlayerPawn?.Value;
|
||||
|
||||
if (playerPawn != null)
|
||||
{
|
||||
float newSize = (float)Instance.Random.NextDouble() * (.95f - .6f) + .6f;
|
||||
newSize = (float)Math.Round(newSize, 2);
|
||||
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
|
||||
playerPawn.SetModel(player.Team == CsTeam.CounterTerrorist ? defaultTT : defaultCT);
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = newSize;
|
||||
playerPawn.SetModel(player.Team == CsTeam.CounterTerrorist ? defaultCT : defaultTT);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"MiniMajk\"{ChatColors.Lime}: Twój mnożnik wielkości to {newSize}x", false);
|
||||
|
||||
Instance.AddTimer(.2f, () => {
|
||||
if (IsPlayerValid(player))
|
||||
playerPawn.CBodyComponent.SceneNode.GetSkeletonInstance().Scale = 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -25,6 +26,20 @@ namespace dRandomSkills
|
|||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventGrenadeThrown>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
|
||||
if (playerInfo?.Skill == "Nieskończone Ammo")
|
||||
player.GiveNamedItem($"weapon_{@event.Weapon}");
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventWeaponReload>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
|
@ -8,7 +9,30 @@ namespace dRandomSkills
|
|||
{
|
||||
public static void LoadObrotWroga()
|
||||
{
|
||||
Utils.RegisterSkill("Obrót Wroga", "Masz 25% szans na obrócenie wroga o 180 stopni po trafieniu", "#00FF00");
|
||||
Utils.RegisterSkill("Obrót Wroga", "Masz losową szanse na obrócenie wroga o 180 stopni po trafieniu", "#00FF00", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Obrót Wroga") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Obrót Wroga\"{ChatColors.Lime}: Twoje szanse na obrucenie wroga po trafieniu to: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
|
|
@ -22,10 +46,8 @@ namespace dRandomSkills
|
|||
|
||||
if (playerInfo?.Skill == "Obrót Wroga" && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
RotateEnemy(victim);
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
|
@ -6,24 +7,46 @@ namespace dRandomSkills
|
|||
{
|
||||
public static class Phoenix
|
||||
{
|
||||
private const double ReviveChance = 0.35;
|
||||
|
||||
public static void LoadPhoenix()
|
||||
{
|
||||
Utils.RegisterSkill("Phoenix", "Masz 35% szans na odrodzenie się po śmierci", "#ff5C0A");
|
||||
Utils.RegisterSkill("Phoenix", "Masz losową szans na odrodzenie się po śmierci", "#ff5C0A", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Phoenix") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Phoenix\"{ChatColors.Lime}: Twoje szanse na odrodzenie się po śmierci: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (!IsValidPlayer(player)) return HookResult.Continue;
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Phoenix")
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= ReviveChance)
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
{
|
||||
player.Respawn();
|
||||
Instance.AddTimer(.2f, () => player.Respawn());
|
||||
Utils.PrintToChat(player, $"Zostałeś odrodzony z popiołów dzięki mocy: {ChatColors.DarkRed}Phoenix", false);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +55,7 @@ namespace dRandomSkills
|
|||
});
|
||||
}
|
||||
|
||||
private static bool IsValidPlayer(CCSPlayerController player)
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace dRandomSkills
|
|||
|
||||
public static void LoadPilot()
|
||||
{
|
||||
Utils.RegisterSkill("Pilot", "Latanie na noclip przez dany czas", "#1466F5");
|
||||
Utils.RegisterSkill("Pilot", "Latanie przez określony czas. Przytrzymaj [USE - E], aby latać!", "#1466F5");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -16,7 +17,7 @@ namespace dRandomSkills
|
|||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (IsValidPlayer(player)) continue;
|
||||
if (!IsValidPlayer(player)) continue;
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Rambo")
|
||||
{
|
||||
|
|
@ -39,15 +40,10 @@ namespace dRandomSkills
|
|||
var pawn = player.PlayerPawn?.Value;
|
||||
if (pawn == null) return;
|
||||
|
||||
player.Health = Math.Min(player.Health + health, player.MaxHealth);
|
||||
pawn.Health = Math.Min(pawn.Health + health, pawn.MaxHealth);
|
||||
|
||||
if (health > 100)
|
||||
{
|
||||
player.MaxHealth = Math.Min(player.MaxHealth + health, 1000);
|
||||
pawn.MaxHealth = Math.Min(pawn.MaxHealth + health, 1000);
|
||||
}
|
||||
pawn.MaxHealth = Math.Min(pawn.Health + health, 1000);
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iMaxHealth");
|
||||
|
||||
pawn.Health = pawn.MaxHealth;
|
||||
Utilities.SetStateChanged(pawn, "CBaseEntity", "m_iHealth");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
|
|
@ -8,7 +10,30 @@ namespace dRandomSkills
|
|||
|
||||
public static void LoadRozbrojenie()
|
||||
{
|
||||
Utils.RegisterSkill("Rozbrojenie", "Masz 25% szans na wyrzucenie broni wroga po trafieniu", "#FF4500");
|
||||
Utils.RegisterSkill("Rozbrojenie", "Masz losow¹ szanse na wyrzucenie broni wroga po trafieniu", "#FF4500", false);
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill != "Rozbrojenie") continue;
|
||||
|
||||
float newChance = (float)Instance.Random.NextDouble() * (.40f - .20f) + .20f;
|
||||
playerInfo.SkillChance = newChance;
|
||||
newChance = (float)Math.Round(newChance, 2) * 100;
|
||||
newChance = (float)Math.Round(newChance);
|
||||
|
||||
Utils.PrintToChat(player, $"{ChatColors.DarkRed}\"Rozbrojenie\"{ChatColors.Lime}: Twoje szanse na wyrzucenie broni wroga to: {newChance}%", false);
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerHurt>((@event, info) =>
|
||||
{
|
||||
|
|
@ -23,23 +48,22 @@ namespace dRandomSkills
|
|||
|
||||
if (playerInfo?.Skill == "Rozbrojenie" && victim.PawnIsAlive)
|
||||
{
|
||||
if (Instance.Random.NextDouble() <= 0.25)
|
||||
if (Instance.Random.NextDouble() <= playerInfo.SkillChance)
|
||||
{
|
||||
var weaponServices = victim.PlayerPawn?.Value?.WeaponServices;
|
||||
if (weaponServices?.MyWeapons == null) return HookResult.Continue;
|
||||
if (weaponServices?.ActiveWeapon == null) return HookResult.Continue;
|
||||
|
||||
foreach (var weapon in weaponServices.MyWeapons)
|
||||
{
|
||||
var weaponName = weapon.Value.DesignerName;
|
||||
if (weaponName != null && !weaponName.Contains("weapon_knife") && !weaponName.Contains("weapon_c4"))
|
||||
{
|
||||
victim.DropActiveWeapon();
|
||||
}
|
||||
}
|
||||
var weaponName = weaponServices?.ActiveWeapon?.Value?.DesignerName;
|
||||
if (weaponName != null && !weaponName.Contains("weapon_knife") && !weaponName.Contains("weapon_c4"))
|
||||
victim.DropActiveWeapon();
|
||||
}
|
||||
}
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
68
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Saper.cs
Normal file
68
[ D3X ] dRandomSkills - SRC Files/src/player/skills/Saper.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class Saper
|
||||
{
|
||||
public static void LoadEliminator()
|
||||
{
|
||||
Utils.RegisterSkill("Saper", "Możesz szybciej podłożyć bombę oraz ją zdefować", "#8A2BE2");
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBeginplant>((@event, info) =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
if (!IsPlayerValid(player)) return HookResult.Continue;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Saper")
|
||||
{
|
||||
var bombEntities = Utilities.FindAllEntitiesByDesignerName<CC4>("weapon_c4").ToList();
|
||||
|
||||
if (bombEntities.Any())
|
||||
{
|
||||
var bomb = bombEntities.FirstOrDefault();
|
||||
if (bomb != null)
|
||||
{
|
||||
bomb.BombPlacedAnimation = false;
|
||||
bomb.ArmedTime = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventBombBegindefuse>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
if (IsPlayerValid(player))
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "Saper")
|
||||
{
|
||||
var plantedBomb = Utilities.FindAllEntitiesByDesignerName<CPlantedC4>("planted_c4").FirstOrDefault();
|
||||
if (plantedBomb != null)
|
||||
{
|
||||
Server.NextFrame(() =>
|
||||
{
|
||||
plantedBomb.DefuseCountDown = 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Numerics;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
using Vector = CounterStrikeSharp.API.Modules.Utils.Vector;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
|
|
@ -16,7 +19,6 @@ namespace dRandomSkills
|
|||
|
||||
if (!IsValidPlayer(victim) || !IsValidPlayer(attacker)) return HookResult.Continue;
|
||||
|
||||
var victimInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == victim.SteamID);
|
||||
var attackerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == attacker.SteamID);
|
||||
|
||||
if (attackerInfo?.Skill == "Teleportator")
|
||||
|
|
@ -38,16 +40,16 @@ namespace dRandomSkills
|
|||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
|
||||
var attackerPosition = attackerPawn.AbsOrigin;
|
||||
var attackerAngles = attackerPawn.AbsRotation;
|
||||
var attackerVelocity = attackerPawn.AbsVelocity;
|
||||
Vector attackerPosition = new Vector(attackerPawn.AbsOrigin.X, attackerPawn.AbsOrigin.Y, attackerPawn.AbsOrigin.Z);
|
||||
QAngle attackerAngles = new QAngle(attackerPawn.AbsRotation.X, attackerPawn.AbsRotation.Y, attackerPawn.AbsRotation.Z);
|
||||
Vector attackerVelocity = new Vector(attackerPawn.AbsVelocity.X, attackerPawn.AbsVelocity.Y, attackerPawn.AbsVelocity.Z);
|
||||
|
||||
var victimPosition = victimPawn.AbsOrigin;
|
||||
var victimAngles = victimPawn.AbsRotation;
|
||||
var victimVelocity = victimPawn.AbsVelocity;
|
||||
Vector victimPosition = new Vector(victimPawn.AbsOrigin.X, victimPawn.AbsOrigin.Y, victimPawn.AbsOrigin.Z);
|
||||
QAngle victimAngles = new QAngle(victimPawn.AbsRotation.X, victimPawn.AbsRotation.Y, victimPawn.AbsRotation.Z);
|
||||
Vector victimVelocity = new Vector(victimPawn.AbsVelocity.X, victimPawn.AbsVelocity.Y, victimPawn.AbsVelocity.Z);
|
||||
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
victimPawn.Teleport(attackerPosition, attackerAngles, attackerVelocity);
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,164 @@
|
|||
using CounterStrikeSharp.API;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using static CounterStrikeSharp.API.Core.Listeners;
|
||||
using static dRandomSkills.dRandomSkills;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
public static class ZamianaMiejsc
|
||||
{
|
||||
private static float timerCooldown = 30f;
|
||||
private static readonly Dictionary<ulong, ZamianaMiejsc_PlayerInfo> SkillPlayerInfo = new Dictionary<ulong, ZamianaMiejsc_PlayerInfo>();
|
||||
public static void LoadZamianaMiejsc()
|
||||
{
|
||||
Utils.RegisterSkill("ZamianaMiejsc", "Zamiana miejscami z losowym wrogiem. Kliknij [USE - E], cooldown 30s!", "#1466F5");
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundFreezeEnd>((@event, info) =>
|
||||
{
|
||||
Instance.RegisterListener<OnTick>(CheckHandle);
|
||||
Instance.AddTimer(0.1f, () =>
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "ZamianaMiejsc")
|
||||
{
|
||||
SkillPlayerInfo[player.SteamID] = new ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
SteamID = player.SteamID,
|
||||
CanUse = true,
|
||||
Cooldown = DateTime.MinValue
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventRoundEnd>((@event, info) =>
|
||||
{
|
||||
Instance.RemoveListener<OnTick>(CheckHandle);
|
||||
SkillPlayerInfo.Clear();
|
||||
return HookResult.Continue;
|
||||
});
|
||||
|
||||
Instance.RegisterEventHandler<EventPlayerDeath>((@event, info) =>
|
||||
{
|
||||
var player = @event.Userid;
|
||||
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "ZamianaMiejsc")
|
||||
if (SkillPlayerInfo.ContainsKey(player.SteamID))
|
||||
SkillPlayerInfo.Remove(player.SteamID);
|
||||
|
||||
return HookResult.Continue;
|
||||
});
|
||||
}
|
||||
|
||||
private static void CheckHandle()
|
||||
{
|
||||
foreach (var player in Utilities.GetPlayers())
|
||||
{
|
||||
var playerInfo = Instance.skillPlayer.FirstOrDefault(p => p.SteamID == player.SteamID);
|
||||
if (playerInfo?.Skill == "ZamianaMiejsc")
|
||||
{
|
||||
Handle(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void Handle(CCSPlayerController player)
|
||||
{
|
||||
var buttons = player.Buttons;
|
||||
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
|
||||
{
|
||||
if (buttons.HasFlag(PlayerButtons.Use))
|
||||
{
|
||||
if (skillInfo.CanUse)
|
||||
UseSkill(player, skillInfo);
|
||||
else
|
||||
UpdateHUD(player, skillInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdateHUD(CCSPlayerController player, ZamianaMiejsc_PlayerInfo skillInfo = null)
|
||||
{
|
||||
float cooldown = 0;
|
||||
if (skillInfo != null)
|
||||
{
|
||||
float time = (float)((skillInfo.Cooldown.Second + timerCooldown) - DateTime.Now.Second);
|
||||
cooldown = time > 0 ? time : 0;
|
||||
}
|
||||
|
||||
string infoLine = $"<font color='#FFFFFF'>ZamianaMiejsc:</font> <br>";
|
||||
string remainingLine = skillInfo == null ? "<font color='#FF0000'>Nie znaleziono przeciwnika</font> <br>" : $"<font color='#FFFFFF'>Musisz poczekać jeszcze <font color='#FF0000'>{cooldown}</font> sekund</font> <br>";
|
||||
|
||||
var hudContent = infoLine + remainingLine;
|
||||
player.PrintToCenterHtml(hudContent);
|
||||
}
|
||||
|
||||
private static void ActiveUse(CCSPlayerController player)
|
||||
{
|
||||
if (SkillPlayerInfo.TryGetValue(player.SteamID, out var skillInfo))
|
||||
{
|
||||
skillInfo.CanUse = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void UseSkill(CCSPlayerController player, ZamianaMiejsc_PlayerInfo skillInfo)
|
||||
{
|
||||
var playerPawn = player.PlayerPawn.Value;
|
||||
if (playerPawn?.CBodyComponent == null) return;
|
||||
|
||||
List<CCSPlayerController> enemy = Utilities.GetPlayers().FindAll(p => IsPlayerValid(p) && p.Team != player.Team && p.PawnIsAlive);
|
||||
if (enemy.Count == 0)
|
||||
{
|
||||
UpdateHUD(player);
|
||||
return;
|
||||
}
|
||||
|
||||
CCSPlayerController randomEnemy = enemy[Instance.Random.Next(0, enemy.Count)];
|
||||
if (player.IsValid && player.PawnIsAlive && randomEnemy.IsValid && randomEnemy.PawnIsAlive)
|
||||
{
|
||||
skillInfo.CanUse = false;
|
||||
skillInfo.Cooldown = DateTime.Now;
|
||||
Instance.AddTimer(timerCooldown, () => ActiveUse(player));
|
||||
TeleportPlayers(player, randomEnemy);
|
||||
}
|
||||
else
|
||||
UpdateHUD(player);
|
||||
}
|
||||
|
||||
private static void TeleportPlayers(CCSPlayerController attacker, CCSPlayerController victim)
|
||||
{
|
||||
var attackerPawn = attacker.PlayerPawn.Value;
|
||||
var victimPawn = victim.PlayerPawn.Value;
|
||||
|
||||
Vector attackerPosition = new Vector(attackerPawn.AbsOrigin.X, attackerPawn.AbsOrigin.Y, attackerPawn.AbsOrigin.Z);
|
||||
QAngle attackerAngles = new QAngle(attackerPawn.AbsRotation.X, attackerPawn.AbsRotation.Y, attackerPawn.AbsRotation.Z);
|
||||
Vector attackerVelocity = new Vector(attackerPawn.AbsVelocity.X, attackerPawn.AbsVelocity.Y, attackerPawn.AbsVelocity.Z);
|
||||
|
||||
Vector victimPosition = new Vector(victimPawn.AbsOrigin.X, victimPawn.AbsOrigin.Y, victimPawn.AbsOrigin.Z);
|
||||
QAngle victimAngles = new QAngle(victimPawn.AbsRotation.X, victimPawn.AbsRotation.Y, victimPawn.AbsRotation.Z);
|
||||
Vector victimVelocity = new Vector(victimPawn.AbsVelocity.X, victimPawn.AbsVelocity.Y, victimPawn.AbsVelocity.Z);
|
||||
|
||||
victimPawn.Teleport(attackerPosition, attackerAngles, attackerVelocity);
|
||||
attackerPawn.Teleport(victimPosition, victimAngles, victimVelocity);
|
||||
}
|
||||
|
||||
private static bool IsPlayerValid(CCSPlayerController player)
|
||||
{
|
||||
return player != null && player.IsValid && player.PlayerPawn?.Value != null;
|
||||
}
|
||||
|
||||
public class ZamianaMiejsc_PlayerInfo
|
||||
{
|
||||
public ulong SteamID { get; set; }
|
||||
public bool CanUse { get; set; }
|
||||
public DateTime Cooldown { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace dRandomSkills
|
||||
{
|
||||
|
|
@ -11,11 +12,11 @@ namespace dRandomSkills
|
|||
player.PrintToChat($" {ChatColors.DarkRed}► {ChatColors.Green}[{ChatColors.DarkRed} LOSOWE MOCE {ChatColors.Green}] {checkIcon} {msg}");
|
||||
}
|
||||
|
||||
public static void RegisterSkill(string name, string description, string color)
|
||||
public static void RegisterSkill(string name, string description, string color, bool display = true)
|
||||
{
|
||||
if (!SkillData.Skills.Any(skill => skill.Name == name))
|
||||
{
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(name, description, color));
|
||||
SkillData.Skills.Add(new dSkill_SkillInfo(name, description, color, display));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue