comparison QuestPOI.lua @ 109:caa482329919

POI optimization
author Nenue
date Mon, 10 Jul 2017 18:34:11 -0400
parents b67ba1078824
children f6ef9a9f5476
comparison
equal deleted inserted replaced
108:b67ba1078824 109:caa482329919
334 334
335 function QuestPOI:OnHide() 335 function QuestPOI:OnHide()
336 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()') 336 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()')
337 self:HideOrShowFrames(false) 337 self:HideOrShowFrames(false)
338 -- reset flags 338 -- reset flags
339 self:SetAlpha(db.PinAlpha) 339 self.icon:SetAlpha(db.PinAlpha)
340 self.RewardBorder:SetAlpha(db.PinAlpha)
340 self.isAnimating = nil 341 self.isAnimating = nil
341 --if db.Config.DebugEnabled then 342 --if db.Config.DebugEnabled then
342 -- db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') 343 -- db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r')
343 --end 344 --end
344 self.hideReason = nil 345 self.hideReason = nil
451 452
452 453
453 454
454 local updateTime, markTime 455 local updateTime, markTime
455 function QuestPOI:OnUpdate (sinceLast) 456 function QuestPOI:OnUpdate (sinceLast)
456 -- control update check intervals
457 457
458 if self.toAlpha then 458 if self.toAlpha then
459 if not self.alphaStart then 459 if not self.alphaStart then
460 self.alphaStart = GetTime() 460 self.alphaStart = GetTime()
461 end 461 end
485 self.toAlpha = nil 485 self.toAlpha = nil
486 end 486 end
487 487
488 else 488 else
489 self.toAlpha = nil 489 self.toAlpha = nil
490 end
491
492 if not self.toAlpha then
493 self.alphaStart = nil 490 self.alphaStart = nil
494 else
495 self.alphaStart = GetTime()
496 end 491 end
497 492
498 self.icon:SetAlpha(alpha) 493 self.icon:SetAlpha(alpha)
499 self.RewardBorder:SetAlpha(alpha) 494 self.RewardBorder:SetAlpha(alpha)
500 end 495 end
501 496
497 -- control update check intervals
502 self.throttle = (self.throttle or self.updateRate) + sinceLast 498 self.throttle = (self.throttle or self.updateRate) + sinceLast
503 if self.throttle >= self.updateRate then 499 if self.throttle >= self.updateRate then
504 -- factor overtime into the throttle timer 500 -- factor overtime into the throttle timer
505 self.throttle = self.throttle - self.updateRate 501 self.throttle = self.throttle - self.updateRate
506 else 502 else
519 -- query for reward data if it wasn't found in the original scan 515 -- query for reward data if it wasn't found in the original scan
520 516
521 if not self.dataLoaded then 517 if not self.dataLoaded then
522 local dataLoaded = self:GetData() 518 local dataLoaded = self:GetData()
523 if dataLoaded and not tContains(db.UpdatedPins, self) then 519 if dataLoaded and not tContains(db.UpdatedPins, self) then
524 -- self.PendingFade:Stop()
525 -- scale info from the parent module is needed, so deal with it there
526 print('|cFF00FF88 queueing for update') 520 print('|cFF00FF88 queueing for update')
527 self.isNew = true 521 self.isNew = true
528 tinsert(db.UpdatedPins, self) 522 self.toAlpha = nil
529 else 523 self.alphaStart = nil
530 524 self:Refresh()
531 --print('|cFFFF4400OnUpdate(|r'..self:GetID()..'|cFFFF4400)|r poll failed') 525 end
532 end
533 return
534 end 526 end
535 527
536 if self.isStale then 528 if self.isStale then
537 self:Refresh() 529 self:Refresh()
538 elseif self.maxAlertLevel then 530 elseif self.maxAlertLevel then
970 print('new pin, has data, cue fade') 962 print('new pin, has data, cue fade')
971 self:StartFading() 963 self:StartFading()
972 self.isNew = nil 964 self.isNew = nil
973 end 965 end
974 else 966 else
975 if not self.toAlpha then 967 icon:SetAlpha(self.toAlpha or 0)
976 icon:SetAlpha(0) 968 iconBorder:SetAlpha(self.toAlpha or 0)
977 iconBorder:SetAlpha(0)
978 end
979 end 969 end
980 970
981 if self.itemName then 971 if self.itemName then
982 if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then 972 if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then
983 local numberString = self.itemNumber 973 local numberString = self.itemNumber