arcana / node-dota2 Goto Github PK
View Code? Open in Web Editor NEWA node-steam plugin for Dota 2.
License: MIT License
A node-steam plugin for Dota 2.
License: MIT License
As the title suggests, while CMsgDOTAProfileResponse
lists:
repeated .CMsgDOTAMatch latest_matches = 3;
but the profileRequest
method does not return any match history for the player.
Example code:
Dota2.profileRequest(147918203, true, function(err, data) {
if(err) return console.log(err);
console.log(JSON.stringify(data));
});
Which returns the following object:
{
"result":1,
"gameAccountClient":{
"accountId":147918203,
"wins":26,
"losses":25,
"xp":155,
"level":9,
"lowPriorityUntilDate":0,
"preventVoiceUntilDate":0,
"teaching":0,
"leadership":0,
"friendly":0,
"forgiving":0,
"lowPriorityGamesRemaining":0,
"calibrationGamesRemaining":9,
"recruitmentLevel":17
},
"heroes":[
{
"heroId":49,
"wins":3
},
{
"heroId":64,
"wins":2
},
{
"heroId":71,
"wins":1
}
],
"playerName":"BALLS DEEP",
"showcaseHero":{
"heroId":0
},
"leaguePasses":[
{
"leagueId":65006,
"itemDef":15406
}
],
"hasPassport":false,
"abandonPercent":0
}
Am I missing something here?
When I try to retrieve a profile of an user that has set it to private, I get "bad profileResponse". How can I listen for this event, so I can handle it?
Hello
I want to know if it's somehow possible that the bot can answer commands, via PN or Chat channel message.
Thanks for creating this, I am using it and it works great.
How can I retrieve a users steamID from their playerName or personaName?
I receive "connect" field when launch practice lobby. I think it contains game address. Anyone knows how I can get source tv address to view this game as spectator?
Would be nice to know :)
I want to have a look at what I can do with this call. If I understand correctly, after making my handler, all I need to do is have the method added to dota_gcmessages.desc . Is that correct?
message CMsgDOTARequestPlayerResources {
optional fixed64 steam_id = 1;
optional uint32 player_id = 2;
}
message CMsgDOTARequestPlayerResourcesResponse {
optional fixed64 steam_id = 1;
optional uint32 rank = 2;
optional uint32 player_id = 3;
optional bool prevent_text_chat = 4;
optional bool prevent_voice_chat = 5;
optional bool low_priority = 6;
optional uint32 solo_rank = 7;
}
My handler is http://pastebin.com/9RyaMdAe and I updated the index.js to call this file.
require("./handlers/new_handler");
I get the following error after doing everything except adding the method to the dota_gcmessages.desc file: http://i.imgur.com/LW9hrtR.png
Can you update the dota_gcmessages.desc or let me know how to do it myself.
Thanks!
So I was looking through the steamkit protobufs for a command to automate party invites (either through a guild or through friends), but I couldn't find anything related to that. Any idea if this is possible? If you could point me in the direction of the relevant protobufs, I could probably add the functionality to this package.
Is there any way to know when a friend of the bot finished a match?
How exactly would i fetch the Dota 2 MMR for solo and party games with this wrapper?
I have successfully created and launched a lobby using steamkit but I always fail to connect to the server, I have looked in all the resources to find a way to connect to lobby server but found none, could someone point me int he right direction please?
A suggestion would be adding a kind of admin-based system. I've tried fiddling around with using Dota2.profileRequest and profileData, trying to get accountId and base commands off of accountId, but I didn't find a way to look if the user of the command has same accountId, I started off using personaName and just write my username, but when people started using my name to use admin commands, I found that this was a bad idea.
It could also be that the friends of the bot are admins or something, I don't know, whatever is easiest. If this already exists, please enlighten me. Thanks!
Is it possible to use node-d2 to force a "Create Lobby" non-local(!) lobby to join my dedicated server with a custom gamemode?
Because sv_search_key does not work for me, maybe because the game is searching for AP , and on the server it is 15, Custom game.
I am very new to all this, please provide some instructions for this.
From what I gather I need to have installed:
(not sure about this one) https://github.com/Obvious/ursa
https://github.com/RJacksonm1/node-steam (which is somewhat older then https://github.com/seishun/node-steam)
finally install this.
Am I correct?
What was the recommended way (easiest to implement) to convert between the 32bit and 64bit steam account id?
11 Mar 14:12:52 - Logged on.
11 Mar 14:12:52 - Launching Dota 2
/Users/wira/dev/node-dota2/node_modules/bignumber.js/bignumber.js:1195
throw error;
^
BigNumber Error: BigNumber() constructor call without new: 76561198113692125
at raise (/Users/wira/dev/node-dota2/node_modules/bignumber.js/bignumber.js:1163:25)
at BigNumber (/Users/wira/dev/node-dota2/node_modules/bignumber.js/bignumber.js:162:29)
at Dota2Client.ToAccountID (/Users/wira/dev/node-dota2/index.js:61:10)
at Dota2Client.launch (/Users/wira/dev/node-dota2/index.js:71:25)
at SteamClient.onSteamLogOn (/Users/wira/dev/node-dota2/test/index.js:16:15)
at SteamClient.emit (events.js:104:17)
at SteamClient.handlers.(anonymous function) (/Users/wira/dev/node-dota2/test/node_modules/steam/lib/handlers/user.js:163:10)
at SteamClient._netMsgReceived (/Users/wira/dev/node-dota2/test/node_modules/steam/lib/steam_client.js:106:26)
at SteamClient.handlers.(anonymous function) (/Users/wira/dev/node-dota2/test/node_modules/steam/lib/steam_client.js:192:10)
at SteamClient._netMsgReceived (/Users/wira/dev/node-dota2/test/node_modules/steam/lib/steam_client.js:106:26)
When lobby starts bot still stay on server in spectators list and after 90 seconds server shut down
I am a complete noob (but working my way through this), and one thing that struck me as odd is the lack of a way to callback on the getMatchDetails. Feel free to ignore, but aren't there many use cases where it is preferable to simply wait for the callback instead of waiting for an event?
The scenario I am currently working on:
On receiving a steam message with a matchID, the bot looks up the matchID and responds with some of the match data. Without the callback, you need to now keep track of who is requesting what, so that you know where to send the match details when you get them.
Perhaps I am approaching this wrong, and I'm not even sure if this is the right place to be making suggestions.
I didn't know as much as I do now about the internal lobby system when I wrote the node-dota2 lobby handlers. I need to go back in and refactor everything with new knowledge I have from building a c# implementation of a full dota2 lobby and party client.
http://blog.paral.in/dota-2-party-system/
There is some info on the party system.
The cache subscriptions come for several things, including parties, party invites, lobbies, and matchmaking. Each has a different ID. I believe lobbies are id 4.
Hello everyone, how can i knew what is result of played game in lobby? What is command and message should i use?
is it correct
Dota2.Dota2Client.prototype.getPracticeLobbyResponse = function(callback) {
callback = callback || null;
if (!this._gcReady) {
if (this.debug) util.log("GC not ready, please listen for the 'ready' event.");
return null;
}
if (this.debug) util.log("Sending match CMsgPracticeLobbyResponse request");
var payload = dota_gcmessages_client.CMsgPracticeLobbyResponse.serialize({
});
this._client.toGC(this._appid,
(Dota2.EDOTAGCMsg.k_EMsgGCPracticeLobbyResponse | protoMask), payload, callback);
};
The problem arises from this line:
https://github.com/RJacksonm1/node-dota2/blob/master/index.js#L88
In my attempt to prevent the crash caused by sending a hello, while the steamclient if offline, I setup a handler for the steam logoff event, which would call the exit() method. However, this will also result in a crash.
Perhaps, there should be some logic to handle this?
I set the bot's ranking within the guild to the officer status but the bot doesn't seem to have the permission to invite. Any idea what's preventing the bot from inviting people to the guild?
I have the following error:
BigNumber Error: BigNumber() constructor call without new: 76561198205968656
at raise (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/dota2/node_modules/bignumber.js/bignumber.js:1163:25)
at BigNumber (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/dota2/node_modules/bignumber.js/bignumber.js:162:29)
at Dota2Client.ToAccountID (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/dota2/index.js:61:10)
at Dota2Client.launch (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/dota2/index.js:71:25)
at SteamClient.onSteamLogOn (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/index.js:108:18)
at SteamClient.emit (events.js:92:17)
at SteamClient.handlers.(anonymous function) (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/steam/lib/handlers/user.js:159:10)
at SteamClient._netMsgReceived (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/steam/lib/steam_client.js:102:26)
at SteamClient.handlers.(anonymous function) (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/steam/lib/steam_client.js:188:10)
at SteamClient._netMsgReceived (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/steam/lib/steam_client.js:102:26)
at Connection.emit (events.js:95:17)
at Connection._readPacket (/home/deploy/apps/dotatrace_production/releases/20150311144506/lib/node/dota2_bot/node_modules/steam/lib/connection.js:50:8)
at Connection.emit (events.js:92:17)
at emitReadable_ (_stream_readable.js:427:10)
at emitReadable (_stream_readable.js:423:5)
at readableAddChunk (_stream_readable.js:166:9)
at Connection.Readable.push (_stream_readable.js:128:10)
at TCP.onread (net.js:529:21)
So basically the error occurs from dota2/index.js:61:10. I used to fix it by restricting BigNumber.js to 2.0 in my packages, but I think you might want have a look at it for for future development.
Hi, I'm trying to get the Lobby
object to get its id. I'm looking to create some sort of autochecker of who's currently in the lobby and which team they are in.
But after creating it using createPracticeLobby()
, Lobby
is still null. I've tried listening to practiceLobbyUpdate
but i don't receive any event from it.
Aside from that whenever I launch Dota2 client I get the following cache subscriptions
5 Jun 23:40:23 - Sending ClientHello
5 Jun 23:40:25 - Received client welcome.5 Jun 23:40:2
5 - Cache subscribed, type undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
5 Jun 23:40:25 - Unknown cache ID: undefined
Am not sure if this is the expected output since. Could you enlighten me on this?
Thanks!
Steam node library was updated after the crc library was updated to drop support for Buffers. They now use buffer-crc32.
A fresh install of node-dota will install the old version of Steam with the new crc library, which means generating a new sentry will fail.
I would recommend updating the required Steam library to 0.6.6, but someone should probably test that first.
Hello, im new at this and i have a few questions:
1º) Could i get banned if i send messages to a channel each 60 seconds? I know is a stupid question.
2º) Is it possible to make an exe from the script i have now ?
3º) When the script is already running, is there any way i can interact with it in real - time ? I mean:
Could i have a script that just log's into dota and joins a channel. And then i send messages via console:
Dota2.sendMessage("","")
Or
Send a Dota2.leaveChat("") so i can close it, because otherwise the channels get bugg
Tried using
node
.load ./script.js
But it won't execute my loop
The 'Setting up' steps under 'Testing' in the readme did not work for me.
Sending an empty auth code resulted in a Logon fail: 65
error.
Commenting out the following auth code line in index.js
fixed the problem and gave me the appropriate Logon fail: 63
error, triggering the steamguard code to be sent.
"authCode": config.steam_guard_code,
There are new protos in place now for lobby invites. Need to implement these.
I am trying to make a private tournament site that isn't based off of humans being awake. Everything works fine up until starting the lobby and then the process is stuck because it can't abandon, can't join and it's not a lobby anymore. Does anyone have a fix for this?
When i try to start with:
var Steam = require('steam'),
steamClient = new Steam.SteamClient(),
dota2 = require('dota2'),
Dota2 = new dota2.Dota2Client(steamClient, true);
I get this error:
Error: Cannot find module 'dota2'
Also i installed the packages via npm for sure !!
http://puu.sh/aAKC1/708c03db1a.png This is installed ! But no dota module :/
Sorry :/ You closed my first iusse way to fast
Hi,
I tried using the generated lobby_id to configure or re-join (after leaving) but it always throws a DOTA_JOIN_RESULT_INVALID_LOBBY.
I even created a lobby from another account using the official client, grabbed the lobby id from console but that resulted in the same error – with or without passwords.
Am I missing something?
Hello! I hasten to apologize for my English, I'm from Russia))
I want to organize a league through a web interface. I realized that your library I can help. But I can not understand what is needed for its operation and how to install it. I ask you to help. Thanks in advance!
I just ran into this issue... The GC never responds with welcome, it's just stuck on sending "ClientHello" over and over.
Like the title says, it is possible to make to the bot connects to a Guild's Chat? I mean no just a simple chat room, if is possible how could i do that?
Thanks for Advance, awesome job!!
As an example, let's look at CMsgGCMatchDetailsRequest.
This method requires a variable named "match_id", yet in the node-dota2 library we send a serialized request with a variable named "matchId".
Is the camel casing a hard and fast convention, or is there somewhere we can look up what the GC servers respond to?
EDIT: Is this perhaps something I should raise with the SteamKit crew?
I am testing bots capabilities in regards of lobbies.
First thing I noticed is that when I bot creates a lobby the bot is present in "unassigned players", but he is not inside the lobby chat channel.
Code such as Dota2.joinChat("Lobby");
doesn't work.
Using the ingame console command dota_lobby_debug
I can find the lobby id.
I added some functions to steam messaging the bot using bot.on('message')
event listener. precisely
if (message.substr(0,2) == '/j') {
console.log('asked to join chat room ' + message.substr(3,message.length));
Dota2.joinChat(message.substr(3,message.length));
}
Works on existing chat channels. This way I tried using the lobby ID as a chat channel name to join, but without success.
In addition I tried to make my own function to start lobbies (without success so far)
Consulting dota_gcmesages.desc and gcsdk_gcmessages.desc, and copying some functions from lobbies.js I wrote this:
Dota2.Dota2Client.prototype.launchPracticeLobby = function(callback) {
callback = callback || null;
/* Sends a message to the Game Coordinator requesting lobby start. */
if (!this._gcReady) {
if (this.debug) util.log("GC not ready, please listen for the 'ready' event.");
return null;
}
if (this.debug) util.log("Sending match CMsgPracticeLobbyLaunch request");
var payload = dota_gcmessages.CMsgPracticeLobbyLaunch.serialize({
});
this._client.toGC(this._appid, (Dota2.EDOTAGCMsg.k_EMsgGCPracticeLobbyLaunch | protoMask), payload, callback);
};
I enter the bot-created-lobby with my real account, join a side and add a pasive bot to the other side. When the function fires I get this in the console
8 Oct 15:45:04 - Sending match CMsgPracticeLobbyLaunch request
8 Oct 15:45:04 - Dota2 fromGC: 570, 7055
8 Oct 15:45:04 - Received a bad practiceLobbyJoinResponse
{"result":"DOTA_JOIN_RESULT_INVALID_LOBBY"}
My thought - I need to add some lobby details to the payload that is being sent. Not sure if that has to be the lobby id, or not or how to present the data to be serialized.
My questions right now:
Does GC provide the lobby id somewhere so I don't have to find it manually?
How do I make the PracticeLobbyLaunch message valid?
I will search for a dota 2 ingame console command for a list of joined channels. That should reveal the lobby chat channel name, I bet it is something like 0052534e8e679ff8_lobby or something.
I am trying to implement this.
k_EMsgGCSourceTVGamesResponse
CMsgSourceTVGamesResponse
k_EMsgGCFindSourceTVGames
CMsgFindSourceTVGames
I never get a response, does this function work?
I have around 50 users in my database and somehow I was able to collect the MMR of ~15 of them. "Somehow", because my profileRequest() will enter the callback only on 4 or 5 of them at a time. I can't figure out when and why the callback is called on someone and when and why not. Am I missing something?
Update: I feel like there is a limitation for profileRequests by the Steam servers. If I request the profile for X Steam IDs at once I will only get answered the first 5 ones. Also, after a time, I won't get an answer for any request at all. Did anyone else face this issue?
Will this package be broken when Reborn goes live? Does Reborn use the same GC as current Dota2? Any knowledge in this scope or is this a big if right now?
Line 103:
var practiceLobbyJoinResponse = dota_gcmessages_client.CMsgPracticeLobbyJoinResponse.parse(message);
I don't think this is the right class to use when you're creating a lobby. I did the Nethook2 inject, and what I received back were two CMsgSOCacheSubscribed
and CMsgSOSingleObject
. I do not receive a CMsgPracticeLobbyJoinResponse
back. I believe this is the reason why and not so much to do with an improper DOTA_JOIN_RESULT_ALREADY_IN_GAME
result.
The lobby ID which I created is 23430582993002354
and can be seen as CMsgSOCacheSubscribed.owner_soid.id
and CMsgSOSingleObject.owner_soid.id
. I have no idea what any other value in that class is, however.
I believe CMsgPracticeLobbyJoinResponse
is reserved only for when you join a lobby that's already created. I used the handler thing k_EMsgGCPracticeLobbyJoinResponse
for joining an already created lobby instead of k_EMsgGCPracticeLobbyResponse
.
var practiceLobbyJoinResponse = dota_gcmessages_client.CMsgPracticeLobbyJoinResponse.parse(message);
Returns a DOTA_JOIN_RESULT_SUCCESS
when I join an already created lobby.
3 Apr 20:37:29 - practiceLobbyJoinResponse. DOTA_JOIN_RESULT_SUCCESS
3 Apr 20:37:29 - Joined lobby: 23430582993002354
I'm not sure how to properly code the fix for this since I'm very inexperienced, but I thought I should let in case you didn't, as of yet, because it was on your "todo" list inside the code.
The method I wrote into the latest version of the package for converting SteamID to 32 bit for Dota 2 might be incorrect. Here's what I'm currently using (kind of hacky)
@toSteamID32 = (id)->
sids = (steamidconvert.convertToText id).split ":"
id = parseInt sids[2]
id*(2+parseInt(sids[1]))+1
This works with SteamTracks' backend. I think this solution might need to be integrated into this package.
CreatePracticeLobby will now not return a callback upon completion. Instead, users should wait for the practiceLobbyUpdate event which contains the snapshot of the lobby upon cache subscription.
Forgot to update this in the docs.
message CMsgSourceTVGamesResponse {
repeated .CSourceTVGame games = 1;
optional uint32 num_total_games = 2;
}
Im using this to return live games, but currenty it will only display 6 results, even though
optional uint32 num_total_games = 75.
Any idea how to retrieve the data on more than 6 results or is that a limitation by valve, I dont think it should be since the client can display more than 6
I did try to use npm install bignumber.js - did not work.
I didn't have this issue with previous versions.
Any idea why does this happen?
Hi,
i'm currently adding support to get the Match History for a player. Since it is working for my usecase i wanted to contribute the changes back. That is where it starts to get more interesting:
What is your approach on having multiple parameters? CMsgDOTAGetPlayerMatchHistory has a lot of parameters:
message CMsgDOTAGetPlayerMatchHistory {
optional uint32 account_id = 1;
optional uint32 start_at_match_id = 2;
optional uint32 matches_requested = 3;
optional uint32 hero_id = 4;
optional uint32 request_id = 5;
}
Granted not all of them need to be used a the same time. But all of them do make sense (with the exception of the hero_id). So would you prefere them to be exposed individually as in function a(param1, param2,...) or would you prefere function a({param1, param2, ...})?
Thanks
Jens
Hi
I'm trying to get this working on my debian vm (Linux version 3.2.0-4-amd64 ([email protected]) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Debian 3.2.54-2)
But I run in several version related issues. First, I installed the current node.js version (0.11.11) but starting with protobuf extension, I already didn't manage to install the node-dota2 in the root directory.
I then downgraded to 0.9.0, which resulted in a successful npm install process in the root directory, but when I tried building the dependencies in the test directory, many modules starting from steam failed.
Lastly I tried 0.10.0 node.js and managed to build the node-dota2 root directory and the test directory, however, when I try to launch the included index.js, this is the consoleoutput:
[email protected] node_modules/steam
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected]
root@debianweb:/home/radon/node-dota2/test# node index.js
module.js:356
Module._extensions[extension](this, filename);
^
Error: Module version mismatch. Expected 11, got 1.
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/radon/node-dota2/index.js:4:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Could you provide me with information about the environment, you last could confirm the application worked at all?
Sorry for english.
Hello can you update bot, with libarry google, youtube ?
For google !g and youtube !yt. For channel use )
Hi to @RJacksonm1 , @paralin
What was the goal : create small service for friends ,with bot, where i can send to bot some lobby match params ( like game type, win/ loss numbers) and then invite friends to this lobby.
Results :
When bot is started, i used "practiceLobbyCreateResponse" to get the id . But with this id, all other requests like "configPracticeLobby", "joinPracticeLobby", or launch - returns DOTA_JOIN_RESULT_INVALID_LOBBY
Tried to get list of lobbies "practiceLobbyListRequest", and in responce can't find this lobby.
some samples:
var lobbyOptions = {
game_name: "PVDraftLobby",
server_region: 0,
game_mode: 11,
allow_cheats: false,
fill_with_bots: true,
allow_spectating: true,
pass_key: "00000000000003",
series_type: 1,
radiant_series_wins: 1,
dire_series_wins: 1,
allchat: true
};
//--------------------------
self.Dota2.on('practiceLobbyCreateResponse', function(res, id) {
if (this.debug) util.log("##Received New Lobby ID " + id);
var lobbyId = id;
self.Dota2.configPracticeLobby(lobbyId, lobbyOptions, function(err, body) {
// console.log('#configPracticeLobby');
// console.log('##Error');
// console.log(err);
// console.log('##Body');
// console.log(JSON.stringify(body));
});
});
// Some log
#configPracticeLobby
##Error
DOTA_JOIN_RESULT_INVALID_LOBBY
##Body
{"result":"DOTA_JOIN_RESULT_INVALID_LOBBY"}
Is that an issue, or i'm doing something wrong.
Is there other posibilite to config the match and provide an steam://IP:PORT to the frends to join?
(working on Ubuntu 14 with node 0.12 )
Thanks
When i try to start with:
var Steam = require('steam'),
steamClient = new Steam.SteamClient(),
dota2 = require('dota2'),
Dota2 = new dota2.Dota2Client(steamClient, true);
I get this error:
Error: Cannot find module 'dota2'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.