View Single Post
11/09/15, 06:21 PM   #3
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
The more I think about it, the less I am certain if it is really that simple.
There are 4 possible cases:
  1. Player did not have plus membership when the duration was saved and does not have plus membership when it is displayed
  2. Player did not have plus membership when it was saved, but does have it now
  3. Player had plus membership, but does not have it now
  4. Player had plus membership and still has it now

The GetSmithingResearchLineTraitTimes function returns duration and timeRemaining and we can detect if someone has plus membership via GetUnitBuffInfo.
So we can save the start time, the duration and if he had plus membership at the time when we saved it.

It could be as simple as multiplying or dividing the duration by 1.1, but it could also be that we need to interpolate between non-plus-duration and plus-duration.
In that case we would need to know how long he had plus membership during the research.

For example:
The user starts research without plus membership. It gives a duration of 10 days.
After 5 days he obtains plus membership which reduces the duration by 10%.
Does it reduce the overall duration, or does it reduce the remaining duration?
In the first case, the remaining time would be 4 days, in the second case it would be 4.5 days.