comparison QuestPOI.lua @ 65:02f1d3bce558

Update for Legion Patch 7.2 - Massively improved performance footprint via 7.2 API changes and some major optimization of POI update triggers - Removed AP token caching until reliable mechanisms for detecting AK shifts can be resolved.
author Nenue
date Wed, 29 Mar 2017 13:45:41 -0400
parents 876c3f0bfd0e
children e43e10c5576b
comparison
equal deleted inserted replaced
64:876c3f0bfd0e 65:02f1d3bce558
1 -- WorldPlan 1 -- WorldPlan
2 -- QuestPOI.lua 2 -- QuestPOI.lua
3 -- Created: 10/1/2016 7:21 PM 3 -- Created: 10/1/2016 7:21 PM
4 -- %file-revision% 4 -- %file-revision%
5 -- Big TODOs:
6 -- -- generate frames using `WorldMap_GetOrCreateTaskPOI' to remove tainting issues
5 -- 7 --
6 local _, db = ... 8 local _, db = ...
7 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID 9 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID
8 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation 10 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
9 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes 11 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
19 local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo 21 local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo
20 local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData 22 local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData
21 local GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString 23 local GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString
22 local SpellCanTargetQuest, GetCVarBool = SpellCanTargetQuest, GetCVarBool 24 local SpellCanTargetQuest, GetCVarBool = SpellCanTargetQuest, GetCVarBool
23 local SetSuperTrackedQuestID = SetSuperTrackedQuestID 25 local SetSuperTrackedQuestID = SetSuperTrackedQuestID
26 local HaveQuestRewardData = HaveQuestRewardData
27
24 28
25 local pairs, ipairs, tinsert, unpack, select = pairs, ipairs, tinsert, unpack, select 29 local pairs, ipairs, tinsert, unpack, select = pairs, ipairs, tinsert, unpack, select
26 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID 30 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID
27 local GameTooltip = GameTooltip 31 local GameTooltip = GameTooltip
28 local GetItemIcon = GetItemIcon 32 local GetItemIcon = GetItemIcon
52 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD 56 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
53 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER 57 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
54 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT 58 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
55 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES 59 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
56 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS 60 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
61 local REWARD_HONOR = WORLD_QUEST_REWARD_TYPE_FLAG_HONOR
57 62
58 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 63 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
59 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 64 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
60 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 65 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
61 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 66 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
64 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 69 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
65 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 70 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
66 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 71 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
67 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 72 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
68 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 73 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
74
75 local LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS = LE_ITEM_CLASS_WEAPON, LE_ITEM_CLASS_ARMOR, LE_ITEM_CLASS_GEM, LE_ITEM_GEM_ARTIFACTRELIC, LE_ITEM_CLASS_TRADEGOODS
76
69 77
70 local STYLE_TYPE_PENDING = 768 78 local STYLE_TYPE_PENDING = 768
71 79
72 80
73 -- Pin color/display variables 81 -- Pin color/display variables
263 if info.questID then 271 if info.questID then
264 GetQuestTooltipExtras(info) 272 GetQuestTooltipExtras(info)
265 end 273 end
266 end 274 end
267 end 275 end
268 WorldMap_AddQuestRewardsToTooltip(questID) 276 GameTooltip_AddQuestRewardsToTooltip(WorldMapTooltip, questID)
269 277
270 WorldMapTooltip:Show() 278 WorldMapTooltip:Show()
271 --WorldMapTooltip.recalculatePadding = true; 279 --WorldMapTooltip.recalculatePadding = true;
272 --print(WorldMapTooltip:GetParent()) 280 --print(WorldMapTooltip:GetParent())
273 --print(WorldMapTooltip:IsVisible()) 281 --print(WorldMapTooltip:IsVisible())
290 end 298 end
291 299
292 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID) 300 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
293 -- if the title is nil, then wait and try later 301 -- if the title is nil, then wait and try later
294 if not questTitle then 302 if not questTitle then
295 if not self.isPending then 303 dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId)
296 C_TaskQuest.RequestPreloadRewardData(questID) 304 return false
297 self.isPending = true
298 end
299 dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId)
300 else 305 else
301 self.title, self.factionID, self.capped = questTitle, factionID, capped 306 self.title, self.factionID, self.capped = questTitle, factionID, capped
302 dprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and '|cFFFF4400delayed|r' or '|cFF00FF00success|r'), self.title, '|r', self.factionID) 307 dprint(questTitle, factionID, capped)
303 if self.dataLoaded then
304 dprint(' |cFFFF4400overwriting data|r')
305 end
306
307 -- set tag details 308 -- set tag details
308 local worldQuestType 309 local worldQuestType
309 self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID); 310 self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID);
310 local tagAtlas 311 local tagAtlas
311 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then 312 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
324 tagAtlas = "worldquest-icon-dungeon" 325 tagAtlas = "worldquest-icon-dungeon"
325 end 326 end
326 self.worldQuestType = worldQuestType 327 self.worldQuestType = worldQuestType
327 self.tagAtlas = tagAtlas 328 self.tagAtlas = tagAtlas
328 329
329 self:SetRewardInfo() 330 local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality = self:UpdateRewards()
330 331 dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality)
331 -- force throttle on success 332 if dataLoaded then
332 --qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown()) 333 self.rewardType = rewardType
333 --qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) 334 self.itemName = itemName
334 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) 335 self.itemTexture = itemTexture
335 336 self.itemNumber = itemNumber
336 if self.itemTexture and self.itemName and self.title then 337 self.itemQuality = quality
337 self.dataLoaded = true 338 self.dataLoaded = true
338 self.isPending = nil
339 self.throttle = 1
340 self.updateRate = PIN_REFRESH_DELAY
341 self.isStale = true 339 self.isStale = true
342 end 340 end
343 end 341 end
344 342
345 self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID) 343 self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID)
346 344
347 return self.isStale, self.isPending 345 return self.dataLoaded
348 end 346 end
349 347
350 function QuestPOI:SetRewardInfo() 348 --- Returns true if data has changed (either from loading in or qualifications changed)
349 function QuestPOI:UpdateRewards()
351 local questID = self.questID 350 local questID = self.questID
352 if not HaveQuestData(questID) then 351 if not HaveQuestRewardData(questID) then
353 self.isPending = true 352 C_TaskQuest.RequestPreloadRewardData(questID);
353 return false;
354 else 354 else
355 355 local rewardMoney, rewardAP, rewardHonor
356 local rewardItems, rewardCurrency = {}, {}
356 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality 357 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality
357 -- set reward category 358 local xpIcon, xpName, xpCount, xpType
359
360 if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then
361 local money = GetQuestLogRewardMoney(questID)
362 if money > 0 then
363 rewardMoney = money
364 rewardIcon = ICON_MONEY
365 rewardName = GetMoneyString(money)
366 rewardCount = floor(money/10000)
367 rewardType = REWARD_CASH
368 end
369
370 local artifactXP = GetQuestLogRewardArtifactXP(questID);
371 if artifactXP > 0 then
372 rewardAP = artifactXP
373 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01"
374 rewardCount = artifactXP
375 rewardType = REWARD_ARTIFACT_POWER
376 qprint(' artifactXP', artifactXP)
377 end
378
379 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID);
380 for i = 1, numQuestCurrencies do
381 local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID);
382 local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name);
383 tinsert(rewardCurrency, {
384 name = name,
385 texture = texture,
386 numItems = numItems,
387 text = text
388 })
389 qprint(' currency', i, name, " |T"..tostring(texture)..":12:12|t")
390 rewardIcon = texture
391 rewardCount = numItems
392 rewardName = name
393 rewardType = REWARD_CURRENCY
394 end
395 local honorAmount = GetQuestLogRewardHonor(questID);
396 if honorAmount > 0 then
397 xpIcon = "Interface\\ICONS\\Achievement_LegionPVPTier4"
398 xpCount = honorAmount
399 xpName = HONOR
400 xpType = HONOR_CURRENCY
401 end
402
403 local numQuestRewards = GetNumQuestLogRewards(questID);
404 if numQuestRewards > 0 then
405 local foundPrimary
406 for i = 1, numQuestRewards do
407 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID)
408
409 if itemID then
410 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID);
411
412
413 if ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then
414 rewardType = REWARD_GEAR
415 rewardIcon = texture
416 rewardName = name
417 rewardCount = numItems
418 foundPrimary = true
419 elseif IsArtifactPowerItem(itemID) then
420 rewardType = REWARD_ARTIFACT_POWER
421 rewardIcon = texture
422 rewardName = name
423 rewardCount = 1
424 foundPrimary = true
425
426 WorldPlanTooltip:SetOwner(self, 'ANCHOR_NONE')
427 WorldPlanTooltip:SetHyperlink(itemLink)
428 for i = 1, WorldPlanTooltip:NumLines() do
429 local line = _G['WorldPlanTooltipTextLeft' .. i]
430 local text = line and line:GetText()
431 local ap = text and text:gsub(',', ''):match('(%d+) '..ARTIFACT_POWER)
432 if ap then
433 rewardCount = tonumber(ap)
434 print(ap)
435 end
436
437 end
438
439 if WorldPlanTooltipTextLeft2 then
440 local text = WorldPlanTooltipTextLeft2:GetText()
441 end
442
443 print('is an AP token')
444 elseif classID == LE_ITEM_CLASS_TRADEGOODS then
445 rewardType = REWARD_REAGENT
446 rewardIcon = texture
447 rewardName = name
448 rewardCount = numItems
449 foundPrimary = true
450 end
451
452
453 qprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID)
454 tinsert(rewardItems, {
455 name = name,
456 texture = texture,
457 numItems = numItems,
458 quality = quality,
459 isUsable = isUsable
460 })
461 if not foundPrimary then
462 rewardType = REWARD_GEAR
463
464 rewardIcon = texture
465 rewardName = name
466 rewardCount = numItems
467 end
468
469 end
470
471 end
472 end
473
474 qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numQuestRewards, rewardType)
475 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
476
477 if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then
478 return true, rewardType, rewardName, rewardIcon, rewardCount, quality
479 else
480 return false
481 end
482 end
483
484
485
486 --[[ set reward category
358 local numRewards = GetNumQuestLogRewards(questID) 487 local numRewards = GetNumQuestLogRewards(questID)
359 local numCurrency = GetNumQuestLogRewardCurrencies(questID) 488 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
360 local money = GetQuestLogRewardMoney(questID) 489 local money = GetQuestLogRewardMoney(questID)
361 if numRewards >= 1 then 490 if numRewards >= 1 then
362 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID) 491 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID)
363 elseif numCurrency >= 1 then 492 elseif numCurrency >= 1 then
364 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) 493 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
365 rewardType = REWARD_CURRENCY 494 rewardType = REWARD_CURRENCY
366 elseif money >= 1 then 495 elseif money >= 1 then
367 rewardIcon = ICON_MONEY
368 rewardName = GetMoneyString(money) 496 rewardName = GetMoneyString(money)
369 rewardType = REWARD_CASH 497 end
370 end 498 --]]
371
372 qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numRewards, rewardType)
373 self.itemNumber = tonumber(rewardCount or self.itemNumber)
374 self.rewardType = rewardType
375 self.quality = quality
376
377 self.itemTexture = rewardIcon or self.itemTexture
378 self.itemName = rewardName or self.itemName
379
380 -- flag unresolved info
381 if not (rewardIcon and rewardName) then
382 self.isPending = true
383 self.isStale = nil
384 --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
385 else
386 if (rewardIcon and rewardName) and self.isPending then
387 --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
388 self.isStale = true
389 end
390 self.isPending = nil
391 end
392 499
393 end 500 end
394 end 501 end
395 502
396 -- run from OnShow if .isNew is set 503 -- run from OnShow if .isNew is set
440 -- reset flags 547 -- reset flags
441 self:SetAlpha(db.PinAlpha) 548 self:SetAlpha(db.PinAlpha)
442 self.isAnimating = nil 549 self.isAnimating = nil
443 end 550 end
444 551
445 -- different from owningFrame 552 -- Places the pin and triggers display
446 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) 553 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
447 wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used) 554 wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used)
448 if not self.used then 555 if not self.used then
449 self:HideFrames() 556 self:HideFrames()
450 return 557 return
458 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) 565 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
459 if (dX and dY) then 566 if (dX and dY) then
460 if not (mapHeight and mapWidth) then 567 if not (mapHeight and mapWidth) then
461 mapWidth, mapHeight = owner:GetSize() 568 mapWidth, mapHeight = owner:GetSize()
462 end 569 end
463 local pX = (dX * mapWidth) 570 if (self.x ~= dY) or (self.y ~= dY) then
464 local pY = (-dY * mapHeight) 571 self.x = dX
465 self.x = dX 572 self.y = dY
466 self.y = dY 573 local pX = (dX * mapWidth)
467 self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY) 574 local pY = (-dY * mapHeight)
575 self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
576 end
468 else 577 else
469 self:SetPoint('CENTER') 578 if self.x or self.y then
579 self.x = nil
580 self.y = nil
581 self:SetPoint('CENTER')
582 end
470 end 583 end
471 584
472 self:ShowFrames() 585 self:ShowFrames()
473 end 586 end
474 587
497 self.used = nil 610 self.used = nil
498 end 611 end
499 612
500 function QuestPOI:OnLoad() 613 function QuestPOI:OnLoad()
501 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config) 614 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
502 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
503 615
504 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' 616 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
505 self.isPending = true 617 self.isPending = true
506 self.count = self.Overlay.count 618 self.count = self.Overlay.count
507 self.timeLabel = self.Overlay.timeLabel 619 self.timeLabel = self.Overlay.timeLabel
519 else 631 else
520 TaskPOI_OnClick(self, button) 632 TaskPOI_OnClick(self, button)
521 end 633 end
522 end 634 end
523 635
524
525 function QuestPOI:OnEvent(event, ...)
526 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
527 self.isStale = true
528 end
529 end
530 636
531 function QuestPOI:OnUpdate (sinceLast) 637 function QuestPOI:OnUpdate (sinceLast)
532 -- control update check intervals 638 -- control update check intervals
533 self.throttle = (self.throttle or self.updateRate) + sinceLast 639 self.throttle = (self.throttle or self.updateRate) + sinceLast
534 if self.throttle >= self.updateRate then 640 if self.throttle >= self.updateRate then
546 return 652 return
547 end 653 end
548 654
549 -- query for reward data if it wasn't found in the original scan 655 -- query for reward data if it wasn't found in the original scan
550 local questID = self.questID 656 local questID = self.questID
551 if self.isPending then 657 if not self.dataLoaded then
552 --print('|cFFFF4400'..self:GetID()..':|r polling reward info') 658 --print('|cFFFF4400'..self:GetID()..':|r polling reward info')
553 if not (self.isAnimating) then 659 if not (self.isAnimating) then
554 self.PendingFade:Play() 660 self.PendingFade:Play()
555 end 661 end
556 self:GetData() 662 self:GetData()
606 712
607 rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) 713 rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
608 714
609 715
610 716
611 local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType 717 local styleType = (self.dataLoaded and self.rewardType) or STYLE_TYPE_PENDING
612 local style,subStyle = self:GetTypeInfo(self.rewardType) 718 local style,subStyle = self:GetTypeInfo(self.rewardType)
613 if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then 719 if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then
614 subStyle = style.minimized 720 subStyle = style.minimized
615 end 721 end
616 self.style = style 722 self.style = style
632 738
633 if self.itemName then 739 if self.itemName then
634 740
635 if self.itemNumber then 741 if self.itemNumber then
636 local numberString = self.itemNumber 742 local numberString = self.itemNumber
637 if self.itemNumber >= 1000 then 743 if self.itemNumber >= 1000000 then
744 numberString = (floor(self.itemNumber/100000)/10) .. 'M'
745 elseif self.itemNumber >= 10000 then
746 numberString = floor(self.itemNumber/1000) .. 'k'
747 elseif self.itemNumber >= 1000 then
638 local numeral = floor(self.itemNumber/1000) 748 local numeral = floor(self.itemNumber/1000)
639 local decimal = mod(self.itemNumber, 1000) 749 local decimal = mod(self.itemNumber, 1000)
640 numberString = numeral 750 numberString = numeral
641 if decimal > 100 then 751 if decimal > 100 then
642 numberString = numberString .. '.' .. tostring(floor(decimal/100)) 752 numberString = numberString .. '.' .. tostring(floor(decimal/100))
738 end 848 end
739 if canShow and self.filtered ~= filtered then 849 if canShow and self.filtered ~= filtered then
740 self.isStale = true 850 self.isStale = true
741 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title) 851 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title)
742 end 852 end
743
744 self.filtered = filtered 853 self.filtered = filtered
745 end 854 end
746 855
747 self.used = canShow 856 self.used = canShow
748 857