public async Task CheckCardDrops(Badge badge) { if (!await badge.CanCardDrops()) { NextIdle(); } else { // Resets the clock based on the number of remaining drops if (badge.RemainingCard == 1) { skipType = 300; TimeLeft = 300; } else { skipType = 900; TimeLeft = 900; } } lblCurrentRemaining.Text = badge.RemainingCard + " " + localization.strings.card_drops_remaining; pbIdle.Value = pbIdle.Maximum - badge.RemainingCard; lblHoursPlayed.Text = badge.HoursPlayed + " " + localization.strings.hrs_on_record; UpdateStateInfo(); }
public async Task CheckCardDrops(Badge badge) { if (!await badge.CanCardDrops()) { // Stop idling the current game StopIdle(); if (CanIdleBadges.Any()) { // Give the user notification that the next game will start soon lblCurrentStatus.Text = "Loading next game..."; // Make a short but random amount of time pass var rand = new Random(); var wait = rand.Next(3, 9); wait = wait * 1000; tmrStartNext.Interval = wait; tmrStartNext.Enabled = true; } else { IdleComplete(); } } else { // Resets the clock based on the number of remaining drops TimeLeft = badge.RemainingCard == 1 ? 300 : 900; } lblCurrentRemaining.Text = badge.RemainingCard + " card drops remaining"; pbIdle.Value = pbIdle.Maximum - badge.RemainingCard; UpdateStateInfo(); }
public async Task CheckCardDrops(Badge badge) { if (!await badge.CanCardDrops()) { NextIdle(); } else { // Resets the clock based on the number of remaining drops TimeLeft = badge.RemainingCard == 1 ? 300 : 900; } lblCurrentRemaining.Text = badge.RemainingCard + " card drops remaining"; pbIdle.Value = pbIdle.Maximum - badge.RemainingCard; lblHoursPlayed.Text = badge.HoursPlayed + " hrs on record"; UpdateStateInfo(); }
public async Task CheckCardDrops(Badge badge) { if (!await badge.CanCardDrops()) { NextIdle(); lblCurrentRemaining.Text = badge.RemainingCard + " " + localization.strings.card_drops_remaining; pbIdle.Value = pbIdle.Maximum - badge.RemainingCard; lblHoursPlayed.Text = badge.HoursPlayed + " " + localization.strings.hrs_on_record; UpdateStateInfo(); } else { // zhenying make it skip to next item StopIdle(); AllBadges.RemoveAll(b => Equals(b, CurrentBadge)); AllBadges.Add(CurrentBadge); StartIdle(); // Resets the clock based on the number of remaining drops //TimeLeft = badge.RemainingCard == 1 ? 300 : 900; //TimeLeft = badge.RemainingCard == 1 ? 10 : 30; } }
public async Task CheckCardDrops(Badge badge) { if (!await badge.CanCardDrops()) NextIdle(); else { // Resets the clock based on the number of remaining drops TimeLeft = badge.RemainingCard == 1 ? 300 : 900; } lblCurrentRemaining.Text = badge.RemainingCard + " " + localization.strings.card_drops_remaining; pbIdle.Value = pbIdle.Maximum - badge.RemainingCard; lblHoursPlayed.Text = badge.HoursPlayed + " " + localization.strings.hrs_on_record; UpdateStateInfo(); }
private async void tmrCardDropCheck_Tick(object sender, EventArgs e) { if (TimeLeft <= 0) { tmrCardDropCheck.Enabled = false; // solo mode if (CurrentBadge != null) { CurrentBadge.Idle(); if (PreviousBadge != null) { await PreviousBadge.CanCardDrops(); if (PreviousCardsRemaining != PreviousBadge.RemainingCard) { //前のゲームのカードがドロップしたようなので、ファストモード成功。 //あと10秒くらいまって次のカードへ。 TimeLeft = 10; //前のゲームにカードが残っているようなら、ファストモードにしておく。 if (PreviousBadge.RemainingCard > 0) { PreviousBadge.FastMode = true; if (Settings.Default.checkNoDrop) { //次も同じゲームをIdleする AllBadges.RemoveAll(b => Equals(b, PreviousBadge)); AllBadges.Insert(0, PreviousBadge); } else { //追加Idle if (PreviousBadge.HoursPlayed <= 10) { while (PreviousBadge.HoursPlayed > PreviousBadge.MinPlayTime) { PreviousBadge.MinPlayTime += 0.5; } } else { //Idle時間が10時間を越えていたならFastModeをやめる。 PreviousBadge.FastMode = false; } } } } else { //ファストモード失敗。 //最低プレイ時間を30min間延ばす //ただしプレイ時間が10時間以上のものは通常モードにする。 //(無限にIdleするのを防ぐため。) if (PreviousBadge.HoursPlayed <= 10) { while (PreviousBadge.HoursPlayed > PreviousBadge.MinPlayTime) { PreviousBadge.MinPlayTime += 0.5; } //あと20秒くらいまって次のカードへ。 TimeLeft = 10; } else { PreviousBadge.FastMode = false; //次のゲームへ。 NextIdle(); } } //前のゲームの処理は終わり PreviousBadge = null; } else { if (Settings.Default.fastModeEnable && CurrentBadge.FastMode) { //現在のゲームとカードドロップ数を記録しておく PreviousCardsRemaining = CurrentBadge.RemainingCard; PreviousBadge = CurrentBadge; //現在のゲームを最後尾へ AllBadges.RemoveAll(b => Equals(b, CurrentBadge)); AllBadges.Add(CurrentBadge); //次のゲームへ NextIdle(); } else { //通常モード await CheckCardDrops(CurrentBadge); } } } var isMultipleIdle = CanIdleBadges.Any(b => !Equals(b, CurrentBadge) && b.InIdle); if (isMultipleIdle) { await LoadBadgesAsync(); UpdateIdleProcesses(); isMultipleIdle = CanIdleBadges.Any(b => b.HoursPlayed < b.MinPlayTime && b.InIdle); if (isMultipleIdle) { TimeLeft = 360; } } // Check if user is authenticated and if any badge left to idle // There should be check for IsCookieReady, but property is set in timer tick, so it could take some time to be set. tmrCardDropCheck.Enabled = !string.IsNullOrWhiteSpace(Settings.Default.sessionid) && IsSteamReady && CanIdleBadges.Any() && TimeLeft != 0; } else { TimeLeft = TimeLeft - 1; lblTimer.Text = TimeSpan.FromSeconds(TimeLeft).ToString(@"mm\:ss"); if (Settings.Default.fastModeEnable && CurrentBadge != null) { lblTimer.Text += CurrentBadge.FastMode ? "(F)" : "(N)"; } } }