seishun/node-steam

Help with steamGameCoordinator

c00kie17 opened this issue · 2 comments

Hi I am trying to send a simple hello client message to dota2 using the steam game co-ordinator but I am not getting a response back. I know im missing something or doing something wrong. Here is my code:

const steam_resources = require("steam-resources")

const steamClient = new steam.SteamClient()
const steamUser = new steam.SteamUser(steamClient)
const steamGameCoordinator = new steam.SteamGameCoordinator(steamClient, 570)
const dota_proto = steam_resources.GC.Dota.Internal

steamClient.connect();
steamClient.on('connected', function() {
  steamUser.logOn({
    account_name: username,
    password: password,
  });
});


steamClient.on('logOnResponse', function(logonResp) {
  if(logonResp.eresult == steam.EResult.OK){
    console.log('logged in')
    send_client_hello()
  }
});

steamGameCoordinator.on("message", function(header, body, callback) {
  console.log(header)
  console.log(body)
});

function send_client_hello(){
  steamGameCoordinator.send(
    {msg: dota_proto.EGCBaseClientMsg.k_EMsgGCClientHello, proto: {}},
    new dota_proto.CMsgClientHello({}).toBuffer()
  )
  console.log('sent hello')
}

I don't know much about Dota 2 GC, but an obvious issue is that you're not playing the game. You need to call SteamUser#gamesPlayed.

Thank you so much! got it