Skip to content

Commit

Permalink
Patch v2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
K4ryuu committed Jul 24, 2024
1 parent 86efbf2 commit d0bb153
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 147 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
166 changes: 51 additions & 115 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,140 +1,84 @@
<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE -->

## License

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

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- CONTACT -->

## Contact

- **Discord:** [Discord Server](https://discord.gg/peBZpwgMHb)
- **Email:** [email protected]

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<a name="readme-top"></a>

![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)

<!-- PROJECT LOGO -->
<br />
<div align="center">
<h1 align="center">K4ryuu</h1>
<h3 align="center">CS2 Damage info</h3>

<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo">
<img src="https://i.imgur.com/sej1ZzD.png" alt="Logo" width="400" height="256">
</a>
<h3 align="center">CounterStrike2 | Damage Informations</h3>
<p align="center">
An awesome CS2 server addon created with <a href="https://github.com/roflmuffin/CounterStrikeSharp"><strong>CounterStrikeSharp</strong></a>
<br />
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.
<br />
<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo/releases">Download</a>
·
<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo/issues/new?assignees=K4ryuu&labels=bug&projects=&template=bug_report.md&title=%5BBUG%5D">Report Bug</a>
<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo/issues/new?assignees=KitsuneLab-Development&labels=bug&template=bug_report.md&title=%5BBUG%5D">Report Bug</a>
·
<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo/issues/new?assignees=K4ryuu&labels=enhancement&projects=&template=feature_request.md&title=%5BREQ%5D">Request Feature</a>
<a href="https://github.com/KitsuneLab-Development/CS2_DamageInfo/issues/new?assignees=KitsuneLab-Development&labels=enhancement&template=feature_request.md&title=%5BREQ%5D">Request Feature</a>
·
<a href="https://kitsune-lab.com">Website</a>
·
<a href="https://nests.kitsune-lab.com/tickets/create?department_id=2">Hire Us</a>
</p>
</div>

<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#dependencies">Dependencies</a></li>
<li><a href="#support-my-work">Support My Work</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li>
<a href="#usage">Usage</a>
<ul>
<li><a href="#commands">Commands</a></li>
<li><a href="#console-variables-(convars)">ConVars</a></li>
</ul>
</li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
</ol>
</details>

<!-- ABOUT THE PROJECT -->

## 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'.

<p align="right">(<a href="#readme-top">back to top</a>)</p>
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

<p align="right">(<a href="#readme-top">back to top</a>)</p>

### 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.

<p align="center">
<a href="https://www.buymeacoffee.com/k4ryuu">
<img src="https://img.buymeacoffee.com/button-api/?text=Support My Work&emoji=☕&slug=k4ryuu&button_colour=FF5F5F&font_colour=ffffff&font_family=Inter&outline_colour=000000&coffee_colour=FFDD00" />
</a>
</p>

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- GETTING STARTED -->

## 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.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

### Installation
<!-- Modules -->

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/\*

<p align="right">(<a href="#readme-top">back to top</a>)</p>

### Translators

I really appreciate the help of the following people who translated the plugin into their language:

- **[deadmau5v](https://github.com/deadmau5v)**: Chinese

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- USAGE EXAMPLES -->

## 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

<p align="right">(<a href="#readme-top">back to top</a>)</p>

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

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- CONTRIBUTING -->
<!-- AUTHORS -->

## 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.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

Expand All @@ -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:** [email protected]
- **KitsuneLab Team** - [[email protected]](mailto:[email protected])

<p align="right">(<a href="#readme-top">back to top</a>)</p>
42 changes: 12 additions & 30 deletions src/K4ryuuDamageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public sealed class PluginConfig : BasePluginConfig
public class DamageInfoPlugin : BasePlugin, IPluginConfig<PluginConfig>
{
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();
Expand Down Expand Up @@ -85,10 +85,10 @@ public override void Load(bool hotReload)

RegisterListener<Listeners.OnMapStart>(OnMapStart);

OnMapStart("");
OnMapStart();
}

private void OnMapStart(string mapName)
private void OnMapStart(string? mapName = null)
{
AddTimer(1.0f, () =>
{
Expand All @@ -98,27 +98,14 @@ 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;

IsDataShown[player.Slot] = false;
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)
Expand All @@ -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);
Expand All @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/K4ryuuDamageInfo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<PublishDir>./bin/K4ryuuDamageInfo/</PublishDir>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.198">
<PackageReference Include="CounterStrikeSharp.API" Version="*">
<PrivateAssets>none</PrivateAssets>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit d0bb153

Please sign in to comment.