예제 #1
0
        public void StartMultipleIdle()
        {
            // Start the mask game
            if (Settings.Default.maskGame == true)
            {
                var GameID = Convert.ToInt32(Settings.Default.maskGameID);
                if (GameID > 0)
                {
                    // AllBadges.Add(new Badge(Settings.Default.maskGameID, "Masking Game", "0", "0"));

                    CurrentBadge.AppId = GameID;
                    CurrentBadge.Idle();
                }
            }

            UpdateIdleProcesses();

            // Update label controls
            lblCurrentRemaining.Text = localization.strings.update_games_status;
            lblCurrentStatus.Text    = localization.strings.currently_ingame;

            lblGameName.Visible           = false;
            lblHoursPlayed.Visible        = false;
            ssFooter.Visible              = true;
            gameToolStripMenuItem.Enabled = false;

            // Start the animated "working" gif
            picIdleStatus.Image = Resources.imgSpin;

            // Start the timer that will check if drops remain
            tmrCardDropCheck.Enabled = true;

            // Reset the timer
            TimeLeft = 360;

            // Show game
            GamesState.Visible = true;
            picApp.Visible     = false;
            RefreshGamesStateListView();

            // Set the correct buttons on the form for pause / resume
            btnResume.Visible = false;
            btnPause.Visible  = false;
            btnSkip.Visible   = false;
            resumeIdlingToolStripMenuItem.Enabled = false;
            pauseIdlingToolStripMenuItem.Enabled  = false;
            skipGameToolStripMenuItem.Enabled     = false;

            var scale = CreateGraphics().DpiY * 3.86;

            Height = Convert.ToInt32(scale);
        }
