Skip to content

lexogrine/csgogsi

 
 

Repository files navigation

Lexogrine fork of CS:GO GSI Digest

How does it work?

The GSI object takes raw request from CS:GO GSI's system, parses this to more comfortable form and calls listeners on certain events. You need to configure GSI file and receiving end yourself.

Installing

For Node and React

npm install @lexogrine/cs2gsi

Example #1

import express from 'express';
import { CS2GSI } from '@lexogrine/cs2gsi';

const app = express();
const GSI = new CS2GSI();

app.use(express.urlencoded({ extended: true }));
app.use(express.json({ limit: '10Mb' }));

app.post('/', (req, res) => {
	GSI.digest(req.body);
	res.sendStatus(200);
});

GSI.on('roundEnd', score => {
	console.log(`Team ${score.winner.name} win!`);
});
GSI.on('bombPlant', player => {
	console.log(`${player.name} planted the bomb`);
});

app.listen(3000);

Methods

Method Description Example Returned objects
digest(GSIData) Gets raw GSI data from CSGO and does magic GSI.digest(req.body) CSGO Parsed
digestMIRV(event: RawKill or RawHurt, eventType: "player_death" (default) or "player_hurt) Gets raw kill data from mirv pgl and does magic GSI.digestMIRV(mirv) KillEvent or HurtEvent
on('event', callback) Sets listener for given event (check them below) GSI.on('roundEnd', score => { console.log(score.winner.name); });
static findSite(mapName, position) Tries to guess the bombsite of the position A, B, null

CS2GSI also has MR property, which specifies the MR system for overtimes (used in map.rounds). Default value is 3.

Beside that, CS2GSI implements standard Event Emitter interfaces.

Events

Event Name Callback
Data incoming data (data: CSGO Parsed) => {}
End of the round roundEnd (score: Score) => {}
End of the map matchEnd (score: Score) => {}
Kill kill (kill: KillEvent) => {}
Hurt hurt (hurt: HurtEvent) => {}
Timeout start timeoutStart (team: Team) => {}
Timeout end timeoutEnd () => {}
MVP of the round mvp (player: Player) => {}
Freezetime start freezetimeStart () => {}
Freezetime end freezetimeEnd () => {}
Intermission start intermissionStart () => {}
Intermission end intermissionEnd () => {}
Defuse started defuseStart (player: Player) => {}
Defuse stopped (but not defused and not exploded) defuseStop (player: Player) => {}
Bomb plant started bombPlantStart (player: Player) => {}
Bomb planted bombPlant (player: Player) => {}
Bomb exploded bombExplode () => {}
Bomb defused bombDefuse (player: Player) => {}

Objects

CSGO Parsed

Property Type
provider Provider Object
map Map Object
round Round Object or null
player Player Object or null
players Array of Player's Object
observer Observer Object
bomb Bomb Object
phase_countdowns Phase Object

Phase

Property Type
phase (optional) 'freezetime', 'bomb', 'warmup', 'live', 'over', 'defuse', 'paused', 'timeout_ct' or 'timeout_t'
phase_ends_in number
timeout_team (optional) Team object

Observer

Property Type
activity 'playing', 'textinput' or 'menu'
spectarget 'free' or SteamID64
position number[]
forward number[]

Team Extension

Property Type
id string
name string
country string or null
logo string or null
map_score number

Player Extension

Property Type
id string
name string
steramid string
realName string or null
country string or null
avatar string or null

Provider

Property Type
name 'Counter-Strike: Global Offensive'
appid 730
version number
steamid number
timestamp number

Map

Property Type
mode string
name string
phase "warmup" or "live" or "intermission" or "gameover"
round number
team_ct Team Object
team_t Team Object
num_matches_to_win_series number
current_spectators number
souvenirs_total number
round_wins Object with Round Outcome Object as values
rounds Array of RoundInfo objects

RoundInfo

Property Type
team Team
round number
side Side
outcome 'ct_win_elimination', 't_win_elimination', 'ct_win_time', 'ct_win_defuse', 't_win_bomb'

Round

Property Type
phase "freezetime" or "live" or "over"
bomb? "planted" or "exploded" or "defused"
win_team? Side Object

Player

Property Type
steamid string
name string
observer_slot number
team Team Object
stats {kills, assists, deaths, mvps, score} all numbers
state {health, armor, helmet, defusekit?, flashed, smoked, burning, money, round_kills, round_killshs, round_totaldmg, equip_value, adr}
position Array of numbers
forward number
avatar string or null
country string or null
realName string or null

Bomb

Property Type
state "carried" or "planted" or "dropped" or "defused" or "defusing" or "planting" or "exploded"
countdown? string
player? Player Object
position number[]

Team

Property Type
score number
consecutive_round_losses number
timeouts_remaining number
matches_won_this_series string
name string
country string or null
id string or null
side Side Object
orientation left or right
logo string

Score

Property Type
winner Team
loser Team
map Map
mapEnd boolean

Side

"CT" or "T"

About

Lexogrine is a premier Node.js development company and AI software development house, delivering high-end AI, web, and mobile design services to a global clientele. In addition to bespoke development, Lexogrine provides a suite of innovative applications, such as LHM.gg, designed to transform professional collaboration and streamline industry-specific workflows.

We specialize in cutting-edge AI development, complemented by robust web, mobile, and cloud solutions. Our core tech stack includes TypeScript, Python, LLMs, React, React Native, Node.js, Prisma, Medusa, PyTorch, AWS, and Google Cloud Platform.

With a proven track record spanning over 5 years, Lexogrine has successfully delivered hundreds of projects, empowering businesses and enterprises worldwide with scalable, future-proof technology.

About

LHM Fork of CSGOGSI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 68.1%
  • JavaScript 31.9%