Skip to content

Commit

Permalink
Fix a bug with calculating booster duration across multiple skills in…
Browse files Browse the repository at this point in the history
… the queue.
  • Loading branch information
mgoeppner committed Dec 23, 2022
1 parent 10dfd20 commit c90c049
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/EVEMon.Common/Models/SkillQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ internal void Dispose()
/// Gets the expected booster duration
/// </summary>
public TimeSpan BoosterDuration => !Items.Any() ? TimeSpan.Zero : TimeSpan.FromHours(Items.Select(i => {
var actualTime = i.RemainingTime;
var remainingTime = i.RemainingTime;
var queueTime = i.EndTime - i.StartTime;

var expectedTime = m_character.GetTimeSpanForPointsWithoutBoosters(i.Skill.StaticData, i.Level);
expectedTime = expectedTime.Subtract(TimeSpan.FromMilliseconds(expectedTime.Milliseconds));

var actualSPRate = m_character.GetBaseSPPerHour(i.Skill.StaticData);
var expectedSPRate = m_character.GetBaseSPPerHourWithoutBoosters(i.Skill.StaticData);

if (expectedTime.Subtract(actualTime).TotalSeconds > 1)
if (expectedTime > remainingTime || !i.IsTraining && (expectedTime > queueTime))
{
// Booster detected!

var remainingSP = i.EndSP - i.CurrentSP;
var expectedSPInActualTime = Math.Round(actualTime.TotalHours * expectedSPRate);
var expectedSPInActualTime = i.IsTraining ?
Math.Round(remainingTime.TotalHours * expectedSPRate) : Math.Round(queueTime.TotalHours * expectedSPRate);

var spRateDiff = actualSPRate - expectedSPRate;

Expand Down

0 comments on commit c90c049

Please sign in to comment.