```
Implement player state spoofing and enhance body identification
- Introduce `CS2AliveSpoofer` class and `IAliveSpoofer` interface to manage "fake alive" player states in `CombatHandler` and `ForceAliveCommand`.
- Modify `BODY_IDENTIFIED` logic in `GameMsgs.cs` for nullable identifiers, providing a default "Someone" message when missing.
- Update `ForceAliveCommand` and `IdentifyAllCommand` to use new spoofing and identification utilities.
- Enhance body tracking with `BodyTracker` class, integrating event handling improvements for game state changes and body creation.
- Refine `OneShotDeagle` functionality by clearing player's inventory before assigning the weapon, improving game balance.
- Adjust `BodyPickupListener` to use `IBodyTracker` for efficient body management and consolidate event handling logic.
- Update various components to utilize dependency injection and new APIs, improving service management and system robustness.
```
- Modify `RoundBasedGame.cs` to improve encapsulation, consistency, and maintainability by refactoring game-ending logic and updating access modifiers for subclassing.
- Implement player data caching in `CS2Player.cs` to enhance performance and improve debug logging capabilities.
- Refactor message formatting in `CS2Messenger.cs` for improved consistency in debug modes.
- Enhance `PlayerConnectionsHandler.cs` by adding asynchronous behavior and a dependency on `IMessenger` for potential future enhancements.
- Add a validity check in `RoundTimerListener.cs` to ensure team scores are only updated with a defined winning role, improving robustness.
- Update `CS2Game.cs` to broadcast notifications for game start states and handle countdowns effectively.
- Introduce `CheckEndConditions()` method in `IGame.cs` interface and deprecate `IsInProgress()` to promote explicit state management.
- Centralize and simplify end game logic in `PlayerCausesEndListener.cs` by implementing `CheckEndConditions()`, eliminating redundant code.
- Rename test method `Round_EndsWhen_PlayerLeaves` to `Round_EndsWhen_PlayerLeavesAndDies` in `RoundEndingTest.cs` and add `PlayerDiesOnLeaveListener`.
- Improve code efficiency and readability in player iteration and event creation in `PlayerConnectionsHandler.cs`.
- Remove redundant console logging for player disconnections and streamline control flow in `disconnectFromServer` method in `PlayerConnectionsHandler.cs`.
- Move dispatching of `PlayerLeaveEvent` to the next world update for consistency in `PlayerConnectionsHandler.cs`.
- Reorder `AddModBehavior` entries in `CS2ServiceCollection.cs` for improved readability and logical grouping, adding `BodySpawner`, `DamageCanceler`, and `LateSpawnListener` earlier in their sections and maintaining order consistency by moving various handlers.
- Remove duplicated entries and ensure all necessary handlers and listeners are included in `CS2ServiceCollection.cs`.
- Add new class `LateSpawnListener` in `Listeners/LateSpawnListener.cs` to handle player join events, implementing a respawn mechanism for new players joining when the game is not in progress.
- Remove game state condition and deferred respawn logic in `PlayerConnectionsHandler.cs`, changing player respawn behavior upon joining the server.
```
Integrate New Features and Enhance Codebase
- Add a new project reference to `CS2.csproj` for integration with the Shop project.
- Introduce a new configuration class `CS2ShopConfig` to manage shop settings and player interactions.
- Implement new player event handling with `PlayerPurchaseItemEvent` and `PlayerBalanceEvent`, enabling cancellable item purchases and balance updates.
- Enhance the `ShopServiceCollection` with new behaviors for extended functionality, including `RoleAssignCreditor`, `BuyCommand`, and `BalanceCommand`.
- Improve `Shop.cs` by replacing `IPlayer` references with string identifiers, introducing event-driven balance updates, and enhancing messaging logic.
- Comprehensive changes across multiple utilities and configurations to support new team score management and event-driven architecture.
```
Refactor and Simplify Codebase with Improved Readability and Efficiency
- **OneShotDeagle.cs:**
- Remove event-related dependencies and streamline class to focus on core functionality.
- **PlayerKillListener.cs:**
- Simplify `OnKill` method, preparing for future enhancements, and clean up unused code.
- **IListener.cs and IEventBus.cs:**
- Remove `IDisposable` dependency from `IListener`. Add obsolescence message for `RegisterListener` in `IEventBus`.
- **LogsCommand.cs and TTTCommand.cs:**
- Consolidate logic for game checking and logging, enhancing error handling and readability.
- **RoundTimerListener.cs and CombatHandler.cs:**
- Refactor event handlers for clear separation of responsibilities and process optimization.
- **Various CS2 Handlers and Commands:**
- Streamline and modularize event handling and role management with newly introduced helper methods across handlers.
- Refactor command logic for improved organization and maintenance.
- **Locale/StringLocalizer.cs and EventBus.cs:**
- Refactor string handling and listener registration for enhanced clarity and performance.
```
- Simplify and enhance `PlayerActionsLogger.cs` by using pattern matching for game status checks and improve logging calls with a `Provider` parameter.
- Update `DeathAction.cs` to support dependency injection and role management by modifying constructors and formatting methods.
- Add role management in `FakeAction.cs` by introducing `PlayerRole` and `OtherRole` properties.
- Mark `IsGameActive` in `IGameManager.cs` as obsolete to guide towards direct game state checks.
- Modify logging in `BodyIdentifyLogger.cs` to use a `Provider` parameter for better context.
- Improve role management in `IdentifyBodyAction.cs` with new properties and constructor overloads supporting dependency injection.
- Refactor `ActionTest.cs` to accommodate constructor changes in `FakeAction`, ensuring backward compatibility.
- Expand `IAction` interface with role properties and enhance `Format` method.
- Add footer text in `en.yml` and `GameMsgs.cs` for clearer game log outputs.
- Enhance `DamagedAction.cs` with dependency injection and role properties, improving role management.
- Adjust `CombatHandler.cs` to refine player event handling and platform checks.
- Clear up documentation comments in `StringLocalizer.cs`.
- Enhance `SimpleLogger.cs` with role management and improved log formatting.
- Deprecate `IsInProgress()` in `IGame` for more explicit game state checks.
```
- Enhance message styling in `en.yml` by adding grey color to `TASER_SCANNED` translation.
- Align logical flow in `RoundTimerListener.cs` by moving the remaining time check in `OnRoundEnd`.
- Clean up `RoundTimerListener.cs` by removing commented-out code related to `EventRoundEnd`.
- Maintain role setting and team switching functionality in `RoundTimerListener.cs` within `OnRoundEnd`.
- Adjust winning team logic and event firing in `RoundTimerListener.cs` based on end reason.
- Ensure correct round transitions in `RoundTimerListener.cs` using scheduled timing logic.
- Add a new translation entry for "TASER_SCANNED" in TTT/CS2/lang/en.yml, ensuring a dynamic message format.
- Enhance TTT/Game/Listeners/BaseListener.cs with dependencies for role assignment and message localization.
- Refactor TTT/Game/Events/Player/PlayerDamagedEvent.cs to improve attacker retrieval logic and robustness.
- Improve TTT/Game/lang/GameMsgs.cs by extracting role prefix determination into a separate method for clarity.
- Introduce new methods and directives in TTT/CS2/lang/CS2Msgs.cs for better integration with TTT API and improved message clarity.
- Update TTT/CS2/GameHandlers/DamageCancelers/TaserListenCanceler.cs to refine event handling logic with taser-specific enhancements.
```
- Add OutOfRoundCanceler and TaserListenCanceler classes for improved damage cancellation in specific scenarios
- Mark RegisterListener method in IEventBus as obsolete
- Update ShopServiceCollection to remove generic type parameter from ShopCommand addition
- Change color representation for DetectiveRole in GameMsgs to DarkBlue
- Enhance ServiceCollectionExtensions with transient service registration and ICommand type handling
- Transition DamageCanceler to an event-driven architecture for improved flexibility
- Allow Player property in PlayerEvent to be set during initialization
- Register new damage cancelers in CS2ServiceCollection and simplify command service addition
- Refactor RoleIconsHandler to improve icon management and refine role assignments
- Update PlayerDamagedEvent for dynamic initialization and error handling
- Remove excessive "Respawning..." message from PlayerConnectionsHandler
- Narrow ShopCommand registration to only the "buy" subcommand
```
```
Refactor and enhance module management and logging across multiple components
- Update `TTT.cs` to differentiate between base and plugin modules during loading, improve logging for module operations, and revise initialization and activation of plugin modules.
- Enhance debugging and registration in `ServiceCollectionExtensions.cs` by adding diagnostic logs and ensuring proper registration of plugin modules and listeners with transient lifetimes.
- Remove redundant `Name` property from multiple logger and listener classes (`PlayerActionsLogger.cs`, `BodyIdentifyLogger.cs`, and `PlayerCausesEndListener.cs`), cleaning up unused code and simplifying logic for handling game-related events.
- Improve event dispatching efficiency in `EventBus.cs` by optimizing handler checks, and update DEBUG logging to handle nullability issues.
- Simplify `DamageCanceler.cs` by removing incorrect interface implementation and clarifying constructor and method usage.
```
Refactor Codebase for Simplification and Improved Modularization
- **RoundEndHandler.cs**
- Removed `Name` and `Version` properties to simplify the class.
- Maintained functionality for handling end-of-round events.
- **BaseListener.cs**
- Removed `ITerrorModule` interface implementation and unnecessary properties.
- Updated `Start` method to change listener lifecycle management.
- **CS2GameConfig.cs**
- Simplified by removing `Name` and `Version` properties, focusing solely on game parameters.
- **GameServiceCollection.cs**
- Changed listener addition method from `AddListener` to `AddModBehavior`, updated service registration terms.
- **DamageCanceler.cs**
- Simplified class by removing `Name` and `Version` properties.
- Enhanced damage processing with additional validity checks.
- Further updates include transitioning from `AddListener` to `AddModBehavior` across files, deprecating old registration methods in `EventBus.cs`, and comprehensive removal of `Name` and `Version` properties from various classes to streamline and refactor code structure. Additionally, obsolete methods were removed, and dependency injection patterns were adopted for intuitive system integration.
```plaintext
Implement comprehensive testing and enhance purchase logic
- Add `BuyTest` class to thoroughly test `BuyCommand` in the shop, covering various scenarios and ensuring correct game rule validation.
- Modify `OneShotDeagle`'s `CanPurchase` method to return a `PurchaseResult` enum for detailed purchasing results.
- Update `IShopItem` interface's `CanPurchase` method signature to use `PurchaseResult` for consistent result handling.
- Add `TestShopItem` class implementing the `IShopItem` interface, complete with properties, methods, and a successful `CanPurchase` implementation for testing.
- Improve `TestMessenger` with a null check for the player parameter and message logging for null player scenarios.
- Move `PurchaseResult.cs` to a new directory within the `Shop` folder for better organization.
- Refactor `CommandManagerTests` to use `ICommandManager` interface, ensuring interface-based testing without functional changes.
- Enhance `BuyCommand` with new aliases, asynchronous `Execute` method, and improved transaction logic, including balance checks and item search refactor.
```
- Await the `bus.Dispatch(deathEvent)` call in `OnKill_WithoutGame_DoesNothing` test.
- Remove unused import and eliminate the unused `IMessenger` component in `PropMover.cs`.
- Rename `refreshBodies` method to `refreshBody` for clarity in `PropMover.cs`.
- Refactor the iteration over `playersPressingE` to call the updated method in `PropMover.cs`.
- Enhance code readability in `PropMover.cs` through minor code style improvements, including removal of unnecessary exclamation points.
- Rename `RoundStartHandler` to `RoundStart_GameStartHandler` and update `Dispose()` method in `RoundStartHandler.cs`
- Rename `RoundEndHandler` to `RoundEnd_GameEndHandler` in `RoundEndHandler.cs`
- Update target framework to .NET 8.0 and add project reference to Karma project in `CS2.csproj`
- Update service collection for specific game start/end handlers and add plugin for player karma in `CS2ServiceCollection.cs`
- Introduce `KarmaSyncer` class for handling player karma with appropriate dependencies and event handling in `KarmaSyncer.cs`
```
- Remove `KarmaTest.cs`, eliminating a test case for default player karma verification upon creation.
- Introduce `KarmaListenerTests.cs` file, laying the groundwork for future KarmaListener test cases.
- Adjust `KeyedMemoryStorage.cs` to enable subclass access and method overriding by changing `data` dictionary to protected and marking `Load` and `Write` methods as virtual.
- Update `MemoryKarmaStorage.cs` with `Xunit.Internal` import, modify generic type parameter to `int`, refine code with target-typed `new()`, and override `Load` method with default karma value handling.
- Refactor `KarmaStorage.cs` to batch process karma updates asynchronously, simplify default karma handling, enhance error management, and refine karma caching.
```
```
- Add `KarmaServiceCollection` for dependency injection setup, facilitating the registration of `IKarmaService` with scoped lifetime.
- Update `TTTServiceCollection` to include new services for Karma management and necessary game services.
- Refactor `KarmaStorage` to implement `IKarmaService`, simplifying interface responsibilities and removing previous interface implementations.
- Configure `Plugin.csproj` with .NET 8.0, implicit usings, nullable reference types, and setup publish output handling.
- Introduce `IKarmaService` interface to streamline access and interaction with karma functionalities.
- Create `KarmaListener` class for managing karma adjustments during game events, implementing event handling and asynchronous tasks.
```
- Create a new KarmaStorage class to handle player karma with MySQL and caching
- Add the Karma project file with .NET 8.0 target and necessary references
- Include the Karma project in TTT.sln with Debug and Release configurations
- Define a Karma configuration file with database and karma settings
- Introduce a KarmaUpdateEvent class for managing player karma updates with event cancellation support
- Add a `Skip` method to `CS2CommandInfo` for argument skipping
- Rename `sub` to `subcommands` in `ShopCommand` for clarity and update execution logic
- Make `caller` parameter nullable in `TestCommandInfo` and introduce `Skip` method for better argument handling
- Add `Skip` method to `ICommandInfo` interface for consistent argument skipping functionality
- Add a `Skip` method to `CS2CommandInfo` for argument skipping
- Rename `sub` to `subcommands` in `ShopCommand` for clarity and update execution logic
- Make `caller` parameter nullable in `TestCommandInfo` and introduce `Skip` method for better argument handling
- Add `Skip` method to `ICommandInfo` interface for consistent argument skipping functionality
- Await the `bus.Dispatch(deathEvent)` call in `OnKill_WithoutGame_DoesNothing` test.
- Remove unused import and eliminate the unused `IMessenger` component in `PropMover.cs`.
- Rename `refreshBodies` method to `refreshBody` for clarity in `PropMover.cs`.
- Refactor the iteration over `playersPressingE` to call the updated method in `PropMover.cs`.
- Enhance code readability in `PropMover.cs` through minor code style improvements, including removal of unnecessary exclamation points.
- Rename `RoundStartHandler` to `RoundStart_GameStartHandler` and update `Dispose()` method in `RoundStartHandler.cs`
- Rename `RoundEndHandler` to `RoundEnd_GameEndHandler` in `RoundEndHandler.cs`
- Update target framework to .NET 8.0 and add project reference to Karma project in `CS2.csproj`
- Update service collection for specific game start/end handlers and add plugin for player karma in `CS2ServiceCollection.cs`
- Introduce `KarmaSyncer` class for handling player karma with appropriate dependencies and event handling in `KarmaSyncer.cs`
```
- Remove `KarmaTest.cs`, eliminating a test case for default player karma verification upon creation.
- Introduce `KarmaListenerTests.cs` file, laying the groundwork for future KarmaListener test cases.
- Adjust `KeyedMemoryStorage.cs` to enable subclass access and method overriding by changing `data` dictionary to protected and marking `Load` and `Write` methods as virtual.
- Update `MemoryKarmaStorage.cs` with `Xunit.Internal` import, modify generic type parameter to `int`, refine code with target-typed `new()`, and override `Load` method with default karma value handling.
- Refactor `KarmaStorage.cs` to batch process karma updates asynchronously, simplify default karma handling, enhance error management, and refine karma caching.
```
```
- Add `KarmaServiceCollection` for dependency injection setup, facilitating the registration of `IKarmaService` with scoped lifetime.
- Update `TTTServiceCollection` to include new services for Karma management and necessary game services.
- Refactor `KarmaStorage` to implement `IKarmaService`, simplifying interface responsibilities and removing previous interface implementations.
- Configure `Plugin.csproj` with .NET 8.0, implicit usings, nullable reference types, and setup publish output handling.
- Introduce `IKarmaService` interface to streamline access and interaction with karma functionalities.
- Create `KarmaListener` class for managing karma adjustments during game events, implementing event handling and asynchronous tasks.
```
- Create a new KarmaStorage class to handle player karma with MySQL and caching
- Add the Karma project file with .NET 8.0 target and necessary references
- Include the Karma project in TTT.sln with Debug and Release configurations
- Define a Karma configuration file with database and karma settings
- Introduce a KarmaUpdateEvent class for managing player karma updates with event cancellation support
Bumps
[softprops/action-gh-release](https://github.com/softprops/action-gh-release)
from 1 to 2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/releases">softprops/action-gh-release's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<ul>
<li>update actions.yml declaration to node20 to address warnings</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md">softprops/action-gh-release's
changelog</a>.</em></p>
<blockquote>
<h2>0.1.12</h2>
<ul>
<li>fix bug leading to empty strings subsituted for inputs users don't
provide breaking api calls <a
href="https://redirect.github.com/softprops/action-gh-release/pull/144">#144</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="72f2c25fcb"><code>72f2c25</code></a>
release 2.3.2</li>
<li><a
href="552dc5524b"><code>552dc55</code></a>
fix: revert <code>fs:readableWebStream</code> change (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/632">#632</a>)</li>
<li><a
href="f3cad8bcbf"><code>f3cad8b</code></a>
release 2.3.1</li>
<li><a
href="07a2257003"><code>07a2257</code></a>
fix: fix file closing issue (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/629">#629</a>)</li>
<li><a
href="d5382d3e6f"><code>d5382d3</code></a>
release 2.3.0</li>
<li><a
href="a0e2122208"><code>a0e2122</code></a>
feat: migrate from jest to vitest (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/626">#626</a>)</li>
<li><a
href="8836085300"><code>8836085</code></a>
chore: replace <code>mime</code> with <code>mime-types</code> (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/624">#624</a>)</li>
<li><a
href="86463358d8"><code>8646335</code></a>
chore: bump node to 20.19.2</li>
<li><a
href="46b284799f"><code>46b2847</code></a>
chore(deps): bump the npm group across 1 directory with 5 updates (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/623">#623</a>)</li>
<li><a
href="37fd9d0351"><code>37fd9d0</code></a>
chore(deps): bump undici from 5.28.5 to 5.29.0 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/621">#621</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/softprops/action-gh-release/compare/v1...v2">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
```
- Update player death description in DeathAction to ensure clarity in scenarios involving a killer.
- Add Format method in DeathAction for structured death action descriptions.
- Implement client event notification in CombatHandler with conditional checks for attacker presence.
- Remove role initialization constructor in CS2Player to streamline code and refactor formatting.
```
- Adjust the logic in `RoundTimerListener.cs` to set final event results based on the winning team, assigning 2 for Counter-Terrorist wins and 3 for others, and refine win panel settings.
- Update `README.md` to reflect completed statuses for "Basic Gameplay," including the subcategories Traitors, Detectives, and Innocents, showcasing project progress.
- Reorder operations in `PlayerStatsTracker.cs` to update `PawnIsAlive` earlier in the `revealDeaths` method for clarity and consistent player state updates.
- Expand `RoleIconsHandler.cs` by adding `RevealIconFor` and `HideIconFor` methods to enhance control over traitor visual representation, allowing dynamic updates of player roles.
```
- Refine game start logic in RoundBasedGame.cs to ensure proper handling of game states and manage player notifications.
- Adjust state management and disposal process in RoundBasedGame.cs for better state handling and resource cleanup.
- Comment out deprecated EventRoundEnd logic in RoundTimerListener.cs and adjust timer settings for improved round transitions.
- Enhance BodyPickupListener.cs with new dependencies and logic for team adjustments during OnPropPickup events.
- Clean up PropMover.cs by removing unnecessary debug logging while maintaining current functionality.
```
- Introduce a server command for handling win conditions during round end in `RoundTimerListener.cs`
- Wrap round end logic processing within a server update block in `RoundTimerListener.cs`
- Improve timing logic for round endings using `Observable.Timer` in `RoundTimerListener.cs`
- Ensure events/messages indicate the winner and specifics in `RoundTimerListener.cs`
- Update `PlayerStatsTracker.cs` to enhance pawn alive state tracking and accuracy
- Modify `GameMsgs.cs` to enhance role identification through improved color coding and type checking for roles.
- Update `RoundTimerListener.cs` to incorporate reactive programming, improve event handling at round end, and refine role assignment logic.
- Enhance version string format in `TTTCommand.cs` by adding a short Git SHA for detailed version information.
- Simplify `EndRound` function in `RoundUtil.cs` by removing unnecessary delay parameter.
- Reorganize `connectToServer` method in `PlayerConnectionsHandler.cs` to delay certain operations until the next world update.
- Add player validity check before printing respawn chat message and update respawn logic to occur during the next world update in `PlayerConnectionsHandler.cs`.
- Consolidate respawn message to a generic "Respawning..." in `PlayerConnectionsHandler.cs`.
- Add new test cases in `ColoredRoleTest.cs` to verify pluralization functionality for role names, including special character handling.
- Ensure `HandlePluralization` method in `ColoredRoleTest.cs` correctly manages singular and plural forms with color formatting and dashes.
- Correct logic in the `OnDeath` event handler by inverting the condition for an active game state check in `TTT/CS2/GameHandlers/BodySpawner.cs`
- Optimize function implementations including `makeGameRagdoll` and `correctRagdoll` in `TTT/CS2/GameHandlers/BodySpawner.cs`
- Add `IGameManager` dependency to `PlayerConnectionsHandler.cs` for enhanced game state management
- Modify `connectToServer` in `PlayerConnectionsHandler.cs` to handle game states and improve player reconnection experience
- Update `DamageCanceler.cs` to improve conditional logic handling during active games
- Simplify player respawn logic and round handling in `RoundTimerListener.cs` by removing `PawnIsAlive` state manipulation and streamlining round start procedures
```
- Modify `RoundTimerListener` to reorder service initialization
- Add `TTT.API.Game` dependency to `BodySpawner` and improve game state checks and player handling upon death
- Reorder initialization logic in `SimpleLogger` for improved readability
- Introduce `GAME_LOGS_HEADER` and refactor message handling in `GameMsgs`
- Group minor organizational code changes across multiple files, including removing unused imports and restructuring logic for consistency
```
- Improve error handling and modify references from `PlayerPawn` to `Pawn` in `BodySpawner.cs` to enhance robustness and reflect changes in the player object model.
- Update logic in `SimpleLogger.cs` to correctly set the `epoch` variable when the `timestamp` is smaller, fixing potential update issues.
- Refactor `PlayerExtensions.cs` for consistency by renaming variables from `PlayerPawn` to `Pawn` and ensure updated variable usage across player activities.
- Rename member from `PlayerPawn` to `Pawn` in `CS2InventoryManager.cs` to align with updated player data model and improve clarity.
- Update `TextSpawner.cs` references from `PlayerPawn` to `Pawn` for consistency and refactor list handling for better code alignment with new player data access method.
- Simplify `CombatHandler.cs` by changing references to `Pawn`, adjusting health updates, and improving code clarity for handling player events.
- Simplify and improve readability in `CS2Player.cs` by changing how player properties are accessed and set, maintaining debugging capabilities.
- Implement `PlayerStatsTracker` to monitor player statistics using
dependency injection and event handlers for tracking kills, deaths, and
assists.
- Update `CS2ServiceCollection` to add `PlayerStatsTracker` listener for
enhanced player statistics tracking.
- Modify `RoundTimerListener` to incorporate player color settings at
round start and ensure proper player state updates.
- Enhance `CombatHandler` with game activity checks in
`OnPlayerDeath_Pre` and `OnPlayerHurt` methods to ensure efficient and
correct handling of game operations.
- Implement `PlayerStatsTracker` to monitor player statistics using dependency injection and event handlers for tracking kills, deaths, and assists.
- Update `CS2ServiceCollection` to add `PlayerStatsTracker` listener for enhanced player statistics tracking.
- Modify `RoundTimerListener` to incorporate player color settings at round start and ensure proper player state updates.
- Enhance `CombatHandler` with game activity checks in `OnPlayerDeath_Pre` and `OnPlayerHurt` methods to ensure efficient and correct handling of game operations.
- Add dependency on `TTT.Locale` in `SimpleLogger.cs` for message localization
- Introduce `locale` field for localization in `SimpleLogger.cs`
- Update `PrintLogs` methods in `SimpleLogger.cs` to include localized headers
- Add `GAME_LOGS_HEADER` message type in `GameMsgs.cs` for enhanced log management
- Include "GAME_LOGS_HEADER" entry in `en.yml` for game log headers translation
- Adjust player assignment roles in `DamagedAction.cs` by swapping victim and attacker
```
- Update release workflow to build and restore Locale project, compiling for release and copying JSON files
- Add steps to restore and publish Plugin project, specifying output directory
- Introduce artifact upload step for TTT with error handling for missing files
- Update GitHub release creation to include build directory files in release assets
```
- Delete `RoleLocale.cs` file, indicating potential refactoring or change in handling role localization
- Modify `CS2Game.cs` to allow the `Start` method to return a nullable `IObservable<long>`, incorporating early exit logic when state is not `WAITING`
- Adjust game state logic in `CS2Game.cs` to set state to `IN_PROGRESS` or `COUNTDOWN` based on countdown parameter presence
- Update `TTTCommand.cs` to append "-DEBUG" to version string in debug mode and respond with modified version string
```
- Enhance body identification by setting player clan based on primary role in BodyPickupListener.
- Add a nullable `DateTime` field `epoch` to SimpleLogger for tracking initial log time and refactor log formatting.
- Refactor SetRoleCommand to use non-prefixed role classes and update role assignment mechanism.
- Implement Lerp and Slerp methods in VectorExtensions for advanced vector interpolation.
- Introduce StopCommand class to forcibly stop active games and manage game dependencies.
- Upgrade RoundTimerListener with role assignment logic and new event triggers on round end.
- Refactor RoleIconsHandler to use dictionaries for icon management and rename role classes.
- Remove CS2TraitorRole, CS2DetectiveRole, and CS2InnocentRole, indicating role refactoring.
- Add color formatting to role names in language files and improve message consistency.
- Enhance PropMover with visual effects for entity interactions and refine entity teleportation logic.
- Use C# 8 range indexer syntax in CS2Player for improved readability and concise logic.
```
- Rename workflow to "Auto Release on SemVer Change" and modify trigger to branch-based for "main" and "dev".
- Change job name to "auto-release" and remove .NET setup to streamline workflow.
- Update GitVersion to 6.3.x and centralize tag management with automatic tagging.
- Revamp changelog generation using GitHub API and update release creation process.
- Implement cleanup process for old pre-releases to maintain repository hygiene.
- Update actions in `.github/workflows/release.yml` to latest versions
- Specify .NET version as 8.0.x for consistency
- Change release tag extraction to MajorMinorPatch format
- Improve logic for checking if tag commit is on the main branch
- Simplify previous tag identification for efficiency
- Implement dynamic range selection for release notes generation
- Ensure correct asset path is used for GitHub release creation
- Differentiate between release and prerelease versions based on branch check results
- Update tag listing format and remove unnecessary comments in `.github/workflows/release.yml`
- Change versioning variables from `FullSemVer` to `MajorMinorPatch` for simpler versioning in `.github/workflows/release.yml`
- Add step to generate `release_notes.md` with a full commit list in `.github/workflows/release.yml`
- Modify release creation to use detailed release notes file in `.github/workflows/release.yml`
- Refine steps for tagged commits, tag range identification, and adjust artifact upload for versioning changes in `.github/workflows/release.yml`
- Update GitHub Actions workflow to include full semantic version in ZIP package and artifact naming
- Modify artifact upload step to use `FullSemVer` for naming instead of `SemVer`
- Improve package ZIP step by using a single variable for full semantic version, enhancing consistency
- Introduce a comment to clarify full semantic version usage for asset naming in release creation
- Optimize variable usage by defining a `FULL` variable for full semantic version to reduce redundancy
- Remove comments from `release.yml` for brevity.
- Add conditional check in `release.yml` for missing language files.
- Introduce step in `release.yml` to package build directory as a ZIP.
- Modify artifact path in `release.yml` to use ZIP file.
- Change artifact name in `release.yml` to include semantic version.
- Add test to `release.yml` for asset existence before creating GitHub release.
- Update checkout action to version 4 in release workflow
- Adjust setup .NET action to latest version 4 in release workflow
- Specify `if-no-files-found` behavior in upload artifact step
- Enhance tag commit check condition for main branch
- Improve logic for finding previous tag with fallback method
- Modify GitHub release creation step to upload artifacts directly from `build/TTT`
- Update `actions/checkout` to latest version in `release.yml`
- Adjust .NET setup to "8.0.x" in `release.yml`
- Simplify artifact upload naming to `TTT.zip` in `release.yml`
- Refine release asset naming in GitHub release creation in `release.yml`
- Modify build process in release workflow to include setting up the Locale project
- Change build step to focus on "Build Locale" and specify output directory for language JSON files
- Revise packaging step to "Publish Plugin" for the TTT Plugin project
- Reorganize upload process by renaming artifact to "TTT" and omitting versioning from file path
- Remove retention-days configuration from workflow artifact upload step
- Update `.github/workflows/release.yml` to trigger on any tag push, removing dependency on other workflows
- Simplify concurrency settings by using GitHub reference name
- Add permissions section to grant write access to contents
- Combine separate jobs into a single `build-and-release` job
- Update to `actions/checkout@v4`, removing ref specification
- Change GitVersion setup to a lower version (v3) and update version spec
- Streamline versioning by removing detailed semantic checks
- Add build step utilizing .NET to restore packages and publish application
- Create and upload zip package of published artifact as a workflow artifact
- Enhance release creation logic, simplifying tag generation and pre-release handling
- Remove redundant artifact renaming, changelog generation, and old release pruning steps
Overall, these changes simplify and enhance the flexibility of the release process.
- Add dependency for `IPlayerConverter<CCSPlayerController>` in `BodyPickupListener.cs`
- Enhance `OnPropPickup` to convert attached player to an online player using the new converter
- Implement validity check for converted online player
- Update online player's pawn state to not alive upon body identification
- Invoke utility function to set `CCSPlayerController` pawn status change
- Reformat debug messages in `CS2Messenger.cs` for improved readability and structure.
- Update color for `ColoredRole` name in `ColoredRoleTest.cs` from red to dark blue.
- Enhance efficiency and clarity in `StringLocalizer.cs` by refining placeholder handling and vowel sound logic.
- Add color-coding to role identification in `GameMsgs.cs` to improve visual feedback during player identification.
- Adjust interaction distance and improve state management in `PropMover.cs` for better control and performance.
```
Enhance Game Functionality and Logging Capabilities
- Update `GameMsgs.cs` to utilize explicit `Name` properties for data retrieval and introduce a new dependency on `CounterStrikeSharp.API.Modules.Utils`.
- Modify `PropMover.cs` to adjust minimum look accuracy, improving precision requirements.
- Extend `SimpleLogger.cs` with new logging methods for individual and all players, enhancing overall logging functionality.
- Revise `CS2CommandManager.cs` to improve code base structure by removing redundancy and ensuring correct method order.
- Update `CommandManager.cs` by implementing `ITerrorModule`, adding modularity and logging command capabilities.
- Enhance `IActionLogger.cs` with new logging methods integrating player functionalities.
- Introduce `LogsCommand.cs` to manage and display active game logs with error handling for inactive games.
- Adjust `StringLocalizer.cs` to refine character evaluation in text handling.
- Revise `en.yml` color schemes for consistency in message display.
- Simplify `GameEndLogsListener.cs` for better efficiency by using `PrintLogs()` method.
- Introduce a new 'MONITOR' priority level in `EventHandlerAttribute.cs` for more granular event handling priorities.
```
- Rename `GameMsgs.cs` and restructure to `lang` directory; add `BODY_IDENTIFIED` message method for body identification scenarios.
- Implement `IdentifyBodyAction` class for handling body identification events, enhancing game event handling.
- Move CS2 messaging structures to `lang` directories for improved organization.
- Update `SpectatorRole.cs` to reflect new `lang` namespace.
- Replace `GamePlayerActionsListener` with `PlayerActionsLogger` in `PlayerActionsTest.cs`, integrating new logging functionality.
- Enhance game service collections with new listeners, including `PlayerActionsLogger` and `BodyIdentifyLogger`.
- Implement `BodyIdentifyLogger` to log body identification events.
- Enhance `BodyPickupListener` with improved error handling and localized messaging.
- Add new localized message format in `en.yml` for body identification events.
- Transform `GamePlayerActionsListener` to `PlayerActionsLogger` with updated structure and logging focus.
Refactor role management and simplify codebase
- **RoleAssignerTest.cs**: Update tests to use `assigner.GetRoles(p)` for role retrieval, ensuring consistency across tests.
- **Program.cs**: Remove error handling for YAML parsing, maintaining functionality in argument parsing and JSON conversion.
- **RoundBasedGameTest.cs**: Integrate `IRoleAssigner`, modifying role checks and simplifying test assertions.
- **IGame.cs**: Add `RoleAssigner` property and refactor role retrieval methods to streamline role management.
- **Multiple Files**: Implement `IRoleAssigner` across various components, enhancing role management consistency and simplifying code by removing direct role access.
```
Update configuration handling and improve code consistency
- Update `RoundBasedGame.cs` to use `TTTConfig`, enhancing game lifecycle management and state transitions.
- Rename `GameConfig.cs` to `TTTConfig.cs` for consistency, with no changes to logic or properties.
- Refactor `CS2CommandManager.cs` to clean up command registration and improve readability.
- Adjust `PlayerConnectionsHandler.cs` to simplify server update logic and remove unnecessary checks.
- Improve `RoleAssignListener.cs` for better role assignment handling and ensure proper player role transitions.
Additionally, minor updates are made across multiple files to replace `GameConfig` with `TTTConfig`, ensuring consistent configuration handling throughout the codebase.
```
```
Implement Various Enhancements and Refactoring Across Multiple Modules
- Update RoleAssignListener.cs: Remove unused imports, add module metadata with new public properties, and reorganize method structure for clarity. Implement new Start method and improve efficiency in onTransmit logic.
- Optimize SimpleLogger.cs by utilizing full date and time for dictionary keys, enhancing logging precision.
- Adjust role assignment process in BaseRole.cs, TraitorRole.cs, DetectiveRole.cs, and InnocentRole.cs to conditionally strip weapons based on new GameConfig.cs setting, StripWeaponsPriorToEquipping.
- Refine SetRoleCommand.cs by reorganizing imports and enhancing role assignment logic, ensuring dynamic role selection and clear messaging.
- Enhance RoundBasedGame.cs with new inventory management component to standardize player inventories at the start of each round and leverage dependency injection for external services.
- Conduct miscellaneous refactorings and performance improvements, including test updates, import optimizations, and enhanced logging across multiple files.
```
```
- Enhance messaging functionality in `BaseRole.cs` with new `IMessenger` dependency and localized player notifications during role assignment.
- Update `CS2CommandManager.cs` to include new `SetRoleCommand` and refine command management namespace.
- Extend `RoleAssignListener` in `RoleAssignListener.cs` to include role identification and icon management for `CS2TraitorRole`, implementing `IPluginModule`.
- Shift role assignment notifications in `RoleAssigner.cs` from player-specific to global messaging for improved game transparency.
- Refactor `CS2ServiceCollection.cs` to use a new `RoleAssignListener` behavior, optimizing role management practices.
```
```
- Rename and reorganize several files for improved project structure, including `CS2Messenger.cs`, `CS2InventoryManager.cs`, `CS2CommandInfo.cs`, `CCPlayerConverter.cs`, `CS2Msgs.cs`, `TestCommand.cs`, and `CS2CommandManager.cs`.
- Add new methods to `VectorExtensions.cs` for vector normalization and scaling, and suppress code analysis warnings.
- Introduce `TextSetting.cs` class for text rendering, defining properties like color, font, justification, and orientation.
- Enhance `PropMover.cs` with new utility imports, increase interaction parameters, remove outdated array logic, add logging, and improve teleport logic.
- Expand `RoleAssignListener.cs` with new `using` directives, implement `ITextSpawner`, replace player color settings, and create text hat during role assignments.
- Introduce `TraceFlags` enum in `RayTrace.cs` to improve mask clarity and refactor vector operations for consistency.
- Implement `TextSpawner.cs`, adhering to `ITextSpawner` interface, to create and manage in-game text entities and associated error handling.
- Optimize `BodySpawner.cs` ragdoll correction with efficient update logic and improved rotation use.
- Define `ITextSpawner` interface for flexible text and text hat creation methods, improving in-game text mechanics.
```
Bumps
[actions/download-artifact](https://github.com/actions/download-artifact)
from 4 to 5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/download-artifact/releases">actions/download-artifact's
releases</a>.</em></p>
<blockquote>
<h2>v5.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Update README.md by <a
href="https://github.com/nebuk89"><code>@nebuk89</code></a> in <a
href="https://redirect.github.com/actions/download-artifact/pull/407">actions/download-artifact#407</a></li>
<li>BREAKING fix: inconsistent path behavior for single artifact
downloads by ID by <a
href="https://github.com/GrantBirki"><code>@GrantBirki</code></a> in <a
href="https://redirect.github.com/actions/download-artifact/pull/416">actions/download-artifact#416</a></li>
</ul>
<h2>v5.0.0</h2>
<h3>🚨 Breaking Change</h3>
<p>This release fixes an inconsistency in path behavior for single
artifact downloads by ID. <strong>If you're downloading single artifacts
by ID, the output path may change.</strong></p>
<h4>What Changed</h4>
<p>Previously, <strong>single artifact downloads</strong> behaved
differently depending on how you specified the artifact:</p>
<ul>
<li><strong>By name</strong>: <code>name: my-artifact</code> → extracted
to <code>path/</code> (direct)</li>
<li><strong>By ID</strong>: <code>artifact-ids: 12345</code> → extracted
to <code>path/my-artifact/</code> (nested)</li>
</ul>
<p>Now both methods are consistent:</p>
<ul>
<li><strong>By name</strong>: <code>name: my-artifact</code> → extracted
to <code>path/</code> (unchanged)</li>
<li><strong>By ID</strong>: <code>artifact-ids: 12345</code> → extracted
to <code>path/</code> (fixed - now direct)</li>
</ul>
<h4>Migration Guide</h4>
<h5>✅ No Action Needed If:</h5>
<ul>
<li>You download artifacts by <strong>name</strong></li>
<li>You download <strong>multiple</strong> artifacts by ID</li>
<li>You already use <code>merge-multiple: true</code> as a
workaround</li>
</ul>
<h5>⚠️ Action Required If:</h5>
<p>You download <strong>single artifacts by ID</strong> and your
workflows expect the nested directory structure.</p>
<p><strong>Before v5 (nested structure):</strong></p>
<pre lang="yaml"><code>- uses: actions/download-artifact@v4
with:
artifact-ids: 12345
path: dist
# Files were in: dist/my-artifact/
</code></pre>
<blockquote>
<p>Where <code>my-artifact</code> is the name of the artifact you
previously uploaded</p>
</blockquote>
<p><strong>To maintain old behavior (if needed):</strong></p>
<pre lang="yaml"><code></tr></table>
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="634f93cb29"><code>634f93c</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/download-artifact/issues/416">#416</a>
from actions/single-artifact-id-download-path</li>
<li><a
href="b19ff43027"><code>b19ff43</code></a>
refactor: resolve download path correctly in artifact download tests
(mainly ...</li>
<li><a
href="e262cbee4a"><code>e262cbe</code></a>
bundle dist</li>
<li><a
href="bff23f9308"><code>bff23f9</code></a>
update docs</li>
<li><a
href="fff8c148a8"><code>fff8c14</code></a>
fix download path logic when downloading a single artifact by id</li>
<li><a
href="448e3f862a"><code>448e3f8</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/download-artifact/issues/407">#407</a>
from actions/nebuk89-patch-1</li>
<li><a
href="47225c44b3"><code>47225c4</code></a>
Update README.md</li>
<li>See full diff in <a
href="https://github.com/actions/download-artifact/compare/v4...v5">compare
view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
```
- Organize and restructure project files by moving core game files to a new "Game" directory.
- Introduce the `BodyEvent` abstract class and multiple body-related event classes such as `BodyIdentifyEvent` and `BodyCreateEvent` for enhanced event handling.
- Implement the `BodySpawner.cs` file, introducing the `BodySpawner` class with robust logic for body spawning, event handling, and game services integration.
- Refactor `VectorExtensions.cs` by changing data types for performance improvements and adding utility methods for vector manipulation.
- Enhance `CombatHandler.cs` with new events `PlayerDeathEvent` and `PlayerDamagedEvent`, correcting spelling errors, and refining player state handling.
- Develop new interface `IBody` and class `CS2Body` to manage game character bodies, including properties and methods for player associations.
- Expand event handling capabilities with the addition of `PropPickupEvent` and `PropDropEvent` classes, supporting cancellable game events.
- Refactor `PropMover.cs` to simplify code, improve efficiency with LINQ, and integrate debug statements and event dispatching.
- Remove the `BodyHider.cs` file, indicating a shift in handling player color changes within the game.
```
- Revise the changelog template in `.github/changelogConfig.json` to include contributors, commit details, and sorting capabilities.
- Simplify syntax and modify concurrency setting in `.github/workflows/release.yml`, and add logical enhancements for version comparison and release conditions.
- Remove the "body" command case and related functionality from `TestCommand.cs`.
- Update `RoundBasedGame.cs` to finalize game state changes upon disposal.
- Overhaul entity interaction and initialization logic in `PropMover.cs`, refine event handling, and introduce enhanced movement tracking using the new `MovementInfo` class.
- Create `MovementInfo.cs` for data handling of entity movement.
- Experimentally disable player connection event dispatching in `PlayerConnectionsHandler.cs`.
- Re-enable `CombatHandler` and add new `BodyHider` plugin behavior in `CS2ServiceCollection.cs`.
- Implement new `BodyHider` module for altering player visibility and enhancing death event handling.
```
- Correct the calculation in the `DistanceSquared` method in `VectorExtensions.cs` to properly compute squared Euclidean distance between two vectors.
- Add new extension and vector utilities in `PropMover.cs`.
- Change type in the dictionary and hashset in `PropMover.cs` from `CEntityInstance` to `CBaseEntity`.
- Revise entity addition condition in `PropMover.cs` using specific logic based on entity type.
- Enhance interaction feedback and implement distance-based detection for player interaction with entities in `PropMover.cs`.
```
```
- Enhance `PropMover.cs` with new event listeners and interaction logic, including player button handling and entity filtering.
- Enable unsafe code in `CS2.csproj` for potential performance improvements.
- Add vector extension methods in `VectorExtensions.cs` to compute distances, aiding geometric calculations.
- Introduce `PropMover` plugin in `CS2ServiceCollection.cs` and reorder handlers, with a note on missing final newline.
- Implement ray tracing in `RayTrace.cs`, including error handling and low-level API interaction for precision in trace calculations.
```
- Introduce a new `TerminateRoundFunc` in `RoundUtil.cs` with game data signature and update `EndRound` to use it.
- Simplify null checks in `RoundUtil.cs` by removing redundant variable declarations and handle potential null values for `ServerUtil.GameRulesProxy`.
- Remove inline comments in `RoundUtil.cs` for better readability.
- Add `JetBrains.Annotations` import and `[UsedImplicitly]` annotations in `RoundTimerListener.cs`.
- Remove `IPlayerFinder` dependency and replace `TerminateRoundFunc` with `RoundUtil.EndRound` in `RoundTimerListener.cs`, enhancing readability and simplifying class structure.
- Implement respawn mechanism for non-alive players during countdown in `RoundTimerListener.cs`.
- Adjust command execution logic and set dynamic round time based on player count in `RoundTimerListener.cs`.
- Change team assignments for `InnocentRole` players at round end in `RoundTimerListener.cs`.
- Rename `ServerExtensions.cs` to `ServerUtil.cs`, and update class and namespace to match in `ServerUtil.cs`.
- Add new utility imports in `CS2Game.cs` and `RoundUtil.cs`.
- Replace `GetGameRules()` method with `GameRules` property in `ServerExtensions.cs` and introduce caching for improved efficiency.
- Update `RoundTimerListener.cs` to use `GameRulesProxy` property for simplified and direct access to game rules.
- Simplify `RoundUtil.cs` by replacing method calls with property accesses for enhanced clarity and code readability.
- Add using directive for `TTT.Shop` and scoped service registration for `IShop` in `Startup.cs`
- Create `BalanceClearTest` class to ensure balances are cleared at game start
- Reformat XAML elements and add code coverage filter in `TTT.sln.DotSettings`
- Add project reference to `Shop.csproj` in `Test.csproj`
- Change type from `IOnlinePlayer` to `IPlayer` in `IShop` and `Shop` classes
- Add a styled badge link to the top of the README
- Rename code coverage badge to "Code Coverage" for clarity
- Introduce a new badge displaying development time with specific request parameters
Add condition to GenerateGitVersionInformation target in Versioning.csproj
- Prevent execution in continuous integration environments by adding a condition to the GenerateGitVersionInformation target in Versioning.csproj.
```
Refactor codebase for improved readability, maintainability, and performance
- TTT/CS2/GameHandlers/CombatHandler.cs: Remove unused directives, reorder methods, and apply minor formatting changes.
- TTT/Game/RoundBasedGame.cs: Optimize `Start` method logic, improve game state transitions, enhance messaging logic, and ensure proper resource cleanup.
- TTT/CS2/CS2InventoryManager.cs: Refine `RemoveWeapon` function by cleaning up parameters and improving weapon removal handling.
- TTT/API/Game/IGame.cs: Rename `GetRole` to `GetOfRole` and enhance `GetAlive` method flexibility with new parameters.
- TTT/Plugin/TTT.cs: Eliminate unused library references for cleaner code.
- Various Files: Remove unused directives, reorder methods for better readability, and improve file organization across multiple files.
```
- Introduce a new test class `ColoredRoleTest` for the `ColoredRole` within a structured namespace.
- Implement the `ColoredRole` class that derives from `IRole` with a red-colored name demonstration.
- Add unit tests using xUnit framework to verify correct article usage in role assignment messages.
- Utilize dependency injection to obtain `IMsgLocalizer` for localization testing.
- Un-comment the `GenerateGitVersionInformation` target in `Versioning.csproj` to enable version information generation on non-Windows systems.
- Remove the execution command previously used to compile and run the project in `Versioning.csproj`.
- Adjust the path for the generated `gitversion.json` file in `Versioning.csproj`, moving it one directory up.
- Update `Program.cs` to change the handling of null JSON values by assigning an empty string for string type, while keeping other JSON value conversions unchanged.
- Modify `AddEntityIOEvent` in `CS2InventoryManager.cs` by removing the delay parameter, potentially changing event timing execution
- Add null and validity check for player pawn in `RoleAssignListener.cs` to ensure it exists and is valid before calling `SetModel()`
- Introduce `TestCommand` class in `TestCommand.cs` with command execution logic and asynchronous task handling
- Integrate `TestCommand` in `CS2CommandManager.cs` with `hotReload` parameter and expanded command registration process
```
Introduce new game mechanics and improve resource management
- Update `TTT.cs` to enhance Dispose method, ensuring cleanup of IGameManager resources.
- Add `RoundStartHandler.cs` with essential round start logic and dependency management.
- Expand `PlayerCausesEndListener.cs` with improved role handling and debug logging.
- Modify `CS2Game.cs` to integrate reactive programming for countdowns and state management.
- Optimize `CS2Player.cs` with consolidated logic for player identification and state checks.
- Refactor `RoundBasedGame.cs` to include localized messaging and enhanced game state handling.
- Update multiple game configuration files with new endgame message templates and listener adjustments.
```
- Modify `GAME_STATE_STARTED` message in `GameMsgs.cs` for grammatical accuracy and clarity regarding the number of traitors.
- Add new translation entries for "AN_RED_ELEPHANT" and "AN_RED_BALL" in `Test/lang/en.yml`.
- Update `Game/lang/en.yml` to use variable placeholders for role messages.
- Expand locale message templates by adding new constants in `Test/Locale/TestMsgs.cs`.
- Implement additional localization and formatting tests in `LocaleTest.cs`.
- Enhance `RoundBasedGameTest.cs` with tests for role messages, game start scenarios, and end conditions.
- Improve string handling in `StringLocalizer.cs` with utility functions and updated trimming methods.
- Add step in release workflow to determine base tag for changelog
generation
- Modify Generate Changelog step to include base tag as input parameter
for accurate changelog creation
- Add step in release workflow to determine base tag for changelog generation
- Modify Generate Changelog step to include base tag as input parameter for accurate changelog creation
- Enhance `RoundTimerListener` by making `TerminateRoundFunc` a `readonly` static field and using `Server.NextWorldUpdate` for deferred execution.
- Update `OnRoundStart` and `OnRoundEnd` for improved timer functionality and team balance in `RoundTimerListener`.
- Change service lifecycles in `Startup` from transient to scoped for `IScheduler` and `IMsgLocalizer`.
- Simplify vowel sound logic in `StringLocalizer` using switch expressions for article determination.
- Refactor `CombatHandler` to focus on event-driven architecture and simplify damage handling.
- Remove console logging from `IGame`'s `GetAlive` method to streamline and enhance performance.
- Fix typo in pull request template format by correcting unbalanced braces in changelogConfig.json
- Extend `label_extractor` pattern to include more label types like `cd` and `workflow` for better categorization
- Simplify `RoleAssignListener` by consolidating conditional logic and updating `SetClan` method signature.
- Remove unnecessary implementation exception from `ListCommand`'s `Dispose` method.
- Clean up comments in `CS2Player`, maintaining current property logic and constructors.
- Streamline round termination logic in `RoundTimerListener` and add TODO for parameter clarification.
- Refactor multiple associated files for enhanced code readability and maintenance.
- Update `RoundTimerListener.cs` to enhance player management and control flow, introducing new fields and refining round start and end logic.
- Refine `RoleAssignListener.cs` to adjust clan assignments based on player roles, specifically setting up for `CS2DetectiveRole`.
- Implement `GetRole` method in `IGame.cs` for role-based player retrieval and enhance `GetAlive` for detailed role logging.
- Revise `CS2Game.cs` to manage role list updates, game state transitions, and ensure main thread consistency during operations.
```
- Add new localization strings and variations in `TTT/Test/lang/en.yml` for testing scenarios.
- Remove debug-only command and enhance error logging in `TTT/CS2/CS2CommandManager.cs` for better debugging support.
- Implement player respawn and improve round ending behavior in `TTT/CS2/Listeners/RoundTimerListener.cs`.
- Add article handling support and update methods for `%an%` placeholders in `Locale/StringLocalizer.cs`.
- Expand test message capabilities with new constants and methods in `TTT/Test/Locale/TestMsgs.cs`.
- Simplify role assignment logic by removing event instantiation in `TTT/CS2/Listeners/RoleAssignListener.cs`.
- Enhance access control and fix game state transition logic in `TTT/Game/RoundBasedGame.cs`.
- Update round management with new static method and using directives in `TTT/CS2/RoundUtil.cs`.
- Modify role assignment messages for grammatical accuracy in `TTT/Game/lang/en.yml`.
- Improve round-end logic and add necessary checks in `TTT/CS2/GameHandlers/RoundEndHandler.cs`.
- Clarify role name usage in message creation in `TTT/Game/GameMsgs.cs`.
- Introduce new event handling and state checks in `TTT/CS2/CS2Game.cs`.
- Add comprehensive tests for article localization and substitution in `TTT/Test/Locale/LocaleTest.cs`.
```
```
- Add `SetClan` method to `PlayerExtensions` in `PlayerExtensions.cs` for clan management
- Improve command handling and debugging in `CS2CommandManager.cs` with conditional `TestClanCommand` registration and enhanced error logging
- Fix typo in `DebugInform` output in `CS2Messenger.cs` and maintain debug method consistency
- Update role assignment logic in `RoleAssignListener.cs` for team assignment and clan setting based on roles
- Introduce localization support in role assignment messages across `en.yml`, `GameMsgs.cs`, and `RoleAssigner.cs`
```
- Add console logging for player roles in `GetAlive` methods within `IGame.cs` and enhance role type matching logic
- Comment out `CBaseEntity_TakeDamageOldFunc` hooks in `CombatHandler.cs` and add player validation check
- Simplify `GameConfig` instantiation and verify correct game start in `JoinStartTest.cs`
- Rename `ScreenMsg` method to `Message` in `RoleAssigner.cs` without affecting functionality
- Enhance console logging for debugging methods in `CS2Messenger.cs` to include message type
- Add import statement for `TTT.Game` in `JoinStartTest` to utilize new functionalities
- Introduce `GameConfig` object in `JoinStartTest` for managing configuration settings
- Modify `OnJoin_StartsGame_WhenTwoPlayersJoin` test to use `GameConfig` for countdown, improving flexibility
- Change `IScheduler` lifecycle in `Startup` from `Scoped` to `Transient` for a new instance per request
```
- Enhance thread safety and state consistency in `CS2Game.cs` during game start operations by ensuring main thread execution and enforcing game state consistency.
- Improve role assignment in `RoleAssigner.cs` by clearing existing roles before assigning new ones and randomizing assignments with a shuffled list of players.
- Strengthen null handling in `EventModifiedMessenger.cs` by allowing nullable `IOnlinePlayer` parameters and ensuring actions are executed with null parameters.
- Prevent active game duplication in `CS2GameManager.cs` by adding a check and throwing an exception if a game is already active.
- Introduce asynchronous execution and better synchronization in `RoundTimerListener.cs` to handle round timings in the next world update cycle.
- Refactor `PlayerConnectionsHandler.cs` for improved dependency management by introducing dependency injection for key components.
- Change directory capitalization for consistency in `ActionTest.cs` file path.
- Enhance configurability in `PlayerJoinStarting.cs` by using a configuration value for the minimum player count to start a game.
- Add new tests in `GameTest.cs` to verify the behavior of the `GetAlive` method with various scenarios and role filters.
```
- Adjust event listener registration in `PlayerConnectionsHandler.cs` to use `OnClientConnected` and simplify function signature
- Activate previously commented-out line in `CombatHandler.cs` for proper `OnTakeDamage` unhooking in `Dispose` method
```
- Comment out initialization of `msg` and disable debug logging in `SimpleLogger.cs` to reduce dependencies and simplify debugging.
- Add a `Start` method in `CS2Game.cs` to enhance round initiation with an optional countdown and expandability for future features.
- Adjust command execution order in `RoundTimerListener.cs` to correctly manage round win conditions during COUNTDOWN and IN_PROGRESS states.
- Implement dependency injection in `CCPlayerConverter.cs` by switching to `IServiceProvider`, deferring `IMessenger` instantiation with `Lazy<T>`.
- Remove redundant logging in `PlayerConnectionsHandler.cs` to streamline startup messages.
- Update several files to enhance logging and debugging, refactor code, and improve initialization and error handling.
```
- Add new debugging methods in `CS2Messenger.cs` and ensure they only run in debug mode using preprocessor directives
- Simplify `SimpleLogger` initialization by removing unnecessary service calls in `RoundBasedGame.cs`
- Import `System.Diagnostics` in `EventModifiedMessenger.cs` to enable potential debugging or logging enhancements
- Enhance `CCPlayerConverter.cs` by combining lookup checks, adding null checks, and improving debug messages
- Correct parameter name case in `CS2GameManager.cs` to conform to naming conventions
- Replace `IScheduler` dependency with `IServiceProvider` in `SimpleLogger.cs` and add dependency injection for messenger and scheduler components
- Update color coding for the "game is starting" message in `en.yml` for clarity and aesthetics
- Modify `CCPlayerConverter.cs` to include dependency on `TTT.API.Messages` and refactor constructor for `IMessenger` integration
- Revise `CS2GameManager.cs` to implement event-driven game creation using `GameInitEvent`
- Change access level of `IEventBus` and `ActiveGame` in `GameManager.cs` to protected for better inheritance support
- Enhance `PlayerJoinStarting.cs` with dependency injection and configurable start countdown
- Reinstate and improve error handling for `OnTakeDamage` in `CombatHandler.cs`
- Add handling logic for `BackgroundMsg` and `ScreenMsg` in `EventModifiedMessenger.cs`, including event dispatching for player-specific messages
- Update `PlayerBackgroundMessageEvent` to accept additional arguments with a params parameter
- Introduce generic type parameter `T` for `SimpleArgsSubstitution` to enhance flexibility in handling event types
- Modify `SimpleMessageSubstitution` to be generic with a type parameter `<T>`, ensuring `T` is a subclass of `PlayerMessageEvent`
- Add support for additional parameters in `PlayerScreenMessageEvent` constructor for flexible message formatting
- Refine message event handling in `MessageModificationTest`, parameterizing test instances with specific event types
- Add formatting functionality to `TestMessenger` and ensure consistency across methods
- Define `SimpleMessageSubstitution` class to modify player messages, with event handling and setup for unregistration
- Refactor `MessageModificationTest` to use new substitution classes, enhance test coverage and readability
- Create `SimpleArgsSubstitution` class for modifying message arguments, and improve event handling clarity
- Enhance `EventModifiedMessenger` with new methods and helper function, improve message broadcasting flexibility
```
Enhance Messaging and Event Handling System
- Expand GameMsgs.cs with new message types and improved structure, including methods for game state notifications and better command organization.
- Refactor PlayerJoinStarting.cs by simplifying messaging logic for cleaner code flow.
- Capitalize configuration descriptions in CS2GameConfig.cs for consistency and readability.
- Improve RoleAssigner.cs through code refactoring, optimizing argument passing for clarity.
- Add flexibility to PlayerMessageEvent.cs by introducing additional parameters for more robust event handling.
Implement Service and Localization Adjustments
- Update EventModifiedMessenger.cs to utilize IServiceProvider, adding conditional debug capabilities and preparing for future messaging enhancements.
- Transition CS2Messenger.cs from ILogger to direct console writes, supporting formatted message delivery.
- Introduce PlayerScreenMessageEvent and PlayerBackgroundMessageEvent classes to enhance player-specific event messaging.
- Leverage localization in RoundBasedGame.cs for message delivery, replacing hardcoded values and improving internationalization support.
Minor Code Enhancements and Cleanups
- Fix method signatures and imports across various files for improved consistency and readability.
- Adjust CS2Player.cs documentation for consistent terminologies.
- Clean diagram in lang/en.yml with the addition of customizable game messages for both start and cancellation scenarios.
```
- Refine settings in `TTT.sln.DotSettings` by consolidating XML tags and maintaining code style rules.
- Document missing parameter in `GiveWeapon` method of `IInventoryManager.cs`.
- Overhaul player connection logic in `PlayerConnectionsHandler.cs` by shifting focus to disconnection, replacing outdated methods, and organizing disposals.
- Note potential crash issue in `CombatHandler.cs` with a TODO, remove `OnTakeDamage` implementation, and prepare for future documentation improvements.
- Clean up `CreateGame` method in `CS2GameManager.cs` by eliminating obsolete code for better clarity.
- Modify `ArmorRemaining` property in `PlayerDamagedEvent.cs` to allow external updates and add validation for `HpLeft` to prevent invalid health values.
- Comment out old damage hooks in `CombatHandler.cs` and replace with new `OnPlayerDeath` and `OnPlayerHurt` handlers to improve event handling and consistency.
Enhance Extensibility and Update API Integrations
- Make `Roles` property and `StartRound` method virtual in `RoundBasedGame.cs` to support subclass customization.
- Add logging and improve readability in `CCPlayerConverter.cs` for player conversion processes.
- Update method parameters and usage of `Server.NextWorldUpdateAsync()` in `CS2CommandManager.cs` for API adjustments.
- Add event listener registration and enhance logging in `PlayerConnectionsHandler.cs` for better handling of player connections.
- Integrate new roles and override method logic in `CS2Game.cs` for role management enhancement.
Additional changes:
- Update `CounterStrikeSharp.API` to version `1.0.331`.
- Improve `PlayerDeathEvent.cs` by removing unnecessary dead checks and making the `Victim` property non-nullable.
- Enhance event handling and logging in `Plugin/TTT.cs` for improved module loading and listener support.
- Refactor and enhance exception handling in `CombatHandler.cs` for robustness.
- Minor updates for consistency and readability across multiple files.
```
- Introduce InvalidListeners.cs to define and test invalid event listener scenarios.
- Add validation in EventBus to ensure listeners have valid event handler methods, throwing `InvalidOperationException` if invalid.
- Extend EventBusTest with new test cases for invalid listener registration, covering cases with no methods, no parameters, and incorrect parameters.
```
```
- Introduce InvalidListeners.cs to define and test invalid event listener scenarios.
- Add validation in EventBus to ensure listeners have valid event handler methods, throwing `InvalidOperationException` if invalid.
- Extend EventBusTest with new test cases for invalid listener registration, covering cases with no methods, no parameters, and incorrect parameters.
```
- Add new `label_extractor` configuration in `.github/changelogConfig.json` for enhanced label categorization based on title patterns, improving automation and organization in changelog generation.
- Delete `changelogConfig.json` to phase out or relocate changelog configurations.
- Update `.github/workflows/release.yml` to modify the `Generate Changelog` path and introduce a new "HYBRID" mode, improving changelog generation.
- Adjust `.github/workflows/release.yml` to limit the `Create GitHub Release` step to specific branches for a more efficient release process.
- Add `.github/changelogConfig.json` to include new templates and change categorization, refining the changelog structure.
- Modify the artifact download step in `.github/workflows/release.yml` to skip unpacking and change the path.
- Add a new step in `.github/workflows/release.yml` to rename the artifact by appending the GitVersion output to its name.
- Update the changelog builder action to version 5 in `.github/workflows/release.yml`.
- Adjust the file reference in the release creation step in `.github/workflows/release.yml` to use the newly renamed artifact.
- Add `changelogConfig.json` configuration file with templates and defined categories for changelog items.
- Include logic in `changelogConfig.json` to ignore labels like "wip" and "ignore" and configure sorting order and template for entries.
- Adjust workflow trigger condition in `.github/workflows/release.yml` to require a successful previous run.
- Update syntax for branch extraction using GitHub Actions expression in the release workflow.
- Bump `actions/checkout` to version v4.
- Modify GitVersion setup and execution to use version v4.0.1.
- Introduce conditions for creating a GitHub release only from the 'main' or 'dev' branch.
- Enhance the `Create GitHub Release` step with dynamic attributes.
- Apply formatting changes for improved clarity.
- Remove .NET setup step in release workflow to reflect changes in dependencies or build process
- Quote workflow name in "Download artifact" step for consistency and to prevent YAML parsing issues
- Remove branch specification in 'Download artifact' step in release workflow to allow applicability to any branch
- Update conditional logic for creating GitHub Release to check for 'main' or 'dev' branches only
- Consolidate artifact download step in release workflow by removing duplicate actions and updating to `dawidd6/action-download-artifact`
- Add parameters for branch and workflow in artifact download step for more precise fetching
- Maintain conditional branching for GitHub release creation based on the triggering branch within the workflow
- Update release workflow to improve artifact download process
- Change artifact download action to `dawidd6/action-download-artifact@v11` and configure additional settings
- Adjust permissions to include read access for actions
- Rename download step ID to `download-artifact` for consistency
> ## Pull Request Overview
>
> This is a large development pull request that adds a comprehensive shop system to the TTT plugin and refactors several core components. The changes include implementing a credit-based shop system with purchasable items, updating APIs to be more flexible with nullable types, and improving the command system architecture.
>
> Key changes:
>
> * Added complete shop system with credits, items, and purchase mechanics
>
> * Refactored storage interfaces to support nullable return types
>
> * Updated messaging and command systems with improved architecture
>
> * Enhanced weapon system with ammo management capabilities
>
>
> ### Reviewed Changes
>
> Copilot reviewed 91 out of 91 changed files in this pull request and generated 5 comments.
> Show a summary per file
> File Description
> TTT/Shop/* New shop module with credit system, purchasable items, and commands
> TTT/API/Storage/* Updated storage interfaces to support nullable return types
> TTT/API/Messages/* Simplified messenger interface by removing IOnlineMessenger
> TTT/Game/Commands/* Added TTT command and refactored CommandManager architecture
> TTT/CS2/* Updated CS2-specific implementations for new APIs
> TTT/Test/* Updated test infrastructure for new command and storage patterns
- Update `concurrency` configuration in `dotnet.yml` to use new syntax for branch/PR name reference
- Remove explicit `main` branch from `push` event trigger in workflow
- Restrict `.github/workflows/dotnet.yml` to trigger only on pushes to the "main" branch and expand monitored paths for changes.
- Add concurrency settings to `.github/workflows/dotnet.yml` to prevent overlapping runs.
- Disable automatic cancellation of in-progress runs in `.github/workflows/release.yml`.
- Add a blank line for improved readability in `.github/workflows/nightly.yml`.
- Add Discord badge to README for improved accessibility to related resources
- Create new GitHub release workflow with concurrency control, versioning, changelog generation, and artifact uploads
- Update Code Coverage badge styling in dotnet workflow to consistent `for-the-badge` design
```
Refactor and enhance role configuration, credit system, and kill handling
- **TraitorRole, DetectiveRole, and InnocentRole:** Refactored role initialization to rely on a common `RoleCfg` structure, introduced a `TargetCount` property, and tidied up logic for configuration access and player assignment.
- **CS2 Specific Roles and GameConfig:** Added custom CS2 versions of roles (e.g., CS2TraitorRole, CS2InnocentRole) with color-coded names and introduced refined configuration handling in CS2GameConfig, including improved role and round-related setups.
- **PlayerDeathEvent and Kill Handling:** Standardized player type enforcement in `PlayerDeathEvent` and added a new `PlayerKillListener` to handle credits and assists through `ShopConfig` with localized messaging.
- **Shop and Messaging System:** Enhanced the shop system by adding balance management functionality, credit multipliers, and localization support for credit-related interactions.
- **RatioBasedRole and RoleAssigner:** Refactored ratio-based role logic by replacing parameters with a `TargetCount` property and simplifying role assignment logic for clarity.
```
- Add `ShopCommand` behavior to `ShopServiceCollection`
- Update localization keys in `OneShotDeagle` to use `DeagleMsgs` instead of `ShopMsgs`
- Modify `ShopCommand` to register with `ICommandManager` and add required `using` directive
- Remove obsolete declarations for deagle messages in `ShopMsgs`
- Introduce `DeagleMsgs` class for managing deagle-related message creation
```
Refactor and enhance TTT game logic, localization, and service structure
- Add `CMD_TTT` method in `GameMsgs.cs` to generate a version message; fix missing newline.
- Introduce new `CS2GameManager` class that customizes role list in `CreateGame`.
- Update `CS2ServiceCollection.cs` for dependency injection of `CS2GameManager` and restructure comments.
- Improve localization in `en.yml` with color-coded `PREFIX` and new `CMD_TTT` entry.
- Refactor `TTTCommand.cs` to use `IMsgLocalizer` for localization, replacing `IMessenger`.
- Modify `GameManager.cs` to use an `IServiceProvider` field and mark `CreateGame` as `virtual`.
- Remove `GameInitRoleListener.cs` and update role initialization logic to `CS2GameManager`.
- Adjust `GameServiceCollection.cs` by removing scoped `IGameManager` registration.
```
- **Cleaned up unused directives** in `GameServiceCollection.cs` by removing unused alias and using statements.
- **Improved plugin filtering** in `TTT.cs` to exclude `IPluginModule` instances when fetching `ITerrorModule` implementations.
- **Enhanced command injection logic** in `CS2CommandInfo.cs` by leveraging `IServiceProvider` for dependability and updating messaging handling with `IMessenger`.
- **Refactored and improved error handling** in `CS2CommandManager.cs`, including better error logging and updates to `ReplySync` logic with localized messaging.
- **Added a new generic error message** with placeholders for dynamic error details in `GameMsgs.cs` and updated the English language file `lang/en.yml`.
Other minor changes:
- Updated field visibility in `CommandManager.cs` for consistency.
- Added a comment to disable a namespace check in `WeaponType.cs`.
```
Refactor messaging system and improve modularity across TTT framework
- Updated `ServiceCollectionExtensions` to include a new overloaded method for plugin behavior registration, improving the modularity and reusability of extension types.
- Renamed `TTTCommand.cs` to a new directory structure, replaced `IOnlineMessenger` with `IMessenger`, and updated messaging to include TTT version information.
- Renamed and adjusted fields, logic, and dependency registrations in `CS2CommandManager`, aligning with the new command and messenger system.
Other notable changes:
- Updated `CS2GameConfig` traitor health defaults from 1000 to 100, with a new valid range.
- Cleaned unused imports and updated registration methods for various services, such as `CS2ServiceCollection` and `GameServiceCollection`.
- Improved documentation and comments for clarity while removing unnecessary or outdated elements.
```
- Register new `TTTCommand` in `CS2CommandManager` and adjust command processing flow
- Create `TTTCommand` class with dependency injection, command properties, and stubbed logic
- Update `IOnlineMessenger` to support nullable players and improve type handling logic
- Modify `CS2ServiceCollection` to use `AddPluginBehavior` for `CS2CommandManager` initialization
- Add support for the "list" subcommand in `ShopCommand` with proper dependency setup and subcommand initialization
- Make `player` parameter nullable in `IMessenger.Message` and add nullability support
- Add `ListCommand` implementation to list shop items, utilizing dependency injection and adhering to the `ICommand` interface
- Refactor `creditsForKillCache` to `creditsForKillDictionary` in `ShopConfig` for improved naming clarity and cleaner dictionary initialization
```
Refactor and update TTT weapon, role, and shop systems
- Add `OneShotDeagle` class implementing `IWeapon` and `IShopItem` with dependency injection and localized messages.
- Replace the deprecated `GiveWeapon` method across roles (`DetectiveRole`, `TraitorRole`, `InnocentRole`) to wrap weapons in `BaseWeapon` objects.
- Create `BaseWeapon` class and `IWeapon` interface, standardizing weapon properties such as `Id`, `ReserveAmmo`, and `CurrentAmmo`.
- Refactor inventory systems (`IInventoryManager`, `CS2InventoryManager`, `FakeInventoryManager`) to accept `IWeapon` instead of string `weaponId` and add overloads for handling weapon removal.
- Restructure shop files, adding `ShopConfig` for role-related credit management and renaming/moving configurations (`ShopItemConfig` and `IShopItem`).
Additional changes:
- Update project metadata in `Shop.csproj` to target framework net8.0 and remove redundant references.
- Add `PlayerExtensions` static class to streamline weapon retrieval through LINQ and validation.
```
```
- Introduce `SpectatorRole` into game and replace outdated `SpectatorRole` implementation with a new version in `CS2/SpectatorRole.cs`.
- Add dependency injection for improved modularity across several files, including `RoleAssignListener.cs`, `GameManager.cs`, and `GameInitRoleListener.cs`.
- Refactor `ShopConfig.cs` to use a dictionary-based kill credit cache for optimized role-based credit retrieval.
- Update `RoundBasedGame.cs` to use a public `Roles` property and ensure fallback to default `GameConfig` values if null.
- Add new game events, including `GameInitEvent.cs` to enable customization of initialization logic.
- Minor improvements include organizing imports, adding missing newlines, cleaning up unused directives, and refining code structure in several files for better readability and maintainability.
```
```
Refactor and expand shop and storage functionality
- Update `IKeyedStorage` interface to add a `Load` method and remove `IStorage` inheritance.
- Introduce `OneShotDeagle` shop item class and configuration with placeholders for logic.
- Add new `Shop` class with player balance management, item registration, and a stubbed `TryPurchase` method.
- Implement `ShopConfig` for role-based credit logic and default credits for player actions.
- Add `PurchaseResult` enum to define outcomes of purchase operations.
- Relocate and restructure shop-related files, updating namespaces, directory structure, and references.
- Add localization support for shop items with the new `lang/en.yml` file.
- Refactor `IWriteable` and related storage interfaces, adjusting methods for clarity and functionality.
- Introduce tools like `ShopCommand`, `RoundBalanceClearer`, and `ShopMsgs` to support shop extensibility and cleanup.
- Harmonize event priority constants in `EventHandlerAttribute` for improved clarity.
```
- Refactor `GameEndLogsListener` to replace direct instantiation of `finder` and `messenger` with static/inherited members, and simplify `OnGameEnd` logic for better clarity.
- Improve `RoleAssigner` by changing `players` parameter to `HashSet` for mutability, handling canceled events to prevent reprocessing, and enhancing role assignment error handling.
- Clean up `DetectiveRole` by removing redundant nullable `IMsgLocalizer` and referencing a globally scoped `Localizer` for consistency.
- Update `GameRestartListener` to remove direct `IGameManager` instantiation and standardize property references to align with new conventions.
- Enhance `RoundTimerListener` in CS2 to include `CounterStrikeSharp.API`, update round state commands, and refine conditional logic.
- Refactor `RoleAssigner` to extract role assignment logic into `tryAssignRole` helper method for improved readability and modularity
- Simplify role assignment loop by replacing `roleAssigned` flag with `tryAssignRole` return value
- Enhance variable naming for clarity and fix inefficiencies in role processing logic
- Improve code organization and reduce complexity of `AssignRoles` method
- Update `OnTestEvent` and `AfterOnEvent` methods to use unused variable naming conventions for clarity (`SingleEventListener.cs` and `CancelableEventListener.cs`)
- Add GitVersion integration and improve artifact handling in `.github/workflows/nightly.yml`
- Refactor `CommandManagerTests` constructor for cleaner primary constructor usage
```
- Remove unused namespace imports across multiple files to clean up code.
- Reorganize constructors, fields, and method orders for improved readability and consistency in various classes, including `RoundBasedGame`, `PlayerActionsTest`, and `GameTest`.
- Change expression-bodied methods to block-bodied methods in `EndReason`, `IGameManager`, and other API classes for consistency.
- Add, remove, or adjust newlines and braces to improve code structure and maintainability.
- Refactor `CombatHandler` to introduce memory module imports, update event dispatch logic, and improve damage-handling workflows.
```
```
- Add `GameRestartListener` class to handle game restarts upon end events
- Add `GameRestartingTest` to verify `GameRestartListener` functionality, including game state transitions after errors
- Refactor `PlayerActionsTest` for consistency, readability, and inheritance from `GameTest`
- Update `EndReason` constructors to simplify initialization and add overloads for improved flexibility
- Rename and refactor multiple CS2 classes (e.g., `RoundStartTimerListener`, `CombatListeners`, `PlayerListeners`) to align with updated naming conventions and broaden functionality
- Improve balance and configuration settings, including time-between-rounds support in `GameConfig` and `CS2GameConfig`
- Add `RoundEndHandler` to handle game conclusion logic and integrate with dependency injection
- Introduce `GameTest` utility class to streamline test setup and dependency management
- Apply cleanups and naming normalization across multiple files for code consistency and maintainability
```
```
Refactor and enhance game listeners and tests
- Rename `GameEndListener` to `PlayerCausesEndListener` in `GameEndListener.cs` and updated corresponding references.
- Update `RoundEndingTest.cs` to reflect the new `PlayerCausesEndListener` changes, ensuring consistency and adjusting tests for game-ending events.
- Add new test file `PlayerActionsTest.cs` to validate player-related events such as kills, damage, and role assignments, with dependency injection and comprehensive test cases.
- Rename `PlayerJoinBaseStartListener` to `PlayerJoinStarting` in `JoinStartTest.cs` and update related object instantiations.
- Introduce new `GameEndLogsListener` class to handle game-end logging, utilizing dependency injection and sending formatted log messages to players.
```
```
- Add `GamePlayerActionsListener` to manage player event handling and game actions
- Update `PlayerDamagedEvent` constructor to support fall damage and nullable weapon values
- Introduce `SimpleLogger` and `IActionLogger` for improved action logging capabilities
- Replace `PlayerDeathListener` with `GameEndListener` in tests and rename relevant files
- Add utility classes and extensions (`ServerExtensions`, `RoundUtil`, `RoundStartTimerListener`) for round and server management
```
```
- Add `GamePlayerActionsListener` to manage player event handling and game actions
- Update `PlayerDamagedEvent` constructor to support fall damage and nullable weapon values
- Introduce `SimpleLogger` and `IActionLogger` for improved action logging capabilities
- Replace `PlayerDeathListener` with `GameEndListener` in tests and rename relevant files
- Add utility classes and extensions (`ServerExtensions`, `RoundUtil`, `RoundStartTimerListener`) for round and server management
```
- Update `RoundBasedGame` logic to replace `WinningTeam` with `WinningRole` for clarity and consistency.
- Refactor `PlayerDeathListener` to handle draw scenarios with `EndReason` and improve winning role determination logic.
- Rename and enhance `EndReason` in the API to better handle game-ending scenarios, including updated constructors and initialization methods.
```
Refactor player and game handling logic; improve event system robustness
- **CS2PlayerFinder.cs**: Updated return types for `AddPlayer` and `RemovePlayer` methods to ensure consistency with the updated player interfaces; added missing newline.
- **IPlayerFinder.cs**: Adjusted method return types for `AddPlayer` and `RemovePlayer` to match new API requirements.
- **EventBus.cs**: Added detailed exceptions for invalid listener signatures; fixed parameter handling in `Dispatch` to use array-based invocation.
- **TestPlayer.cs**: Removed unused `weapons` collection and methods; dropped constructor and placeholders for unused features.
- **FakePlayerFinder.cs**: Updated `AddPlayer` and `RemovePlayer` methods to include return statements and adjusted their return types.
- Introduced new game logic and event listeners:
- **IGameManager.cs**: Added `IsGameActive` method to verify ongoing game status.
- **PlayerDeathListener.cs**: Utilized `IsGameActive()` for game activity checks and added new `OnLeave` handler for `PlayerLeaveEvent`.
- **PlayerDiesOnLeaveListener.cs**: Implemented new listener to handle player departures by marking them not alive and dispatching corresponding death events.
- **PlayerDeathEvent.cs**: Refactored class structure with added validation for dead players and improved argument validation in its constructor.
- Enhanced and added new tests:
- **DeathListenerTest.cs**: Added new test class to verify game end behavior via `PlayerDeathEvent`. Simulated player death scenarios and tested event handling.
- **RoundBasedGameTest.cs**: Simplified test logic by reworking constructors, consolidating dependencies, and updating method calls to follow API changes.
```
```
Refactor game listeners and improve player state management
- Add `PlayerJoinBaseStartListener` to handle game start logic, replacing `PlayerJoinGameStartListener`.
- Prevent game start if one is already active and ensure at least 2 players are online.
- Notify players of game start and initialize the game with a delay.
- Replace `PlayerJoinGameStartListener` with a streamlined implementation and delete the outdated class.
- Introduce `PlayerDeathListener` to manage game-ending logic based on alive players and winning roles.
- Update `IGame` interface:
- Rename `winningTeam` to `winningRole` in the `EndGame` method.
- Add `GetAlive` methods for player queries, including role-based filtering.
- Add abstract `BaseListener` class to centralize dependency handling and lifecycle management for listeners.
- Simplify `JoinStartTest` by removing unused dependencies and updating tests to reflect listener changes.
```
```
Refactor command execution logic and update permission handling
- Add `CanExecute` method to `ICommandManager` for permission validation of commands.
- Remove `CanExecute` method from `ICommand` to shift permission validation responsibility.
- Update `CS2PermManager` implementation to use generic player types for `HasFlags` and `InGroups` methods.
- Refactor `IPermissionManager` to remove generics and explicitly use `IPlayer` type.
- Update `CommandManager` to use dependency injection for `IPermissionManager` and refactor logic to integrate the new `CanExecute` method.
```
* Add Admin Data
* Create Command Result Enum
* Prep For Tests
* add TODO
* implement commandinfo
* create command interface
* gAdd Admin Data
# Conflicts:
# TTT/CS2/CS2Player.cs
* Create Command Result Enum
* Prep For Tests
* add TODO
* implement commandinfo
* create command interface
* Refactor out inventory and permission to their own interfaces
* Resolve reverse group perm check
---------
Co-authored-by: ShookEagle <shookeagle@gmail.com>
```
Refactor player and game handling logic; improve event system robustness
- **CS2PlayerFinder.cs**: Updated return types for `AddPlayer` and `RemovePlayer` methods to ensure consistency with the updated player interfaces; added missing newline.
- **IPlayerFinder.cs**: Adjusted method return types for `AddPlayer` and `RemovePlayer` to match new API requirements.
- **EventBus.cs**: Added detailed exceptions for invalid listener signatures; fixed parameter handling in `Dispatch` to use array-based invocation.
- **TestPlayer.cs**: Removed unused `weapons` collection and methods; dropped constructor and placeholders for unused features.
- **FakePlayerFinder.cs**: Updated `AddPlayer` and `RemovePlayer` methods to include return statements and adjusted their return types.
- Introduced new game logic and event listeners:
- **IGameManager.cs**: Added `IsGameActive` method to verify ongoing game status.
- **PlayerDeathListener.cs**: Utilized `IsGameActive()` for game activity checks and added new `OnLeave` handler for `PlayerLeaveEvent`.
- **PlayerDiesOnLeaveListener.cs**: Implemented new listener to handle player departures by marking them not alive and dispatching corresponding death events.
- **PlayerDeathEvent.cs**: Refactored class structure with added validation for dead players and improved argument validation in its constructor.
- Enhanced and added new tests:
- **DeathListenerTest.cs**: Added new test class to verify game end behavior via `PlayerDeathEvent`. Simulated player death scenarios and tested event handling.
- **RoundBasedGameTest.cs**: Simplified test logic by reworking constructors, consolidating dependencies, and updating method calls to follow API changes.
```
```
Refactor game listeners and improve player state management
- Add `PlayerJoinBaseStartListener` to handle game start logic, replacing `PlayerJoinGameStartListener`.
- Prevent game start if one is already active and ensure at least 2 players are online.
- Notify players of game start and initialize the game with a delay.
- Replace `PlayerJoinGameStartListener` with a streamlined implementation and delete the outdated class.
- Introduce `PlayerDeathListener` to manage game-ending logic based on alive players and winning roles.
- Update `IGame` interface:
- Rename `winningTeam` to `winningRole` in the `EndGame` method.
- Add `GetAlive` methods for player queries, including role-based filtering.
- Add abstract `BaseListener` class to centralize dependency handling and lifecycle management for listeners.
- Simplify `JoinStartTest` by removing unused dependencies and updating tests to reflect listener changes.
```
* Overhaul locale structure
* Reformat & Cleanup
* refactor: Refactor roles to use dependency injection.
```
Introduce dependency injection and refactor role architecture
- Refactor `RoleAssignerTest` to use `IServiceProvider` for dependency injection, update role initialization, and align test cases accordingly.
- Update `IOnlinePlayer` and `IGame` interfaces to use the fully qualified namespace for roles and modify method signatures to reflect new role architecture.
- Add `BaseRole` abstract class and refactor role classes (e.g., `InnocentRole`, `DetectiveRole`, `TraitorRole`, `RatioBasedRole`) to inherit from it, implementing dependency injection and overriding key properties and methods.
- Introduce new storage interfaces (`IStorage<T>`, `IWriteable<T>`, `IKeyedStorage<T>`) for improved configuration management and add related test implementations (e.g., `FakeConfig`, `MemoryStorage`).
- Add `GameConfig` class for configurable game and round settings, implement `CS2GameConfig` class to manage configuration storage and plugin module lifecycle, and refactor `RoundBasedGame` to leverage the new configuration structure.
```
* Fix lang copying
* Rename step
* Add debug
* Fix path
* refactor: Refactor roles and role assignment for consistency.
```
Refactor roles and role assignment logic for improved consistency and dependency management
- Refactor `DetectiveRole` to replace `localizer` with `Localizer` property, implement `OnAssign` for player configuration, and improve overall consistency.
- Update `RoleAssigner` to use `IServiceProvider` for dependency injection and call `OnAssign` during role assignment.
- Simplify `RoundBasedGame` constructor and remove redundant fields, improving initialization and readability.
- Adjust `TraitorRole` to use the refactored `Localizer` property, override `OnAssign`, and streamline weapon assignment logic.
- Refactor `BaseRole` to support dependency injection via new protected fields and updated initializations.
Additional: Improved unit tests for `RoleAssigner` and updated `InnocentRole` to align with new role assignment structure.
```
* Reformat and Cleanup
* Overhaul locale structure
* Reformat & Cleanup
* refactor: Refactor roles to use dependency injection.
```
Introduce dependency injection and refactor role architecture
- Refactor `RoleAssignerTest` to use `IServiceProvider` for dependency injection, update role initialization, and align test cases accordingly.
- Update `IOnlinePlayer` and `IGame` interfaces to use the fully qualified namespace for roles and modify method signatures to reflect new role architecture.
- Add `BaseRole` abstract class and refactor role classes (e.g., `InnocentRole`, `DetectiveRole`, `TraitorRole`, `RatioBasedRole`) to inherit from it, implementing dependency injection and overriding key properties and methods.
- Introduce new storage interfaces (`IStorage<T>`, `IWriteable<T>`, `IKeyedStorage<T>`) for improved configuration management and add related test implementations (e.g., `FakeConfig`, `MemoryStorage`).
- Add `GameConfig` class for configurable game and round settings, implement `CS2GameConfig` class to manage configuration storage and plugin module lifecycle, and refactor `RoundBasedGame` to leverage the new configuration structure.
```
* Fix lang copying
* Rename step
* Add debug
* Fix path
```
Introduce IMsgLocalizer interface and improve localization functionality
- Extend `StringLocalizer` to support `IMsg` object localization and implement the new `IMsgLocalizer` interface.
- Update `.github/workflows/dotnet.yml` to use newer Actions versions, enable coverage tracking, and generate dynamic coverage badges.
- Add `IMsgLocalizer` interface and implement localization indexer in `IMsgLocalizer.cs`.
- Update dependency injection in `Startup.cs` to register `IMsgLocalizer` and refine localization services.
- Improve tests in `LocaleTest.cs` to validate `IMsgLocalizer` usage, placeholder substitution, and remove redundant assertions.
Minor: Adjust `en.yml` formatting by removing unnecessary quotes.
```
```
Refactor namespaces, improve naming consistency, and enhance game and role functionality
- **JoinMessageTest.cs**: Updated to use `IPlayerFinder` and fixed method casing.
- **CS2Player.cs and CCPlayerConverter.cs**: Added new `using` directives, introduced nullable checks, and implemented `GetPlayer` functionality in `CCPlayerConverter`.
- **RoundBasedGame.cs**: Renamed methods, improved game state handling, and added `EndGame` and `Dispose` methods.
- **CS2/CS2PlayerFinder.cs**: Added a new class implementing `IPlayerFinder` with methods utilizing `TTT.API.Player`.
- **Test/Game/Roles/RoleAssignerTest.cs**: Refactored to use a new `TestRoles` structure and added a cancellation-based test for role assignment.
- Moved and renamed multiple files (e.g., `IRoleAssigner`, `IGame`, `IGameManager`) to align with updated directory structure.
- Newly created files include `RoleAssignListener`, `RoleAssignCanceler`, and `TestRoles`.
Miscellaneous:
- Changed various method names to follow PascalCase conventions (e.g., `addPlayer` to `AddPlayer`).
- Streamlined imports across multiple files to align with updated namespaces and dependencies.
- Removed and relocated legacy files (`Channel.cs`) to clean up outdated definitions.
```
- Update actions/checkout and setup-dotnet to v4 in dotnet.yml
- Target .NET 8.0.x in Setup .NET step
- Modify test execution to run Test.dll directly from build output
- Add step to write code coverage results to GitHub Job Summary
- Update `.github/workflows/dotnet.yml` to remove GitVersion step and fix test project path
- Adjust `TTT/Directory.Build.props` to exclude certain `ItemGroup` conditions during CI on non-Windows platforms
- Add `Run GitVersion` step to build and test jobs in `.github/workflows/dotnet.yml` for version output and consistency
- Include GitVersion installation step in test job
- Remove `GenerateGitVersionInformation` target block from `Directory.Build.props` for non-Windows OS compatibility.
- Add GitVersion execution step in `.github/workflows/dotnet.yml` test job.
- Comment out custom Git version generation target in `Versioning/Versioning.csproj` for future reference.
- Refactor `Directory.Build.props`:
- Add blank line between `<ItemGroup>` elements for clarity.
- Remove redundant condition from `GitVersion.MsBuild` package reference.
- Update `GenerateGitVersionInformation` target to execute `BeforeCompile` instead of `BeforeBuild`.
- Replace `<PropertyGroup>` elements with explicit `<Exec>` commands in the `GenerateGitVersionInformation` target.
- Modify `<Exec>` command syntax for consistency with other entries.
- Update `Start` method across game logic to include a configurable countdown parameter
- Adjust `RoundBasedGameTest` to reflect new countdown logic and validate state transitions during delayed starts
- Modify `PlayerJoinGameStartListener` to pass a 5-second countdown when starting the game
- Update `IGame` interface to support countdown parameter in `Start` method and revise documentation accordingly
- Rename `State.cs` in `TTT.Game` without modifying its content.
- Register `IGameManager` with `GameManager` implementation in `TTT.Test/Startup.cs`.
- Add new tests for joining games in `JoinStartTest.cs` to handle state transitions and messaging.
- Update logic in `RoundBasedGame.cs` to notify players of countdown interruptions and handle insufficient players during round start.
- Add `State` property to `IGame` interface and fix formatting in `TTT.Api/IGame.cs`.
- Simplify `DetectiveRole` constructor logic and clean up formatting in `TTT.Game/Roles/DetectiveRole.cs`.
Update coverage file path in GitHub Actions workflow
- Update the file path in `.github/workflows/dotnet.yml` to use a specific coverage file instead of a generic pattern.
- Update `.github/workflows/dotnet.yml` to streamline the test job by removing the dependency restoration step and unused commented-out build step, and adding quotes around the test command for consistency.
```
- Update `TTT.Api.csproj` to target .NET 8.0, add GitVersion.MsBuild reference, and retain existing package references.
- Modify `.github/workflows/dotnet.yml` to split test and build jobs, report code coverage, and introduce conditional tasks.
- Add code coverage badge to `README.md` and improve formatting.
- Remove debug-related properties and add GitVersion.MsBuild reference in `TTT.Game.csproj` and `TTT.CS2.csproj`.
- Clean up unused imports and update namespaces in `IPlayerConverter.cs` and other listener files to align with `TTT.Api.Player`.
```
```
- Remove "tools" and "GenerateGitVersion" projects from TTT.sln and their associated configuration and mappings.
- Update TTT.Plugin.csproj with improved publish configuration, including new properties, versioned ZIP output, and refined file handling.
- Disable debug symbols and set debug type to none in TTT.CS2.csproj.
```
- Fix formatting in `nightly.yml`
- Update `dotnet.yml` with enhanced `actions/checkout` configuration, including `fetch-depth` set to 0, enabled `fetch-tags`, and `show-progress`.
```
Add new features, interfaces, and improve dependency injection across multiple components
- Update `IGameManager` interface to include the `ActiveGame` property and `CreateGame` method.
- Add `DelayAsync` method to the `IDelayer` interface for asynchronous delays utilizing `TimeSpan`.
- Implement dependency injection for `IOnlineMessenger`, `IRoleAssigner`, and `TestScheduler` in `TTT.Test/Startup.cs`.
- Enhance `FakeMessenger` to implement `IOnlineMessenger` and update messaging logic with stricter type validation and new methods.
- Modify `removePlayer` logic in `FakePlayerFinder` to use `Id` for player matching, with improved filtering via `RemoveWhere`.
- Register `IScheduler` in `TTTServiceCollection` and restructure module loading logic in `TTT.Plugin/TTT.cs`.
- Update `IGame` interface to make `Start` method return an `IObservable<long>` for reactive support.
- Implement new tests in `RoundBasedGameTest` to cover game state transitions based on players and delays.
```
| Microsoft.Reactive.Testing | 6.0.1 | Expression | MIT | https://licenses.nuget.org/MIT | Copyright (c) .NET Foundation and Contributors. | .NET Foundation and Contributors | https://github.com/dotnet/reactive |
| System.Reactive | 6.0.1 | Expression | MIT | https://licenses.nuget.org/MIT | Copyright (c) .NET Foundation and Contributors. | .NET Foundation and Contributors | https://github.com/dotnet/reactive |
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.