Giter Club home page Giter Club logo

jsgo's Introduction

JSGO

Sorry for my lack of updates on this. I'm aware its not working with latest demo files. I've been extremely busy - I'll be launching a new version soon

A javascript library for reading CS:GO demo files. It supports both the browser and node.js.

Once parsing starts most data is sent in the form of events. From there you can look up entity properties if needed for additional information.

Contact me on irc.esper.net #jsgo.

Installing in node

npm install jsgo

Example

var fs = require('fs');
var jsgo = require('jsgo');

fs.readFile('demo.dem', function(err, data) {

  new jsgo.Demo().on('game.weapon_fire', function(event) {
    
    var player = event.player;
    var position = player.getPosition();

    console.log(player.getName() + ' used weapon ' +
            	event.weapon + ' at ' + position.x + ', ' + position.y + ', ' + position.z);
  
  }).parse(data);
  
});

Output:

aizy used weapon ak47 at -1547.6976318359375, 591.0830078125, 32.03125
NiP-Fifflaren- AKRACING used weapon knife at 1376.483154296875, 2409.856689453125, 34.39018630981445
aizy used weapon ak47 at -1547.6976318359375, 591.0830078125, 32.03125
aizy used weapon ak47 at -1547.6976318359375, 591.0830078125, 32.03125
NiP-Fifflaren- AKRACING used weapon knife at 1383.9927978515625, 2505.580322265625, 60.96079635620117
NiP-GeT_RiGhT-A- EIZO used weapon smokegrenade at -617.7000122070312, 2168.052734375, -120.24928283691406
...etc...

Events

server_info
player_added
entity_added
entity_updated
entity_removed
game.cs_round_final_beep
game.round_freeze_end
game.round_announce_match_start
game.player_footstep
game.weapon_fire
game.player_jump
game.hltv_chase
game.weapon_reload
game.decoy_started
game.hltv_status
game.player_death
game.buytime_ended
game.decoy_detonate
game.bomb_dropped
game.player_falldamage
game.weapon_fire_on_empty
game.server_cvar
game.cs_pre_restart
game.round_prestart
game.player_spawn
game.bomb_pickup
game.round_start
game.round_poststart
game.begin_new_match
game.cs_round_start_beep
game.player_connect_full
game.round_mvp
game.cs_win_panel_round
game.round_end
game.round_officially_ended
game.round_announce_warmup
game.hegrenade_detonate
game.smokegrenade_detonate
game.bomb_beginplant
game.bomb_planted
game.bomb_beep
game.smokegrenade_expired
game.player_blind
game.flashbang_detonate
game.weapon_zoom
game.inferno_startburn
game.inferno_expire
game.bomb_begindefuse
game.bomb_defused
game.round_time_warning
game.round_announce_last_round_half
game.announce_phase_end
game.player_team
game.player_disconnect
game.player_connect
game.round_announce_match_point
game.cs_win_panel_match

Class Demo

demo.findEntityById(entityId);
demo.findEntityByUserId(userId);
demo.getTick();
demo.getTeams();
demo.getPlayers();
demo.getEntities(type);
demo.parse(buffer);

Class Entity

entity.getData();

Class Player extends Entity

player.getName();
player.isHLTV();
player.isFakePlayer();
player.getGuid();
player.getUserId();
player.getHealth();
player.getArmorValue();
player.getTeam(demo);
player.getEyeAngle();
player.getPosition();
player.getAimPunchAngle();
player.isSpotted();
player.hasHelmet();
player.getCurrentEquipmentValue();
player.getRoundStartCash();
player.getCurrentCash();
player.getLastPlaceName();
player.getRoundKills();
player.getRoundHeadshotKills();
player.isScoped();
player.isWalking();
player.hasDefuser();

Class Team extends Entity

team.getTeamNumber();
team.getSide();
team.getClanName();
team.getFlag();
team.getScore();
team.getFirstHalfScore();
team.getSecondHalfScore();
team.getPlayers(demo);

LICENSE

The MIT License (MIT)

Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

jsgo's People

Contributors

dubbl avatar mikeemoo avatar moritzuehling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsgo's Issues

[Bug] Used undefined method `signedVarInt32`

Somewhere disappeared method signedVarInt32

/project/node_modules/jsgo/lib/jsgo.js:1209
                return stream.signedVarInt32();
                              ^
TypeError: Object #<BitStream> has no method 'signedVarInt32'
    at Entity.decodeInt (/project/node_modules/jsgo/lib/jsgo.js:1209:31)
    at Entity.decodeProperty (/project/node_modules/jsgo/lib/jsgo.js:1164:60)
    at Entity.readFromStream (/project/node_modules/jsgo/lib/jsgo.js:1115:39)
    at Demo.handlePacketEntities (/project/node_modules/jsgo/lib/jsgo.js:1843:48)
    at Demo.parsePacket (/project/node_modules/jsgo/lib/jsgo.js:1768:30)
    at Demo.parse (/project/node_modules/jsgo/lib/jsgo.js:1634:26)
    at new CSGOParser (/project/parser/csgo.js:42:15)
    at parse (/project/index.js:40:22)
    at /project/index.js:102:13
    at fs.js:272:14
    at Object.oncomplete (fs.js:108:15)

Parsing is not terminating

I've found a problem with some demos:
After parsing 447 to 449 ticks, the parser while hang.

fs.readFile(args[0], function(err, data) {
    var demo = new jsgo.Demo();
    var tick_count = 0;
    demo.on('tick', function() {
        console.log(tick_count++);
    });
    demo,parse(data);
});

The parsing never finishes and the application just hangs.

JSGO Browser Examples not working

When attempting to run either browser examples the browser console will return Buffer is not defined. Wondering if their is any easy solution?

How to get informatin about hits and damage per weapon?

Hi,
I know exist event on fire and death. I find in player.getData() information about damage per player m_iMatchStats_Damage. But i can't find informations about hits and damage per weapon. How to get this informations?

jsgo doesn't work with new demos?

I installed it and tried running it on a few of my demos that I recorded today, but all it's logging is "cant find entity 4" or "cant find entity 7" etc. However, jsgo works perfectly fine with the .dem that's included in the npm package. Yes, I made sure that I have the latest jsgo.

I used the round scores example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.