Skip to content

Commit

Permalink
Ticketing now works!
Browse files Browse the repository at this point in the history
  • Loading branch information
MeLlamoPablo committed Jan 5, 2017
1 parent dd24d53 commit 6b02935
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 23 deletions.
9 changes: 8 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ module.exports = {
// --server flag to the add-inhouse command.
// Go to that command's file (Or type -schedulebot add-ihouse --help)
// to see possible values.
defaultServer: "Luxembourg"
defaultServer: "Luxembourg",

// If enabled is true, the bot will ticket any lobbies using the provided league id.
// Make sure that the steam bot is an admin of that league.
ticketing: {
enabled: false,
league_id: 12345
}
}
};

Expand Down
46 changes: 24 additions & 22 deletions lib/modules/dotahandler/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const db = require("../dbhandler")
, cfg = require("../../../config")
, Dota2 = require("dota2")
, ELobbyStatus = require("../../structures/enums/ELobbyStatus")
;
Expand Down Expand Up @@ -133,29 +134,30 @@ class DotaHandler {
return reject(new Error("Unknown game mode " + inhouseProps.gameMode));
}

// TODO make this work
// Can't continue working until https://github.com/Arcana/node-dota2/issues/414
// is resolved.
this.client.createTournamentLobby(
let options = {
"game_name": this.currentLobbyName,
"server_region": server,
"game_mode": gamemode,
"game_version": EGameVersion.GAME_VERSION_STABLE,
"series_type": ESeriesType.NONE,
"cm_pick": ECMPick.DOTA_CM_RANDOM,
"allow_cheats": false,
"fill_with_bots": false,
"allow_spectating": true,
"pass_key": this.currentLobbyPassword,
"radiant_series_wins": 0,
"dire_series_wins": 0,
"allchat": false,
"dota_tv_delay": EDotaTVDelay.LobbyDotaTV_120,
};

if (cfg.dota.ticketing.enabled) {
options.leaguid = cfg.dota.ticketing.league_id;
}

this.client.createPracticeLobby(
this.currentLobbyPassword,
/*tournament_game_id*/ 123456789,
/*tournament_id*/ 4187, /*https://es.dotabuff.com/esports/leagues/4187*/
{
"game_name": this.currentLobbyName,
"server_region": server,
"game_mode": gamemode,
"game_version": EGameVersion.GAME_VERSION_STABLE,
"series_type": ESeriesType.NONE,
"cm_pick": ECMPick.DOTA_CM_RANDOM,
"allow_cheats": false,
"fill_with_bots": false,
"allow_spectating": true,
"pass_key": this.currentLobbyPassword,
"radiant_series_wins": 0,
"dire_series_wins": 0,
"allchat": false,
"dota_tv_delay": EDotaTVDelay.LobbyDotaTV_120
},
options,
err => {
if (!err) {
console.log("[DOTA] Created lobby " + this.currentLobbyName);
Expand Down

0 comments on commit 6b02935

Please sign in to comment.