private void arenaButton_Click(object sender, EventArgs e) { var t = new Thread(() => { Func <string, int> update = i => { levelStatus.Text = i; return(1); }; arenaButton.Enabled = false; client.Login(); client.ClearArena(); arenaButton.Enabled = true; }); t.IsBackground = true; t.Start(); }
private void RunMission(bool queuedMission = false) { StartMission.Enabled = false; startQueuedMissions.Enabled = false; client.Device = RBiOS.Checked ? "iPhone9,3" : "XT890"; client.OperatingSystem = RBiOS.Checked ? "ios10.2.1" : RBAndroid.Checked ? "android4.4.2" : "amazon"; client.Login(); //if (Verbose) client.UpdateCurrentParty(); var mission = missionSelect.SelectedItem as Mission; //client.DoMission(mission, CBFriends.Checked, null, null, null, CBTrophies.Checked, CBChallenge.Checked, CBLoot.Checked, CBUnits.Checked, CBExplore.Checked, LBLevel.Text, 3000); RunMissionCount = 0; var TotalErrors = 0; var runTotal = RepeatMission.Text.Replace(" ", "") ?? "1"; while (RunMissionCount < Int32.Parse(runTotal) && TotalErrors < 3) { if (queuedMission && QueuedMissions.Count > 0) { mission = QueuedMissions.FirstOrDefault(); QueuedMissions.Remove(mission); queuedMissions.Items.RemoveAt(queuedMissions.Items.IndexOf(mission.Name)); } try { var iterationInfo = $"Doing run ... {mission.Name} {(++RunMissionCount).ToString()}/{runTotal} With party: {client.MyCurrentParty.CurrentPartyNames}"; Logger.Out(iterationInfo); var missionResult = client.DoMission(mission, CBFriends.Checked, null, null, null, CBTrophies.Checked, CBChallenge.Checked, CBLoot.Checked, CBUnits.Checked, CBExplore.Checked, LBLevel.Text, 1500, CBIsParadeMissionEnd.Checked); client.ArenaOrbs = UInt16.Parse(missionResult[GameObject.UserTeamInfo][0][Variable.ColosseumOrb].ToString()); client.RaidOrbs = UInt16.Parse(missionResult[GameObject.UserTeamInfo][0][Variable.RaidOrb].ToString()); var currentEnergy = Int32.Parse(missionResult[GameObject.UserTeamInfo][0][Variable.Energy].ToString()); Thread.Sleep(1500); if (StopForArena && client.ArenaOrbs > 0)// && (RunMissionCount % 20 == 0)) { client.ClearArena(); } if (StopForRaid && client.RaidOrbs > 0)//&& (RunMissionCount % 20 == 0)) { client.ClearRaid(RaidMissionSelect.SelectedItem as Mission, RaidParty); } if (RunMissionCount % 5 == 0) { client.UpdateCurrentParty(missionResult); /*client.MyCurrentParty.MyPartyUnits.ForEach(x => * { * if (x.TMR == 100 || (x.TMR > 0 && x.TMR > x.LastTMR)) * { * Logger.Out(x.Name + " Gained " + (x.TMR - x.LastTMR) + " points."); * } * * if (x.LastLevel < x.Level) * { * Logger.Out($"{x.Name} Leveld up! Now Level {x.Level}"); * } * });*/ } /*if (Verbose && currentEnergy > 195) * { * Logger.Out("Warning: Excess Energy " + client.TotalEnergy); * }*/ if (ChangeParty >= 0 && ChangeParty < 5 && client.MyCurrentParty.MyPartyId != ChangeParty) { client.ChangeParty(ChangeParty); } // Get fresh data every x runs if (RunMissionCount > 1 && RunMissionCount % 100 == 0) { client.UpdateGetUserInfo(); } } catch (Exception ex) { Logger.Out(ex.Message); Console.WriteLine(ex.InnerException); TotalErrors++; } } StartMission.Enabled = true; Logger.Out("Run Complete!"); }