annotate 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
rev   line source
Nenue@7 1 -- WorldPlan
Nenue@7 2 -- QuestPOI.lua
Nenue@7 3 -- Created: 10/1/2016 7:21 PM
Nenue@7 4 -- %file-revision%
Nenue@65 5 -- Big TODOs:
Nenue@65 6 -- -- generate frames using `WorldMap_GetOrCreateTaskPOI' to remove tainting issues
Nenue@7 7 --
Nenue@40 8 local _, db = ...
Nick@64 9 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID
Nenue@7 10 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
Nenue@7 11 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
Nenue@9 12 local TQ_IsActive = C_TaskQuest.IsActive
Nenue@29 13 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
Nenue@7 14 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame
Nenue@33 15 local WorldMap_DoesWorldQuestInfoPassFilters = WorldMap_DoesWorldQuestInfoPassFilters
Nenue@33 16 local QuestMapFrame_IsQuestWorldQuest = QuestMapFrame_IsQuestWorldQuest
Nenue@40 17 local GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo = GetAchievementNumCriteria, GetAchievementCriteriaInfo, GetAchievementInfo
Nick@64 18
Nick@64 19 local IsQuestFlaggedCompleted = IsQuestFlaggedCompleted
Nick@64 20 local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo
Nick@64 21 local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo
Nick@64 22 local GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData = GetNumQuestLogRewards, GetNumQuestLogRewardCurrencies, HaveQuestData
Nick@64 23 local GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString = GetQuestLogRewardMoney, GetQuestLogRewardCurrencyInfo, GetMoneyString
Nick@64 24 local SpellCanTargetQuest, GetCVarBool = SpellCanTargetQuest, GetCVarBool
Nick@64 25 local SetSuperTrackedQuestID = SetSuperTrackedQuestID
Nenue@65 26 local HaveQuestRewardData = HaveQuestRewardData
Nenue@65 27
Nick@64 28
Nenue@40 29 local pairs, ipairs, tinsert, unpack, select = pairs, ipairs, tinsert, unpack, select
Nenue@40 30 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID
Nenue@33 31 local GameTooltip = GameTooltip
Nenue@33 32 local GetItemIcon = GetItemIcon
Nenue@7 33
Nenue@33 34 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
Nenue@7 35 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
Nenue@33 36 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
Nenue@30 37 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
Nenue@7 38 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
Nenue@40 39 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
Nenue@49 40 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end
Nenue@7 41 local QuestPOI = WorldPlanPOIMixin
Nenue@7 42
Nenue@56 43 local pinBaseIndex = 1300
Nenue@56 44 local overlayBaseIndex = 1350
Nenue@56 45 local previousHighlight
Nenue@40 46
Nenue@40 47 local PIN_REFRESH_DELAY = .5
Nenue@54 48 local PIN_REQUEST_DELAY = .1
Nenue@9 49 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
Nenue@9 50 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
Nenue@9 51
Nenue@40 52 local WORLD_QUEST_BORDER = "Interface\\UNITPOWERBARALT\\Generic1Target_Circular_Frame"
Nenue@47 53 local PENDING_BORDER = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@40 54 local PENDING_ICON = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@9 55
Nenue@29 56 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
Nenue@29 57 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
Nenue@29 58 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
Nenue@29 59 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
Nenue@29 60 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
Nenue@65 61 local REWARD_HONOR = WORLD_QUEST_REWARD_TYPE_FLAG_HONOR
Nenue@29 62
Nenue@29 63 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
Nenue@29 64 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
Nenue@29 65 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
Nenue@29 66 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
Nenue@29 67 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
Nenue@29 68
Nenue@29 69 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
Nenue@29 70 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
Nenue@29 71 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
Nenue@29 72 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
Nenue@29 73 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
Nenue@29 74
Nenue@65 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
Nenue@65 76
Nenue@65 77
Nenue@40 78 local STYLE_TYPE_PENDING = 768
Nenue@40 79
Nenue@31 80
Nenue@29 81 -- Pin color/display variables
Nenue@40 82 db.TooltipExtras = db.TooltipExtras or {} -- idiot-proofing
Nenue@49 83 db.PinAlpha = 1
Nenue@29 84
Nenue@33 85 local familiars = {
Nenue@40 86 [42159] = 'Nightwatcher Merayl',
Nenue@40 87 [40277] = 'Tiffany Nelson',
Nenue@40 88 [40298] = 'Sir Galveston',
Nenue@40 89 [40282] = 'Grixis Tinypop',
Nenue@40 90 [40278] = 'Robert Craig',
Nenue@40 91 [48195] = 'Aulier',
Nenue@40 92 [41990] = 'Varenne',
Nenue@40 93 [41860] = 'Xorvasc',
Nenue@40 94 [40299] = 'Bodhi Sunwayver',
Nenue@40 95 [42442] = 'Amalia',
Nenue@40 96 [40280] = 'Bredda Tenderhide',
Nenue@40 97 [41687] = 'Odrogg',
Nenue@40 98 [41944] = 'Trapper Jarrun',
Nenue@40 99 [40337] = 'Master Tamer Flummox',
Nenue@40 100 [40279] = 'Durian Strongfruit'
Nenue@40 101 }
Nenue@40 102 local falcosaurs = {
Nenue@40 103 [44895] = {44881, 'Sharptalon Hatchling', 115786},
Nenue@40 104 [44894] = {44882, 'Bloodgazer Hatchling', 115787},
Nenue@40 105 [44893] = {44880, 'Direbeak Hatchling', 115785},
Nenue@40 106 [44892] = {44879, 'Snowfeather Hatchling', 115784},
Nenue@33 107 }
Nenue@33 108 local familiars_id = 9696
Nenue@40 109 for questID, name in pairs(familiars) do
Nenue@40 110 db.TooltipExtras[questID] = {{
Nenue@40 111 achievementID = familiars_id,
Nenue@40 112 name = name
Nenue@40 113 }}
Nenue@40 114 end
Nenue@40 115 for questID, info in pairs(falcosaurs) do
Nenue@40 116 local trackingQuestID, petName, petID = unpack(info)
Nenue@33 117
Nenue@40 118 db.TooltipExtras[questID] = {{
Nenue@40 119 questID = trackingQuestID,
Nenue@40 120 pet = petName,
Nenue@40 121 petID = petID
Nenue@40 122 }}
Nenue@9 123 end
Nenue@7 124
Nenue@40 125 local GetAchievementTooltipExtras = function(info)
Nenue@29 126
Nenue@40 127 local hasInfo
Nenue@40 128 local achievementID = info.achievementID
Nenue@40 129 local _, name, _, completed, _, _, _, _, _, icon = GetAchievementInfo(achievementID)
Nenue@40 130 if not completed then
Nenue@40 131
Nenue@40 132 local numItems = GetAchievementNumCriteria(achievementID)
Nenue@40 133 local numNeeded = 0
Nenue@40 134 local tooltipLines = {}
Nenue@40 135 for i =1, numItems do
Nenue@40 136 local criteriaName, criteriaType, completed, _, _, _, _, subAchievementID = GetAchievementCriteriaInfo(achievementID, i)
Nenue@49 137 --print(GetAchievementCriteriaInfo(achievementID, i))
Nenue@40 138
Nenue@40 139 if not completed then
Nenue@49 140 --print('::', criteriaName, completed, subAchievementID)
Nenue@40 141 if criteriaType == 8 then
Nenue@40 142 local _, _, _, completed, _, _, _, _, _, subIcon = GetAchievementInfo(subAchievementID)
Nenue@49 143 --print(' -', criteriaName, completed, subIcon)
Nenue@40 144 if not completed then
Nenue@40 145 local numCompleted = 0
Nenue@40 146 local numSubItems = GetAchievementNumCriteria(subAchievementID)
Nenue@40 147 local subCriteriaLine
Nenue@40 148 for j = 1, numSubItems do
Nenue@40 149 local subName, _, completed = GetAchievementCriteriaInfo(subAchievementID, j)
Nenue@40 150
Nenue@49 151 --print(' -',subName, completed)
Nenue@40 152 if completed then
Nenue@40 153 numCompleted = numCompleted + 1
Nenue@40 154 else
Nenue@40 155 numNeeded = numNeeded + 1
Nenue@40 156 if subName:match(info.name) then
Nenue@40 157 hasInfo = true
Nenue@40 158 subCriteriaLine = ' |T'..subIcon..':16:16|t ' .. criteriaName
Nenue@40 159 end
Nenue@40 160 end
Nenue@40 161
Nenue@40 162 end
Nenue@40 163 if subCriteriaLine then
Nenue@40 164 tinsert(tooltipLines, subCriteriaLine .. ' ('..numCompleted..'/'..numSubItems..')')
Nenue@40 165 end
Nenue@40 166 end
Nenue@40 167 elseif criteriaName:match(info.name) and (not completed) then
Nenue@40 168 numNeeded = numNeeded + 1
Nenue@40 169 tinsert(tooltipLines, criteriaName)
Nenue@40 170 end
Nenue@40 171 end
Nenue@40 172 end
Nenue@49 173 if hasInfo then
Nenue@49 174 WorldMapTooltip:AddLine(" ")
Nenue@49 175 WorldMapTooltip:AddLine("Achievements:")
Nenue@49 176 WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name)
Nenue@40 177 for i, line in ipairs(tooltipLines) do
Nenue@40 178 WorldMapTooltip:AddLine(line)
Nenue@40 179 end
Nenue@40 180 end
Nenue@40 181 end
Nenue@40 182 return hasInfo
Nenue@40 183 end
Nenue@40 184
Nenue@40 185 local GetQuestTooltipExtras = function(info)
Nenue@40 186 local questID = info.questID
Nenue@40 187 local hasInfo
Nenue@40 188
Nenue@40 189 if info.pet then
Nenue@40 190 local index, guid = C_PetJournal.FindPetIDByName(info.pet)
Nenue@40 191 if not index then
Nenue@40 192 hasInfo = true
Nenue@40 193 WorldMapTooltip:AddLine('Pets:')
Nenue@40 194 WorldMapTooltip:AddLine(' - ' .. info.petName)
Nenue@40 195
Nenue@40 196 if not IsQuestFlaggedCompleted(questID) then
Nenue@40 197 WorldMapTooltip:AddLine(' Required Quest Flags', 1, 1, 0)
Nenue@40 198 else
Nenue@40 199 WorldMapTooltip:AddLine(' Quest Flags Complete!', 0, 1, 0)
Nenue@40 200 end
Nenue@40 201
Nenue@40 202 end
Nenue@29 203 end
Nenue@29 204
Nenue@29 205 end
Nenue@29 206
Nenue@40 207
Nenue@40 208 function QuestPOI:OnEnter()
Nenue@57 209 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then
Nenue@49 210 return
Nenue@7 211 end
Nenue@57 212 WorldMap_HijackTooltip(self.owningFrame);
Nenue@56 213 self:SetFrameLevel(pinBaseIndex+100)
Nenue@56 214 self.Overlay:SetFrameLevel(pinBaseIndex+101)
Nenue@56 215
Nenue@56 216 if previousHighlight then
Nenue@56 217 previousHighlight:SetFrameLevel(pinBaseIndex+previousHighlight:GetID())
Nenue@56 218 previousHighlight.Overlay:SetFrameLevel(overlayBaseIndex+previousHighlight:GetID())
Nenue@56 219 end
Nenue@56 220
Nenue@56 221 previousHighlight = self
Nenue@56 222
Nenue@56 223
Nenue@40 224 WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT");
Nenue@49 225 --print('doing tooltip stuff')
Nenue@40 226
Nenue@40 227 -- Can't add stuff after, so most of the blizzard tooltip hook is simply copied over
Nenue@40 228 local questID = self.questID
Nenue@40 229 local color = WORLD_QUEST_QUALITY_COLORS[self.rarity] or NORMAL_FONT_COLOR;
Nenue@40 230
Nenue@40 231
Nenue@40 232 WorldMapTooltip:SetText(self.title, color.r, color.g, color.b);
Nenue@40 233 QuestUtils_AddQuestTypeToTooltip(WorldMapTooltip, questID, NORMAL_FONT_COLOR);
Nenue@40 234
Nenue@40 235 if ( self.factionID ) then
Nenue@40 236 local factionName = GetFactionInfoByID(self.factionID);
Nenue@40 237 if ( factionName ) then
Nenue@40 238 if (self.capped) then
Nenue@40 239 WorldMapTooltip:AddLine(factionName, GRAY_FONT_COLOR:GetRGB());
Nenue@40 240 else
Nenue@40 241 WorldMapTooltip:AddLine(factionName);
Nenue@40 242 end
Nenue@40 243 end
Nenue@40 244 end
Nenue@40 245
Nenue@40 246 if self.worldQuest then
Nenue@40 247 WorldMap_AddQuestTimeToTooltip(questID);
Nenue@40 248 end
Nenue@40 249
Nenue@40 250
Nenue@40 251 for objectiveIndex = 1, self.numObjectives do
Nenue@40 252 local objectiveText, objectiveType, finished = GetQuestObjectiveInfo(questID, objectiveIndex, false);
Nenue@40 253 if ( objectiveText and #objectiveText > 0 ) then
Nenue@40 254 local color = finished and GRAY_FONT_COLOR or HIGHLIGHT_FONT_COLOR;
Nenue@40 255 WorldMapTooltip:AddLine(QUEST_DASH .. objectiveText, color.r, color.g, color.b, true);
Nenue@40 256 end
Nenue@40 257 end
Nenue@40 258
Nenue@40 259 local percent = C_TaskQuest.GetQuestProgressBarInfo(self.questID);
Nenue@40 260 if ( percent ) then
Nenue@40 261 GameTooltip_InsertFrame(WorldMapTooltip, WorldMapTaskTooltipStatusBar);
Nenue@40 262 WorldMapTaskTooltipStatusBar.Bar:SetValue(percent);
Nenue@40 263 WorldMapTaskTooltipStatusBar.Bar.Label:SetFormattedText(PERCENTAGE_STRING, percent);
Nenue@40 264 end
Nenue@40 265
Nenue@40 266 if db.TooltipExtras[self.questID] then
Nenue@40 267 for index, info in pairs(db.TooltipExtras[questID]) do
Nenue@40 268 if info.achievementID then
Nenue@40 269 GetAchievementTooltipExtras(info)
Nenue@40 270 end
Nenue@40 271 if info.questID then
Nenue@40 272 GetQuestTooltipExtras(info)
Nenue@40 273 end
Nenue@40 274 end
Nenue@40 275 end
Nenue@65 276 GameTooltip_AddQuestRewardsToTooltip(WorldMapTooltip, questID)
Nenue@40 277
Nenue@40 278 WorldMapTooltip:Show()
Nenue@40 279 --WorldMapTooltip.recalculatePadding = true;
Nenue@40 280 --print(WorldMapTooltip:GetParent())
Nenue@40 281 --print(WorldMapTooltip:IsVisible())
Nenue@7 282 end
Nenue@40 283 function QuestPOI:OnLeave()
Nenue@57 284 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then
Nenue@57 285 return
Nenue@57 286 end
Nenue@35 287 WorldMap_RestoreTooltip()
Nenue@40 288 WorldMapTooltip:Hide();
Nenue@7 289 end
Nenue@7 290
Nenue@40 291 -- attempt to pull pin data
Nenue@40 292 function QuestPOI:GetData ()
Nenue@49 293 dprint('|cFF00FF88'..self:GetID()..':GetData()|r')
Nenue@40 294 local questID = self.questID
Nenue@40 295 if not questID then
Nenue@49 296 dprint('|cFFFF4400bad pin|r', self:GetName())
Nenue@40 297 return nil
Nenue@29 298 end
Nenue@29 299
Nenue@40 300 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
Nenue@40 301 -- if the title is nil, then wait and try later
Nenue@40 302 if not questTitle then
Nenue@65 303 dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId)
Nenue@65 304 return false
Nenue@40 305 else
Nenue@40 306 self.title, self.factionID, self.capped = questTitle, factionID, capped
Nenue@65 307 dprint(questTitle, factionID, capped)
Nenue@40 308 -- set tag details
Nenue@40 309 local worldQuestType
Nenue@40 310 self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID);
Nenue@40 311 local tagAtlas
Nenue@40 312 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
Nenue@40 313 tagAtlas = "worldquest-icon-petbattle"
Nenue@40 314 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
Nenue@40 315 tagAtlas = "worldquest-icon-pvp-ffa"
Nenue@40 316 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@40 317 self.isKnownProfession = nil
Nenue@40 318 local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex))
Nenue@40 319 if id then
Nenue@40 320 self.isKnownProfession = true
Nenue@40 321 qprint('profession' , self.title, id)
Nenue@40 322 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
Nenue@40 323 end
Nenue@40 324 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
Nenue@40 325 tagAtlas = "worldquest-icon-dungeon"
Nenue@40 326 end
Nenue@40 327 self.worldQuestType = worldQuestType
Nenue@40 328 self.tagAtlas = tagAtlas
Nenue@29 329
Nenue@65 330 local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality = self:UpdateRewards()
Nenue@65 331 dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality)
Nenue@65 332 if dataLoaded then
Nenue@65 333 self.rewardType = rewardType
Nenue@65 334 self.itemName = itemName
Nenue@65 335 self.itemTexture = itemTexture
Nenue@65 336 self.itemNumber = itemNumber
Nenue@65 337 self.itemQuality = quality
Nenue@49 338 self.dataLoaded = true
Nenue@48 339 self.isStale = true
Nenue@40 340 end
Nenue@40 341 end
Nenue@40 342
Nenue@40 343 self.isCriteria = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(questID)
Nenue@40 344
Nenue@65 345 return self.dataLoaded
Nenue@40 346 end
Nenue@40 347
Nenue@65 348 --- Returns true if data has changed (either from loading in or qualifications changed)
Nenue@65 349 function QuestPOI:UpdateRewards()
Nenue@40 350 local questID = self.questID
Nenue@65 351 if not HaveQuestRewardData(questID) then
Nenue@65 352 C_TaskQuest.RequestPreloadRewardData(questID);
Nenue@65 353 return false;
Nenue@29 354 else
Nenue@65 355 local rewardMoney, rewardAP, rewardHonor
Nenue@65 356 local rewardItems, rewardCurrency = {}, {}
Nenue@65 357 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality
Nenue@65 358 local xpIcon, xpName, xpCount, xpType
Nenue@29 359
Nenue@65 360 if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then
Nenue@65 361 local money = GetQuestLogRewardMoney(questID)
Nenue@65 362 if money > 0 then
Nenue@65 363 rewardMoney = money
Nenue@65 364 rewardIcon = ICON_MONEY
Nenue@65 365 rewardName = GetMoneyString(money)
Nenue@65 366 rewardCount = floor(money/10000)
Nenue@65 367 rewardType = REWARD_CASH
Nenue@65 368 end
Nenue@65 369
Nenue@65 370 local artifactXP = GetQuestLogRewardArtifactXP(questID);
Nenue@65 371 if artifactXP > 0 then
Nenue@65 372 rewardAP = artifactXP
Nenue@65 373 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01"
Nenue@65 374 rewardCount = artifactXP
Nenue@65 375 rewardType = REWARD_ARTIFACT_POWER
Nenue@65 376 qprint(' artifactXP', artifactXP)
Nenue@65 377 end
Nenue@65 378
Nenue@65 379 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID);
Nenue@65 380 for i = 1, numQuestCurrencies do
Nenue@65 381 local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID);
Nenue@65 382 local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name);
Nenue@65 383 tinsert(rewardCurrency, {
Nenue@65 384 name = name,
Nenue@65 385 texture = texture,
Nenue@65 386 numItems = numItems,
Nenue@65 387 text = text
Nenue@65 388 })
Nenue@65 389 qprint(' currency', i, name, " |T"..tostring(texture)..":12:12|t")
Nenue@65 390 rewardIcon = texture
Nenue@65 391 rewardCount = numItems
Nenue@65 392 rewardName = name
Nenue@65 393 rewardType = REWARD_CURRENCY
Nenue@65 394 end
Nenue@65 395 local honorAmount = GetQuestLogRewardHonor(questID);
Nenue@65 396 if honorAmount > 0 then
Nenue@65 397 xpIcon = "Interface\\ICONS\\Achievement_LegionPVPTier4"
Nenue@65 398 xpCount = honorAmount
Nenue@65 399 xpName = HONOR
Nenue@65 400 xpType = HONOR_CURRENCY
Nenue@65 401 end
Nenue@65 402
Nenue@65 403 local numQuestRewards = GetNumQuestLogRewards(questID);
Nenue@65 404 if numQuestRewards > 0 then
Nenue@65 405 local foundPrimary
Nenue@65 406 for i = 1, numQuestRewards do
Nenue@65 407 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID)
Nenue@65 408
Nenue@65 409 if itemID then
Nenue@65 410 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID);
Nenue@65 411
Nenue@65 412
Nenue@65 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
Nenue@65 414 rewardType = REWARD_GEAR
Nenue@65 415 rewardIcon = texture
Nenue@65 416 rewardName = name
Nenue@65 417 rewardCount = numItems
Nenue@65 418 foundPrimary = true
Nenue@65 419 elseif IsArtifactPowerItem(itemID) then
Nenue@65 420 rewardType = REWARD_ARTIFACT_POWER
Nenue@65 421 rewardIcon = texture
Nenue@65 422 rewardName = name
Nenue@65 423 rewardCount = 1
Nenue@65 424 foundPrimary = true
Nenue@65 425
Nenue@65 426 WorldPlanTooltip:SetOwner(self, 'ANCHOR_NONE')
Nenue@65 427 WorldPlanTooltip:SetHyperlink(itemLink)
Nenue@65 428 for i = 1, WorldPlanTooltip:NumLines() do
Nenue@65 429 local line = _G['WorldPlanTooltipTextLeft' .. i]
Nenue@65 430 local text = line and line:GetText()
Nenue@65 431 local ap = text and text:gsub(',', ''):match('(%d+) '..ARTIFACT_POWER)
Nenue@65 432 if ap then
Nenue@65 433 rewardCount = tonumber(ap)
Nenue@65 434 print(ap)
Nenue@65 435 end
Nenue@65 436
Nenue@65 437 end
Nenue@65 438
Nenue@65 439 if WorldPlanTooltipTextLeft2 then
Nenue@65 440 local text = WorldPlanTooltipTextLeft2:GetText()
Nenue@65 441 end
Nenue@65 442
Nenue@65 443 print('is an AP token')
Nenue@65 444 elseif classID == LE_ITEM_CLASS_TRADEGOODS then
Nenue@65 445 rewardType = REWARD_REAGENT
Nenue@65 446 rewardIcon = texture
Nenue@65 447 rewardName = name
Nenue@65 448 rewardCount = numItems
Nenue@65 449 foundPrimary = true
Nenue@65 450 end
Nenue@65 451
Nenue@65 452
Nenue@65 453 qprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID)
Nenue@65 454 tinsert(rewardItems, {
Nenue@65 455 name = name,
Nenue@65 456 texture = texture,
Nenue@65 457 numItems = numItems,
Nenue@65 458 quality = quality,
Nenue@65 459 isUsable = isUsable
Nenue@65 460 })
Nenue@65 461 if not foundPrimary then
Nenue@65 462 rewardType = REWARD_GEAR
Nenue@65 463
Nenue@65 464 rewardIcon = texture
Nenue@65 465 rewardName = name
Nenue@65 466 rewardCount = numItems
Nenue@65 467 end
Nenue@65 468
Nenue@65 469 end
Nenue@65 470
Nenue@65 471 end
Nenue@65 472 end
Nenue@65 473
Nenue@65 474 qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numQuestRewards, rewardType)
Nenue@65 475 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
Nenue@65 476
Nenue@65 477 if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then
Nenue@65 478 return true, rewardType, rewardName, rewardIcon, rewardCount, quality
Nenue@65 479 else
Nenue@65 480 return false
Nenue@65 481 end
Nenue@65 482 end
Nenue@65 483
Nenue@65 484
Nenue@65 485
Nenue@65 486 --[[ set reward category
Nenue@29 487 local numRewards = GetNumQuestLogRewards(questID)
Nenue@29 488 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
Nenue@29 489 local money = GetQuestLogRewardMoney(questID)
Nenue@29 490 if numRewards >= 1 then
Nenue@40 491 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID)
Nenue@29 492 elseif numCurrency >= 1 then
Nenue@29 493 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
Nenue@29 494 rewardType = REWARD_CURRENCY
Nenue@29 495 elseif money >= 1 then
Nenue@29 496 rewardName = GetMoneyString(money)
Nenue@29 497 end
Nenue@65 498 --]]
Nenue@29 499
Nenue@40 500 end
Nenue@7 501 end
Nenue@7 502
Nenue@34 503 -- run from OnShow if .isNew is set
Nenue@34 504
Nenue@49 505 function QuestPOI:StartFade()
Nenue@34 506 if not self.isAnimating then
Nenue@35 507 --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
Nenue@35 508 self:SetAlpha(0)
Nenue@49 509 self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha)
Nenue@49 510 self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha)
Nenue@49 511 self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha)
Nenue@49 512
Nenue@34 513 self.isAnimating = true
Nenue@35 514 self.isNew = nil
Nenue@40 515 self.isStale = true
Nenue@35 516 self.FadeIn:Play()
Nenue@34 517 end
Nenue@7 518 end
Nenue@7 519
Nenue@49 520 function QuestPOI:EndFade()
Nenue@49 521 self.isAnimating = nil
Nenue@49 522 self:SetAlpha(db.PinAlpha)
Nenue@49 523 end
Nenue@49 524
Nenue@40 525 function QuestPOI:OnShow ()
Nenue@27 526
Nenue@49 527 if self.isStale then
Nenue@49 528 qprint('|cFF0088FFflagged for refresh')
Nenue@48 529 self:Refresh()
Nenue@48 530 end
Nenue@34 531
Nenue@54 532 if self.isNew or (not self.Overlay:IsShown()) then
Nenue@54 533 --qprint('|cFFFFFF00popping new pin handler')
Nenue@49 534 self:StartFade()
Nenue@49 535 end
Nenue@49 536
Nenue@54 537 if not self.isAnimating then
Nenue@57 538 self:SetAlpha(db.PinAlpha) -- fix stuck alpha
Nenue@54 539 end
Nenue@59 540
Nick@62 541 self:ShowFrames()
Nenue@27 542 end
Nick@62 543
Nenue@40 544 function QuestPOI:OnHide()
Nick@60 545 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()')
Nick@62 546 self:HideFrames()
Nenue@59 547 -- reset flags
Nenue@59 548 self:SetAlpha(db.PinAlpha)
Nenue@49 549 self.isAnimating = nil
Nenue@27 550 end
Nenue@27 551
Nenue@65 552 -- Places the pin and triggers display
Nenue@52 553 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight)
Nick@62 554 wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used)
Nick@62 555 if not self.used then
Nick@62 556 self:HideFrames()
Nick@62 557 return
Nick@62 558 end
Nick@62 559
Nick@62 560
Nenue@52 561 self:SetParent(owner)
Nenue@49 562 self:ClearAllPoints()
Nenue@56 563 self:SetFrameLevel(pinBaseIndex + self:GetID())
Nenue@53 564 self.Overlay:SetParent(owner)
Nenue@53 565 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
Nenue@53 566 if (dX and dY) then
Nenue@53 567 if not (mapHeight and mapWidth) then
Nenue@53 568 mapWidth, mapHeight = owner:GetSize()
Nenue@53 569 end
Nenue@65 570 if (self.x ~= dY) or (self.y ~= dY) then
Nenue@65 571 self.x = dX
Nenue@65 572 self.y = dY
Nenue@65 573 local pX = (dX * mapWidth)
Nenue@65 574 local pY = (-dY * mapHeight)
Nenue@65 575 self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
Nenue@65 576 end
Nenue@53 577 else
Nenue@65 578 if self.x or self.y then
Nenue@65 579 self.x = nil
Nenue@65 580 self.y = nil
Nenue@65 581 self:SetPoint('CENTER')
Nenue@65 582 end
Nenue@53 583 end
Nick@62 584
Nick@62 585 self:ShowFrames()
Nick@62 586 end
Nick@62 587
Nick@64 588 -- Show/Hide the text overlays associated with the quest pin; they aren't hierarchically linked
Nick@62 589 function QuestPOI:ShowFrames()
Nick@62 590 if not self:IsShown() then
Nick@62 591 print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
Nick@64 592 -- do not SetShown() here
Nick@64 593 end
Nick@62 594
Nick@62 595 self.count:SetShown(true)
Nick@62 596 self.Overlay:SetShown(true)
Nick@62 597 self.count:SetShown(true)
Nick@62 598 self.timeLabel:SetShown(true)
Nick@62 599 end
Nick@62 600
Nick@62 601 function QuestPOI:HideFrames()
Nick@62 602 if self:IsShown() then
Nick@62 603 print(self:GetName()..':HideFrames()')
Nick@62 604 self:SetShown(false)
Nick@62 605 end
Nick@62 606 self.count:SetShown(false)
Nick@62 607 self.Overlay:SetShown(false)
Nick@62 608 self.count:SetShown(false)
Nick@62 609 self.timeLabel:SetShown(false)
Nick@62 610 self.used = nil
Nenue@7 611 end
Nenue@7 612
Nenue@40 613 function QuestPOI:OnLoad()
Nenue@40 614 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
Nenue@36 615
Nenue@40 616 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
Nenue@40 617 self.isPending = true
Nenue@36 618 self.count = self.Overlay.count
Nick@62 619 self.timeLabel = self.Overlay.timeLabel
Nenue@54 620 self.Description = self.Overlay.Description
Nenue@40 621 self.updateRate = PIN_REQUEST_DELAY
Nenue@40 622 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
Nenue@41 623
Nenue@53 624 self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4)
Nenue@53 625 self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4)
Nenue@7 626 end
Nick@64 627
Nenue@57 628 function QuestPOI:OnMouseDown(button)
Nenue@57 629 if button == 'RightButton' then
Nenue@57 630 SetSuperTrackedQuestID(nil)
Nenue@57 631 else
Nenue@57 632 TaskPOI_OnClick(self, button)
Nenue@57 633 end
Nenue@57 634 end
Nenue@57 635
Nenue@7 636
Nenue@40 637 function QuestPOI:OnUpdate (sinceLast)
Nenue@40 638 -- control update check intervals
Nenue@40 639 self.throttle = (self.throttle or self.updateRate) + sinceLast
Nenue@40 640 if self.throttle >= self.updateRate then
Nenue@40 641 -- factor overtime into the throttle timer
Nenue@40 642 self.throttle = self.throttle - self.updateRate
Nenue@40 643 else
Nenue@40 644 return
Nenue@40 645 end
Nenue@35 646 if self.isNew then
Nenue@59 647 --print('|cFFFFFF00push new poi stuff')
Nenue@35 648 self:OnNew()
Nenue@40 649 elseif (self.isStale or (not self.title)) and not self.isAnimating then
Nenue@59 650 --wprint('|cFFFFFF00push poi update')
Nenue@35 651 self:Refresh()
Nenue@35 652 return
Nenue@35 653 end
Nenue@7 654
Nenue@7 655 -- query for reward data if it wasn't found in the original scan
Nenue@7 656 local questID = self.questID
Nenue@65 657 if not self.dataLoaded then
Nenue@59 658 --print('|cFFFF4400'..self:GetID()..':|r polling reward info')
Nenue@49 659 if not (self.isAnimating) then
Nenue@7 660 self.PendingFade:Play()
Nenue@7 661 end
Nenue@49 662 self:GetData()
Nenue@7 663 return
Nenue@7 664 else
Nenue@7 665 if self.PendingFade:IsPlaying() then
Nenue@7 666 self.PendingFade:Stop()
Nenue@7 667 end
Nenue@7 668 end
Nenue@7 669
Nenue@55 670 self:UpdateStatus()
Nenue@55 671 end
Nenue@7 672
Nenue@55 673 -- Called at static intervals and with Refresh
Nenue@55 674 function QuestPOI:UpdateStatus()
Nenue@7 675 -- update time elements
Nick@64 676 self.isActive = TQ_IsActive(self.questID)
Nick@64 677
Nick@64 678 if self.isActive then
Nenue@40 679 local tl = self.alertLevel
Nenue@55 680 local timeLeft = TQ_GetQuestTimeLeftMinutes(self.questID)
Nenue@40 681 if timeLeft > 0 then
Nenue@40 682
Nenue@40 683 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel)
Nenue@40 684 if tl ~= timeState then
Nenue@40 685 tl = timeState
Nenue@40 686 self.timeLabel:SetText(text)
Nenue@40 687 end
Nenue@40 688 else
Nenue@9 689 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
Nick@62 690 self:HideFrames()
Nenue@9 691 end
Nenue@7 692 end
Nenue@55 693
Nenue@57 694 if tl and (timeLeft < 120) then
Nenue@55 695 self.HighlightBorder:SetVertexColor(1,0,0,0.7)
Nenue@55 696 elseif self.isBounty then
Nenue@55 697 self.HighlightBorder:SetVertexColor(.25,.5,1,1)
Nenue@55 698 else
Nenue@55 699 self.HighlightBorder:SetVertexColor(0,0,0,0.7)
Nenue@55 700 end
Nenue@40 701 self.alertLevel = tl
Nick@60 702 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
Nenue@59 703 else
Nick@60 704 if not self.completed then
Nick@60 705 self.completed = true
Nick@62 706 self:HideFrames()
Nick@60 707 end
Nenue@7 708 end
Nenue@8 709 end
Nenue@8 710
Nick@60 711 function QuestPOI:Refresh ()
Nenue@49 712
Nick@60 713 rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
Nenue@49 714
Nenue@49 715
Nenue@9 716
Nenue@65 717 local styleType = (self.dataLoaded and self.rewardType) or STYLE_TYPE_PENDING
Nenue@40 718 local style,subStyle = self:GetTypeInfo(self.rewardType)
Nenue@52 719 if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then
Nenue@40 720 subStyle = style.minimized
Nenue@40 721 end
Nenue@40 722 self.style = style
Nenue@40 723 self.subStyle = subStyle
Nenue@40 724 --print(style, subStyle)
Nenue@40 725 self.currentWidth = subStyle.iconWidth
Nenue@40 726 self.borderWidth = subStyle.borderWidth
Nenue@40 727 self.highlightWidth = subStyle.highlightWidth
Nenue@40 728 self.tagSize = subStyle.TagSize
Nenue@40 729 self.maxAlertLevel = subStyle.maxAlertLevel
Nenue@40 730 self.NoIcon = subStyle.NoIcon
Nenue@9 731
Nenue@57 732 local questID = self.questID
Nenue@36 733 local iconBorder = self.RewardBorder
Nenue@36 734 local trackingBorder = self.HighlightBorder
Nenue@9 735 local icon = self.icon
Nenue@9 736 local count = self.count
Nenue@55 737 self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID)
Nenue@36 738
Nenue@9 739 if self.itemName then
Nenue@45 740
Nenue@54 741 if self.itemNumber then
Nenue@54 742 local numberString = self.itemNumber
Nenue@65 743 if self.itemNumber >= 1000000 then
Nenue@65 744 numberString = (floor(self.itemNumber/100000)/10) .. 'M'
Nenue@65 745 elseif self.itemNumber >= 10000 then
Nenue@65 746 numberString = floor(self.itemNumber/1000) .. 'k'
Nenue@65 747 elseif self.itemNumber >= 1000 then
Nenue@54 748 local numeral = floor(self.itemNumber/1000)
Nenue@54 749 local decimal = mod(self.itemNumber, 1000)
Nenue@54 750 numberString = numeral
Nenue@54 751 if decimal > 100 then
Nenue@54 752 numberString = numberString .. '.' .. tostring(floor(decimal/100))
Nenue@54 753 end
Nenue@54 754 numberString = numberString .. 'k'
Nenue@40 755 end
Nenue@45 756 self.count:SetText(numberString)
Nenue@45 757 else
Nenue@54 758 self.count:SetText(nil)
Nenue@45 759 end
Nenue@54 760 end
Nenue@30 761
Nenue@55 762 if db.Config.ShowVerboseInfo then
Nenue@55 763 self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5))
Nenue@55 764 end
Nenue@55 765
Nenue@40 766
Nenue@40 767 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
Nenue@36 768 if self.itemTexture then
Nenue@47 769 --iconBorder:SetTexture(WORLD_QUEST_BORDER)
Nenue@40 770
Nenue@40 771 if self.NoIcon then
Nenue@40 772 icon:SetTexture(PENDING_ICON)
Nenue@40 773 icon:SetDesaturated(true)
Nenue@47 774 icon:SetVertexColor(style.r, style.g, style.b)
Nenue@40 775 else
Nenue@40 776
Nenue@40 777 icon:SetTexture(self.itemTexture)
Nenue@40 778 icon:SetDesaturated(false)
Nenue@40 779 icon:SetVertexColor(1, 1, 1)
Nenue@40 780 end
Nenue@40 781 else
Nenue@47 782 --
Nenue@40 783 icon:SetTexture(PENDING_ICON)
Nenue@40 784 icon:SetDesaturated(true)
Nenue@47 785 icon:SetVertexColor(style.r, style.g, style.b)
Nenue@9 786 end
Nenue@9 787
Nenue@47 788 iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
Nenue@47 789 iconBorder:SetTexture(PENDING_BORDER)
Nenue@54 790 iconBorder:SetVertexColor(style.r, style.g, style.b, 1)
Nenue@52 791
Nenue@9 792 iconBorder:SetDesaturated(true)
Nenue@40 793 iconBorder:SetAlpha(subStyle.alpha or 1)
Nenue@9 794
Nenue@47 795 trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background")
Nenue@47 796 trackingBorder:SetTexture(PENDING_BORDER)
Nenue@9 797
Nenue@49 798 self.tagIcon:SetShown((not self.filtered) and true or false)
Nenue@9 799 self.tagIcon:SetAtlas(self.tagAtlas)
Nenue@49 800
Nenue@47 801 self.EliteBorder:SetShown(self.isElite and not self.filtered)
Nenue@36 802
Nenue@9 803 self:UpdateSize()
Nenue@55 804 self:UpdateStatus()
Nenue@33 805 self.isStale = nil
Nenue@57 806
Nenue@57 807 -- signal filter info update
Nenue@57 808 WorldPlanSummary.isStale = true
Nenue@9 809 end
Nenue@9 810
Nenue@35 811 local cvar_check = {
Nenue@35 812 [REWARD_CASH] = 'worldQuestFilterGold',
Nenue@35 813 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower',
Nenue@35 814 [REWARD_CURRENCY] = 'worldQuestFilterOrderResources',
Nenue@35 815 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials',
Nenue@35 816 [REWARD_GEAR] = 'worldQuestFilterEquipment',
Nenue@35 817 }
Nenue@8 818
Nick@64 819
Nick@64 820
Nenue@57 821 function QuestPOI:CheckFilterRules ()
Nenue@36 822 local print = qprint
Nenue@33 823 local qType = self.worldQuestType
Nenue@57 824 local filtered
Nenue@57 825 local canShow = TQ_IsActive(self.questID)
Nenue@52 826 if SpellCanTargetQuest() then
Nenue@52 827 -- hiding so player can click a valid target
Nenue@52 828 self.used = nil
Nenue@52 829 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@57 830 if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then
Nenue@57 831 canShow = nil
Nenue@36 832 end
Nenue@36 833 end
Nenue@57 834 if canShow then
Nenue@57 835 for filterKey, value in pairs(db.UsedFilters) do
Nenue@57 836 if self[filterKey] ~= value then
Nenue@57 837 if not self.filtered then
Nenue@57 838 print('|cFFFF4400filtering', filterKey, value, '~=', self[filterKey], self.title)
Nenue@57 839 end
Nenue@57 840
Nenue@57 841 filtered = true
Nenue@57 842 end
Nenue@57 843 end
Nenue@57 844 if self.rewardType and cvar_check[self.rewardType] then
Nenue@57 845 if not GetCVarBool(cvar_check[self.rewardType]) then
Nenue@57 846 filtered = true
Nenue@57 847 end
Nenue@57 848 end
Nenue@57 849 if canShow and self.filtered ~= filtered then
Nenue@57 850 self.isStale = true
Nenue@57 851 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title)
Nenue@57 852 end
Nenue@57 853 self.filtered = filtered
Nenue@57 854 end
Nenue@57 855
Nenue@57 856 self.used = canShow
Nenue@57 857
Nenue@57 858
Nenue@33 859 end
Nenue@33 860
Nenue@33 861 --- Fixes icons upon size update
Nenue@36 862 function QuestPOI:UpdateSize ()
Nenue@33 863
Nenue@49 864 --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle)
Nenue@33 865
Nenue@40 866 local style = self.style
Nenue@40 867 local subStyle = self.subStyle
Nenue@36 868 local icon = self.icon
Nenue@36 869 local iconBorder = self.RewardBorder
Nenue@36 870 local trackingBorder = self.HighlightBorder
Nenue@36 871 local tag = self.tagIcon
Nenue@33 872
Nenue@36 873 local iconWidth = subStyle.iconWidth
Nenue@36 874 local borderWidth = iconWidth + (subStyle.borderWidth * 2)
Nenue@36 875 local highlightWidth = borderWidth + (subStyle.highlightWidth * 2)
Nenue@36 876 local iconTexture = self.itemTexture
Nenue@33 877
Nenue@47 878
Nenue@56 879 self:SetSize(highlightWidth, highlightWidth)
Nenue@47 880 if self.questID == GetSuperTrackedQuestID() then
Nenue@47 881 highlightWidth = highlightWidth + 2
Nenue@57 882 if self.filtered then
Nenue@57 883 self:SetAlpha(db.PinAlpha * 0.5)
Nenue@57 884 else
Nenue@57 885 self:SetAlpha(db.PinAlpha)
Nenue@57 886 end
Nenue@57 887
Nenue@47 888 end
Nenue@47 889
Nenue@47 890 if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then
Nenue@47 891 highlightWidth = highlightWidth + self.rarity
Nenue@47 892 end
Nenue@40 893 self.tagIcon:SetSize(self.tagSize, self.tagSize)
Nenue@36 894 icon:SetSize(iconWidth, iconWidth)
Nenue@36 895 iconBorder:SetSize(borderWidth, borderWidth)
Nenue@36 896 trackingBorder:SetSize(highlightWidth, highlightWidth)
Nenue@33 897
Nenue@36 898
Nenue@36 899 iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
Nenue@36 900 trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
Nenue@36 901
Nenue@36 902
Nick@62 903 if (subStyle.showNumber and self.itemNumber) and style.hasNumeric then
Nenue@36 904 self.count:SetTextColor(unpack(style.numberRGB))
Nenue@36 905 if subStyle.numberFontObject then
Nenue@36 906 --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
Nenue@36 907 self.count:SetFontObject(_G[subStyle.numberFontObject])
Nenue@36 908 end
Nick@62 909 else
Nick@62 910 self.count:SetText(nil)
Nenue@33 911 end
Nenue@7 912 end