PTS Error:
It looks like:
ZO_HUDInfamyMeter_Update(..) doesn't get called until the ZO_HUDInfamyMeter is shown.
xml Code:
<TopLevelControl name="ZO_HUDInfamyMeter" hidden="true" >
<OnInitialized>
ZO_HUDInfamyMeter_Initialize(self)
</OnInitialized>
<OnUpdate>
ZO_HUDInfamyMeter_Update(time)
</OnUpdate>
</TopLevelControl>
Which is the only place I see :Update(..) getting called
Lua Code:
function ZO_HUDInfamyMeter_Update(time)
HUD_INFAMY_METER:Update(time)
end
Which calls :OnInfamyUpdate(..)
Lua Code:
function ZO_HUDInfamyMeter:Update(time)
if self.nextUpdateTime <= time and not self.hiddenExternalRequest then
self.nextUpdateTime = time + INFAMY_METER_UPDATE_DELAY_SECONDS
self:OnInfamyUpdated(UPDATE_TYPE_TICK)
end
end
and finally self.oldInfamy does not get initialized until the last line of this function:
Lua Code:
function ZO_HUDInfamyMeter:OnInfamyUpdated(updateType)
...
self.oldInfamy = self.infamy
end
So if this event fires before the HUDInfamyMeter gets displayed (by opening some ui panel) then self.oldInfamy is still nil
Lua Code:
-- Register for events
control:RegisterForEvent(EVENT_JUSTICE_INFAMY_UPDATED, function()
local infamy = GetInfamy()
if not self.hiddenExternalRequest and infamy ~= 0 and infamy > self.oldInfamy then self:OnInfamyUpdated(UPDATE_TYPE_EVENT) end
end)