View Single Post
11/10/15, 03:32 AM   #6
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 578
Long time ago, than my crafter was young, I had a remaining research.
I finally was able to spend an additional skillpoint to shorten research.
Instead of shorting the remaining time, the research was immediately finished.

If the ESO+ membership is handled that way, too:

For a logged-in char you get:
local duration, remaining = GetSmithingResearchLineTraitTimes(...)

These values are ajusted to your current ESO+ membership

You can get and should store at EVENT_PLAYER_DEACTIVATED: (because of skillpoints, which could be spend in-between)
local duration, remaining = GetSmithingResearchLineTraitTimes(...)
local FinishTimestamp = GetTimestamp() + remaining
local StartTime = FinishTimestamp - duration
local esoPlus = GetUnitBuffInfo(...)

if you are ESO+ member at that time, duration is 90% of real duration, otherwise 100%.

For an offline char:
local duration = EndTimestamp - StartTimestamp
if lostMembership then
duration = duration / 0.9 -- 1.11111111, not 1.10
else if gotMembership then
duration = duration * 0.9
else
-- duration remains
end
local newFinishTimestamp = StartTimestamp + duration
local remaining = newFinishTimestamp - GetTimestamp()
if remaining <= 0 then
-- Finished
end

Correct me, if I am wrong. I wrote this at work and could not test.

But I guess, this is what you already did.