/// <summary> /// Resets the dota 2 lobby in preperation for a new lobby to be created /// </summary> public void Reset() { // try random bs to leave the post-match screen dota.AbandonGame(); dota.LeaveLobby(); }
/// <summary> /// Connects to steam & logs in the bot account. /// This is SYNCHRONOUS. /// </summary> public void Connect() { client.Connect(); doLoop = true; messageLoop.Start(); // wait for successful connection while (true) { if (Connected) { break; } } user.LogOn(new SteamUser.LogOnDetails { Username = username, Password = password, }); //wait for successful login while (true) { if (LoggedIn) { break; } } DotaGCHandler.Bootstrap(client, Dota2.Base.Data.Games.DOTA2); dota = client.GetHandler <DotaGCHandler>(); //wait for successful dota connection bool retry = false; do { retry = false; if (ConnectToDota()) { UpdateStatus(DotaClientStatus.Normal, "Dota: Connected."); } else { retry = this.parameters.dota_reconnect; if (retry) { UpdateStatus(DotaClientStatus.Warning, "Dota: Connection Failed. Retrying..."); continue; } else { UpdateStatus(DotaClientStatus.Fatal, "Dota: Connection Failed."); return; } } if (dota.Lobby != null) { UpdateStatus(DotaClientStatus.Warning, "Lobby: Already in a lobby. Leaving..."); dota.LeaveLobby(); while (dota.Lobby == null) { Thread.Sleep(10); } UpdateStatus(DotaClientStatus.Warning, "Dota: Reconnecting..."); dota.Stop(); Thread.Sleep(7000); retry = true; } } while (retry); }