public void Init(String username, String pwd, LoLLauncher.Region reg, QueueTypes queuetype) { userName = username; password = pwd; queueType = queuetype; region = reg; connection.OnConnect += connection_OnConnect; connection.OnDisconnect += connection_OnDisconnect; connection.OnError += connection_OnError; connection.OnLogin += connection_OnLogin; connection.OnLoginQueueUpdate += connection_OnLoginQueueUpdate; connection.OnMessageReceived += connection_OnMessageReceived; updateStatus("Init"); }
public LoLLauncherClient(String username, String pwd, LoLLauncher.Region reg, QueueTypes queuetype, IntPtr panelhnd, String installExe) { panelHandle = panelhnd; userName = username; password = pwd; queueType = queuetype; region = reg; connection.OnConnect += connection_OnConnect; connection.OnDisconnect += connection_OnDisconnect; connection.OnError += connection_OnError; connection.OnLogin += connection_OnLogin; connection.OnLoginQueueUpdate += connection_OnLoginQueueUpdate; connection.OnMessageReceived += connection_OnMessageReceived; installPath = installExe; updateStatus("Init"); }
private void connection_OnError(object sender, LoLLauncher.Error error) { if (error.Message.Contains("is not owned by summoner")) { return; } else if (error.Message.Contains("Your summoner level is too low to select the spell")) { var random = new Random(); var spellList = new List<int> { 13, 6, 7, 10, 1, 11, 21, 12, 3, 14, 2, 4 }; int index = random.Next(spellList.Count); int index2 = random.Next(spellList.Count); int randomSpell1 = spellList[index]; int randomSpell2 = spellList[index2]; if (randomSpell1 == randomSpell2) { int index3 = random.Next(spellList.Count); randomSpell2 = spellList[index3]; } int Spell1 = Convert.ToInt32(randomSpell1); int Spell2 = Convert.ToInt32(randomSpell2); return; } updateStatus("error received:\n" + error.Message, Accountname); }