Questie

Questie

124M Downloads

TODO: Tracker buttons OnUpdate performance

Laumesis opened this issue ยท 0 comments

commented

Questie Tracker item buttons OnUpdate needs some lovely looking

btn.OnUpdate = function(self, elapsed)
if not self.itemID or not self:IsVisible() then
return
end
local valid
local rangeTimer = self.rangeTimer
local charges = GetItemCount(self.itemID, nil, true)
if (not charges or charges ~= self.charges) then
self.count:Hide()
self.charges = GetItemCount(self.itemID, nil, true)
if self.charges > 1 then
self.count:SetText(self.charges)
self.count:Show()
end
end
if UnitExists("target") then
if not self.itemName then
self.itemName = GetItemInfo(self.itemID)
end
if (rangeTimer) then
rangeTimer = rangeTimer - elapsed
if (rangeTimer <= 0) then
valid = IsItemInRange(self.itemName, "target")
if valid == false then
self.range:SetVertexColor(1.0, 0.1, 0.1)
self.range:Show()
elseif valid == true then
self.range:SetVertexColor(0.6, 0.6, 0.6)
self.range:Show()
end
rangeTimer = 0.3
end
self.rangeTimer = rangeTimer
end
end
end