annotate QuestPOI.lua @ 30:8cb750e79952

WorldPlan: - Reworking filters to utilize newly added CVars
author Nenue
date Fri, 28 Oct 2016 14:06:07 -0400
parents c1612c2c1840
children d0114b51cdea
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@30 16 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) 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 self.inProgress = info.inProgress
Nenue@29 176 self.floor = info.floor
Nenue@29 177 self.numObjectives = info.numObjectives or 0
Nenue@30 178 if info.x and info.y then
Nenue@30 179 self.x = info.x or self.x
Nenue@30 180 self.y = info.y or self.y
Nenue@30 181 qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
Nenue@30 182 end
Nenue@30 183
Nenue@30 184 self.passesBlizzFilters = WorldMap_DoesWorldQuestInfoPassFilters(info)
Nenue@29 185 end
Nenue@29 186
Nenue@29 187
Nenue@29 188 local questID = self:GetID()
Nenue@29 189 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
Nenue@30 190 local hasUpdate, isPending = self.hasUpdate, self.isPending
Nenue@29 191
Nenue@29 192
Nenue@29 193 if not HaveQuestData(questID) then
Nenue@29 194 TQ_RequestPreloadRewardData(questID)
Nenue@29 195 isPending = true
Nenue@29 196 qprint('because not have data')
Nenue@29 197 else
Nenue@29 198
Nenue@29 199 -- set reward category
Nenue@29 200 local numRewards = GetNumQuestLogRewards(questID)
Nenue@29 201 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
Nenue@29 202 local money = GetQuestLogRewardMoney(questID)
Nenue@29 203 if numRewards >= 1 then
Nenue@29 204 rewardType, rewardIcon, rewardCount, rewardName, itemID = ParseItemReward(questID)
Nenue@29 205 elseif numCurrency >= 1 then
Nenue@29 206 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID)
Nenue@29 207 rewardType = REWARD_CURRENCY
Nenue@29 208 elseif money >= 1 then
Nenue@29 209 rewardIcon = ICON_MONEY
Nenue@29 210 rewardName = GetMoneyString(money)
Nenue@29 211 rewardType = REWARD_CASH
Nenue@29 212 end
Nenue@30 213 rewardStyle = self:GetTypeInfo(rewardType)
Nenue@29 214
Nenue@29 215 self.itemNumber = rewardCount or self.itemNumber
Nenue@29 216 self.rewardType = rewardType or REWARD_ITEM
Nenue@29 217 self.style = rewardStyle
Nenue@29 218
Nenue@29 219 -- title, faction, capped state
Nenue@29 220 local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
Nenue@29 221 self.factionID = factionID
Nenue@29 222 self.capped = capped
Nenue@29 223
Nenue@29 224 -- set tag details
Nenue@29 225 local tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex = GetQuestTagInfo(questID);
Nenue@29 226 local tagAtlas
Nenue@29 227 if worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE then
Nenue@29 228 tagAtlas = "worldquest-icon-petbattle"
Nenue@29 229 elseif worldQuestType == LE_QUEST_TAG_TYPE_PVP then
Nenue@29 230 tagAtlas = "worldquest-icon-pvp-ffa"
Nenue@29 231 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@29 232 local id = tradeskillLineIndex and select(7, GetProfessionInfo(tradeskillLineIndex))
Nenue@29 233 if id then
Nenue@29 234 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
Nenue@29 235 end
Nenue@29 236 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
Nenue@29 237 tagAtlas = "worldquest-icon-dungeon"
Nenue@29 238 end
Nenue@29 239
Nenue@29 240 self.tagID = tagID
Nenue@29 241 self.tagName = tagName
Nenue@29 242 self.worldQuestType = worldQuestType
Nenue@29 243 self.isElite = isElite
Nenue@29 244 self.tradeskillLineIndex = tradeskillLineIndex
Nenue@29 245 self.rarity = rarity
Nenue@29 246 self.tagAtlas = tagAtlas
Nenue@29 247
Nenue@29 248 -- flag unresolved info
Nenue@29 249 if not (rewardIcon and rewardName) then
Nenue@29 250 isPending = true
Nenue@29 251 qprint('because not have icon')
Nenue@29 252 TQ_RequestPreloadRewardData (questID)
Nenue@29 253 --WorldPlan:print('|cFFFFFF00'..tostring(self.title)..'|r waiting on texture info')
Nenue@29 254 else
Nenue@29 255 if (rewardIcon and rewardName) and isPending then
Nenue@29 256 --WorldPlan:print('|cFF00FF00'..tostring(self.title)..'|r has info', rewardIcon, rewardName)
Nenue@29 257 hasUpdate = true
Nenue@29 258 end
Nenue@29 259 isPending = false
Nenue@29 260 end
Nenue@29 261
Nenue@29 262 self.title = questTitle or "|cFFFF0000Retrieving..."
Nenue@29 263 self.itemTexture = rewardIcon or self.itemTexture
Nenue@29 264 self.itemName = rewardName or self.itemName
Nenue@29 265 self.hasUpdate = hasUpdate
Nenue@29 266 self.isPending = isPending
Nenue@29 267
Nenue@29 268
Nenue@29 269 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
Nenue@30 270 qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
Nenue@30 271 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
Nenue@29 272 end
Nenue@29 273 return hasUpdate, isPending
Nenue@29 274 end
Nenue@29 275
Nenue@29 276
Nenue@7 277 function WorldPlanPOIMixin:SetAchievementProgressTooltip()
Nenue@7 278 print('cheevos')
Nenue@7 279 end
Nenue@7 280
Nenue@27 281 function WorldPlanPOIMixin:ShowNew()
Nenue@27 282 self:SetShown(true)
Nenue@27 283 self.isNew = nil
Nenue@30 284 self.hasUpdate = true
Nenue@27 285 self.FadeIn:Play()
Nenue@7 286 end
Nenue@7 287
Nenue@27 288 function WorldPlanPOIMixin:OnShow ()
Nenue@27 289 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating)
Nenue@27 290 -- pop this on principle
Nenue@27 291 if self.hasUpdate then
Nenue@27 292 self:Refresh()
Nenue@27 293 end
Nenue@27 294
Nenue@27 295 end
Nenue@27 296 function WorldPlanPOIMixin:OnHide()
Nenue@27 297 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
Nenue@27 298 end
Nenue@27 299
Nenue@27 300 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
Nenue@29 301 qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth)
Nenue@7 302 self:ClearAllPoints()
Nenue@29 303 local dX, dY = TQ_GetQuestLocation(self.questID)
Nenue@7 304 if not dX or dX == 0 then
Nenue@7 305 local _, x, y = QuestPOIGetIconInfo(self.questID)
Nenue@7 306 if x and floor(x) ~= 0 then
Nenue@7 307 dX, dY = x, y
Nenue@7 308 else
Nenue@7 309 dX, dY = self.x, self.y
Nenue@7 310 end
Nenue@7 311 end
Nenue@7 312 self.x = dX
Nenue@7 313 self.y = dY
Nenue@7 314
Nenue@29 315 --qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
Nenue@7 316
Nenue@7 317 local pX = (dX * mapWidth)
Nenue@7 318 local pY = (-dY * mapHeight)
Nenue@7 319
Nenue@7 320 self:SetParent(WorldMapPOIFrame)
Nenue@7 321 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
Nenue@7 322 end
Nenue@7 323
Nenue@7 324
Nenue@27 325 function WorldPlanPOIMixin:OnLoad()
Nenue@27 326 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
Nenue@7 327 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
Nenue@27 328 self.style = WorldPlan.db.defaultPinStyle
Nenue@27 329 self.subStyle = WorldPlan.db.defaultPinStyle.continent
Nenue@7 330 end
Nenue@7 331
Nenue@27 332 function WorldPlanPOIMixin:OnEvent(event, ...)
Nenue@7 333 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
Nenue@30 334 self.hasUpdate = true
Nenue@7 335 end
Nenue@7 336 end
Nenue@7 337
Nenue@7 338
Nenue@7 339 local PIN_UPDATE_DELAY = .016
Nenue@7 340 local TOP_PIN_ID
Nenue@27 341 function WorldPlanPOIMixin:OnUpdate (sinceLast)
Nenue@30 342
Nenue@30 343 if self.hasUpdate then
Nenue@30 344 wqprint('|cFFFFFF00push poi update')
Nenue@30 345 self:Refresh()
Nenue@30 346 return
Nenue@30 347 end
Nenue@7 348 -- control update check intervals
Nenue@7 349 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
Nenue@7 350 if self.throttle <= 0 then
Nenue@7 351 -- factor overtime into the throttle timer
Nenue@7 352 self.throttle = PIN_UPDATE_DELAY - self.throttle
Nenue@7 353 else
Nenue@7 354 return
Nenue@7 355 end
Nenue@7 356
Nenue@7 357 -- query for reward data if it wasn't found in the original scan
Nenue@7 358 local questID = self.questID
Nenue@7 359 if self.isPending then
Nenue@29 360 self:RefreshData()
Nenue@7 361 if not (self.PendingFade:IsPlaying() or self.isAnimating) then
Nenue@7 362 self.PendingFade:Play()
Nenue@7 363 end
Nenue@7 364 return
Nenue@7 365 else
Nenue@7 366 if self.PendingFade:IsPlaying() then
Nenue@7 367 self.PendingFade:Stop()
Nenue@7 368 end
Nenue@7 369 end
Nenue@7 370
Nenue@7 371
Nenue@7 372 -- update time elements
Nenue@7 373 local tl = self.timeThreschold
Nenue@7 374 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
Nenue@7 375 if timeLeft > 0 then
Nenue@29 376 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage)
Nenue@29 377 if tl ~= timeState then
Nenue@29 378 tl = timeState
Nenue@29 379 self.timeLabel:SetText(text)
Nenue@7 380 end
Nenue@7 381 else
Nenue@7 382 -- remove self in a timely manner
Nenue@9 383 if not TQ_IsActive(self.questID) then
Nenue@9 384 print('|cFFFF4400'..self:GetName()..' pin hard timeout')
Nenue@9 385 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
Nenue@9 386 self:Hide()
Nenue@9 387 end
Nenue@7 388 end
Nenue@7 389 end
Nenue@7 390 self.timeThreschold = tl
Nenue@7 391
Nenue@7 392 if self:IsMouseOver() then
Nenue@7 393 self.MouseGlow:Show()
Nenue@7 394 else
Nenue@7 395 self.MouseGlow:Hide()
Nenue@7 396 end
Nenue@8 397 end
Nenue@8 398
Nenue@8 399
Nenue@9 400
Nenue@27 401 function WorldPlanPOIMixin:Refresh ()
Nenue@9 402 local db = WorldPlan.db
Nenue@30 403 local print = wqprint
Nenue@30 404 print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
Nenue@9 405
Nenue@9 406
Nenue@9 407
Nenue@29 408 local questID = self:GetID()
Nenue@30 409 local style,subStyle = self:GetTypeInfo(self.rewardType)
Nenue@29 410 if self.filtered then
Nenue@29 411 subStyle = style.minimized
Nenue@29 412 end
Nenue@30 413 self.style = style
Nenue@30 414
Nenue@29 415
Nenue@9 416 local borderMask = style.mask
Nenue@9 417 local borderFill = style.texture
Nenue@9 418 local iconBorder = self.iconBorder
Nenue@9 419 local icon = self.icon
Nenue@9 420 local count = self.count
Nenue@9 421
Nenue@27 422 self.subStyle = subStyle
Nenue@27 423 self.hasNumeric = style.hasNumeric
Nenue@27 424 self.numberRGB = style.numberRGB
Nenue@27 425 self.showNumber = subStyle.showNumber
Nenue@9 426
Nenue@27 427
Nenue@9 428
Nenue@9 429 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
Nenue@9 430 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
Nenue@9 431 icon:SetAllPoints(self)
Nenue@9 432
Nenue@9 433 if self.itemName then
Nenue@27 434
Nenue@29 435
Nenue@27 436 if self.hasNumeric then
Nenue@30 437 if subStyle.numberFontObject then
Nenue@30 438 wqprint('change font', _G[subStyle.numberFontObject]:GetName())
Nenue@30 439 self.count:SetFontObject(_G[subStyle.numberFontObject])
Nenue@30 440 end
Nenue@30 441
Nenue@29 442 self.count:SetShown(true)
Nenue@29 443 self.count:SetText(self.itemNumber)
Nenue@29 444 self.count:SetTextColor(unpack(self.numberRGB))
Nenue@9 445 else
Nenue@29 446 self.count:SetShown(false)
Nenue@29 447 self.count:SetText(nil)
Nenue@9 448 end
Nenue@27 449
Nenue@9 450 end
Nenue@9 451
Nenue@9 452 SetMaskedTexture(iconBorder, borderFill, borderMask)
Nenue@30 453 local border = self:GetTypeInfo(self.rewardType)
Nenue@9 454 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
Nenue@9 455 iconBorder:SetDesaturated(true)
Nenue@9 456
Nenue@9 457 local trackingBorder = self.supertrackBorder
Nenue@9 458
Nenue@9 459 self.highlight:SetMask(nil)
Nenue@9 460 if questID == GetSuperTrackedQuestID() then
Nenue@9 461 trackingBorder:SetVertexColor(0,0,0,1)
Nenue@9 462 else
Nenue@9 463 trackingBorder:SetVertexColor(0,0,0,0.5)
Nenue@9 464 end
Nenue@9 465 self.highlight:SetAllPoints(trackingBorder)
Nenue@9 466
Nenue@9 467 SetMaskedTexture(trackingBorder, borderFill, borderMask)
Nenue@9 468 self.highlight:SetMask(borderMask)
Nenue@9 469
Nenue@9 470 local qType = self.worldQuestType
Nenue@9 471 self.tagIcon:SetAtlas(self.tagAtlas)
Nenue@9 472 self.tagIcon:SetTexCoord(0,1,0,1)
Nenue@9 473
Nenue@9 474
Nenue@9 475 if self.isElite then
Nenue@29 476 self.EliteBorder:Show()
Nenue@9 477 else
Nenue@29 478 self.EliteBorder:Hide()
Nenue@9 479 end
Nenue@30 480 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
Nenue@30 481 --print(' - subStyle:', (self.filtered == true), self.subStyle)
Nenue@9 482
Nenue@9 483
Nenue@9 484 self:UpdateSize()
Nenue@27 485 self.hasUpdate = nil
Nenue@9 486 end
Nenue@9 487
Nenue@8 488 function WorldPlanFilterPinMixin:OnEnter ()
Nenue@8 489 local filter = WorldPlan.FilterOptions[self:GetID()]
Nenue@8 490 local mapID = GetCurrentMapAreaID()
Nenue@8 491 local quests = (mapID == WorldPlan.BrokenIsleID) and WorldPlan.QuestsByID or WorldPlan.QuestsByZone[mapID]
Nenue@8 492 if quests then
Nenue@8 493 GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
Nenue@8 494 GameTooltip:AddLine(filter.label)
Nenue@8 495 local filterKey = self.filterKey
Nenue@8 496 local filterValue = self.filterValue
Nenue@8 497 if filterKey then
Nenue@8 498 for questID, pin in pairs(quests) do
Nenue@8 499 if pin.used and not pin.filtered then
Nenue@8 500 if pin[filterKey] == filterValue then
Nenue@8 501 local style = pin.style or WorldPlan.FilterStyle
Nenue@8 502
Nenue@8 503 if familiars[questID] then
Nenue@8 504 GameTooltip:AddLine(pin.title,0,1,0)
Nenue@8 505 else
Nenue@8 506 GameTooltip:AddLine(pin.title,1,1,1)
Nenue@8 507 end
Nenue@8 508
Nenue@8 509 end
Nenue@8 510 end
Nenue@8 511 end
Nenue@8 512 else
Nenue@8 513 GameTooltip:AddLine('Reset all filters')
Nenue@8 514 end
Nenue@8 515 GameTooltip:Show()
Nenue@8 516 end
Nenue@7 517 end