private static void QueueTimerCallback(object state) // check main screen { if (LOLProcess != null && !LOLProcess.HasExited) { Try++; if (Try > MAX_TRIES) { State = ClientStates.Idle; LogAndInfo("Can't get in queue: Reached to max. number of tries."); KillTimers(); } else { LogAndInfo("Waiting for the main screen..."); //); TimerChange(LoginTimer, QueueTimerInterval); } } else { /*if (LOLProcess != null) * { * LOLProcess.Dispose(); * LOLProcess = null; * }*/ GameSession.TimerTick = DateTime.Now.Ticks; KillTimers(); Logger.Log("Killed timers (q1)"); LogAndInfo("Preparing..."); Try = 0; sel = 0; Thread.Sleep(GameSession.RandomTimeGenerator(5000)); try { LCU = new LCU(); while (LCU.SummonerID == 0) { KillEdge(); Thread.Sleep(GameSession.RandomTimeGenerator(15000)); if (GameSession.GetPort() != 0) { GameSession.TimerTick = DateTime.Now.Ticks; LogAndInfo("reconnecting"); Restart = true; break; } LogAndInfo("Can't set summonerID"); Try = -1; LCU = new LCU(); } Thread.Sleep(GameSession.RandomTimeGenerator(15000)); while (LCU.IsInLoginQueue()) { GameSession.TimerTick = DateTime.Now.Ticks; KillEdge(); LogAndInfo("Still in login queue."); Thread.Sleep(GameSession.RandomTimeGenerator(15000)); } } catch (Exception x) { LogAndInfo("qu error: " + x.Message); } KillEdge(); if (!Restart) { try { for (int i = 0; i < 5; i++) { TryToContinue(); } //ok-ok-ok Thread.Sleep(GameSession.RandomTimeGenerator(15000)); LogAndInfo("Creating lobby..."); string re = LCU.CreateLobby("intro"); while (re != "OK" && re != "423") { LCU = new LCU(); Thread.Sleep(GameSession.RandomTimeGenerator(5000)); re = LCU.CreateLobby("intro"); } Server.SetIndicator(IndicatorStates.Wait); LoginTimer = new Timer(Queue2TimerCallback, null, Queue2TimerInterval, Timeout.Infinite); } catch (Exception x) { Logger.Log("!res err: " + x.Message); } } else { while (GameSession.GetPort() == 0) { TryToContinue(); LogAndInfo("waiting for reconnect..."); } LogAndInfo("Reconnecting..."); State = ClientStates.InGame; Communication.SendMessageWithoutReply(Server.ClientID, "state", "ingame"); StartGameSession(Champions.RandomChamp()); KillTimers(); Restart = false; } } }