Skip to content
This repository has been archived by the owner on Oct 28, 2019. It is now read-only.

Added auto skip button #246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Source/IdleMaster/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 41 additions & 3 deletions Source/IdleMaster/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public IEnumerable<Badge> CanIdleBadges
public int TimeLeft = 900;
public int RetryCount = 0;
public int ReloadCount = 0;
public int skipType = 900;
public bool skipEnabled = false;
public int CardsRemaining { get { return CanIdleBadges.Sum(b => b.RemainingCard); } }
public int GamesRemaining { get { return CanIdleBadges.Count(); } }
public Badge CurrentBadge;
Expand Down Expand Up @@ -290,7 +292,16 @@ public void StartSoloIdle(Badge badge)
tmrCardDropCheck.Enabled = true;

// Reset the timer
TimeLeft = CurrentBadge.RemainingCard == 1 ? 300 : 900;
if (CurrentBadge.RemainingCard == 1)
{
skipType = 300;
TimeLeft = 300;
}
else
{
skipType = 900;
TimeLeft = 900;
}

// Set the correct buttons on the form for pause / resume
btnResume.Visible = false;
Expand Down Expand Up @@ -552,8 +563,17 @@ public async Task CheckCardDrops(Badge badge)
else
{
// Resets the clock based on the number of remaining drops
TimeLeft = badge.RemainingCard == 1 ? 300 : 900;
}
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;
Expand Down Expand Up @@ -863,7 +883,10 @@ private async void tmrCardDropCheck_Tick(object sender, EventArgs e)

isMultipleIdle = CanIdleBadges.Any(b => b.HoursPlayed < 2 && b.InIdle);
if (isMultipleIdle)
{
skipType = 360;
TimeLeft = 360;
}
}

// Check if user is authenticated and if any badge left to idle
Expand All @@ -873,6 +896,16 @@ private async void tmrCardDropCheck_Tick(object sender, EventArgs e)
else
{
TimeLeft = TimeLeft - 1;
if (skipEnabled)
{
if ( (skipType == 360 && TimeLeft < 355) ||
(skipType == 300 && TimeLeft < 295) ||
(skipType == 900 && TimeLeft < 895)
)
btnSkip.PerformClick();
}


lblTimer.Text = TimeSpan.FromSeconds(TimeLeft).ToString(@"mm\:ss");
}
}
Expand Down Expand Up @@ -1049,5 +1082,10 @@ private void tmrStatistics_Tick(object sender, EventArgs e)
statistics.increaseMinutesIdled();
statistics.checkCardRemaining((uint)CardsRemaining);
}

private void checkBoxSkipAuto_CheckedChanged(object sender, EventArgs e)
{
skipEnabled = checkBoxSkipAuto.Checked;
}
}
}