private void SecondStrikeTimer_Tick(object source, EventArgs e) { while (true) { var dateTime = _clickTimes.FirstOrDefault(); // If _clickTimes is empty, stop the timer. if (dateTime == default) { _timer.Stop(); break; } // If at least (StrikeDelay) seconds has passed, click again. If not, wait (for next tick). if (DateTime.Now - dateTime >= TimeSpan.FromSeconds(StrikeDelay)) { CombatHelper.HandleUserClickOnEnemy(); _clickTimes.RemoveAt(0); // Remove the artificial click (should be the last one in the list). _clickTimes.RemoveAt(_clickTimes.Count - 1); } else { break; } } }
private void MonsterButton_Click(object sender, RoutedEventArgs e) { var isNoQuestActive = User.Instance.CurrentHero.Quests.All(x => x.EndDate == default); if (isNoQuestActive) { CombatHelper.HandleUserClickOnEnemy(); } else { AlertBox.Show("Your hero is busy completing quest!\nCheck back when it's finished.", MessageBoxButton.OK); } }
private void BossButton_Click(object sender, RoutedEventArgs e) { CombatHelper.HandleUserClickOnEnemy(); }