private async void autoPvPCheckbox_CheckedChanged(object sender, EventArgs e) { if (autoPvPCheckbox.Checked) { PVPIndicator.BackColor = Color.Green; if ((DateTime.Now - start).TotalSeconds > 3) { await getData(); autopvp.nextPVP = getTime(PFStuff.PVPTime); PvPTimeLabel.setText(autopvp.nextPVP.ToString()); autopvp.PVPTimer.Interval = Math.Max(8000, (autopvp.nextPVP - DateTime.Now).TotalMilliseconds); } } else { PVPIndicator.BackColor = Color.Red; } }
public async void startTimers() { DateTime[] times = new DateTime[] { DateTime.Now }; if (!PlayFab.PlayFabClientAPI.IsClientLoggedIn()) { if (!await login()) { return; } } await getData(); autoWB.loadWBSettings(); autoLevel.loadALSettings(); autopvp.loadPVPSettings(); times = getTimes(PFStuff.miracleTimes); int i = 0; foreach (Label l in timeLabels) { l.SynchronizedInvoke(() => l.Text = times[i++].ToString()); } nextClaim = times.Min(); nextclaimtime.setText(times.Min().ToString()); initialFollowers = Int64.Parse(PFStuff.followers); tmr.Interval = Math.Max(3000, (times.Min() - DateTime.Now).TotalMilliseconds); tmr.Elapsed += OnTmrElapsed; tmr.Start(); DQLevelLabel.Text = PFStuff.DQLevel; if (Int32.Parse(PFStuff.DQLevel) < 2) { if (DQSoundBox.Checked) { using (var soundPlayer = new SoundPlayer(@"c:\Windows\Media\Windows Notify.wav")) { soundPlayer.Play(); } } if (DQCalcBox.Checked) { autoDQ.RunCalc(AutoDQ.CalcMode.DQ); } } else { DateTime DQRunTime = getTime(PFStuff.DQTime); autoDQ.DQTimer.Interval = (autoDQ.nextDQTime < DateTime.Now && DQCalcBox.Checked) ? 8000 : Math.Max(8000, (autoDQ.nextDQTime - DateTime.Now).TotalMilliseconds); autoDQ.DQTimer.Start(); } autopvp.nextPVP = getTime(PFStuff.PVPTime); PvPTimeLabel.setText(autopvp.nextPVP.ToString()); autopvp.PVPTimer.Interval = Math.Max(3000, (autopvp.nextPVP - DateTime.Now).TotalMilliseconds); autopvp.PVPTimer.Start(); await getCurr(); autoChests.nextFreeChest = DateTime.Now.AddSeconds(PFStuff.freeChestRecharge); FreeChestTimeLabel.setText(autoChests.nextFreeChest.ToString()); autoChests.FreeChestTimer.Interval = PFStuff.freeChestRecharge * 1000; autoChests.FreeChestTimer.Start(); autoWB.getWebsiteData(); autoWB.WBTimer.Interval = 15 * 1000; autoWB.nextWBRefresh = DateTime.Now.AddMilliseconds(autoWB.WBTimer.Interval); foreach (ComboBox c in auctionComboBoxes) { c.Items.AddRange(auctionHouse.getAvailableHeroes()); } auctionHouse.loadSettings(); }