evemon icon indicating copy to clipboard operation
evemon copied to clipboard

Skill duration incorrect when using accelerators

Open wvdvegt opened this issue 6 years ago • 7 comments

The skill queue shows training times that seem to incorporate accelerator effects even after its finished. Seems like it's corrected twice or at least incorrect.

The EveEsi skill queue data is, as far as i can tell, already corrected for these effects (at least in my app i see correct times matching eve for skills taking longer then the accelerator lifespan and I do the math pure on Start_Date / Finish_Date values without any further corrections).

Example: my accelerator still lasts 10h. I get the following numbers:

EVEMon shows 2d22h remaining on 'Missile Launcher Operations' and 5m on 'Caldari Offensive Systems'. The EVEMon overview shows 3d20h for the first skill (same as in Eve itself, so correct). Eve shows 7m for the 2nd skill also matching Eve.

Without accelerator the first skill would be even longer and the second one would still be 7m (proof the overview value is the correctly calculated value).

So i think you can remove adjustments caused by attributes and just use the EveEsi Start_Date / Finish_Date data as it's already corrected for these effects.

wvdvegt avatar Oct 03 '18 09:10 wvdvegt

I think the issue is caused by the use of

public TimeSpan GetLeftTrainingTimeToLevel(Int64 level) => GetTimeSpanForPoints(GetLeftPointsRequiredToLevel(level));

in Skills.cs (and related method using SP to calculate durations). This SP based code will fail when pilot attributes are not fixed in time like when using accelerators.

It should just be something using Start_Date/Now/Finish_Date based like the following Duration code I use in my app:

public String Duration {
            get {
                if (Finish_Date == DateTime.MinValue || Start_Date == DateTime.MinValue)
                {
                    return "Paused";
                }

                TimeSpan duration = DateTime.Now > Start_Date
                    ? (Finish_Date - DateTime.Now)
                    : (Finish_Date - Start_Date);
                if (duration.Ticks <= 0)
                {
                    return "Completed";
                }

                return Utils.SpanToString(duration);
            }
        }

wvdvegt avatar Oct 03 '18 09:10 wvdvegt

The following code fixes the issue (in the skill queue)

Add the following method to CharacterSkillsQueueList.cs (or some utility class):

        private static String DurationLeft(QueuedSkill skill)
        {
                if (skill.EndTime == DateTime.MinValue || skill.StartTime == DateTime.MinValue)
                {
                    return "Pauzed";
                }

                TimeSpan duration = DateTime.Now > skill.StartTime
                    ? (skill.EndTime - DateTime.Now)
                    : (skill.EndTime - skill.StartTime);
                if (duration.Ticks <= 0)
                {
                    return "Completed";
                }

            return duration.ToDescriptiveText(DescriptiveTextOptions.SpaceBetween);
        }

In CharacterSkillsQueueList.cs / DrawItem() change the line 243 from:

string remainingTimeText = timeSpanFromPoints.ToDescriptiveText(DescriptiveTextOptions.SpaceBetween);

into:

string remainingTimeText = DurationLeft(skill);

And a similar change in CharacterSkillsQueueList.cs / GetTooltip

private static string GetTooltip(QueuedSkill skill)

wvdvegt avatar Oct 03 '18 10:10 wvdvegt

One last remark, I think this (switching to start/end time from EveEsi) might cause some issues with way the remaining time is updating when time progresses.

Just checked and the remaining time is nicely counting down in the skill queue

wvdvegt avatar Oct 03 '18 10:10 wvdvegt

This code does not work if the queue is paused. In this case, the end time is not specified and needs to be inferred by EVEMon using the current attributes.

peterhaneve avatar Oct 04 '18 00:10 peterhaneve

Even though we don't get the booster effect/duration directly through ESI, the attribute increase from the accelerators is still included in the Attributes data returned by ESI. Even though it doesn't help for use in plans, it means that the accelerator effect should still be visible in the character overview.

However, there is currently a bug with the way EVEMon queries implants and attributes (it does them chained, first implants and then attributes), which causes changes to attributes to not be queried if the implants don't change. This means that the attribute bonus from the accelerator will stick around until either implants ETag expires, or EVEMon is restarted. I've tried to explain the problem on #13 (specifically in this comment https://github.com/peterhaneve/evemon/pull/13#issuecomment-403164823 ), and I've tried to fix the problem as well. I think it should be possible to move those changes out of that PR

wbSD avatar Oct 07 '18 12:10 wbSD

The current code has some additional flaws:

  1. For one of my pilots with an active training the topmost skill is not updating (training time/SP don't change). The level indicator however is flashing.
  2. The title bar remaining time runs (but shows 10d12h3m37s instead of the training queue's 8d13h21m57s).
  3. Same values for the footer below the queue.
  4. Progressbar of the active skill is at 0% completion.

Another pilot shows 1d11h9m28s in both queue, title bar and footer. SP of the skill is counting up there. Progressbar at 5% completion.

This with +10 accelerators plugged into both pilots.

With my time/date based fix applied these queues show up ok. But one of the inactive pilots shows two 0% yet completed queues (so there is some case that slipped through).

wvdvegt avatar Oct 09 '18 13:10 wvdvegt

I looked at this again, for one I believe that EVEMon uses UTC throughout so it should be DateTime.UtcNow instead of DateTime.Now. Is only the tooltip broken, or does the "width" of the skill bar need to be changed too? Changing only the tooltip text does not change what EVEMon actually thinks is the time left.

peterhaneve avatar Dec 14 '18 06:12 peterhaneve