On the current 10.1.0 PTR, Buildnumber 48898, the api for evoker essences still precludes accurately tracking evoker essences.
The following lua just creates a frame that gathers UNIT_POWER_FREQUENT events and logs them into an editbox
local f = CreateFrame("EditBox");
f:SetFontObject(ChatFontNormal)
f:SetMultiLine(true)
f:EnableMouse(true)
f:SetAutoFocus(false)
f:SetScript("OnEscapePressed", f.ClearFocus)
f:SetPoint("CENTER", UIParent, "CENTER")
f:SetWidth(400)
f:SetHeight(900)
local text = ""
f:RegisterUnitEvent("UNIT_POWER_FREQUENT", "player")
f:SetScript("OnEvent", function(self, event, unitTarget, powerType)
if powerType ~= "ESSENCE" then return end
local EssenceEnum = Enum.PowerType.Essence
local power = UnitPower("player", EssenceEnum)
local total = UnitPowerMax("player", EssenceEnum)
local partial = UnitPartialPower("player", EssenceEnum) / 1000
text = text .. GetTime() .. " " .. power .. "/" .. total .. " " .. partial .. "\n"
f:SetText(text)
--print(GetTime(), power .. "/" .. total, partial)
end)
To reproduce one of the many problems with the api use the above lua and do the following.
a) Cast a 3 essence spell
b) Wait until one essence is half recharged
c) Cast a 2 essence spell
You'll get an output similar to the below, with the numbers being:
time / current essences / total / partial * 1000
The first line is the update after the first cast, so at 922637.02 essence regeneration starts. Since this evoker is nude without talents, it has a base essence regeneration of 5s.
Line 2) 100ms after casting an event comes in that claims UnitPartialPower is 0, when it should be 0.02. Off by 2% is visible on any display with more than 50px, so clearly this is a bug.
Line 3) is directly after casting the second spell. As I was aiming for a half filled essence, this output is about right.
Line 4) is at the same timestamp a second UNIT_POWER_FREQUENT event, except UnitPartialPower returns 0. This is clearly bogus.
Line 5) is ~4s after Line 1 and is the first regenerated essence, this appears to be one second too early.
Line 6) Again a duplicated event, though with the same data.
Line 7) This is the second rengenerated essence, at 5s after the first on Line 4, this appears to be correct.
Line 9) This is the third regenerrated essence again, 5s from the last one appears to be correct
Line 10) Is a second event for the 3 essence, 70ms after the last one. Either line 9 or 10 is incorrect
Line 11 + Line 13) Again at 5s interval, this appears to be correct
Line 14) A second event for the 5 essence.Either 13 or 14 is incorrect
On the current 10.1.0 PTR, Buildnumber 48898, the api for evoker essences still precludes accurately tracking evoker essences.
The following lua just creates a frame that gathers UNIT_POWER_FREQUENT events and logs them into an editbox
To reproduce one of the many problems with the api use the above lua and do the following. a) Cast a 3 essence spell b) Wait until one essence is half recharged c) Cast a 2 essence spell
You'll get an output similar to the below, with the numbers being: time / current essences / total / partial * 1000
Casting Spell with 3 Essence Cost
1) 922637.021 2/5 0.003 2) 922637.121 2/5 0
Casting Spell with 2 Essence Cost
3) 922640.142 0/5 0.56 4) 922640.142 0/5 0 5) 922641.06 1/5 0 6) 922641.06 1/5 0 7) 922646.117 2/5 0 8) 922647.135 2/5 0.2 9) 922651.124 3/5 0 10) 922651.191 3/5 0 11) 922656.132 4/5 0 12) 922657.266 4/5 0.223 13) 922661.155 5/5 0.003 14) 922661.322 5/5 0.003
The first line is the update after the first cast, so at 922637.02 essence regeneration starts. Since this evoker is nude without talents, it has a base essence regeneration of 5s. Line 2) 100ms after casting an event comes in that claims UnitPartialPower is 0, when it should be 0.02. Off by 2% is visible on any display with more than 50px, so clearly this is a bug. Line 3) is directly after casting the second spell. As I was aiming for a half filled essence, this output is about right. Line 4) is at the same timestamp a second UNIT_POWER_FREQUENT event, except UnitPartialPower returns 0. This is clearly bogus. Line 5) is ~4s after Line 1 and is the first regenerated essence, this appears to be one second too early. Line 6) Again a duplicated event, though with the same data. Line 7) This is the second rengenerated essence, at 5s after the first on Line 4, this appears to be correct. Line 9) This is the third regenerrated essence again, 5s from the last one appears to be correct Line 10) Is a second event for the 3 essence, 70ms after the last one. Either line 9 or 10 is incorrect Line 11 + Line 13) Again at 5s interval, this appears to be correct Line 14) A second event for the 5 essence.Either 13 or 14 is incorrect