예제 #2
0
        private async void tmrCardDropCheck_Tick(object sender, EventArgs e)
        {
            if (TimeLeft <= 0)
            {
                tmrCardDropCheck.Enabled = false;
                if (CurrentBadge != null)
                {
                    CurrentBadge.Idle();
                    await CheckCardDrops(CurrentBadge);
                }

                var isMultipleIdle = CanIdleBadges.Any(b => !Equals(b, CurrentBadge) && b.InIdle);
                if (isMultipleIdle)
                {
                    await LoadBadgesAsync();

                    UpdateIdleProcesses();

                    isMultipleIdle = CanIdleBadges.Any(b => b.HoursPlayed < 2 && 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");
            }
        }
예제 #3
0
        public void StartSoloIdle(Badge badge)
        {
            // Set the currentAppID value
            CurrentBadge = badge;

            // Place user "In game" for card drops
            CurrentBadge.Idle();

            // Update game name
            lblGameName.Visible = true;
            lblGameName.Text    = CurrentBadge.Name;

            GamesState.Visible            = false;
            gameToolStripMenuItem.Enabled = true;

            // Update game image
            try
            {
                picApp.Load("http://cdn.akamai.steamstatic.com/steam/apps/" + CurrentBadge.StringId + "/header_292x136.jpg");
                picApp.Visible = true;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "frmMain -> StartIdle -> load pic, for id = " + CurrentBadge.AppId);
            }

            // Update label controls
            lblCurrentRemaining.Text = CurrentBadge.RemainingCard + " " + localization.strings.card_drops_remaining;
            lblCurrentStatus.Text    = localization.strings.currently_ingame;
            lblHoursPlayed.Visible   = true;
            lblHoursPlayed.Text      = CurrentBadge.HoursPlayed + " " + localization.strings.hrs_on_record;

            // Set progress bar values and show the footer
            pbIdle.Maximum   = CurrentBadge.RemainingCard;
            pbIdle.Value     = 0;
            ssFooter.Visible = true;

            // Start the animated "working" gif
            picIdleStatus.Image = Resources.imgSpin;

            // Start the timer that will check if drops remain
            tmrCardDropCheck.Enabled = true;

            // Reset the timer
            // zhenying 5 minutes or 15 minutes?
            //TimeLeft = CurrentBadge.RemainingCard == 1 ? 300 : 900;
            TimeLeft = CurrentBadge.RemainingCard == 1 ? 10 : 30;

            // Set the correct buttons on the form for pause / resume
            btnResume.Visible = false;
            btnPause.Visible  = true;
            btnSkip.Visible   = true;
            resumeIdlingToolStripMenuItem.Enabled = false;
            pauseIdlingToolStripMenuItem.Enabled  = false;
            skipGameToolStripMenuItem.Enabled     = false;

            var scale = CreateGraphics().DpiY * 3.9;

            Height = Convert.ToInt32(scale);
        }
예제 #4
0
        private async void tmrCardDropCheck_Tick(object sender, EventArgs e)
        {
            if (TimeLeft <= 0)
            {
                tmrCardDropCheck.Enabled = false;
                if (CurrentBadge != null)
                {
                    CurrentBadge.Idle();
                }

                var isMultipleIdle = CanIdleBadges.Any(b => !Equals(b, CurrentBadge) && b.InIdle);
                if (isMultipleIdle)
                {
                    lblDrops.Visible       = true;
                    lblDrops.Text          = localization.strings.reading_badge_page + ", " + localization.strings.please_wait;
                    lblIdle.Visible        = false;
                    picReadingPage.Visible = true;
                    await LoadBadgesAsync();
                }

                // 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;
            }
        }
예제 #5
0
        public void StartIdle(Badge badge)
        {
            // Set the currentAppID value
            CurrentBadge = badge;

            // Place user "In game" for card drops
            CurrentBadge.Idle();
            Thread.Sleep(500);

            UpdateIdleProcesses();

            // Update game name
            lblGameName.Visible = true;
            lblGameName.Text    = CurrentBadge.Name;

            // Update game image
            try
            {
                picApp.Load("http://cdn.akamai.steamstatic.com/steam/apps/" + CurrentBadge.StringId + "/header_292x136.jpg");
                picApp.Visible = true;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "frmMain -> StartIdle -> load pic, for id = " + CurrentBadge.AppId);
            }

            // Update label controls
            lblCurrentRemaining.Text = CurrentBadge.RemainingCard + " card drops remaining";
            lblCurrentStatus.Text    = "Currently in-game";
            UpdateStateInfo();

            // Set progress bar values and show the footer
            pbIdle.Maximum   = CurrentBadge.RemainingCard;
            pbIdle.Value     = 0;
            ssFooter.Visible = true;

            // Start the animated "working" gif
            picIdleStatus.Image = Resources.imgSpin;

            // Start the timer that will check if drops remain
            tmrCardDropCheck.Enabled = true;

            // Reset the timer
            TimeLeft = pbIdle.Maximum != 1 ? 900 : 300;

            // Set the correct buttons on the form for pause / resume
            btnResume.Visible = false;
            btnPause.Visible  = true;
            resumeIdlingToolStripMenuItem.Enabled = false;
            pauseIdlingToolStripMenuItem.Enabled  = false;
            skipGameToolStripMenuItem.Enabled     = false;

            var graphics = CreateGraphics();
            var scale    = graphics.DpiY * 3.86;

            Height = Convert.ToInt32(scale);
        }
