//public void Send(IClientGCMsg msg) //{ // var clientMsg = new ClientMsgProtobuf<CMsgGCClient>(EMsg.ClientToGC); // clientMsg.Body.msgtype = MsgUtil.MakeGCMsg(msg.MsgType, msg.IsProto); // clientMsg.Body.appid = (uint)570; // clientMsg.Body.payload = msg.Serialize(); // steamClient.Send(clientMsg); //} private void OnConnectionStatus(DotaGCHandler.ConnectionStatus callback) { if (callback.result.status == Dota2.GC.Internal.GCConnectionStatus.GCConnectionStatus_NO_SESSION_IN_LOGON_QUEUE) { dotaIsReady = false; Console.WriteLine("Waiting for LOGON QUEUE 10 seconds..."); Thread.Sleep(TimeSpan.FromSeconds(10)); return; } if (callback.result.status != Dota2.GC.Internal.GCConnectionStatus.GCConnectionStatus_HAVE_SESSION) { dotaIsReady = false; if (dota.Ready) { dota.Stop(); } dota.Start(); } }
/// <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); }