annotate QuestPOI.lua @ 66:e43e10c5576b

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