diff --git a/CHANGELOG b/CHANGELOG index 5fa613f..3a0d466 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +-- 2024.07.24 - V2.3.3 + +- upgrade: update to NET8.0 from NET7.0 +- fix: remove duplicated event hook +- chore: upgrade README.md to use the team standards + -- 2024.03.30 - V2.3.2 fix: Schema target points to null diff --git a/README.md b/README.md index eee2ae2..769a3e8 100644 --- a/README.md +++ b/README.md @@ -1,140 +1,84 @@ +

(back to top)

+ + + +## License + +Distributed under the GPL-3.0 License. See `LICENSE.md` for more information. + +

(back to top)

+ + + +## Contact + +- **Discord:** [Discord Server](https://discord.gg/peBZpwgMHb) +- **Email:** k4ryuu@icloud.com + +

(back to top)

+ ![GitHub tag (with filter)](https://img.shields.io/github/v/tag/KitsuneLab-Development/CS2_DamageInfo?style=for-the-badge&label=Version) ![GitHub Repo stars](https://img.shields.io/github/stars/KitsuneLab-Development/CS2_DamageInfo?style=for-the-badge) ![GitHub issues](https://img.shields.io/github/issues/KitsuneLab-Development/CS2_DamageInfo?style=for-the-badge) ![GitHub](https://img.shields.io/github/license/KitsuneLab-Development/CS2_DamageInfo?style=for-the-badge) -![GitHub contributors](https://img.shields.io/github/contributors/KitsuneLab-Development/CS2_DamageInfo?style=for-the-badge) ![GitHub all releases](https://img.shields.io/github/downloads/KitsuneLab-Development/CS2_DamageInfo/total?style=for-the-badge) ![GitHub last commit (branch)](https://img.shields.io/github/last-commit/KitsuneLab-Development/CS2_DamageInfo/dev?style=for-the-badge)
-

K4ryuu

-

CS2 Damage info

- + + Logo + +

CounterStrike2 | Damage Informations

- An awesome CS2 server addon created with CounterStrikeSharp -
+ A CounterStrike2 server extension to display damage informations to center of the screen, console and/or to the chat. You can customise the plugin fully with the config file.
Download · - Report Bug + Report Bug · - Request Feature + Request Feature + · + Website + · + Hire Us

- -
- Table of Contents -
    -
  1. - About The Project - -
  2. -
  3. - Getting Started - -
  4. -
  5. - Usage - -
  6. -
  7. Roadmap
  8. -
  9. Contributing
  10. -
  11. License
  12. -
  13. Contact
  14. -
-
- ## About The Project -CS2 server extension that displays the amount of damage players have inflicted on the victim's HP and Armor, as well as the hit groups they have hit. As well as a round end chat message with the given and taken hits. The extension is fully configurable using 'configs.json'. - -

(back to top)

+CS2 server extension that displays the amount of damage players have inflicted on the victim's HP and Armor, as well as the hit groups they have hit. As well as a round end chat message with the given and taken hits. ### Dependencies To use this server addon, you'll need the following dependencies installed: -- [**CounterStrikeSharp**](https://github.com/roflmuffin/CounterStrikeSharp/releases): CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2 - -

(back to top)

- -### Support My Work - -I offer various ways to support my journey: - -- 💬 **Request Private Paid Jobs:** Got a specific project in mind? Let's chat, and I'll provide a quote. -- 🎁 **Subscribe to My Tiers:** Join one of my subscription tiers for exclusive benefits, early access to projects, and personalized support. -- ☕ **Buy Me a Coffee:** One-time donations keep me motivated and my creativity flowing. -- 💼 **Shop from My Paid Resources:** Explore and purchase resources I've crafted for private use. - -Your support keeps my creative engine running and allows me to share knowledge with the community. Thanks for being part of my journey. - -

- - - -

- -

(back to top)

- - - -## Getting Started - -Follow these steps to install and use the addon: - -### Prerequisites - -Before you begin, ensure you have the following prerequisites: - -- A working CS2 (Counter-Strike 2) server. -- CounterStrikeSharp is up to date and is running on your server. +- [**CounterStrikeSharp**](https://github.com/roflmuffin/CounterStrikeSharp/releases): CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2.

(back to top)

-### Installation + -1. **Download the Addon:** Start by downloading the addon from the [GitHub Releases Page](https://github.com/KitsuneLab-Development/CS2_DamageInfo/releases). Choose the latest release version. +## Modules -2. **Extract the Addon:** After downloading, extract the contents of the addon to the counterstrikesharp/plugins directory on your server. Inside the plugins folder, you should have a folder named exactly as the project dll. From the releases, you find it pre zipped with the correct name. +All listed modules can be found within the modules folder: -3. **Configuration:** The configuration file (if there is any), will be generated automatically to counterstrikesharp/configs/plugins/\* - -

(back to top)

- -### Translators - -I really appreciate the help of the following people who translated the plugin into their language: - -- **[deadmau5v](https://github.com/deadmau5v)**: Chinese - -

(back to top)

- - - -## Usage - -The addon provides several commands and console variables (convars) to customize and interact with its features. Here is the list of the key commands and convars you can use: - -### Commands - -None +- **Health**: Extra health skill +- **Armor**: Extra armor skill +- **Health Regeneration**: Health regeneration skill +- **Armor Regeneration**: Armor regeneration skill +- **Shot Damage Multiplier (Linux Only)**: Damage multiplier skill for shots +- **Knife Damage Multiplier (Linux Only)**: Damage multiplier skill for knife damages +- **Thorns (Reflect damage)**: Damage reflect skill +- **Vampire (Steal health)**: Health steal skill +- **Nade King**: Spawn grenade kits per level +- **Backstab Freeze (Linux Only)**: Chance based freeze on backstab of an enemy +- **Speed**: Additional speed on every round

(back to top)

@@ -146,20 +90,13 @@ None

(back to top)

- + -## Contributing +## Authors -Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. +- [**K4ryuu**](https://github.com/K4ryuu) - _Initial work_ -If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". -Don't forget to give the project a star! Thanks again! - -1. Fork the Project -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) -3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -4. Push to the Branch (`git push origin feature/AmazingFeature`) -5. Open a Pull Request +See also the list of [contributors](https://github.com/KitsuneLab-Development/CS2_DamageInfo/graphs/contributors) who participated in this project as an outside contributor.

(back to top)

@@ -175,7 +112,6 @@ Distributed under the GPL-3.0 License. See `LICENSE.md` for more information. ## Contact -- **Discord:** [Discord Server](https://discord.gg/peBZpwgMHb) -- **Email:** k4ryuu@icloud.com +- **KitsuneLab Team** - [contact@kitsune-lab.com](mailto:contact@kitsune-lab.com)

(back to top)

diff --git a/src/K4ryuuDamageInfo.cs b/src/K4ryuuDamageInfo.cs index 228dc00..ccfaecf 100644 --- a/src/K4ryuuDamageInfo.cs +++ b/src/K4ryuuDamageInfo.cs @@ -57,7 +57,7 @@ public sealed class PluginConfig : BasePluginConfig public class DamageInfoPlugin : BasePlugin, IPluginConfig { public override string ModuleName => "Damage Info"; - public override string ModuleVersion => "2.3.2"; + public override string ModuleVersion => "2.3.3"; public override string ModuleAuthor => "K4ryuu"; public required PluginConfig Config { get; set; } = new PluginConfig(); @@ -85,10 +85,10 @@ public override void Load(bool hotReload) RegisterListener(OnMapStart); - OnMapStart(""); + OnMapStart(); } - private void OnMapStart(string mapName) + private void OnMapStart(string? mapName = null) { AddTimer(1.0f, () => { @@ -98,8 +98,7 @@ private void OnMapStart(string mapName) private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info) { - CCSPlayerController player = @event.Userid; - + CCSPlayerController? player = @event.Userid; if (player is null || !player.IsValid || !player.PlayerPawn.IsValid) return HookResult.Continue; @@ -107,18 +106,6 @@ private HookResult OnPlayerSpawn(EventPlayerSpawn @event, GameEventInfo info) return HookResult.Continue; } - private HookResult OnPlayerDeath(EventPlayerConnectFull @event, GameEventInfo info) - { - CCSPlayerController player = @event.Userid; - - if (player is null || !player.IsValid) - return HookResult.Continue; - - IsDataShown[player.Slot] = false; - VictimKiller[player.Slot] = -1; - return HookResult.Continue; - } - private HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info) { if (GameRules is null || GameRules.WarmupPeriod) @@ -127,11 +114,11 @@ private HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info) if (!Config.AlowDeathPrint) return HookResult.Continue; - CCSPlayerController victim = @event.Userid; + CCSPlayerController? victim = @event.Userid; if (victim is null || !victim.IsValid || !victim.PlayerPawn.IsValid || victim.Connected == PlayerConnectedState.PlayerDisconnecting) return HookResult.Continue; - CCSPlayerController attacker = @event.Attacker; + CCSPlayerController? attacker = @event.Attacker; VictimKiller[victim.Slot] = attacker?.IsValid == true && attacker.PlayerPawn?.IsValid == true ? attacker.Slot : -1; DisplayDamageInfo(victim); @@ -150,13 +137,11 @@ private HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info) private HookResult OnPlayerHurt(EventPlayerHurt @event, GameEventInfo info) { - CCSPlayerController victim = @event.Userid; - + CCSPlayerController? victim = @event.Userid; if (victim is null || !victim.IsValid || !victim.PlayerPawn.IsValid) return HookResult.Continue; - CCSPlayerController attacker = @event.Attacker; - + CCSPlayerController? attacker = @event.Attacker; if (attacker is null || !attacker.IsValid || !attacker.PlayerPawn.IsValid) return HookResult.Continue; @@ -287,9 +272,8 @@ private void DisplayDamageInfo(CCSPlayerController player) foreach (var summary in allPlayerSummaries) { - CCSPlayerController otherPlayer = Utilities.GetPlayerFromSlot(summary.Key); - - if (Config.ShowAllDamagesTeamOnly && otherPlayer.TeamNum == player.TeamNum) + CCSPlayerController? otherPlayer = Utilities.GetPlayerFromSlot(summary.Key); + if (Config.ShowAllDamagesTeamOnly && otherPlayer?.TeamNum == player.TeamNum) continue; int otherPlayerHealth = 0; @@ -367,8 +351,7 @@ private void DisplayPlayerDamageInfo(CCSPlayerController player, PlayerDamageInf int otherPlayerHealth = 0; string otherPlayerName = "Unknown"; - CCSPlayerController otherPlayer = Utilities.GetPlayerFromSlot(otherPlayerId); - + CCSPlayerController? otherPlayer = Utilities.GetPlayerFromSlot(otherPlayerId); if (otherPlayer?.IsValid == true) { otherPlayerName = otherPlayer.PlayerName; @@ -399,8 +382,7 @@ private void DisplayPlayerDamageInfo(CCSPlayerController player, PlayerDamageInf int otherPlayerHealth = 0; string otherPlayerName = "Unknown"; - CCSPlayerController otherPlayer = Utilities.GetPlayerFromSlot(otherPlayerId); - + CCSPlayerController? otherPlayer = Utilities.GetPlayerFromSlot(otherPlayerId); if (otherPlayer?.IsValid == true) { otherPlayerName = otherPlayer.PlayerName; diff --git a/src/K4ryuuDamageInfo.csproj b/src/K4ryuuDamageInfo.csproj index 5c806bf..c439e26 100644 --- a/src/K4ryuuDamageInfo.csproj +++ b/src/K4ryuuDamageInfo.csproj @@ -6,12 +6,12 @@ ./bin/K4ryuuDamageInfo/ - net7.0 + net8.0 enable enable - + none runtime compile; build; native; contentfiles; analyzers; buildtransitive