Add ItemDefinitionIndex enum and weapon mapping dictionary to Helpers #89
+204
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Related Issues
N/A
Changes Made
Detailed Changes
List the specific changes made:
ItemDefinitionIndexenum inIHelpers.cscontaining all CS2 weapon item definition indices (pistols, rifles, grenades, knives, utility items)WeaponItemDefinitionIndicesstatic dictionary inHelpers.csmapping weapon names (e.g., "weapon_awp") to their item definition indicesTesting
Test Environment
Test Cases
Describe the test cases you've run:
GetWeaponCSDataFromKeymethodsBreaking Changes
None - this is purely additive functionality.
Performance Impact
Details: Static readonly dictionary and enum only add minimal memory overhead and provide O(1) lookups.
Checklist
Additional Notes
This addition makes it easy for developers to:
ItemDefinitionIndex.Awpreturns9WeaponItemDefinitionIndices["weapon_awp"]returns9GetWeaponCSDataFromKey(int itemDefinitionIndex)methodAll item definition indices are sourced from the CS2 SDK weapon map.