Skip to content

sak0a/node-cs2

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

node-cs2

npm version Node.js Version

Modern CS2/CS:GO Game Coordinator integration with the latest GameTracking-CS2 protobuf definitions. This package provides a simple API for interacting with the Counter-Strike 2 and CS:GO Game Coordinator, with full support for all modern CS2 features.

πŸ†• What's New in This Fork

This fork addresses critical issues with the original globaloffensive package and adds comprehensive support for modern CS2 features:

βœ… Latest GameTracking-CS2 Protobuf Definitions

  • All protobuf files updated from the latest GameTracking-CS2 repository
  • Future-proof with current CS2 game definitions
  • Comprehensive field support for all modern CS2 items

βœ… Fixed Missing Fields

  • highlight_reel support in stickers, keychains, and variations
  • musicindex - Music kit support
  • entindex - Entity index support
  • petindex - Pet/companion support
  • style - Style variations support
  • upgrade_level - Item upgrade level support

βœ… New Array Support

  • variations - Complete new array for item variations
  • Enhanced stickers array with all new fields
  • Enhanced keychains array with all new fields

βœ… Enhanced Handler Logic

  • Updated handlers.js to process all new fields
  • Proper field mapping and null handling
  • 100% backward compatible with existing code

πŸ› Critical Bug Fixes

Missing highlight_reel Field

Problem: The original package was missing the highlight_reel field in inspect responses, causing incomplete data for items with highlight reels.

Solution: Updated protobuf definitions and enhanced handlers to properly capture and return highlight_reel data.

// Before (missing data)
{
  keychains: [
    {
      slot: 0,
      sticker_id: 36,
      offset_x: 3.445085287094116,
      // highlight_reel: MISSING! ❌
    }
  ]
}

// After (complete data)
{
  keychains: [
    {
      slot: 0,
      sticker_id: 36,
      offset_x: 3.445085287094116,
      highlight_reel: 67890  // βœ… NOW WORKING!
    }
  ]
}

πŸ“¦ Installation

npm install node-cs2

πŸ”„ Migration from globaloffensive

This package is 100% API compatible with the original globaloffensive package:

// Old
const GlobalOffensive = require('globaloffensive');

// New - just change the require!
const NodeCS2 = require('node-cs2');

// All your existing code works unchanged!
const cs2 = new NodeCS2(steamUser);

πŸš€ Usage

const SteamUser = require('steam-user');
const NodeCS2 = require('node-cs2');

const user = new SteamUser();
const cs2 = new NodeCS2(user);

user.logOn({
    accountName: 'username',
    password: 'password'
});

user.on('loggedOn', () => {
    console.log('Logged into Steam');
    user.gamesPlayed([730]); // CS2/CS:GO app ID
});

user.on('appLaunched', (appid) => {
    if (appid == 730) {
        console.log('CS2/CS:GO launched');
        cs2.helloGC();
    }
});

cs2.on('connectedToGC', () => {
    console.log('Connected to CS2/CS:GO Game Coordinator');
});

// Inspect an item with full modern field support
cs2.on('inspectItemInfo', (item) => {
    console.log('Item data with all modern fields:', {
        defindex: item.defindex,
        paintindex: item.paintindex,
        paintwear: item.paintwear,
        
        // NEW FIELDS NOW SUPPORTED!
        musicindex: item.musicindex,
        petindex: item.petindex,
        style: item.style,
        upgrade_level: item.upgrade_level,
        
        // ARRAYS WITH FULL FIELD SUPPORT
        stickers: item.stickers, // includes highlight_reel
        keychains: item.keychains, // includes highlight_reel  
        variations: item.variations // NEW! includes highlight_reel
    });
});

// Inspect an item
cs2.inspectItem('76561198057249394', '2569415699', '7115007497');

πŸ” Inspect URL Support

Full support for both masked and unmasked inspect URLs:

// Unmasked URL (requires Steam client) - NOW WITH FULL FIELD SUPPORT!
const unmaskedUrl = 'steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198857794835A45540551473D7523863830991655521';

// Extract parameters and inspect
const match = unmaskedUrl.match(/S(\d+)A(\d+)D(\d+)/);
if (match) {
    const [, ownerId, assetId, classId] = match;
    cs2.inspectItem(ownerId, assetId, classId);
}

πŸ“‹ Complete Field Support

Basic Item Fields

  • defindex - Item definition index
  • paintindex - Paint/skin index
  • paintseed - Paint seed
  • paintwear - Wear value
  • rarity - Item rarity
  • quality - Item quality

Modern CS2 Fields ✨

  • musicindex - Music kit index
  • entindex - Entity index
  • petindex - Pet/companion index
  • style - Style variation index
  • upgrade_level - Item upgrade level

Arrays with Full Field Support

  • stickers[] - Sticker applications
  • keychains[] - Keychain attachments
  • variations[] - Item variations (NEW!)

Sticker/Keychain/Variation Fields

  • slot - Attachment slot
  • sticker_id - Sticker/item ID
  • wear - Wear value
  • scale - Scale factor
  • rotation - Rotation angle
  • tint_id - Tint color ID
  • offset_x, offset_y, offset_z - Position offsets
  • pattern - Pattern index
  • highlight_reel - Highlight reel ID (FIXED!)

πŸ”§ Development

Building from Source

git clone https://github.com/sak0a/node-cs2.git
cd node-globaloffensive
npm install
npm run generate-protos

Updating Protobuf Definitions

# Copy latest protobuf files from GameTracking-CS2
# Then regenerate:
npm run generate-protos

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Credits

πŸ› Issues & Support

If you encounter any issues or need support:

  1. Check if the issue exists in the original package
  2. Open an issue on GitHub
  3. Provide detailed information about your use case

πŸš€ Why Use This Fork?

  • βœ… Up-to-date with latest CS2 definitions
  • βœ… Bug fixes for missing fields
  • βœ… Enhanced functionality with new CS2 features
  • βœ… 100% compatible with existing code
  • βœ… Actively maintained with GameTracking-CS2 updates
  • βœ… Community-driven improvements

About

A Node.js module to connect to and interact with the CS2 game coordinator. Mostly used to get item data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%