saul / demofile

Node.js library for parsing Counter-Strike: Global Offensive demo files
https://demofile.dev
MIT License
485 stars 53 forks source link

Game Mode #146

Closed ghost closed 3 years ago

ghost commented 4 years ago

Hi, it's possible to get the Game Mode ? Like "Competitve" or "Wingman" or "Scrimmage" etc ?

saul commented 4 years ago

You can get the game type and game mode with:

var gameType = demoFile.conVars.vars.get("game_type") | 0;
var gameMode = demoFile.conVars.vars.get("game_mode") | 0;
# Game type Game modes
0 Classic 0 = Casual
1 = Competitive
2 = Scrim comp 2v2
3 = Scrim comp 5v5
1 GunGame 0 = Progressive
1 = Bomb
2 = Deathmatch
2 Training 0 = Training
3 Custom 0 = Custom
4 Co-operative 0 = Co-operative
1 = Co-op mission
5 Skirmish 0 = Skirmish
6 Free for all 0 = Survival

So game_type = 1 and game_mode = 2 corresponds to GunGame Deathmatch.

You can find the full information here: https://github.com/SteamDatabase/GameTracking-CSGO/blob/master/csgo/gamemodes.txt

Hope that makes sense.