internal async Task <bool> getCurr() { bool b = false; while (!(b = await pf.getCurrencies())) { } if (PFStuff.freeChestAvailable && freeChestBox.Checked && !taskQueue.Contains("chest")) { taskQueue.Enqueue(() => autoChests.openChest("normal"), "chest"); } autoChests.nextFreeChest = DateTime.Now.AddSeconds(PFStuff.freeChestRecharge); FreeChestTimeLabel.setText(autoChests.nextFreeChest.ToString()); NormalChestLabel.setText(PFStuff.normalChests.ToString()); HeroChestLabel.setText(PFStuff.heroChests.ToString()); autoChests.FreeChestTimer.Interval = PFStuff.freeChestAvailable == true ? 20000 : Math.Max(4000, PFStuff.freeChestRecharge * 1000); return(b); }
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(); }