comparison 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
comparison
equal deleted inserted replaced
29:c1612c2c1840 30:8cb750e79952
11 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData 11 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
12 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame 12 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame
13 13
14 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end 14 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
15 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end 15 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
16 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuest', ...) end or function() end 16 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
17 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end 17 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
18 local QuestPOI = WorldPlanPOIMixin 18 local QuestPOI = WorldPlanPOIMixin
19 19
20 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" 20 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
21 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" 21 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
170 function WorldPlanPOIMixin:RefreshData (info) 170 function WorldPlanPOIMixin:RefreshData (info)
171 171
172 qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r') 172 qprint('|cFF00FF88'..self:GetName()..':RefreshData()|r')
173 173
174 if info then 174 if info then
175
176 self.x = info.x or self.x
177 self.y = info.y or self.y
178 self.inProgress = info.inProgress 175 self.inProgress = info.inProgress
179 self.floor = info.floor 176 self.floor = info.floor
180 self.numObjectives = info.numObjectives or 0 177 self.numObjectives = info.numObjectives or 0
181 print('|cFFFF4400subbing in new info', info.x, info.y, self.x, self.y) 178 if info.x and info.y then
179 self.x = info.x or self.x
180 self.y = info.y or self.y
181 qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y)
182 end
183
184 self.passesBlizzFilters = WorldMap_DoesWorldQuestInfoPassFilters(info)
182 end 185 end
183 186
184 187
185 local questID = self:GetID() 188 local questID = self:GetID()
186 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ 189 local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _
187 local hasUpdate, isPending = self.isNew, false 190 local hasUpdate, isPending = self.hasUpdate, self.isPending
188 191
189 192
190 if not HaveQuestData(questID) then 193 if not HaveQuestData(questID) then
191 TQ_RequestPreloadRewardData(questID) 194 TQ_RequestPreloadRewardData(questID)
192 isPending = true 195 isPending = true
205 elseif money >= 1 then 208 elseif money >= 1 then
206 rewardIcon = ICON_MONEY 209 rewardIcon = ICON_MONEY
207 rewardName = GetMoneyString(money) 210 rewardName = GetMoneyString(money)
208 rewardType = REWARD_CASH 211 rewardType = REWARD_CASH
209 end 212 end
210 rewardStyle = WorldPlan:GetTypeInfo(rewardType) 213 rewardStyle = self:GetTypeInfo(rewardType)
211 214
212 self.itemNumber = rewardCount or self.itemNumber 215 self.itemNumber = rewardCount or self.itemNumber
213 self.rewardType = rewardType or REWARD_ITEM 216 self.rewardType = rewardType or REWARD_ITEM
214 self.style = rewardStyle 217 self.style = rewardStyle
215 218
262 self.hasUpdate = hasUpdate 265 self.hasUpdate = hasUpdate
263 self.isPending = isPending 266 self.isPending = isPending
264 267
265 268
266 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending) 269 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending)
267 qprint(' ', self.title, self.itemTexture, 'rewardType:', self.rewardType, 'tag:', self.tagID, 'style', self.style ) 270 qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID)
271 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
268 end 272 end
269 return hasUpdate, isPending 273 return hasUpdate, isPending
270 end 274 end
271 275
272 276
275 end 279 end
276 280
277 function WorldPlanPOIMixin:ShowNew() 281 function WorldPlanPOIMixin:ShowNew()
278 self:SetShown(true) 282 self:SetShown(true)
279 self.isNew = nil 283 self.isNew = nil
284 self.hasUpdate = true
280 self.FadeIn:Play() 285 self.FadeIn:Play()
281 end 286 end
282 287
283 function WorldPlanPOIMixin:OnShow () 288 function WorldPlanPOIMixin:OnShow ()
284 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating) 289 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating)
285 qprint(debugstack())
286 -- pop this on principle 290 -- pop this on principle
287 if self.hasUpdate then 291 if self.hasUpdate then
288
289 self:Refresh() 292 self:Refresh()
290 end 293 end
291 294
292 end 295 end
293 function WorldPlanPOIMixin:OnHide() 296 function WorldPlanPOIMixin:OnHide()
326 self.subStyle = WorldPlan.db.defaultPinStyle.continent 329 self.subStyle = WorldPlan.db.defaultPinStyle.continent
327 end 330 end
328 331
329 function WorldPlanPOIMixin:OnEvent(event, ...) 332 function WorldPlanPOIMixin:OnEvent(event, ...)
330 if event == 'SUPER_TRACKED_QUEST_CHANGED' then 333 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
331 if self:IsVisible() then 334 self.hasUpdate = true
332 self:Refresh()
333 end
334 end 335 end
335 end 336 end
336 337
337 338
338 local PIN_UPDATE_DELAY = .016 339 local PIN_UPDATE_DELAY = .016
339 local TOP_PIN_ID 340 local TOP_PIN_ID
340 function WorldPlanPOIMixin:OnUpdate (sinceLast) 341 function WorldPlanPOIMixin:OnUpdate (sinceLast)
342
343 if self.hasUpdate then
344 wqprint('|cFFFFFF00push poi update')
345 self:Refresh()
346 return
347 end
341 -- control update check intervals 348 -- control update check intervals
342 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast 349 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
343 if self.throttle <= 0 then 350 if self.throttle <= 0 then
344 -- factor overtime into the throttle timer 351 -- factor overtime into the throttle timer
345 self.throttle = PIN_UPDATE_DELAY - self.throttle 352 self.throttle = PIN_UPDATE_DELAY - self.throttle
359 if self.PendingFade:IsPlaying() then 366 if self.PendingFade:IsPlaying() then
360 self.PendingFade:Stop() 367 self.PendingFade:Stop()
361 end 368 end
362 end 369 end
363 370
364 if self.hasUpdate then
365 self:Refresh()
366 self.hasUpdate = nil
367 end
368 371
369 -- update time elements 372 -- update time elements
370 local tl = self.timeThreschold 373 local tl = self.timeThreschold
371 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID) 374 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
372 if timeLeft > 0 then 375 if timeLeft > 0 then
395 398
396 399
397 400
398 function WorldPlanPOIMixin:Refresh () 401 function WorldPlanPOIMixin:Refresh ()
399 local db = WorldPlan.db 402 local db = WorldPlan.db
400 local print = qprint 403 local print = wqprint
401 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) 404 print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
402 print(self.style)
403 405
404 406
405 407
406 local questID = self:GetID() 408 local questID = self:GetID()
407 local style,subStyle = WorldPlan:GetTypeInfo(self.rewardType or ((self.quality or 0) + 127)) 409 local style,subStyle = self:GetTypeInfo(self.rewardType)
408 if self.filtered then 410 if self.filtered then
409 subStyle = style.minimized 411 subStyle = style.minimized
410 end 412 end
413 self.style = style
414
411 415
412 local borderMask = style.mask 416 local borderMask = style.mask
413 local borderFill = style.texture 417 local borderFill = style.texture
414 local iconBorder = self.iconBorder 418 local iconBorder = self.iconBorder
415 local icon = self.icon 419 local icon = self.icon
419 self.hasNumeric = style.hasNumeric 423 self.hasNumeric = style.hasNumeric
420 self.numberRGB = style.numberRGB 424 self.numberRGB = style.numberRGB
421 self.showNumber = subStyle.showNumber 425 self.showNumber = subStyle.showNumber
422 426
423 427
424 print(' - subStyle:', (self.filtered == true), self.subStyle)
425 428
426 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) 429 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
427 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) 430 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
428 icon:SetAllPoints(self) 431 icon:SetAllPoints(self)
429 432
430 if self.itemName then 433 if self.itemName then
431 local color = self.rewardColor or COMMON_COLOR
432
433 434
434 435
435 if self.hasNumeric then 436 if self.hasNumeric then
437 if subStyle.numberFontObject then
438 wqprint('change font', _G[subStyle.numberFontObject]:GetName())
439 self.count:SetFontObject(_G[subStyle.numberFontObject])
440 end
441
436 self.count:SetShown(true) 442 self.count:SetShown(true)
437 self.count:SetText(self.itemNumber) 443 self.count:SetText(self.itemNumber)
438 self.count:SetTextColor(unpack(self.numberRGB)) 444 self.count:SetTextColor(unpack(self.numberRGB))
439 else 445 else
440 self.count:SetShown(false) 446 self.count:SetShown(false)
442 end 448 end
443 449
444 end 450 end
445 451
446 SetMaskedTexture(iconBorder, borderFill, borderMask) 452 SetMaskedTexture(iconBorder, borderFill, borderMask)
447 local border = WorldPlan:GetTypeInfo(self.rewardType) 453 local border = self:GetTypeInfo(self.rewardType)
448 print(self.rewardType, print)
449 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) 454 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
450 iconBorder:SetDesaturated(true) 455 iconBorder:SetDesaturated(true)
451 456
452 local trackingBorder = self.supertrackBorder 457 local trackingBorder = self.supertrackBorder
453 458
470 if self.isElite then 475 if self.isElite then
471 self.EliteBorder:Show() 476 self.EliteBorder:Show()
472 else 477 else
473 self.EliteBorder:Hide() 478 self.EliteBorder:Hide()
474 end 479 end
475 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') 480 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
481 --print(' - subStyle:', (self.filtered == true), self.subStyle)
476 482
477 483
478 self:UpdateSize() 484 self:UpdateSize()
479 self.hasUpdate = nil 485 self.hasUpdate = nil
480 end 486 end