Refactor configuration initialization and improve code readability across multiple modules
- **GameHandlers/RoundStart_GameStartHandler.cs**: Change `config` initialization to a property to streamline retrieval and improve formatting for better readability.
- **Shop/Items/Traitor/C4/C4ShopItem.cs**: Refactor `config` to enable lazy loading through the Service Provider and remove the `readonly` keyword.
- **Karma/KarmaStorage.cs**: Simplify code by removing the lazy-loaded property `_configStorage` and directly using `_config`.
- **Game/RoundBasedGame.cs**: Implement lazy loading for configuration retrieval, update player initialization logic, and improve method structure for clarity.
- **Shop/Listeners/RoleAssignCreditor.cs**: Change `config` to a read-only property for lazy loading and enhance performance with delayed instantiation.
Implement AFK Management and Enhance Reward and Purchase Systems
- **TTTConfig.cs**: Add `CheckAFKTimespan` configuration to manage player inactivity during game rounds.
- **HealthshotConfig.cs**: Introduce `MaxPurchases` property to limit healthshot item usage per player.
- **Command/Test/TestCommand.cs**: Implement "reload" sub-command with permission checks for restricted execution.
- **CS2ServiceCollection.cs**: Integrate `AfkTimerListener` for handling inactive players and remove conditional compilation for `TestCommand`.
- **Listeners/AfkTimerListener.cs**: Develop an AFK detection system, moving idle players to spectator mode and issuing warnings.
**Additional updates:**
- **ReloadModule.cs**: Implement class to handle reloading of modules with user feedback and error handling.
- **CS2/lang/CS2Msgs.cs**: Add message templates for AFK warnings and notifications.
- **RoundTimerListener.cs**: Streamline TTTConfig access and remove redundant scheduler handling.
- **TeamChangeHandler.cs**: Enhance team change logic with new dependencies and player checks.
- **ShopConfig.cs**: Rework reward distribution system, introducing flexible reward ranges and removing the old fixed interval configuration.
- **HealthshotItem.cs**: Implement purchase tracking and finalize configurations for purchase limits.
- **PeriodicRewarder.cs**: Split reward and update timers, integrate player position tracking, and enhance reward calculation logic based on player movement.
- **GameHandlers/LateSpawnListener.cs**: Add game state checks to improve player respawn logic during specific states.
- Increase the price of camo configuration in `CamoConfig.cs` from 55 to 75
- Add `CS2CamoConfig` behavior to `CS2ServiceCollection.cs` for extended configuration options
- Update logic in `PlayerKillListener.cs` to enhance role-based kill classification by checking differing roles
- Introduce `CS2CamoConfig.cs` with configuration variables for camo items and player visibility
- Adjust starting credits in `CS2ShopConfig.cs` for Innocents, Traitors, and Detectives
- Reduce interval reward amount for credits in `ShopConfig.cs` from 8 to 5
Refactor configuration initialization for improved code readability and maintainability
- Update `PoisonSmokeListener.cs` to use a property for `PoisonSmokeConfig` initialization, adding conditional access and null-coalescing logic.
- Adjust `KarmaConfig.cs` to reduce karma gain values, affecting end-of-round and winning scenarios.
- Refactor `HealthshotItem.cs`, using an expression-bodied property for `config` to enhance code clarity.
- Enhance `ArmorItem.cs` with lazy loading for `ArmorConfig` by transitioning `config` to a property using an expression-bodied member.
- Modify `PeriodicRewarder.cs` to initialize `ShopConfig` using a property, ensuring fallback configuration with unchanged core logic.
Other file changes focus on transitioning configuration retrieval to properties, promoting lazy loading and streamlined expressions across items and listeners, thereby refining consistency and readability throughout the codebase.
```markdown
Implement player muting feature and enhance game mechanics
- Add `RTD_MUTED` message in `RtdMsgs.cs` utilizing the existing message creation method.
- Enhance `PlayerMuter.cs` by checking game state before muting players and implementing event handler to unmute players when the game finishes.
- Update `TraitorChatHandler.cs` to handle muted players in chat and prevent dead players from participating in traitor chat.
- Introduce `MuteReward` class in `MuteReward.cs` to mute players for the next round and manage muted player voice events.
- Modify `RewardGenerator.cs` to include `MuteReward` and adjust reward probabilities, enhancing the reward system.
These changes collectively introduce and integrate a system for managing player muting, ensuring robust gameplay dynamics and clarity for players during active game sessions.
```
Introduce RTD Project and Enhance Codebase with Localization and Config Improvements
- Introduce a new RTD project with multiple enhancements to reward and command systems:
- Add new interfaces and classes for `IRtdReward`, `IRewardGenerator`, and several types of rewards like `ShopItemReward`, `CreditReward`, `HealthReward`, and `WeaponReward`.
- Implement new command functionality through `RtdCommand` and `RtdStatsCommand`.
- Strengthen the code architecture by refactoring configuration access:
- Convert `config` fields to properties using expression-bodied members across various items and listeners, promoting improved readability and potential lazy loading.
- Integrate localization features:
- Add and standardize import statements for `TTT.Game.lang` to support upcoming language and localization developments across different game modules.
- Create new language configuration files, like `en.yml`, and introduce classes such as `RtdMsgs` for localized message handling.
- Improve game mechanics:
- Enhance poison effect handling within `PoisonShotsListener` with periodic damage application and improved player interaction updates.
- Extend the `IIconManager` to offer additional player visibility options, enhancing game dynamics through methods like `RevealToAll`.
- Optimize plugin and module management:
- Add logging features with `ShopPurchaseLogger` and new logging statements for plugin module registration.
- Ensure cohesive project structure by updating project files and solution configuration for the new RTD module.
- Refactor utility and helper functions for better clarity:
- Introduce utility classes like `WeaponTranslations` to map internal to user-friendly weapon names.
- Clean up and streamline namespaces for clarity and consistency, especially within utilities like `GrenadeDataHelper`.
This commit collectively enhances the system's modularity, readability, and capability for future localization and extensibility.
- Change `killedWithStation` data structure to `Dictionary` for enhanced player interaction tracking in `DamageStation.cs`
- Update `PoisonShotsListener.cs` to use `Dictionary` for poison kill tracking and adjust related logic
- Specify priority levels for event handlers in `GlovesListener.cs` to optimize execution order
This PR implements a comprehensive set of game balancing changes, bug fixes, and new features for a Trouble in Terrorist Town (TTT) game mode in Counter-Strike 2.
Key Changes:
Shop item pricing rebalance: Adjusted prices across multiple traitor and detective items to improve game economy balance
New cluster grenade item: Added a new traitor shop item that splits into multiple grenades on detonation
Compass system refactor: Split the single compass into two separate items (player compass and body compass) with a shared abstract base class
Karma system improvements: Updated karma calculation values and added proper storage/disposal patterns
Bug fixes: Fixed damage application, ragdoll spawning, and team change handling issues
Refactor and Enhance Gameplay Mechanics
- Remove unnecessary type checks and modify logic for handling victim HP in `OneHitKnifeListener`.
- Add configurable properties in `HealthStationConfig` for improved control over healing behavior.
- Enhance `BodySpawner` with optional parameters and improve code readability for ragdoll management.
- Simplify array initialization and item sorting logic in `BuyCommand`.
- Refactor health-related variables and update sound effects in `HealthStation` to standardize behavior.
- Introduce `DealPoisonDamage` method and utility imports in `PlayerExtensions` for improved poison damage handling.
- Implement tracking and handling of poison-related events in `PoisonShotsListener` and `PoisonSmokeListener`.
- Update `DamageStation` with tracking mechanisms and improved health adjustment logic.
- Enhance item search logic in `GiveItemCommand` and introduce `DebugMessage` management in `CS2ServiceCollection`.
- Revise communication consistency in `lang/en.yml` and add `DebugMessage` class for handling debug scenarios.
- Streamline damage handling and weapon verification in `DeagleDamageListener`.
- Increase the price of the Poison Smoke item in `PoisonSmokeConfig.cs` from 30 to 35 and ensure a newline at the end of the file.
- Reduce the price of the gloves in `GlovesConfig.cs` from 65 to 50.
- Refactor `BuyMenuHandler.cs` to improve command management and handling robustness.
- Reduce the default price of armor in `ArmorConfig.cs` from 80 to 60.
- Adjust prices in various Traitor and Detective configurations, including `C4Config.cs`, `PoisonShotsConfig.cs`, and `StickersConfig.cs` for better game balance.
```
- Add section for `CHEGrenadeProjectile_CreateFunc` in gamedata for new grenade functionality
- Update BuyMenuHandler to recognize "weapon_hegrenade" alias for purchase process
- Enhance ClusterGrenadeListener to implement multi-projectile detonation logic and remove unused fields
- Introduce `GrenadeDataHelper` class for handling grenade projectile creation
- Extend ClusterGrenadeConfig with `UpForce` and `ThrowForce` properties for customization
```
- Increase the price of the One-Shot Deagle item in CS2OneShotDeagleConfig.cs from 100 to 110.
- Reduce item prices in CamoConfig.cs and Detective/DnaScannerConfig.cs, adjusting the game's economy and item valuation.
- Introduce the Cluster Grenade item in ClusterGrenadeItem.cs and implement its related services.
- Create ClusterGrenadeListener.cs to handle events and dependencies for cluster grenades.
- Add the Cluster Grenade item description in en.yml.
- Reduce the price of HealthStationConfig.cs to improve affordability and balance.
- Update BodyPaintConfig.cs to allow for increased usage flexibility.
- Add new configuration for the traitor shop's Cluster Grenade in Traitor/ClusterGrenadeConfig.cs.
- Add the Cluster Grenade to the shop services and adjust service ordering in ShopServiceCollection.cs.
Implement New Compass Item System and Remove Legacy CompassItem
- Remove `CompassItem.cs`, eliminating the legacy radar-like compass functionality for traitors and any associated gameplay mechanics.
- Introduce `InnoCompassItem` class, providing role-specific target identification and implementing extension methods for service collection integration.
- Add `AbstractCompassItem` class as a base for compass-related items, including periodic updates, abstract methods for target logic, and a visual compass display.
- Split and rename `AddCompassServices` to `AddInnoCompassServices` and `AddBodyCompassServices` in `ShopServiceCollection.cs` for better service management.
- Update `CompassMsgs.cs` by refining message identifiers and adding new instances to support expanded in-game functionalities.
- Enhance `StationItem` object spawning logic for more accurate placement based on player orientation.
- Amend `en.yml` to include "Body Compass" item details and adjust existing labels for clarity and consistency.
- Implement `BodyCompassItem` class, extending abstract compass functionality for detective roles, with methods for ownership checks and target retrieval.
```
- Add JetBrains.Annotations to PlayerStatsTracker and annotate methods with [UsedImplicitly] to enhance code quality and maintainability.
- Reorder logic in CombatHandler's `OnPlayerDeath_Pre` to ensure necessary operations are executed before checking game state.
- Move `info.DontBroadcast` setting in CombatHandler to occur only when game is in progress.
- Modify operation sequence in `OnPlayerDeath_Pre` to spoof player status before dispatching death event.
- Clarify comment in `OnPlayerHurt` method in CombatHandler for better understanding on non-Windows platforms.
```
- Introduce `PlayerMuter` class in `GameHandlers` for muting dead players and send appropriate messages
- Add `PlayerMuter` behavior to `CS2ServiceCollection` and organize mod behaviors
- Remove unnecessary debug print and simplify logic in `SilentAWPItem`'s `onWeaponSound` method
- Add reminder message in `en.yml` for dead players indicating they cannot be heard
- Add `DEAD_MUTE_REMINDER` message in `CS2Msgs.cs` to notify muted dead players
- Change dictionary key types from `IOnlinePlayer` to `string` in `ListCommand` for consistency, using `executor.Id` as the key.
- Update method calls in `ListCommand` to align with new dictionary key types.
- Update `silentShots` dictionary in `SilentAWPItem` to use player IDs (`string`) instead of `IOnlinePlayer` objects.
- Modify `OnPurchase` method in `SilentAWPItem` to handle weapon management asynchronously.
- Add server logging for debug messages in `SilentAWPItem`.
- Update the traitor chat format label to pluralize "TRAITOR" to "TRAITORS" in `en.yml`
- Replace `ChatHandler` with `TraitorChatHandler` in `CS2ServiceCollection.cs` to enhance focus on traitor-specific chat functionality
- Rename `ChatHandler` to `TraitorChatHandler` and update to manage traitor roles in `ChatHandler.cs`
- Ensure message processing occurs only if the game is in progress or finished in `ChatHandler.cs`
- Modify command message handling in `ChatHandler.cs` to strip backslashes from messages
- Add new message format function for traitor chat in CS2Msgs.cs
- Update ChatHandler.cs with new API modules and role-checking logic
- Modify onSay method in ChatHandler.cs to support traitor message formatting
- Add new chat format specification for traitors in en.yml
```
Enhance logging and visibility management in game commands and role handling
- Update `LogsCommand.cs` to integrate messaging and localization with `IMessenger` and `IMsgLocalizer`, and conditionally adjust player visibility using `IIconManager`.
- Add new localized message in `GameMsgs.cs` for player's log viewing activity, using player's name.
- Overload `SetVisiblePlayers` in `IIconManager.cs` to increase flexibility by accepting an `IOnlinePlayer` object.
- Implement `SetVisiblePlayers` in `RoleIconsHandler.cs` to improve player visibility and role management, and integrate rules for specific roles like `DetectiveRole` and `TraitorRole`.
- Modify `en.yml` to include a log message for when a player views logs alive.
```
```
- Improve player respawn logic in RoundTimerListener for better team handling and secure timer disposal.
- Enhance initial setup and end game logic in RoundBasedGame with robust role assignment, game state checks, and localization support.
- Increase default Healthshot item price in HealthshotConfig.
```
- Change dependency injection lifetime for services implementing `TExtension` from scoped to singleton in `ServiceCollectionExtensions.cs`
- Register `ITerrorModule` as a transient service in `ServiceCollectionExtensions.cs`
- Replace `Dictionary<IPlayer, int>` with `ConcurrentDictionary<string, int>` in `KarmaStorage.cs` for thread-safe operations.
- Introduce caching logic with semaphore for serialized writes in `KarmaStorage.cs`.
- Add periodic data flushing mechanism to the database with improved error handling in `KarmaStorage.cs`.
- Seal `KarmaStorage` class to prevent inheritance and ensure configuration loading precedes database operations.
- Improve error handling with logging and ensure reliable database connections in `KarmaStorage.cs`.
- Enhance thread safety and performance in `FlushAsync` and `Write` methods, improving idempotency and preventing race conditions.
- Increase robustness with null checks, additional validations, and modular code separation in `KarmaStorage.cs`.
```
- Introduce `IItemSorter` interface across multiple components to enhance item sorting capabilities in shop commands.
- Enhance `ListCommand` with caching mechanisms, improved sorting logic, and item formatting adjustments for better performance and usability.
- Implement `PlayerPingShopAlias` for enhanced player interaction, including command listeners and shop command processing tied to player actions.
- Set default price for Silent AWP in `SilentAWPConfig` to standardize item pricing.
- Conduct significant cleanup and optimization in `PoisonShotsListener` to improve gameplay experience and reduce unnecessary debug messages.
```
```
- Increase delay time in KarmaListenerTests to ensure proper karma update processing.
- Change `Event` class from abstract to concrete, and modify `Id` property implementation.
- Adjust CS2GameConfig timing settings for more balanced gameplay.
- Enhance PoisonShotsListener functionality with player health parameters and item removal.
- Make SimpleLogger methods virtual to improve subclass flexibility.
- Implement new logging capabilities in CS2Logger with Serilog integration.
- Enhance GiveItemCommand with new event handling for item purchases.
- Update DeagleTests for accurate simulation of weapon damage.
- Modify PlayerDamagedEvent structure for more precise damage calculations.
- Improve DamageStation logic to align with new damage handling.
- Refactor DamageCanceler for better code organization and cross-platform support.
```
- Change database connection string constant name for consistency in `CS2KarmaConfig.cs`
- Extend description of minimum karma for clarification of its impact
- Refine descriptions of player actions related to karma for improved clarity
- Rename karma-related constants to generic terms for simplicity
- Introduce configurable warning window for low karma to prevent repeat warnings
- Add configurable karma delta values for in-game actions
- Update Load method to include new karma-related configurations
```
- Add detailed XML documentation comments to `KarmaConfig.cs` to improve code understanding and maintainability.
- Remove the default value of `MinKarma` in `KarmaConfig.cs`, making it a mandatory setting.
- Introduce new properties in `KarmaConfig.cs` for handling different karma scenarios in player interactions.
- Add a dependency on `TTT.API.Storage` in `KarmaListener.cs` for loading configurations.
- Replace hardcoded karma values in `KarmaListener.cs` with configurable options, enhancing flexibility and adaptability.
```
- Update `DeagleDamageListener.cs` to enhance type safety and address edge cases related to item removal and friendly fire logic.
- Improve the purchase validation logic in `Stickers.cs` using a type-specific item check.
- Refactor `Shop.cs` to use generic type parameters in item removal methods, enhancing type safety.
- Simplify `IShop.cs` by removing default implementations and focusing on type-based item checks.
- Enhance overall code clarity and maintainability with type-specific method improvements.
```
- Introduce validation to `EventBus` listener methods to enforce `void` return type and enhance exception messaging for parameter constraints.
- Refactor `RoleAssignCreditor` to simplify execution path by making `OnRoleAssign` synchronous and handling asynchronous operations with `Task.Run`.
```
- Remove asynchronous calls and convert to synchronous dispatch in multiple files, improving performance and reducing complexity.
- Refactor `RoundBasedGame.cs` to enhance game state management, implement team victory determination, and ensure resource disposal.
- Update `IEventBus.cs` and `EventBus.cs` to change the dispatch method to synchronous operation, altering method return types.
- Modify karma-related tests and storage in `KarmaListenerTests.cs`, `KarmaStorage.cs`, and `MemoryKarmaStorage.cs` to reflect synchronization changes, ensuring correct behavior.
- Refactor `EventModifiedMessenger.cs` to improve message handling by switching to synchronous calls.
- Implement new karma penalty logic in `KarmaListener.cs` for certain actions, adjusting the handling and calculations of karma.
- Implement Silent AWP item functionality with
`SilentAWPServiceCollection` and `SilentAWPItem` class for `TraitorRole`
- Add Silent AWP shop item and related localized texts in `en.yml`
- Define message constants for Silent AWP in `SilentAWPMsgs.cs` for
internationalization
- Modify `GiveItemCommand.cs` to incorporate `OnPurchase` logic for item
purchases
- Manage player validity in `CS2AliveSpoofer.cs` by removing players
with null handles
- Enhance player detail replies in `IndexCommand.cs`
- Introduce messaging functionality in `BaseItem.cs` and use via
`Messenger` field
- Add Silent AWP service integration in `ShopServiceCollection.cs` and
`Traitor` config in `SilentAWPConfig.cs`
- Implement Silent AWP item functionality with `SilentAWPServiceCollection` and `SilentAWPItem` class for `TraitorRole`
- Add Silent AWP shop item and related localized texts in `en.yml`
- Define message constants for Silent AWP in `SilentAWPMsgs.cs` for internationalization
- Modify `GiveItemCommand.cs` to incorporate `OnPurchase` logic for item purchases
- Manage player validity in `CS2AliveSpoofer.cs` by removing players with null handles
- Enhance player detail replies in `IndexCommand.cs`
- Introduce messaging functionality in `BaseItem.cs` and use via `Messenger` field
- Add Silent AWP service integration in `ShopServiceCollection.cs` and `Traitor` config in `SilentAWPConfig.cs`
- Add new configuration fields in CompassConfig.cs to customize compass FOV and length
- Implement maximum range check and refactor angle calculations in CompassItem.cs
- Update distance descriptions in CompassItem.cs for thematic clarity
- Enhance code readability and maintainability in CompassItem.cs through refactoring
- Enhance `CompassItem` in `CompassItem.cs` with refined enemy detection, directional compass, and improved documentation.
- Add `TextCompass` utility class in `TextCompass.cs` featuring static method for compass line generation with direction normalization and cardinal placements.
```
Introduce Compass Item for Traitor Role
- Add a new configuration file `CompassConfig.cs` for the traitor-exclusive compass with default settings, including a price of 70 and a maximum range of 10,000.
- Integrate the `Compass` service into the shop by updating `ShopServiceCollection.cs` to support the new item.
- Extend `BaseItem.cs` with additional dependencies for game management, enhancing item functionality.
- Update localization in `en.yml` to include the "Player Compass" item, ensuring descriptions and structure accommodate the new addition.
- Create `CompassMsgs.cs` to manage compass-related messages with `SHOP_ITEM_COMPASS` and `SHOP_ITEM_COMPASS_DESC` for localization.
- Enhance vector handling in `VectorExtensions.cs` by adding nullability checks and support for nullable objects.
- Implement `CompassItem.cs` to support traitor-specific gameplay features like real-time radar updates and enemy tracking.
```
```
- Update PlayerKillListener to modify balance adjustments and simplify kill log messages.
- Add TeamChangeHandler to CS2ServiceCollection for managing team changes.
- Introduce TaseRewarder to ShopServiceCollection, enabling taser damage event handling.
- Make RoleAssignCreditor asynchronous and integrate karma-based credit adjustments.
- Update SpectatorRole assignment logic with new IRoleAssigner dependency.
- Make player parameter nullable in KarmaConfig's MaxKarma method.
- Refactor BuyListener to remove server chat notifications and streamline armor setting.
```
- Update `KarmaStorage.cs` to increase karma update frequency and integrate Counter Strike features.
- Enhance `CS2ServiceCollection.cs` with new `BuyListener` behavior for handling purchase activities.
- Add `GetArmor` method in `PlayerExtensions.cs` to retrieve player armor and helmet status.
- Implement `BuyListener.cs` to manage player purchases, logging, and inventory adjustments.
- Simplify `PlayerDamagedEvent` instantiation by removing an unused parameter in `DeagleTests.cs` and `PlayerActionsTest.cs`.
- Update `HpLeft` calculation in `PlayerDamagedEvent.cs` to use a new formula for determining remaining health, improving damage calculation accuracy.
- Enhance debugging in `PoisonShotsListener.cs` by adding debug logs and null checks for more reliable damage event tracking.
- Refactor tests in `DeagleTests.cs` to verify unique item kill behavior after the first use.
- Simplify `PlayerDamagedEvent` constructor and update health calculations for clarity and consistency.
- Add context to damage events in `DamageStation.cs` by including weapon property and streamline damage calculation logic.
- Enhance `PoisonShotsListener.cs` with localization support for weapon names, improve poison effect handling, and cleanup code for better maintainability.
- Refactor `OneHitKnifeListener` to set victim's health directly to zero for simplified one-hit kill logic.
- Add `PlayerDamagedEvent` in `DamageStation` to allow external interference in damage calculation and consider event modifications.
- Streamline `PlayerDamagedEvent` class by refactoring damage calculation logic and removing unnecessary properties and fields.
- Update `PoisonShotsListener` to include dependency on `IEventBus`, enhance poison effects, and dispatch relevant events such as `PlayerDamagedEvent` and `PlayerDeathEvent`.
- Remove `DamageEventTest` class, indicating a refactor or change in damage event management/testing strategy.
```
- Update DamageStation.cs to enhance event handling and player interaction:
- Integrate `IEventBus` for event dispatching.
- Improve `onInterval` to provide health boosts, handle player deaths, and ensure sound commands are issued post-death event.
- Modify RoundBasedGame.cs to increase class extensibility:
- Update variable access levels and rename to maintain consistency.
- Adjust OneHitKnife.cs to change service registration approach and extend functionality.
- Enhance DamageCanceler.cs with OS-specific cleanup logic and streamlined damage handling.
- Update OneHitKnifeListener.cs for improved damage calculation and to incorporate JetBrains annotations.
- Simplify station tracking and ownership in StationItem.cs and StationInfo.cs.
- Introduce EmitSoundCommand.cs to expand command module functionality.
```
```
Refactor and optimize multiple components
- Remove obsolete attributes and unused dependencies in `IEventBus.cs`, `KarmaListener.cs`, `KarmaSyncer.cs`, and `ICommandManager.cs` to clean up code and improve maintainability.
- Enhance asynchronous event handling in `EventModifiedMessenger.cs` by integrating `await` for dispatch operations, improving consistency in message processing.
- Refine `CombatHandler.cs` logic with improved null-checking and better statistics handling, enhancing robustness during player events.
- Enable caching by default in `KarmaStorage.cs`, and update karmas asynchronously to boost performance.
- Simplify `Game/RoundBasedGame.cs` by removing unnecessary dependencies and improving state management and role assignment logic, enhancing game flow control.
```
- Add new shop item "One-Hit Knife" with description in `en.yml`
- Introduce `OneHitKnifeMsgs` class for handling localization messages related to "One-Hit Knife" item
- Implement `OneHitKnifeListener` class to handle game events for the "One-Hit Knife" item functionality
- Create `OneHitKnife` class, extending the item functionality for the `TraitorRole` with service integration
- Update `ShopServiceCollection.cs` to include "One-Hit Knife" in the item collection and shop services
- Add `OneHitKnifeConfig.cs` to define configuration settings including price and friendly fire options for the "One Hit Knife" feature
Implement enhanced Karma system functionalities and refactorings
- Update `KarmaConfig.cs` to make properties non-virtual and add immutability with "init" accessors, and introduce new configuration properties to support additional karma functionalities.
- Add `KarmaSyncer` behavior to `CS2ServiceCollection.cs` for managing Karma-related synchronization tasks.
- Enhance `SpectatorRole.cs` with an `OnAssign` method to facilitate role assignments and automatically convert players to spectators when needed.
- Filter player assignments in `RoundBasedGame.cs` to include only specific roles and refine non-traitor calculations to only consider assigned players.
- Introduce a comprehensive `KarmaSyncer` class in `Listeners/KarmaSyncer.cs` for managing Karma synchronization, including event handling for Karma updates and safe operations checks.
- Refactor `CS2KarmaConfig.cs` by simplifying structure, adding descriptive updates, and altering command usages related to Karma configurations.
- Remove `KarmaSyncer.cs` from `GameHandlers` to accommodate code restructuring and potential modality changes for player data management.
- Refactor and expand methods in `KarmaMsgs.cs` to adopt simpler expression-bodied syntax and create structured warning messages.
- Introduce dependency checks and reward temporal conditions in `PeriodicRewarder.cs` to ensure balanced issuance aligns with game progression.
- Enhance `KarmaBanner.cs` with new dependencies, tracking mechanisms, and advanced event handling for role assignments and karma-related notifications.
- Improve `KarmaListener.cs` by changing class inheritance, adding debugging capabilities, and switching to batch processing for Karma updates.
- Extend language file `en.yml` with additional warning messages targeting users with critically low Karma levels.
```
- Update TTT/Plugin/Plugin.csproj to target .NET 8.0 and add Microsoft.Data.Sqlite reference
- Enhance TTT/CS2/CS2ServiceCollection.cs with new KarmaBanner mod behavior
- Add TTT/Karma/lang/KarmaMsgs.cs for Karma language messages handling
- Introduce configuration command in TTT/CS2/Configs/CS2KarmaConfig.cs for low karma actions
- Add old karma value property in TTT/Karma/Events/KarmaUpdateEvent.cs
- Implement KarmaBanner class in TTT/CS2/Listeners/KarmaBanner.cs for monitoring karma updates
- Develop new KarmaCommand class in TTT/Karma/KarmaCommand.cs for retrieving karma values
- Enhance TTT/Karma/KarmaStorage.cs with cache support and better SQL handling
- Introduce NameDisplayer OS check in TTT/CS2/GameHandlers/NameDisplayer.cs
- Add CommandUponLowKarma configuration in TTT/Karma/KarmaConfig.cs
- Register KarmaCommand in TTT/Karma/KarmaServiceCollection.cs
- Create English language file TTT/Karma/lang/en.yml for Karma messages
```
```
Implement Karma Configuration and Improve Event Handling
- Add `IStorage<KarmaConfig>` service registration in `CS2ServiceCollection`, enhancing support for karma configurations.
- Make `KarmaUpdateEvent` dispatch asynchronous in `KarmaStorage`, and improve error checking for database connections.
- Introduce `CS2KarmaConfig`, a new configuration class with settings for managing karma, including connection strings and value limits.
- Convert karma properties and methods to virtual in `KarmaConfig`, allowing for potential overrides in derived classes.
```
- Update `Karma.csproj` to include Microsoft.Data.Sqlite and SQLite packages.
- Refactor `KarmaSyncer.cs` by removing the unused `IPlayerFinder` initialization, adding the `UsedImplicitly` attribute, and streamlining player validation logic.
- Change database backend in `KarmaStorage.cs` from MySQL to SQLite.
- Define a default value for the `DbString` property in `KarmaConfig.cs`.
- Adjust service configuration in `KarmaServiceCollection.cs` by modifying `IKarmaService` registration and introducing `KarmaListener`.
**Summary**
This PR delivers a substantial TTT update that expands the shop, refines
gameplay flow, and improves player feedback. It adds multiple new items
with CS2-specific behavior, introduces a periodic reward system,
implements configurable sounds and full localization, and cleans up
internal command and event handling.
**Scope**
* 56 commits
* 117 files changed
* +2,518 −301
**Why**
* Broaden traitor and detective toolkits to increase strategic variety.
* Make messaging consistent and translatable.
* Reduce friction in command handling and event wiring.
* Close a set of outstanding issues.
**Highlights**
New items and features
* C4 item with CS2 configuration (resolves#79).
* M4A1 item and storage support (resolves#71).
* Traitor gloves item (resolves#81).
* Camouflage item with async fix.
* Poison shots with enhanced effects and feedback (resolves#75).
* Poison smoke (resolves#74).
* Armor item (resolves#67).
* Taser item (resolves#69).
* Healthshot and role reveal (resolves#98).
* Body Paint item and service registration with default config.
* Periodic reward system for players (resolves#97).
* Credits granted for kills and identifications with tuned penalties.
Player experience
* Configurable sound support.
* Full localization for commands and messages.
* Increased HUD font size and adjusted text positioning.
* Shop prefix and HUD tweaks. Skull hidden in HUD.
Core refactors
* Command execution support on main thread. Command structure
consolidated and clarified.
* Round timer and C4 event handling refactored. Old C4 listener logic
removed.
* Event namespaces and item handling reorganized.
* Name formatting utilities updated.
Stability and fixes
* Shop events now reliably fire.
* Role assignment logging corrected.
* Credits no longer overridden by balance clearer.
* Various cleanup, reformatting, and unused line removals.
Administrative
* Licenses updated for new dependencies and content.
* Multiple merges and resyncs with main to keep branch current.
**Configuration changes**
* New item configs: C4, M4A1, Gloves, Camouflage, Poison Shots, Poison
Smoke, Armor, Taser, Healthshot, Body Paint.
* Added localization keys for new messages, commands, and out-of-ammo
lines.
* Sound configuration is now user configurable.
* Station role behavior updated to support Poison Smoke changes.
**API and plugin touchpoints**
* Storage and plugin modules extended for M4A1Config.
* PlayerKillListener added and registered.
* BodyPaint service registered and applied by default where configured.
**Testing**
* Unit and runtime checks for:
* Shop purchase flows for each new item.
* Command execution on main thread and permission checks.
* Credits earn and clear at round transitions.
* Poison effects timing, damage application, particles, and feedback.
* HUD text size and positions across common resolutions.
* Localization fallback behavior for missing keys.
* Manual CS2 tests for C4 behavior and item equips.
* Verified shop events fire for buy, equip, and use.
```
Enhance poison effect management and resource disposal
- Improve resource management in `PoisonSmokeListener.cs` by ensuring proper disposal of poison smoke timers, clearing the timer list upon disposal, and ensuring termination of damage effects according to configuration settings. Remove unnecessary debug output for cleaner logs.
- Refactor `PoisonShotsListener.cs` to reset poison shot data and improve disposal logic. Enhance poison shot usage management and streamline game mechanics related to poison damage and effects, ensuring a more efficient game experience.
```
```
- Modify `DamageStation.cs` to check `_Config.TotalHealthGiven` before health comparison and improve `onInterval` method for better clarity and robustness.
- Enhance `ShopServiceCollection.cs` by adding `PeriodicRewarder`, introducing periodic rewards functionality.
- Update `StationConfig.cs` by setting `TotalHealthGiven` to 0 and increasing `StationHealth` from 100 to 1000, enhancing station durability.
- Implement `PeriodicRewarder.cs`, a new class for issuing periodic rewards to players using dependency injection and a timed approach.
- Introduce new properties `CreditRewardInterval` and `IntervalRewardAmount` in `ShopConfig.cs` to define frequency and amount of periodic rewards, supporting a new credit accumulation strategy.
```
Enhance Game Messaging and Item Functionality
- Update `GameMsgs.cs` to add new messages for role reveal on death and traitor reveal, ensuring consistency with message factory use.
- Add "Health Shot" item to `en.yml`, enhancing shop content with healing capabilities.
- Refine `RoundBasedGame.cs` to improve game state transitions, event handling, and winning team determination.
- Create `HealthshotConfig.cs` for configuring "Health Shot" item specifics, including pricing and weapon identifiers.
- Modify `BuyCommand.cs` to implement main thread execution and enhance item search logic for partial matches.
- Introduce `TraitorBuddyInformer` class to inform traitors of their allies during rounds.
- Expand `OutOfRoundCanceler.cs` logic to allow damage events in finished game states.
- Add `PlayerDeathInformer` class for revealing player killers, enhancing game event transparency.
- Introduce and register `HealthshotItem` within the shop, defining purchase logic and localized messaging.
- Remove redundant debug information from `PoisonSmokeListener.cs`, optimizing poison effect logic.
Introduce Poison Smoke Item and Enhance Role Configurations
- Create `CS2PoisonSmokeConfig.cs` to configure the new Poison Smoke item, defining parameters like price, damage, and sound effect.
- Update `CS2ServiceCollection.cs` to handle poison smoke configuration using new implementations.
- Add `PoisonSmokeMsgs.cs` to define messages for the Poison Smoke item, facilitating localization.
- Enhance `DamageStation.cs` with role management by excluding `TraitorRole` from damage and adding sound feedback.
- Implement `PoisonSmokeListener.cs` to manage poison smoke events with dependencies and scheduled effects.
- Refactor `StationItem.cs` to introduce a generic role parameter, increasing flexibility.
- Update `HealthStation.cs` to specify the detective role with the generic `StationItem`.
- Introduce new configuration files for the traitor's poison smoke in `Traitor/PoisonSmokeConfig.cs`, detailing item properties.
- Simplify `ListCommand.cs` by adjusting item formatting logic for consistency.
- Update `PoisonShotsListener.cs` to handle refined poison configurations.
- Create `PoisonSmokeItem.cs` to define and manage the Poison Smoke item with dependency injection and role restrictions.
- Increase default font size in TextSetting.cs for improved visibility
- Adjust world units per pixel in TextSetting.cs for better text scaling
- Modify text hat positioning in TextSpawner.cs relative to player’s rotation
- Enhance `BuyCommand` with usage guidance and unified query logic
- Improve `ListCommand` with async task handling, dependency injections, and enhanced filtering and sorting based on player roles and game state
- Introduce a shorthand alias for `ShopCommand` balance and add usage property for better command guidance
- Upgrade `RoleIconsHandler` event handling, visibility management, and hot-reload logic
- Implement standard pricing and new properties in Traitor and Detective configuration files; adjust color mapping for health display
- Improve player equality handling by implementing `IEquatable` in `CS2Player` and `IPlayer` classes
- Integrate `CounterStrikeSharp.API` in `BuyCommand.cs` for enhanced shop functionality.
- Refactor health color calculation in `HealthStationConfig.cs` to increase intensity as health increases.
- Revamp `CS2CommandManager.cs` with improved synchronous command processing and robust exception handling.
- Add `MustBeOnMainThread` property in `ICommand.cs` to manage command execution context.
- Update `ShopCommand.cs` to refine execution flow and description formatting.
- Revise logical comment and color calculation in `DamageStationConfig.cs` for correctness.
- Enhance clarity in `PlayerKillListener.cs` by refining event handling messages.
```
- Update `BalanceCommand.cs` to include message localization and update reply format
- Refactor `Shop.cs` logging methods and simplify item handling
- Enhance `ShopMsgs.cs` with message prefix logic and credit prefix determination
- Update `en.yml` with consistent shop prefix and add new balance display message
```
```
- Modify RoundShopClearer to reset balances and items only when the game state is "FINISHED"
- Add debug logging and correct logic in PlayerKillListener to improve event handling
- Comment out obsolete Roles property in TestPlayer
- Enhance debug logging and initialize item lists correctly in Shop
- Update BalanceClearTest with role-related imports and new test for role assignments
```
```
- Integrate Taser functionality into the Shop module by updating the `ShopServiceCollection.cs` to include the Taser item in the shop services.
- Add a new `TaserConfig` file to define default configurations for the taser item in `TTT/ShopAPI/Configs`.
- Update `en.yml` to include localization for the new Taser item with its description.
- Introduce `CS2TaserConfig` for advanced configuration management of taser items within the CS2 module, and integrate it into `CS2ServiceCollection.cs`.
- Implement the `TaserItem` class in `TTT/Shop/Items/Taser` along with the supporting `TaserMsgs` class for handling messages related to the taser in the shop.
```
```plaintext
Add comprehensive armor functionalities and improvements
- Introduce `ArmorConfig` class to configure shop items with default armor and helmet settings.
- Create `ArmorMsgs` class to handle message creation for armor-related items in the game.
- Enhance `PlayerExtensions` with new `SetArmor` method and improve `SetColor` handling and state management.
- Register armor services within `ShopServiceCollection` to integrate armor features into the shop framework.
- Refactor `RoundTimerListener` for improved readability and consistency in round-ending logic.
- Include "Armor with Helmet" in the language file with its description for better item localization.
- Develop `ArmorItem` class to manage armor items, incorporating configuration, purchase logic, and localization.
```
- Enhance `PoisonShotsListener.cs` by adding utility functions, refining weapon event handling, and improving player feedback with configurable effects and sounds.
- Update `PoisonShotMsgs.cs` to include personalized messages for poison hit events by leveraging the player's name.
- Refactor `GiveItemCommand.cs` for improved targeting and async item delivery, adding clearer command usage instructions.
- Add a new localization message in `en.yml` for poison shot hit feedback.
- Modify `PoisonShotsConfig.cs` to adjust damage interval and introduce configurable sound and color for poison effects.
- Remove event handler for item purchases in `BodyPaintListener` and enhance logic for body identification and use tracking
- Integrate `IPluginModule` interface in `PoisonShotsListener` and refactor poison shot handling to improve inventory management and dependency injection
- Update `PoisonShotsItem` to use specific configuration and storage mechanisms
- Register PoisonShots service in `ShopServiceCollection` to expand shop functionalities
```
- Add new configuration for poison shots in `Traitor/PoisonShotsConfig.cs` to manage properties like price, damage, and total shots.
- Implement `PoisonShotsListener` in the game to handle item usage, apply poison effects, and ensure resource management.
- Create `PoisonShotsItem` class to introduce a new item restricted to the Traitor role, integrating it with shop functionalities.
- Update `lang/en.yml` to include a new shop item description for "Poison Shots".
- Define message constants for poison shots in `PoisonShotMsgs.cs` to facilitate localization and UI display.
```
```
- Add descriptions and labels for "Body Paint" in English language file
- Update Detective's DNA Scanner and Sticker configurations for improved namespace specificity
- Implement BodyPaintMsgs class for handling body paint item messages
- Introduce BodyPaintListener for handling body paint purchase and usage events
- Restructure PlayerEvent files to align with new ShopAPI directory and namespace
- Add BodyPaintConfig for shop item configuration with default settings
```
- Adjust handling of round win conditions in `RoundTimerListener.cs` by adding commands to ignore and re-enable conditions during round end process; improve round end subscription logic and add `Dispose` method to clean up resources.
- Remove addition of `C4Listener` from the service collection in `C4ShopItem.cs`.
- Delete `C4Listener.cs`, removing event handlers for bomb-related events.
```
- Refactor `CS2Player.cs` to improve name formatting with `CreatePaddedName`, eliminating redundant methods and enhancing alignment.
- Integrate `C4Listener` into `C4ShopItem.cs` for improved C4 item handling in the shop.
- Comment out the `RoundEnd_GameEndHandler` registration in `CS2ServiceCollection.cs` to potentially defer its functional roles.
- Refactor `EndRound` method in `RoundUtil.cs` to utilize `VirtualFunctions.TerminateRoundFunc`, comment out obsolete implementations.
- Update `RoundTimerListener.cs` to incorporate `System.Reactive.Concurrency`, optimize round timing logic, and introduce resource disposal to prevent leaks.
- Implement `C4Listener.cs` to handle bomb events and announce activities, enhancing player communication.
- Simplify `StationItem.cs` by removing unused imports and redundant debug announcements while maintaining core functionality.
- Adjust `RoundBasedGame.cs` to ensure the game state is accurately set to `IN_PROGRESS` post player preparation, without changing game flow logic.
```
- Add support for M4A1Config storage in CS2ServiceCollection by including a new `AddModBehavior` for `IStorage<M4A1Config>`
- Implement a new configuration class for the M4A1 shop item in CS2M4A1Config with storage and plugin module interfaces
- Define static configuration variables with validators for price, clear slots, and associated weapons in CS2M4A1Config
- Implement plugin initialization methods and register fake config variables in CS2M4A1Config
- Load configuration in CS2M4A1Config, parsing clear slots and weapons from strings into arrays, with nullable type inference and asynchronous processing
```
- Refactor balance deduction in Shop.cs to use `AddBalance` method for improved consistency and added player notification for successful purchases.
- Enhance BuyCommand.cs by updating Execute method to return Task.FromResult, adding a health check, and modifying item search logic for better accuracy.
- Update PlayerKillListener.cs to extend from BaseListener, integrate ShopAPI, and add methods for handling on-kill and body identification events with balance adjustments.
- Use JetBrains.Annotations in RoleAssignCreditor.cs for potential external or reflective method use, adding UsedImplicitly attribute for OnRoleAssign method.
- Extend ShopMsgs.cs and en.yml with new purchase success messages including item names, improving player feedback.
```
- Add `CamouflageItem` class for managing camouflage items in the game
- Implement `AddCamoServices` in service collection extension for mod behavior
- Introduce configuration loading for camouflage settings with `IStorage<CamoConfig>`
- Provide localization for item name and description
- Implement purchasing logic: visibility settings and ownership check in `CamouflageItem`
- Add "Camouflage" item and description to the language file
- Expand shop services to include camouflage features via `AddCamoServices`
- Establish `CamoConfig` in `ShopAPI` with default pricing and visibility properties
- Create `CamoMsgs` class for managing camouflage item messages
- Add new "Gloves" item to traitor shop with localization and descriptions
- Allow modification of `Killer` property in `IBody.cs` for enhanced gameplay flexibility
- Reorganize configuration files under relevant directories for better clarity (e.g., HealthStationConfig, DnaScannerConfig)
- Introduce `GlovesListener` class to handle event-driven interactions for the "Gloves" item
- Implement traitor-specific configurations and services for items like C4 and gloves, including default pricing and usage limits
```
Add M4A1 Item to Shop with Configuration and Localization
- Add TTT/Shop/Items/M4A1/M4A1Msgs.cs to manage localized messages for the M4A1 item.
- Update TTT/Shop/lang/en.yml with a new shop item "M4A1 Rifle and USP-S" and its description.
- Modify TTT/Shop/ShopServiceCollection.cs to include M4A1 services and adjust service ordering for better organization.
- Introduce TTT/ShopAPI/Configs/M4A1Config.cs for setting up the M4A1 item configuration, including price and weapon slots.
- Create TTT/Shop/Items/M4A1/M4A1ShopItem.cs to define the M4A1 shop item with purchase and inventory management logic.
```
- Add C4Msgs class for localization of C4 shop item in the Traitor category
- Introduce C4ShopItem class with methods for purchase, limitations, and role restriction handling
- Update ShopServiceCollection to include C4 service for Traitor role
- Introduce C4Config class for configuration of C4 shop items with various properties
- Add English localization entry for "C4 Explosive" shop item with description
- Add configuration for `UseSound` property in `DamageStationConfig` and `HealthStationConfig`
- Implement localization support in `HealthStation.cs` by replacing hardcoded strings with localized messages
- Introduce `UseSound` abstract property in `StationConfig`
- Update localization files with new shop items and descriptions in `lang/en.yml`
- Create `StationMsgs.cs` to manage station-related item messages via a factory pattern
- Enhance `DamageStation.cs` for internationalization and configurable sound settings
- Annotate unused or implicitly used methods in `StickerListener.cs` with `[UsedImplicitly]`
```
- Integrate ShopAPI into various components including PlayerPurchaseItemEvent, DnaScanner, and multiple stations for improved shop functionalities.
- Introduce new HealthStationConfig and DamageStationConfig for configuring health and damage-related station items.
- Update CS2 project to target .NET 8.0 and enable advanced C# features, while removing outdated folder references for streamlined project structure.
- Correct namespace declarations across multiple files, enhancing consistency and organizational clarity within the codebase.
- Add new or updated commands and extensions, such as SetHealthCommand, to improve player health management and interaction.
- Enhance localization features by importing TTT.Game.lang across various roles, commands, and logging implementations.
- Incorporate new logic in DNA scanning and station interactions, including damage dealing and healing over time based on player proximity.
```
```
- Integrate ShopAPI into various components including PlayerPurchaseItemEvent, DnaScanner, and multiple stations for improved shop functionalities.
- Introduce new HealthStationConfig and DamageStationConfig for configuring health and damage-related station items.
- Update CS2 project to target .NET 8.0 and enable advanced C# features, while removing outdated folder references for streamlined project structure.
- Correct namespace declarations across multiple files, enhancing consistency and organizational clarity within the codebase.
- Add new or updated commands and extensions, such as SetHealthCommand, to improve player health management and interaction.
- Enhance localization features by importing TTT.Game.lang across various roles, commands, and logging implementations.
- Incorporate new logic in DNA scanning and station interactions, including damage dealing and healing over time based on player proximity.
```
- Add a new message for item not found in `en.yml` to enhance user error feedback
- Clean up `GiveItemCommand.cs` by importing `TTT.Locale` and removing debug messages
- Improve `CS2AliveSpoofer.cs` readability with better conditional logic and early return handling
- Enhance `BuyCommand.cs` by removing redundant searches and utilizing localization for consistency
- Change `DecayTime` in `DnaScannerConfig.cs` from 3 minutes to 10 seconds for faster testing
- Clean up `ShopAPI.csproj` by removing redundant project references.
- Remove the DNA Scanner item and its description from the English language file in `Shop`.
- Streamline `DnaScanner.cs` by eliminating an unnecessary using directive.
- Enhance `DnaListener.cs` to improve messaging logic with role information and implement new message templating for DNA scans.
- Refactor `DnaMsgs.cs` by adjusting namespaces and adding message properties for enhanced DNA scan functionalities.
- Update `CS2.csproj` by removing a duplicate project reference.
- Expand `en.yml` in `CS2` with translations for DNA scanner items and messages for DNA scanning, including specific scenarios involving suicide.
- Extend functionality in `DnaListener.cs` by adding dependency injection and enhancing the `OnPropPickup` event handler with player and body checks.
- Add `TimeOfDeath` property to `CS2Body.cs` for improved tracking of body creation time.
- Introduce `DnaScannerServiceCollection` in `DnaScanner.cs` for better service management and mod behavior registration.
- Extend `IBody` interface with `TimeOfDeath` to track deceased player identification time.
- Update `ShopServiceCollection.cs` to integrate `AddDnaScannerServices`, enhancing shop capabilities with DNA scanner features.
```
- Rename and reorganize directories for DNA-related items to new path under "CS2/Items/DNA"
- Relocate RoleRestrictedItem.cs while maintaining its original functionality
- Move and update DnaListener.cs with a low-priority event handler and add an execution order comment
- Rename BaseItem.cs file path as part of project structure reorganization
- Update CS2.csproj by adding "Items\" folder and correcting duplicate project reference
```
```
- Rename property `Name` to `Id` across various commands and classes for consistency and clarity, affecting files like `Test/SetRoleCommand.cs`, `GameHandlers/KarmaSyncer.cs`, and `Command/Test/TestCommand.cs`.
- Add new interface `IIconManager` to manage player visibility with methods for handling up to 64 players using a bitmask in `API/Player/IIconManager.cs`.
- Introduce `ShowIconsCommand` and `IndexCommand` classes to enhance game command functionality, leveraging the new `IIconManager` for icon management.
- Implement a new shop item "Stickers" with associated classes `Stickers.cs`, `StickerListener.cs`, and `StickerMsgs.cs`, providing role-revealing capabilities for detective players.
- Refactor shop item and command structures to use a new `BaseItem` abstract class, enhancing code organization and inheritance patterns.
- Update logging in `Plugin/TTT.cs` to use `Id` instead of `Name` for module identification, standardizing log outputs.
- Adjust visibility and color duration settings in `Listeners/ScreenColorApplier.cs` for improved gameplay feedback.
- Refactor service registration and command handling to remove redundancies and improve icon manager integrations in files like `CS2ServiceCollection.cs` and `Command/Test/ScreenColorCommand.cs`.
```
- Add new localized messages for shop interactions in `TTT/Shop/lang/en.yml`
- Implement `PurchaseResultExtensions` in `TTT/Shop/Shop/PurchaseResult.cs` to translate purchase outcomes to user-friendly messages
- Streamline and optimize purchase process in `TTT/Shop/Commands/BuyCommand.cs`
- Localize error messages and improve test setup in `TTT/Test/Shop/Commands/BuyTest.cs`
- Update `TTT/Shop/Shop.cs` to use localized messages and enhance error handling logic
```
- Introduce a new configuration variable in `CS2OneShotDeagleConfig.cs` to determine if the shooter should be killed upon friendly fire, and update the `Load` method accordingly.
- Add a static message `SHOP_ITEM_DEAGLE_HIT_FF` in `DeagleMsgs.cs` for handling new Deagle functionality messages.
- Rename "One-Hit Deagle" to "One-Hit Revolver" in `en.yml` and update description and messages for consistency.
- Refactor friendly fire logic in `DeagleDamageListener.cs` by integrating nested conditions and simplifying weapon verification logic for damage events.
- Add `KillShooterOnFF` configuration option in `OneShotDeagle.cs` to manage shooter consequences on friendly fire.
```
<p dir="auto">This pull request appears to be a development branch merge
that implements several enhancements and fixes to the TTT (Trouble in
Terrorist Town) game system. The changes focus on improving weapon
handling, adding new test coverage, and enhancing player visual
effects.</p>
<ul dir="auto">
<li>Refactors weapon API by renaming <code class="notranslate">Id</code>
property to <code class="notranslate">WeaponId</code> for better
clarity</li>
<li>Implements comprehensive shop and weapon testing infrastructure</li>
<li>Adds screen color effects and player visual enhancements</li>
</ul>
<h3 dir="auto">Reviewed Changes</h3>
<p dir="auto">Copilot reviewed 32 out of 32 changed files in this pull
request and generated 2 comments.</p>
<details open="">
<summary>Show a summary per file</summary>
<markdown-accessiblity-table data-catalyst="">
File | Description
-- | --
TTT/API/IWeapon.cs | Renames weapon identifier property from Id to
WeaponId
TTT/Test/Shop/ShopTests.cs | Adds comprehensive test coverage for shop
functionality
TTT/Test/Shop/Items/DeagleTests.cs | Implements tests for one-shot
deagle weapon behavior
TTT/Test/TestPlayer.cs | Enhances test player with computed IsAlive
property
TTT/CS2/Player/CS2InventoryManager.cs | Adds weapon slot management and
refactors weapon handling
TTT/CS2/Extensions/PlayerExtensions.cs | Implements screen color fade
effects for players
TTT/CS2/Listeners/ScreenColorApplier.cs | Adds role-based screen color
feedback
TTT/Game/Roles/BaseWeapon.cs | Updates weapon class to use WeaponId
property
TTT/Shop/Items/OneShotDeagle/OneShotDeagle.cs | Updates deagle
implementation for new weapon API
</markdown-accessiblity-table></details>
- Add environment variables and steps for OpenAI API usage in
`.github/workflows/release.yml`
- Retain raw changelog on AI rewrite failure and differentiate naming
- Introduce conditional logic for selective changelog rewriting
- Update GitHub release creation to utilize AI-rewritten changelog when
available
- Add `fetch-tags: true` to actions/checkout in release workflow to ensure all tags are fetched during checkout.
- Improve tag determination process with lineage-aware strategy and refined pattern matching.
- Change changelog generation to use local git log for better control over commit messages.
- Enhance logic for finding commits for changelog, specifically handling first and subsequent releases.
- Improve error handling and retry mechanism for OpenAI API calls, and refine changelog rewrite logic with fallback strategies.
- Update comment styles for better clarity and organization.
- Add environment variables and steps for OpenAI API usage in `.github/workflows/release.yml`
- Retain raw changelog on AI rewrite failure and differentiate naming
- Introduce conditional logic for selective changelog rewriting
- Update GitHub release creation to utilize AI-rewritten changelog when available
- Remove debug logging statements and simplify service registration logic in `ServiceCollectionExtensions.cs`
- Adjust the event handler's priority in `RoundShopClearer.cs` without functional changes
- Update wording in `README.md` for clearer public API usage
- Modify event handler priority in `PlayerStatsTracker.cs` while maintaining existing functionality
- Streamline `IOnlinePlayer.cs` by removing obsolete commented-out code and refining interface properties
- Lower event handler priority in `PlayerActionsLogger.cs` for player kills
- Rename property `Id` to `WeaponId` in `IWeapon.cs`, `BaseWeapon.cs`, and `OneShotDeagle.cs` for improved clarity.
- Update weapon removal method in `IInventoryManager.cs` to use `weapon.WeaponId`.
- Refactor `PlayerDamagedEvent.cs` to initialize `Weapon` property with `init` for stricter immutability.
- Revise `IsAlive` logic in `TestPlayer.cs` to adjust `Health` based on `IsAlive` status; deprecate the `Roles` property.
- Add `using` directive and `[UsedImplicitly]` attribute to `DeagleDamageListener.cs` for dependency management and traceability.
- Develop `DeagleTests.cs` to ensure proper functionality of Deagle weapon behaviors using Xunit.
- Adjust the alpha value handling in `SetColor` method within `PlayerExtensions.cs` to ensure it stays within limits.
- Simplify player color setting in `RoundTimerListener.cs` by using `Color.White` for improved readability.
- Update `BodySpawner.cs` to change player post-death color to fully opaque white and simplify round start color setting using `Color.White`.
- Fix typo in comment and clarify kill detection process in `PlayerStatsTracker.cs`
- Add `RemoveWeaponInSlot` method for slot-based weapon removal in `FakeInventoryManager.cs` and update `IInventoryManager.cs` for enhanced functionality
- Reformat `BaseWeapon` constructor for readability and standardize file formatting
- Simplify `CS2Body.cs` API by removing overloaded weapon method and reinforce `IWeapon` interface usage
- Refactor `CS2InventoryManager.cs` for improved weapon management, add methods for slot conversion and weapon removal, and streamline code structure
- Add debug messaging to `DeagleDamageListener.cs` for better runtime clarity on friendly fire and one-shot kill conditions
- Modify `BodySpawner.cs` to incorporate `BaseWeapon` wrapper for improved weapon management without affecting core functionality
- Adjust `OnPlayerKill` event handler priority in `PlayerActionsLogger.cs` to ensure kill logging before game ends
```
Enhance game management and command structure with new features and optimizations
- Add logic in `PlayerJoinStarting.cs` to handle failure in game instance creation and ensure game starts only upon successful creation.
- Introduce IMessenger service in `CS2GameManager.cs` using dependency injection; add debug logging for the game creation process.
- Implement new behavior for `ScreenColorApplier` in `CS2ServiceCollection.cs` to enhance listening capabilities.
- Create a new `StateCommand` in `StateCommand.cs` to check active game state and implement basic command lifecycle methods.
- Remove "screentext" command and add "state" and "screencolor" commands in `TestCommand.cs` to revamp command options.
- Simplify vector operations in `TextSpawner.cs` by replacing `GetRightVector`; enhance screen text positioning.
- Expand `VectorExtensions.cs` with `ToRight` and `ToUp` methods for better angle-to-vector conversions.
- Remove `ScreenTextCommand.cs` to streamline project and potentially refactor screen text feature.
- Add `ScreenColorApplier` to apply screen color effects upon role assignment, enhancing player interaction experience.
- Introduce `ScreenColorCommand` for player screen color effects with configurable parameters, enriching command functionality.
```
- Refactor `TextSpawner.cs` to improve angle calculations and text positioning with respect to the player.
- Replace static `screenAngle` with local computations for better clarity and maintainability in `TextSpawner.cs`.
- Introduce `angle` object in `TextSpawner.cs` to enhance readability and explicitness in rotation management.
- Add `FadeFlags` enum and implement `ColorScreen` method in `PlayerExtensions.cs` to manage screen color fade effects.
- Enhance color fade handling in `PlayerExtensions.cs` by utilizing `UserMessage` with custom flag settings and improved color configurations.
Pinned System.Text.Json at 8.0.5.
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 <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/MSWS/TTT/network/alerts).
</details>
```
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.
```
echo "CHANGELOG.md is empty. Skipping AI rewrite."
echo "skipped=true" >> $GITHUB_OUTPUT
exit 0
fi
head -c "${MAX_CHANGELOG_CHARS}" CHANGELOG.md > CHANGELOG_RAW.md
jq -Rs --arg sys "You are an expert release-notes writer. Given a list of changes in various formats (e.g: commits, merges, etc.), write release notes intended for reading by the public, grouping by features, features, and other pertinent groups where appropriate. Do not include a group if it is unnecessary. Remove internal ticket IDs and commit hashes unless essential. Merge duplicates. Use imperative, past tense voice with proper prose. Output valid Markdown only." \
| 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 |
| SQLite | 3.13.0 | Unknown | | | Public Domain | SQLite Development Team | |
| 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.