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-gsi-model

v0.5.2

Published

A CSGO Game State Integration (GSI) module with custom functions to use with game data

Downloads

18

Readme

csgo-model-gsi

A node module providing an easy way to reformat the data from the Game State Integration API of CSGO. Also providing functions to manage the data.

Used by

  • Csgo Web Specator panel - A free and customizable view for spectators (Soon on GitHub)
  • Csgo Client panel - A free Electron application giving information about the game you're playing (Soon on GitHub)

Requirements

  • Requests (used to call the Steam API to get player images)
  • A configuration file to enable GSI

Usage

The constructor waits for two parameters :

  • The raw body data sent from the GSI API
  • (optional) Your Steam API key which can be found here : http://steamcommunity.com/dev/apikey

**To use comparaison functions, it's advisable to store the last data on another variable

Example :

router.post('/', function(req, res) {
    csgo = new csgoModel(req.body, 'STEAM_API_KEY');
    // The data is set up
    // All the behaviour here

    // At the end, we store the data on another variable to use it for comparaison
    oldCsgo = csgo;
}

Functions available

Usage

csgo.functionName

sortPlayersByTeam() - Used to sort the players by their team.

sortPlayersBySteamId() - Used to sort the players by their Steam ID.

isStatusChanged(oldCsgoData) - Used to check if the round status changed between the two data.

isBombStatusChanged(oldCsgoData) - Used to check if the bomb status changed between the two data.

getWinnerTeamName() - Used to get the winning team name of a round.

getWinnerTeamSide() - Used to get the winning team side of a round.

getCTPlayers() - Used to get the CT players.

getTPlayers() - Used to get the T players.

isWarmup() - Used to check if the round is the warmup round.

isAlive(player) - Used to check if the player given is alive (check if his health > 0).

getTeamPlayersAlive(teamSide) - Used to get the number of alive players on the side given. teamSide : 'T' or 'CT'

IsPlayersChanged(oldCsgoData) - Used to check if the players are still the same between the two data.

IsScreenPlayerProvider() - Used to check if the player is also the provider of the data (check by the Steam ID)

IsPlaying() - Used to check if the player is playing the game (= on a server)

getPlayerImages(newCsgoData, oldCsgoData) A big one... This one calls the Steam API to get the player images. It needs both old and new data to check if it's useful to call the API (the images aren't on the old data) and also to access everything on the Promise.

getScreenPlayerImage(newCsgoData, oldCsgoData) Same as above, but for the player at the screen. Used for the Electron app.

Changelog

V 0.5.0 : First public release on NPM

V 0.5.1 : Fixed the Steam API call

V 0.5.2 : Updated on Github & 1st README

Licence

MIT