예제 #6
0
        public void StartSoloIdle(Badge badge) // aka2
        {
            // Set the currentAppID value
            CurrentBadge = badge;

            // Place user "In game" for card drops
            CurrentBadge.Idle();

            // Update game name
            lblGameName.Visible = true;
            lblGameName.Text    = CurrentBadge.Name;

            GamesState.Visible            = false;
            gameToolStripMenuItem.Enabled = true;

            // Update game image
            try
            {
                picApp.Load("http://cdn.akamai.steamstatic.com/steam/apps/" + CurrentBadge.StringId + "/header_292x136.jpg");
                picApp.Visible = true;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "frmMain -> StartIdle -> load pic, for id = " + CurrentBadge.AppId);
            }

            // Update label controls
            lblCurrentStatus.Visible = true;
            lblCurrentStatus.Text    = localization.strings.currently_ingame;
            lblHoursPlayed.Visible   = true;
            lblHoursPlayed.Text      = CurrentBadge.HoursPlayed + " " + localization.strings.hrs_on_record;

            // Start the animated "working" gif
            picIdleStatus.Image = Settings.Default.customTheme ? Resources.imgSpinInv : Resources.imgSpin;

            // Set the correct buttons on the form for pause / resume
            btnResume.Visible = false;
            btnPause.Visible  = true;
            btnSkip.Visible   = true;
            resumeIdlingToolStripMenuItem.Enabled = false;
            pauseIdlingToolStripMenuItem.Enabled  = false;
            skipGameToolStripMenuItem.Enabled     = false;

            var scale = CreateGraphics().DpiY * 3.9;

            Height = Convert.ToInt32(scale);
        }
 private void btnIdle_Click(object sender, EventArgs e)
 {
     if (lstGames.SelectedItem != null)
     {
         if (CurrentGame != null)
         {
             CurrentGame.StopIdle();
         }
         CurrentGame = AllGames.FirstOrDefault(b => b.Name == lstGames.SelectedItem.ToString());
         if (CurrentGame != null)
         {
             label2.Text = localization.strings.currently_ingame + @" " + CurrentGame.Name;
             CurrentGame.Idle();
         }
     }
     txtName.Text = string.Empty;
     txtName.Focus();
 }
예제 #8
0
        private async void tmrCardDropCheck_Tick(object sender, EventArgs e)
        {
            if (TimeLeft <= 0)
            {
                tmrCardDropCheck.Enabled = false;
                CurrentBadge.Idle();
                await CheckCardDrops(CurrentBadge);

                if (CanIdleBadges.Any(b => !Equals(b, CurrentBadge) && b.InIdle))
                {
                    await LoadBadgesAsync();
                }

                UpdateIdleProcesses();

                tmrCardDropCheck.Enabled = CanIdleBadges.Any() && TimeLeft != 0;
            }
            else
            {
                TimeLeft      = TimeLeft - 1;
                lblTimer.Text = TimeSpan.FromSeconds(TimeLeft).ToString(@"mm\:ss");
            }
        }
예제 #9
0
        public void StartSoloIdle(Badge badge)
        {
            // Set the currentAppID value
            CurrentBadge = badge;

            // Place user "In game" for card drops
            CurrentBadge.Idle();

            // Update game name
            lblGameName.Visible = true;
            lblGameName.Text = CurrentBadge.Name;

            GamesState.Visible = false;
            gameToolStripMenuItem.Enabled = true;

            // Update game image
            try
            {
                picApp.Load("http://cdn.akamai.steamstatic.com/steam/apps/" + CurrentBadge.StringId + "/header_292x136.jpg");
                picApp.Visible = true;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "frmMain -> StartIdle -> load pic, for id = " + CurrentBadge.AppId);
            }

            // Update label controls
            lblCurrentRemaining.Text = CurrentBadge.RemainingCard + " " + localization.strings.card_drops_remaining;
            lblCurrentStatus.Text = localization.strings.currently_ingame;
            lblHoursPlayed.Visible = true;
            lblHoursPlayed.Text = CurrentBadge.HoursPlayed + " " + localization.strings.hrs_on_record;

            // Set progress bar values and show the footer
            pbIdle.Maximum = CurrentBadge.RemainingCard;
            pbIdle.Value = 0;
            ssFooter.Visible = true;

            // Start the animated "working" gif
            picIdleStatus.Image = Resources.imgSpin;

            // Start the timer that will check if drops remain
            tmrCardDropCheck.Enabled = true;

            // Reset the timer
            TimeLeft = CurrentBadge.RemainingCard == 1 ? 300 : 900;

            // Set the correct buttons on the form for pause / resume
            btnResume.Visible = false;
            btnPause.Visible = true;
            btnSkip.Visible = true;
            resumeIdlingToolStripMenuItem.Enabled = false;
            pauseIdlingToolStripMenuItem.Enabled = false;
            skipGameToolStripMenuItem.Enabled = false;

            var scale = CreateGraphics().DpiY * 3.9;
            Height = Convert.ToInt32(scale);
        }
예제 #10
0
        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)";
                }
            }
        }