Skip to content

Conversation

@T3Marius
Copy link
Contributor

@T3Marius T3Marius commented Nov 9, 2025

Description

Added ItemDefinitionIndex enum and WeaponItemDefinitionIndices dictionary to the Helpers module, providing easy access to CS2 weapon item definition indices for all weapons, grenades, knives, and utility items.

Type of Change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Related Issues

N/A

Changes Made

  • Managed Changes (C#)
  • API additions/modifications

Detailed Changes

List the specific changes made:

  • Added ItemDefinitionIndex enum in IHelpers.cs containing all CS2 weapon item definition indices (pistols, rifles, grenades, knives, utility items)
  • Added WeaponItemDefinitionIndices static dictionary in Helpers.cs mapping weapon names (e.g., "weapon_awp") to their item definition indices
  • Organized items by category: Pistols, Rifles, Grenades, Knives/Equipment, and Utility
  • Includes all 80+ weapons and items with their correct item definition indices

Testing

Test Environment

  • OS: Windows 11
  • Game: Counter-Strike 2

Test Cases

Describe the test cases you've run:

  1. Verified enum values match the CS2 weapon item definition indices
  2. Confirmed dictionary mappings are correct and complete
  3. Tested usage with existing GetWeaponCSDataFromKey methods

Breaking Changes

None - this is purely additive functionality.

Performance Impact

  • No performance impact

Details: Static readonly dictionary and enum only add minimal memory overhead and provide O(1) lookups.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

This addition makes it easy for developers to:

  • Use enum values directly: ItemDefinitionIndex.Awp returns 9
  • Look up weapon indices by name: WeaponItemDefinitionIndices["weapon_awp"] returns 9
  • Pass indices to GetWeaponCSDataFromKey(int itemDefinitionIndex) method

All item definition indices are sourced from the CS2 SDK weapon map.

@skuzzis skuzzis changed the base branch from master to beta November 9, 2025 12:28
@github-project-automation github-project-automation bot moved this from Backlog to In review in SwiftlyS2 - Roadmap Nov 9, 2025
@skuzzis skuzzis merged commit ab49abe into swiftly-solution:beta Nov 9, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in SwiftlyS2 - Roadmap Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants