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.