npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

csgo-events

v0.6.4

Published

Fires events when CSGO game state changes

Downloads

20

Readme

csgo-events

Node.js module that fires events when CS:GO game state changes.

Some code based on Shaunidiot's CSGOGSI implementation at https://github.com/shaunidiot/node-csgo-gsi

Socket.io

The module includes socketio for communication with frontend apps. If you don't need this functionality, feel free to ignore it.

Message format

The CsgoEvents class has one optional parameter, msgFormat, which controls how events are specified.

  • default or simply left blank: Unique events are triggered per game state.
  • updated: all csgo-related messages are a csgoEvent, and a data object is passed where data.type specifies which game state has been reached.

Default behaviour:

var CsgoEvents = require('csgo-events');
var csgo = new CsgoEvents();

csgo.on('roundFreezetime', function(data) {
    console.log('Freezetime');
});

csgo.on('roundOver', function(winner) {
    console.log('Round over, ' + winner + 'win');
});

New format:

var CsgoEvents = require('csgo-events');
var csgo = new CsgoEvents('updated');

csgo.on('csgoEvent', function(msg) {
    switch (msg.type) {
        case 'roundFreezeTime':
            console.log('Freezetime');
            break;
        case 'roundOver':
            console.log('Round over, ' + msg.data +' win');
            break;
    }
});

Methods

.returnData (data)

Emits a socketIO message named 'returnData' containing data.

.forceRoundStats()

Forces roundStats message on next game state update (see below). This only applies to the new message format.

Events (new format)

csgoEvent

Fires on a CSGO game state change. If msg.type is 'roundOver', msg.data contains the winning team, either 'T' or 'CT'. If msg.type is 'roundStats', msg.data contains the csgo data object as received.

extRequest

Fires when an ext (external) socketIO message is received. Usage:

csgo.on('extRequest', function(data) {
    // log received message to console
    console.log(data);
});

csgoEvent Message types (new format)

  • roundFreezetime
  • roundLive
  • roundOver (msg.data contains string indicating winning team)
  • bombPlanted
  • bombDefused
  • bombExploded
  • roundStats (msg.data contains full data object)
  • noGame

Events (default)

roundLive

Fires when the round goes live.

roundFreezetime

Fires when freezetime starts.

roundOver

Fires on round end and returns the winning team, if the bomb wasn't planted

  • T
  • CT

bombPlanted

Fires when the bomb is planted

bombDefused

Fires when the bomb is defused

bombExploded

Fires when the bomb explodes

noGame

Fires the first time data is recieved without a data.map object, meaning no game is in progress.