annotate QuestPOI.lua @ 29:c1612c2c1840

WorldPlan: - Optimizations to in a lot of areas that should lead to better load-times and snappier world map. * Responding to quest log and map events by setting flags instead of tailing into the complete works. * Using a generic getter function for resolving pin visual attributes. and making use of blizzard constants for sanity's sake.
author Nenue
date Thu, 27 Oct 2016 13:50:56 -0400
parents 4a7e89bffbcb
children 8cb750e79952
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@7 5 --
Nenue@29 6
Nenue@29 7 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
Nenue@7 8 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
Nenue@7 9 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
Nenue@9 10 local TQ_IsActive = C_TaskQuest.IsActive
Nenue@29 11 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
Nenue@7 12 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame
Nenue@7 13
Nenue@7 14 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
Nenue@7 15 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
Nenue@29 16 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuest', ...) end or function() end
Nenue@7 17 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
Nenue@7 18 local QuestPOI = WorldPlanPOIMixin
Nenue@7 19
Nenue@9 20 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
Nenue@9 21 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
Nenue@9 22
Nenue@9 23 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
Nenue@9 24 local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@9 25 local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE"
Nenue@9 26 local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
Nenue@9 27 local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
Nenue@9 28 local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"
Nenue@9 29
Nenue@29 30 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
Nenue@29 31 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
Nenue@29 32 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
Nenue@29 33 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
Nenue@29 34 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
Nenue@29 35
Nenue@29 36
Nenue@29 37 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
Nenue@29 38 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
Nenue@29 39 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
Nenue@29 40 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
Nenue@29 41 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
Nenue@29 42
Nenue@29 43 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
Nenue@29 44 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
Nenue@29 45 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
Nenue@29 46 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
Nenue@29 47 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
Nenue@29 48
Nenue@29 49 -- Pin color/display variables
Nenue@29 50
Nenue@7 51 local familiars = {
Nenue@7 52 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'},
Nenue@7 53 [40277] = {npc = 97804, name = 'Tiffany Nelson'},
Nenue@7 54 [40298] = {npc = 99182, name = 'Sir Galveston'},
Nenue@7 55 [40282] = {npc= 99150, name = 'Grixis Tinypop'},
Nenue@7 56 [40278] = {npc = 98270, name = 'Robert Craig'},
Nenue@7 57 [48195] = {npc = 105250, name = 'Aulier'},
Nenue@7 58 [41990] = {npc = 105674, name = 'Varenne'},
Nenue@7 59 [41860] = {npc = 104970, name = 'Xorvasc'},
Nenue@7 60 [40299] = {npc = 99210, name = 'Bodhi Sunwayver'},
Nenue@7 61 [42442] = {npc = 107489, name = 'Amalia'},
Nenue@7 62 [40280] = {npc = 99077, name = 'Bredda Tenderhide'},
Nenue@7 63 [41687] = {npc = 104553, name = 'Odrogg'},
Nenue@7 64 [41944] = {npc = 105455, name = 'Trapper Jarrun'},
Nenue@7 65 [40337] = {npc = 97709, name = 'Master Tamer Flummox'},
Nenue@7 66 [40279] = {npc = 99035, name = 'Durian Strongfruit'}
Nenue@7 67 }
Nenue@7 68 local familiars_id = 9696
Nenue@7 69
Nenue@7 70
Nenue@9 71 -- update a masked texture without messing up its blending mask
Nenue@9 72 local SetMaskedTexture = function(region, file, mask)
Nenue@9 73 mask = mask or POI_BORDER_MASK
Nenue@9 74 region:SetMask(nil)
Nenue@9 75 region:SetTexture(file)
Nenue@9 76 region:SetMask(mask)
Nenue@9 77 end
Nenue@7 78
Nenue@29 79
Nenue@29 80 -- use tooltip object to extract item details
Nenue@29 81 local ParseItemReward = function(questID)
Nenue@29 82 local name, icon, quantity, quality, _, itemID = GetQuestLogRewardInfo(1, questID)
Nenue@29 83 local scanner = _G.WorldPlanTooltip
Nenue@29 84 if not itemID then
Nenue@29 85 return
Nenue@29 86 end
Nenue@29 87
Nenue@29 88 scanner:SetOwner(WorldPlan, "ANCHOR_NONE")
Nenue@29 89 scanner:SetItemByID(itemID)
Nenue@29 90 scanner:Show()
Nenue@29 91 local ttl1 = _G['WorldPlanTooltipTextLeft1']
Nenue@29 92 local ttl2 = _G['WorldPlanTooltipTextLeft2']
Nenue@29 93 local ttl3 = _G['WorldPlanTooltipTextLeft3']
Nenue@29 94 local ttl4 = _G['WorldPlanTooltipTextLeft4']
Nenue@29 95 if ttl2 then
Nenue@29 96 local text = ttl2:GetText()
Nenue@29 97 -- Artifact Power
Nenue@29 98 if text then
Nenue@29 99 if text:match("|cFFE6CC80") then
Nenue@29 100 --print('AP token!', text)
Nenue@29 101 local power
Nenue@29 102 if ttl4 then
Nenue@29 103 local text = ttl4:GetText()
Nenue@29 104 --print('tip line 4', text)
Nenue@29 105 if text then
Nenue@29 106 power = text:gsub("%p", ""):match("%d+")
Nenue@29 107 power = tonumber(power)
Nenue@29 108 end
Nenue@29 109
Nenue@29 110 end
Nenue@29 111 return REWARD_ARTIFACT_POWER, "Interface\\ICONS\\inv_7xp_inscription_talenttome01", power, name, itemID
Nenue@29 112 elseif text:match("Item Level") then
Nenue@29 113 --print('equipment!', text)
Nenue@29 114 quantity = text:match("Item Level ([%d\+]+)")
Nenue@29 115 return REWARD_GEAR, icon, quantity, name, itemID
Nenue@29 116 elseif text:match("Crafting Reagent") then
Nenue@29 117 --print('|cFFFF4400it is a reagent', text)
Nenue@29 118 return REWARD_REAGENT, icon, quantity, name, itemID
Nenue@29 119 end
Nenue@29 120 end
Nenue@29 121
Nenue@29 122 elseif ttl3 then
Nenue@29 123 local text = ttl3:GetText()
Nenue@29 124 if text:match("Crafting Reagent") then
Nenue@29 125 --print('|cFFFF4400it is a reagent', text)
Nenue@29 126 return REWARD_REAGENT, icon, quantity, name, itemID
Nenue@29 127 end
Nenue@29 128 end
Nenue@29 129 return 128, icon, quantity, name, itemID
Nenue@29 130 end
Nenue@29 131
Nenue@27 132 function WorldPlanPOIMixin:OnEnter()
Nenue@7 133 local completed = select(4,GetAchievementInfo(familiars_id))
Nenue@7 134 if not completed then
Nenue@7 135 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
Nenue@7 136 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
Nenue@7 137 WorldMapTooltip:AddLine('Family Familiars')
Nenue@7 138 local trainer = familiars[self.questID].name
Nenue@7 139 local numCheevs = GetAchievementNumCriteria(familiars_id)
Nenue@7 140 for index = 1, numCheevs do
Nenue@7 141 local cheevName, cType, cCompleted, quantity, requiredQuantity, charName, flags, cheevID, quantityString, criteriaID = GetAchievementCriteriaInfo(familiars_id, index)
Nenue@7 142 local numTrainers = GetAchievementNumCriteria(cheevID)
Nenue@7 143 for subIndex = 1, numTrainers do
Nenue@7 144 local desc, cType, partCompleted = GetAchievementCriteriaInfo(cheevID, subIndex)
Nenue@7 145 if desc == trainer then
Nenue@7 146 if not partCompleted then
Nenue@7 147 local iconPath = select(10, GetAchievementInfo(cheevID))
Nenue@7 148 WorldMapTooltip:AddLine(cheevName)
Nenue@7 149 WorldMapTooltip:AddTexture(iconPath)
Nenue@7 150 end
Nenue@7 151 end
Nenue@7 152 end
Nenue@7 153 end
Nenue@7 154 WorldMapTooltip:Show()
Nenue@7 155 return
Nenue@7 156 end
Nenue@7 157 end
Nenue@7 158 TaskPOI_OnEnter(self)
Nenue@7 159 end
Nenue@27 160 function WorldPlanPOIMixin:OnLeave()
Nenue@7 161 TaskPOI_OnLeave(self)
Nenue@7 162 end
Nenue@27 163 function WorldPlanPOIMixin:OnMouseDown()
Nenue@7 164 TaskPOI_OnClick(self)
Nenue@7 165 end
Nenue@7 166
Nenue@7 167
Nenue@29 168
Nenue@29 169 -- create or update the pin using the given questID and C_TaskQuest results
Nenue@29 170 function WorldPlanPOIMixin:RefreshData (info)
Nenue@29 171
Nenue@29 172 qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r')
Nenue@29 173
Nenue@29 174 if info then
Nenue@29 175
Nenue@29 176 self.x = info.x or self.x
Nenue@29 177 self.y = info.y or self.y
Nenue@29 178 self.inProgress = info.inProgress
Nenue@29 179 self.floor = info.floor
Nenue@29 180 self.numObjectives = info.numObjectives or 0
Nenue@29 181 print('|cFFFF4400subbing in new info', info.x, info.y, self.x, self.y)
Nenue@29 182 end
Nenue@29 183
Nenue@29 184
Nenue@29 185 local questID = self:GetID()
Nenue@29 186 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
Nenue@29 187 local hasUpdate, isPending = self.isNew, false
Nenue@29 188
Nenue@29 189
Nenue@29 190 if not HaveQuestData(questID) then
Nenue@29 191 TQ_RequestPreloadRewardData(questID)
Nenue@29 192 isPending = true
Nenue@29 193 qprint('because not have data')
Nenue@29 194 else
Nenue@29 195
Nenue@29 196 -- set reward category
Nenue@29 197 local numRewards = GetNumQuestLogRewards(questID)
Nenue@29 198 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
Nenue@29 199 local money = GetQuestLogRewardMoney(questID)
Nenue@29 200 if numRewards >= 1 then
Nenue@29 201 rewardType, rewardIcon, rewardCount, rewardName, itemID = ParseItemReward(questID)
Nenue@29 202 elseif numCurrency >= 1 then
Nenue@29 203 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
Nenue@29 204 rewardType = REWARD_CURRENCY
Nenue@29 205 elseif money >= 1 then
Nenue@29 206 rewardIcon = ICON_MONEY
Nenue@29 207 rewardName = GetMoneyString(money)
Nenue@29 208 rewardType = REWARD_CASH
Nenue@29 209 end
Nenue@29 210 rewardStyle = WorldPlan:GetTypeInfo(rewardType)
Nenue@29 211
Nenue@29 212 self.itemNumber = rewardCount or self.itemNumber
Nenue@29 213 self.rewardType = rewardType or REWARD_ITEM
Nenue@29 214 self.style = rewardStyle
Nenue@29 215
Nenue@29 216 -- title, faction, capped state
Nenue@29 217 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
Nenue@29 218 self.factionID = factionID
Nenue@29 219 self.capped = capped
Nenue@29 220
Nenue@29 221 -- set tag details
Nenue@29 222 local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID);
Nenue@29 223 local tagAtlas
Nenue@29 224 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
Nenue@29 225 tagAtlas = "worldquest-icon-petbattle"
Nenue@29 226 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
Nenue@29 227 tagAtlas = "worldquest-icon-pvp-ffa"
Nenue@29 228 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@29 229 local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex))
Nenue@29 230 if id then
Nenue@29 231 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
Nenue@29 232 end
Nenue@29 233 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
Nenue@29 234 tagAtlas = "worldquest-icon-dungeon"
Nenue@29 235 end
Nenue@29 236
Nenue@29 237 self.tagID = tagID
Nenue@29 238 self.tagName = tagName
Nenue@29 239 self.worldQuestType = worldQuestType
Nenue@29 240 self.isElite = isElite
Nenue@29 241 self.tradeskillLineIndex = tradeskillLineIndex
Nenue@29 242 self.rarity = rarity
Nenue@29 243 self.tagAtlas = tagAtlas
Nenue@29 244
Nenue@29 245 -- flag unresolved info
Nenue@29 246 if not (rewardIcon and rewardName) then
Nenue@29 247 isPending = true
Nenue@29 248 qprint('because not have icon')
Nenue@29 249 TQ_RequestPreloadRewardData (questID)
Nenue@29 250 --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
Nenue@29 251 else
Nenue@29 252 if (rewardIcon and rewardName) and isPending then
Nenue@29 253 --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
Nenue@29 254 hasUpdate = true
Nenue@29 255 end
Nenue@29 256 isPending = false
Nenue@29 257 end
Nenue@29 258
Nenue@29 259 self.title = questTitle or "|cFFFF0000Retrieving..."
Nenue@29 260 self.itemTexture = rewardIcon or self.itemTexture
Nenue@29 261 self.itemName = rewardName or self.itemName
Nenue@29 262 self.hasUpdate = hasUpdate
Nenue@29 263 self.isPending = isPending
Nenue@29 264
Nenue@29 265
Nenue@29 266 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
Nenue@29 267 qprint(' ', self.title, self.itemTexture, 'rewardType:', self.rewardType, 'tag:', self.tagID, 'style', self.style )
Nenue@29 268 end
Nenue@29 269 return hasUpdate, isPending
Nenue@29 270 end
Nenue@29 271
Nenue@29 272
Nenue@7 273 function WorldPlanPOIMixin:SetAchievementProgressTooltip()
Nenue@7 274 print('cheevos')
Nenue@7 275 end
Nenue@7 276
Nenue@27 277 function WorldPlanPOIMixin:ShowNew()
Nenue@27 278 self:SetShown(true)
Nenue@27 279 self.isNew = nil
Nenue@27 280 self.FadeIn:Play()
Nenue@7 281 end
Nenue@7 282
Nenue@27 283 function WorldPlanPOIMixin:OnShow ()
Nenue@27 284 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating)
Nenue@27 285 qprint(debugstack())
Nenue@27 286 -- pop this on principle
Nenue@27 287 if self.hasUpdate then
Nenue@27 288
Nenue@27 289 self:Refresh()
Nenue@27 290 end
Nenue@27 291
Nenue@27 292 end
Nenue@27 293 function WorldPlanPOIMixin:OnHide()
Nenue@27 294 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
Nenue@27 295 end
Nenue@27 296
Nenue@27 297 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
Nenue@29 298 qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth)
Nenue@7 299 self:ClearAllPoints()
Nenue@29 300 local dX, dY = TQ_GetQuestLocation(self.questID)
Nenue@7 301 if not dX or dX == 0 then
Nenue@7 302 local _, x, y = QuestPOIGetIconInfo(self.questID)
Nenue@7 303 if x and floor(x) ~= 0 then
Nenue@7 304 dX, dY = x, y
Nenue@7 305 else
Nenue@7 306 dX, dY = self.x, self.y
Nenue@7 307 end
Nenue@7 308 end
Nenue@7 309 self.x = dX
Nenue@7 310 self.y = dY
Nenue@7 311
Nenue@29 312 --qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
Nenue@7 313
Nenue@7 314 local pX = (dX * mapWidth)
Nenue@7 315 local pY = (-dY * mapHeight)
Nenue@7 316
Nenue@7 317 self:SetParent(WorldMapPOIFrame)
Nenue@7 318 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
Nenue@7 319 end
Nenue@7 320
Nenue@7 321
Nenue@27 322 function WorldPlanPOIMixin:OnLoad()
Nenue@27 323 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
Nenue@7 324 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
Nenue@27 325 self.style = WorldPlan.db.defaultPinStyle
Nenue@27 326 self.subStyle = WorldPlan.db.defaultPinStyle.continent
Nenue@7 327 end
Nenue@7 328
Nenue@27 329 function WorldPlanPOIMixin:OnEvent(event, ...)
Nenue@7 330 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
Nenue@7 331 if self:IsVisible() then
Nenue@7 332 self:Refresh()
Nenue@7 333 end
Nenue@7 334 end
Nenue@7 335 end
Nenue@7 336
Nenue@7 337
Nenue@7 338 local PIN_UPDATE_DELAY = .016
Nenue@7 339 local TOP_PIN_ID
Nenue@27 340 function WorldPlanPOIMixin:OnUpdate (sinceLast)
Nenue@7 341 -- control update check intervals
Nenue@7 342 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
Nenue@7 343 if self.throttle <= 0 then
Nenue@7 344 -- factor overtime into the throttle timer
Nenue@7 345 self.throttle = PIN_UPDATE_DELAY - self.throttle
Nenue@7 346 else
Nenue@7 347 return
Nenue@7 348 end
Nenue@7 349
Nenue@7 350 -- query for reward data if it wasn't found in the original scan
Nenue@7 351 local questID = self.questID
Nenue@7 352 if self.isPending then
Nenue@29 353 self:RefreshData()
Nenue@7 354 if not (self.PendingFade:IsPlaying() or self.isAnimating) then
Nenue@7 355 self.PendingFade:Play()
Nenue@7 356 end
Nenue@7 357 return
Nenue@7 358 else
Nenue@7 359 if self.PendingFade:IsPlaying() then
Nenue@7 360 self.PendingFade:Stop()
Nenue@7 361 end
Nenue@7 362 end
Nenue@7 363
Nenue@7 364 if self.hasUpdate then
Nenue@7 365 self:Refresh()
Nenue@7 366 self.hasUpdate = nil
Nenue@7 367 end
Nenue@7 368
Nenue@7 369 -- update time elements
Nenue@7 370 local tl = self.timeThreschold
Nenue@7 371 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
Nenue@7 372 if timeLeft > 0 then
Nenue@29 373 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage)
Nenue@29 374 if tl ~= timeState then
Nenue@29 375 tl = timeState
Nenue@29 376 self.timeLabel:SetText(text)
Nenue@7 377 end
Nenue@7 378 else
Nenue@7 379 -- remove self in a timely manner
Nenue@9 380 if not TQ_IsActive(self.questID) then
Nenue@9 381 print('|cFFFF4400'..self:GetName()..' pin hard timeout')
Nenue@9 382 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@9 383 self:Hide()
Nenue@9 384 end
Nenue@7 385 end
Nenue@7 386 end
Nenue@7 387 self.timeThreschold = tl
Nenue@7 388
Nenue@7 389 if self:IsMouseOver() then
Nenue@7 390 self.MouseGlow:Show()
Nenue@7 391 else
Nenue@7 392 self.MouseGlow:Hide()
Nenue@7 393 end
Nenue@8 394 end
Nenue@8 395
Nenue@8 396
Nenue@9 397
Nenue@27 398 function WorldPlanPOIMixin:Refresh ()
Nenue@9 399 local db = WorldPlan.db
Nenue@9 400 local print = qprint
Nenue@9 401 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
Nenue@9 402 print(self.style)
Nenue@9 403
Nenue@9 404
Nenue@9 405
Nenue@29 406 local questID = self:GetID()
Nenue@29 407 local style,subStyle = WorldPlan:GetTypeInfo(self.rewardType or ((self.quality or 0) + 127))
Nenue@29 408 if self.filtered then
Nenue@29 409 subStyle = style.minimized
Nenue@29 410 end
Nenue@29 411
Nenue@9 412 local borderMask = style.mask
Nenue@9 413 local borderFill = style.texture
Nenue@9 414 local iconBorder = self.iconBorder
Nenue@9 415 local icon = self.icon
Nenue@9 416 local count = self.count
Nenue@9 417
Nenue@27 418 self.subStyle = subStyle
Nenue@27 419 self.hasNumeric = style.hasNumeric
Nenue@27 420 self.numberRGB = style.numberRGB
Nenue@27 421 self.showNumber = subStyle.showNumber
Nenue@9 422
Nenue@27 423
Nenue@9 424 print(' - subStyle:', (self.filtered == true), self.subStyle)
Nenue@9 425
Nenue@9 426 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
Nenue@9 427 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
Nenue@9 428 icon:SetAllPoints(self)
Nenue@9 429
Nenue@9 430 if self.itemName then
Nenue@9 431 local color = self.rewardColor or COMMON_COLOR
Nenue@27 432
Nenue@27 433
Nenue@29 434
Nenue@27 435 if self.hasNumeric then
Nenue@29 436 self.count:SetShown(true)
Nenue@29 437 self.count:SetText(self.itemNumber)
Nenue@29 438 self.count:SetTextColor(unpack(self.numberRGB))
Nenue@9 439 else
Nenue@29 440 self.count:SetShown(false)
Nenue@29 441 self.count:SetText(nil)
Nenue@9 442 end
Nenue@27 443
Nenue@9 444 end
Nenue@9 445
Nenue@9 446 SetMaskedTexture(iconBorder, borderFill, borderMask)
Nenue@29 447 local border = WorldPlan:GetTypeInfo(self.rewardType)
Nenue@29 448 print(self.rewardType, print)
Nenue@9 449 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
Nenue@9 450 iconBorder:SetDesaturated(true)
Nenue@9 451
Nenue@9 452 local trackingBorder = self.supertrackBorder
Nenue@9 453
Nenue@9 454 self.highlight:SetMask(nil)
Nenue@9 455 if questID == GetSuperTrackedQuestID() then
Nenue@9 456 trackingBorder:SetVertexColor(0,0,0,1)
Nenue@9 457 else
Nenue@9 458 trackingBorder:SetVertexColor(0,0,0,0.5)
Nenue@9 459 end
Nenue@9 460 self.highlight:SetAllPoints(trackingBorder)
Nenue@9 461
Nenue@9 462 SetMaskedTexture(trackingBorder, borderFill, borderMask)
Nenue@9 463 self.highlight:SetMask(borderMask)
Nenue@9 464
Nenue@9 465 local qType = self.worldQuestType
Nenue@9 466 self.tagIcon:SetAtlas(self.tagAtlas)
Nenue@9 467 self.tagIcon:SetTexCoord(0,1,0,1)
Nenue@9 468
Nenue@9 469
Nenue@9 470 if self.isElite then
Nenue@29 471 self.EliteBorder:Show()
Nenue@9 472 else
Nenue@29 473 self.EliteBorder:Hide()
Nenue@9 474 end
Nenue@9 475 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
Nenue@9 476
Nenue@9 477
Nenue@9 478 self:UpdateSize()
Nenue@27 479 self.hasUpdate = nil
Nenue@9 480 end
Nenue@9 481
Nenue@8 482 function WorldPlanFilterPinMixin:OnEnter ()
Nenue@8 483 local filter = WorldPlan.FilterOptions[self:GetID()]
Nenue@8 484 local mapID = GetCurrentMapAreaID()
Nenue@8 485 local quests = (mapID == WorldPlan.BrokenIsleID) and WorldPlan.QuestsByID or WorldPlan.QuestsByZone[mapID]
Nenue@8 486 if quests then
Nenue@8 487 GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
Nenue@8 488 GameTooltip:AddLine(filter.label)
Nenue@8 489 local filterKey = self.filterKey
Nenue@8 490 local filterValue = self.filterValue
Nenue@8 491 if filterKey then
Nenue@8 492 for questID, pin in pairs(quests) do
Nenue@8 493 if pin.used and not pin.filtered then
Nenue@8 494 if pin[filterKey] == filterValue then
Nenue@8 495 local style = pin.style or WorldPlan.FilterStyle
Nenue@8 496
Nenue@8 497 if familiars[questID] then
Nenue@8 498 GameTooltip:AddLine(pin.title,0,1,0)
Nenue@8 499 else
Nenue@8 500 GameTooltip:AddLine(pin.title,1,1,1)
Nenue@8 501 end
Nenue@8 502
Nenue@8 503 end
Nenue@8 504 end
Nenue@8 505 end
Nenue@8 506 else
Nenue@8 507 GameTooltip:AddLine('Reset all filters')
Nenue@8 508 end
Nenue@8 509 GameTooltip:Show()
Nenue@8 510 end
Nenue@7 511 end