3.0.1 • Published 7 months ago

csgogsi v3.0.1

Weekly downloads
149
License
MIT
Repository
github
Last release
7 months ago

Statements CI Dependencies Downloads Version

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 csgogsi

Example #1

import express from 'express';
import { CSGOGSI } from 'csgogsi';

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

app.use(express.urlencoded({extended:true}));
app.use(express.raw({limit:'10Mb', type: 'application/json' }));

app.post('/', (req, res) => {
    const text = req.body.toString().replace(/"(player|owner)":([ ]*)([0-9]+)/gm, '"$1": "$3"').replace(/(player|owner):([ ]*)([0-9]+)/gm, '"$1": "$3"');
    const data = JSON.parse(text);
    GSI.digest(data);
    res.sendStatus(200);
});

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

app.listen(3000);

Methods

MethodDescriptionExampleReturned objects
digest(GSIData)Gets raw GSI data from CSGO and does magicGSI.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 magicGSI.digestMIRV(mirv)KillEvent or HurtEvent
on('event', callback)Sets listener for given event (check them below)GSI.on('roundEnd', team => console.log(team.name));
static findSite(mapName, position)Tries to guess the bombsite of the positionA, B, null

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

Beside that, CSGOGSI implements standard Event Emitter interfaces.

Events

EventNameCallback
Data incomingdata(data: CSGO Parsed) => {}
End of the roundroundEnd(score: Score) => {}
End of the mapmatchEnd(score: Score) => {}
Killkill(kill: KillEvent) => {}
Hurthurt(hurt: HurtEvent) => {}
Timeout starttimeoutStart(team: Team) => {}
Timeout endtimeoutEnd() => {}
MVP of the roundmvp(player: Player) => {}
Freezetime startfreezetimeStart() => {}
Freezetime endfreezetimeEnd() => {}
Intermission startintermissionStart() => {}
Intermission endintermissionEnd() => {}
Defuse starteddefuseStart(player: Player) => {}
Defuse stopped (but not defused and not exploded)defuseStop(player: Player) => {}
Bomb plant startedbombPlantStart(player: Player) => {}
Bomb plantedbombPlant(player: Player) => {}
Bomb explodedbombExplode() => {}
Bomb defusedbombDefuse(player: Player) => {}

Objects

CSGO Parsed

PropertyType
providerProvider Object
mapMap Object
roundRound Object or null
playerPlayer Object or null
playersArray of Player's Object
observerObserver Object
bombBomb Object
phase_countdownsThe same as in raw GSI

Observer

PropertyType
activity'playing', 'textinput' or 'menu'
spectarget'free' or SteamID64
positionnumber[]
forwardnumber[]

Team Extension

PropertyType
idstring
namestring
countrystring or null
logostring or null
map_scorenumber

Player Extension

PropertyType
idstring
namestring
steramidstring
realNamestring or null
countrystring or null
avatarstring or null

Provider

PropertyType
name'Counter-Strike: Global Offensive'
appid730
versionnumber
steamidnumber
timestampnumber

Map

PropertyType
modestring
namestring
phase"warmup" or "live" or "intermission" or "gameover"
roundnumber
team_ctTeam Object
team_tTeam Object
num_matches_to_win_seriesnumber
current_spectatorsnumber
souvenirs_totalnumber
round_winsObject with Round Outcome Object as values
roundsArray of RoundInfo objects

RoundInfo

PropertyType
teamTeam
roundnumber
sideSide
outcome'ct_win_elimination', 't_win_elimination', 'ct_win_time', 'ct_win_defuse', 't_win_bomb'

Round

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

Player

PropertyType
steamidstring
namestring
observer_slotnumber
teamTeam 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}
positionArray of numbers
forwardnumber
avatarstring or null
countrystring or null
realNamestring or null

Bomb

PropertyType
state"carried" or "planted" or "dropped" or "defused" or "defusing" or "planting" or "exploded"
countdown?string
player?Player Object
positionstring

Team

PropertyType
scorenumber
consecutive_round_lossesnumber
timeouts_remainingnumber
matches_won_this_seriesstring
namestring
countrystring or null
idstring or null
sideSide Object
orientationleft or right
logostring

Score

PropertyType
winnerTeam
loserTeam
mapMap
mapEndboolean

Side

"CT" or "T"

3.0.1

7 months ago

2.7.4

7 months ago

2.7.3

7 months ago

3.0.0

7 months ago

2.7.2

7 months ago

2.7.1

8 months ago

2.7.0

1 year ago

2.6.0

1 year ago

2.5.6

2 years ago

2.5.5

2 years ago

2.4.3

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.5.4

2 years ago

2.5.3

2 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.4.2

3 years ago

2.3.7

3 years ago

2.3.6

3 years ago

2.3.5

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago