forked from k0mar12/node-dota2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.hbs
66 lines (53 loc) · 4.08 KB
/
README.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
node-dota2
========
[![NPM version](https://img.shields.io/npm/v/dota2.svg)](https://npmjs.org/package/dota2 "View this project on NPM")
[![Build Status](https://img.shields.io/travis/Arcana/node-dota2.svg)](https://travis-ci.org/Arcana/node-dota2 "View this project's build information")
[![Dependency Status](https://img.shields.io/david/Arcana/node-dota2.svg)](https://david-dm.org/Arcana/node-dota2 "Check this project's dependencies")
[![Greenkeeper badge](https://badges.greenkeeper.io/Arcana/node-dota2.svg)](https://greenkeeper.io/)
A node-user-steama plugin for Dota 2, consider it in alpha state.
## Contributing
Check out @RJacksonm1's blog post (his only blog post), [Extending node-dota2](https://blog.rjackson.me/extending-node-dota2/), for a rough overview of adding new functionality to the library.
A fair warning, while the way you search for new functionality is still the same, quite a lot has changed (and been simplified) implementation wise.
It is now easier to implement new functionality than it was back when this blog was written.
Be careful, you'll need SVN if you want to work on the project! Executing an `npm install` inside the project directory
has node-steam-user fetch the most recent node-steam-resources-fork, which needs SVN to obtain the protobufs.
## Installation and setup
* `npm install dota2` in your repository root
* Copy `node_modules/dota2/examples/config.js.example` to `config.js` in your project root and edit appropriately
* Copy `node_modules/dota2/examples/example.js` in your project root and change line 5 to `dota2 = require("dota2"),`
* Run the example script: `node example.js`
* If you receive Error 63 you need to provide a Steam Guard code by setting the Steam Guard code in `config.js` and launching again.
* Make sure to use at least version 4.4.5 of node js
### WARNING
At the moment the serverlist that is kept internally by node-steam contains IP addresses which are no longer responsive.
This causes timeouts and makes node-dota2 seem unresponsive. The examples contain a fix for this behaviour.
In short, node-steam emits a servers event that will always contain the latest version of the server list.
You need to make sure that your bot handles this event and saves its contents so that upon next startup you can initialize node-steam with a more up to date list.
The examples folder contains a (as of the beginning of October 2018) working list that is read by the example bots.
You can use this list to bootstrap your bot until node-steam updates their embedded list.
## Initializing
Parameters:
* `steamClient` - Pass a SteamClient instance to use to send & receive GC messages.
* `debug` - A boolean noting whether to print information about operations to console.
* `debugMore` - A boolean noting whether to print extended debug information. Activating this will log messages for each proto message exchanged with the GC.
```js
var Steam = require('steam-user')
var dota2 = require('dota2')
var Dota2 = new dota2.Dota2Client(Steam, true, false);
```
## Disclaimer
We do not in any way encourage people to use their own accounts when using this library.
This library tries to mimic the behavior of the Dota 2 client to allow people to programmatically interact with the Dota 2 GC,
however we make no efforts to hide this fact and it's pretty easy for Valve to detect clients using this library based on the generated traffic.
While Valve has not yet expressed a dislike regarding reverse engineering projects like this one,
it's not unimaginable that this might one day change and result in VAC bans.
## Examples
The `examples` directory contains two Dota2 bots as an example. One contains commented-out dota2 methods, the other has boolean activated methods.
Both examples show how to interact with the library.
## Testing
There is a partial automated test suite for node-dota2, which is located in the test directory.
You need to configure the `STEAM_USERNAME` and `STEAM_PASSWORD` environment variables to be able to run it.
You can launch the tests by running the file with mocha.
# API
The API doc can be consulted here or at [doclets.io](https://doclets.io/Arcana/node-dota2)
{{>main}}