comparison QuestPOI.lua @ 36:21bcff08b0f4

WorldPlan: - Quest pins are now placed on the flight map. Their visibility rules will mirror the filter options from the world map. - Filter controls polish: - First click negates other reward type filters. Subsequent clicks will then toggle individual reward types until the filters are reset via Right-click. - Adheres to the Blizzard CVars added in patch 7.1 - Numerous optimizations to how data and visual updates are handled; should see an even better load time, and snappier world map interaction. ClassPlan: - The 'Available Missions' list is now recorded. It can be reviewed by clicking on the mission list heading. - Information filtering by character and realm.
author Nenue
date Fri, 04 Nov 2016 01:40:39 -0400
parents 26dfa661daa7
children 78cf1f19856a
comparison
equal deleted inserted replaced
35:26dfa661daa7 36:21bcff08b0f4
51 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 51 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
52 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 52 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
53 53
54 local subStyles = { 54 local subStyles = {
55 continent = { 55 continent = {
56 PinSize = 14, 56 iconWidth = 14,
57 Border = 2, 57 borderWidth = 2,
58 TrackingBorder = 1, 58 highlightWidth = 1,
59 TagSize = 6, 59 TagSize = 6,
60 TimeleftStage = 0, 60 maxAlertLevel = 0,
61 showNumber = false, 61 showNumber = false,
62 numberFontObject = 'WorldPlanFont' 62 numberFontObject = 'WorldPlanFont'
63 }, 63 },
64 zone = { 64 zone = {
65 PinSize = 22, 65 iconWidth = 22,
66 Border = 3, 66 borderWidth = 3,
67 TrackingBorder = 2, 67 highlightWidth = 2,
68 TagSize = 12, 68 TagSize = 12,
69 TimeleftStage = 3, 69 maxAlertLevel = 3,
70 showNumber = true, 70 showNumber = true,
71 numberFontObject = 'WorldPlanNumberFontThin' 71 numberFontObject = 'WorldPlanNumberFontThin'
72 }, 72 },
73 minimized = { 73 minimized = {
74 PinSize = 4, 74 iconWidth = 4,
75 Border = 0, 75 borderWidth = 0,
76 TrackingBorder = 1, 76 highlightWidth = 1,
77 NoIcon = true, 77 NoIcon = true,
78 TimeleftStage = 1, 78 maxAlertLevel = 1,
79 showNumber = false, 79 showNumber = false,
80 } 80 }
81 } 81 }
82 82
83 -- Pin color/display variables 83 -- Pin color/display variables
165 end 165 end
166 return 128, icon, quantity, name, itemID, quality 166 return 128, icon, quantity, name, itemID, quality
167 end 167 end
168 168
169 function WorldPlanPOIMixin:OnEnter() 169 function WorldPlanPOIMixin:OnEnter()
170 WorldMap_HijackTooltip(self) 170 if not WorldMapFrame:IsVisible() then
171 WorldMap_HijackTooltip(self)
172 end
173
171 local completed = select(4,GetAchievementInfo(familiars_id)) 174 local completed = select(4,GetAchievementInfo(familiars_id))
172 if not completed then 175 if not completed then
173 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then 176 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
174 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') 177 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
175 WorldMapTooltip:AddLine(self.title, 1, 1, 1) 178 WorldMapTooltip:AddLine(self.title, 1, 1, 1)
365 self.FadeIn:Play() 368 self.FadeIn:Play()
366 end 369 end
367 end 370 end
368 371
369 function WorldPlanPOIMixin:OnShow () 372 function WorldPlanPOIMixin:OnShow ()
370 qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
371 -- pop this on principle 373 -- pop this on principle
372 374
373 if self.isNew or self.isStale then 375 if self.isNew or self.isStale then
374 self:Refresh() 376 self:Refresh()
375 end 377 end
376 378
377 379
378 -- is it a new quest? 380 -- is it a new quest?
379 if self.isNew then 381 if self.isNew then
380 print('|cFFFFFF00popping new pin handler') 382 qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating)
383 --qprint('|cFFFFFF00popping new pin handler')
381 self:OnNew() 384 self:OnNew()
382 elseif not self.isAnimating then 385 elseif not self.isAnimating then
383 self:SetAlpha(1) 386 self:SetAlpha(1)
384 end 387 end
385 388
389 self.Overlay:SetShown(true)
386 --WorldPlan:print(self:GetAlpha()) 390 --WorldPlan:print(self:GetAlpha())
387 391
388 end 392 end
389 function WorldPlanPOIMixin:OnHide() 393 function WorldPlanPOIMixin:OnHide()
390 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') 394 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
391 if not self:IsShown() then 395 if not self:IsShown() then
392 self.isAnimating = nil 396 self.isAnimating = nil
393 self:SetAlpha(1) 397 self:SetAlpha(1)
394 end 398 end
395 399
400 self.Overlay:SetShown(false)
396 end 401 end
397 402
398 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) 403 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
399 --qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth) 404 --qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID, mapWidth)
400 self:ClearAllPoints() 405 self:ClearAllPoints()
421 426
422 427
423 function WorldPlanPOIMixin:OnLoad() 428 function WorldPlanPOIMixin:OnLoad()
424 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db) 429 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
425 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') 430 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
426 self.style = WorldPlan.db.defaultPinStyle 431
427 self.subStyle = WorldPlan.db.defaultPinStyle.continent 432 self.count = self.Overlay.count
433 self.timeLabel = self.Overlay.timeLabel
428 end 434 end
429 435
430 function WorldPlanPOIMixin:OnEvent(event, ...) 436 function WorldPlanPOIMixin:OnEvent(event, ...)
431 if event == 'SUPER_TRACKED_QUEST_CHANGED' then 437 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
432 self.isStale = true 438 self.isStale = true
448 self.throttle = PIN_UPDATE_DELAY - self.throttle 454 self.throttle = PIN_UPDATE_DELAY - self.throttle
449 else 455 else
450 return 456 return
451 end 457 end
452 if self.isStale and not self.isAnimating then 458 if self.isStale and not self.isAnimating then
453 print('|cFFFFFF00push poi update') 459 wprint('|cFFFFFF00push poi update')
454 self:Refresh() 460 self:Refresh()
455 return 461 return
456 end 462 end
457 463
458 -- query for reward data if it wasn't found in the original scan 464 -- query for reward data if it wasn't found in the original scan
469 end 475 end
470 end 476 end
471 477
472 478
473 -- update time elements 479 -- update time elements
474 local tl = self.timeThreschold 480 local tl = self.alertLevel
475 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID) 481 local timeLeft = TQ_GetQuestTimeLeftMinutes(questID)
476 if timeLeft > 0 then 482 if timeLeft > 0 then
477 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage) 483 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel)
478 if tl ~= timeState then 484 if tl ~= timeState then
479 tl = timeState 485 tl = timeState
480 self.timeLabel:SetText(text) 486 self.timeLabel:SetText(text)
481 end 487 end
482 else 488 else
486 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then 492 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
487 self:Hide() 493 self:Hide()
488 end 494 end
489 end 495 end
490 end 496 end
491 self.timeThreschold = tl 497 self.alertLevel = tl
492 498
493 if self:IsMouseOver() then 499 if self:IsMouseOver() then
494 self.MouseGlow:Show() 500 self.MouseGlow:Show()
495 else 501 else
496 self.MouseGlow:Hide() 502 self.MouseGlow:Hide()
504 print('|cFF00FF88'..self:GetName()..'|r:Refresh()') 510 print('|cFF00FF88'..self:GetName()..'|r:Refresh()')
505 511
506 512
507 513
508 local questID = self:GetID() 514 local questID = self:GetID()
509 local style,subStyle = WorldPlanQuests:GetTypeInfo(self.rewardType) 515 local iconBorder = self.RewardBorder
510 if self.filtered then 516 local trackingBorder = self.HighlightBorder
511 subStyle = style.minimized
512 end
513 self.style = style
514 self.subStyle = subStyle
515
516
517 local borderMask = style.mask
518 local borderFill = style.texture
519 local iconBorder = self.iconBorder
520 local icon = self.icon 517 local icon = self.icon
521 local count = self.count 518 local count = self.count
522 519
523 self.hasNumeric = style.hasNumeric
524 self.numberRGB = style.numberRGB
525 self.showNumber = subStyle.showNumber
526 520
527 521
528 522
529 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) 523 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
530 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) 524
531 icon:SetAllPoints(self) 525
532 526
533 if self.itemName then 527 if self.itemName then
534
535
536 if self.hasNumeric then
537 if subStyle.numberFontObject then
538 --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
539 self.count:SetFontObject(_G[subStyle.numberFontObject])
540 end
541 --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber) 528 --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber)
542 529
543 self.count:SetShown(self.showNumber)
544 self.count:SetText(self.itemNumber) 530 self.count:SetText(self.itemNumber)
545 self.count:SetTextColor(unpack(self.numberRGB)) 531 end
546 else 532 if self.itemTexture then
547 self.count:SetShown(false) 533 icon:SetTexture(self.itemTexture)
548 self.count:SetText(nil) 534 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background")
549 end 535 end
550 536
551 end
552
553 SetMaskedTexture(iconBorder, borderFill, borderMask)
554 local border = self:GetTypeInfo(self.rewardType) 537 local border = self:GetTypeInfo(self.rewardType)
555 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) 538 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
556 iconBorder:SetDesaturated(true) 539 iconBorder:SetDesaturated(true)
557 540
558 local trackingBorder = self.supertrackBorder 541
559
560 self.highlight:SetMask(nil)
561 if questID == GetSuperTrackedQuestID() then 542 if questID == GetSuperTrackedQuestID() then
562 trackingBorder:SetVertexColor(0,0,0,1) 543 trackingBorder:SetVertexColor(0,0,0,1)
563 else 544 else
564 trackingBorder:SetVertexColor(0,0,0,0.5) 545 trackingBorder:SetVertexColor(0,0,0,0.5)
565 end 546 end
566 self.highlight:SetAllPoints(trackingBorder) 547
567
568 SetMaskedTexture(trackingBorder, borderFill, borderMask)
569 self.highlight:SetMask(borderMask)
570
571 local qType = self.worldQuestType
572 self.tagIcon:SetAtlas(self.tagAtlas) 548 self.tagIcon:SetAtlas(self.tagAtlas)
573 self.tagIcon:SetTexCoord(0,1,0,1) 549 self.tagIcon:SetTexCoord(0,1,0,1)
574 550 self.EliteBorder:SetShown(self.isElite and not self.filtered)
575
576 if self.isElite then
577 self.EliteBorder:Show()
578 else
579 self.EliteBorder:Hide()
580 end
581 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') 551 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
582 --print(' - subStyle:', (self.filtered == true), self.subStyle) 552 --print(' - subStyle:', (self.filtered == true), self.subStyle)
553
554 self.Overlay:SetShown(self:IsShown())
555 self.Overlay:SetParent(self:GetParent())
556 self.Overlay:SetFrameLevel(self:GetFrameLevel()+200)
557 self.Overlay:SetAllPoints(self)
583 558
584 559
585 self:UpdateSize() 560 self:UpdateSize()
586 561
587 self.isStale = nil 562 self.isStale = nil
596 [REWARD_GEAR] = 'worldQuestFilterEquipment', 571 [REWARD_GEAR] = 'worldQuestFilterEquipment',
597 } 572 }
598 573
599 574
600 function QuestPOI:IsShowable () 575 function QuestPOI:IsShowable ()
601 local print = wqprint 576 local print = qprint
602 local db = WorldPlan.db 577 local db = WorldPlan.db
603 local qType = self.worldQuestType 578 local qType = self.worldQuestType
604 local rType = self.rewardType 579 local rType = self.rewardType
605 self.filtered = nil 580 self.filtered = nil
606 self.used = true 581 self.used = true
607 582
583 for filterKey, value in pairs(WorldPlan.UsedFilters) do
584 print('|cFFFF4400', filterKey, self[filterKey])
585 if self[filterKey] ~= value then
586 self.filtered = true
587 end
588 end
608 589
609 self.questId = self:GetID() 590 self.questId = self:GetID()
610 if self.rewardType then 591 if self.rewardType then
611 if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then 592 if cvar_check[self.rewardType] then
612 self.filtered = true 593 if self.rewardType == REWARD_CASH then
613 end 594 print('##', cvar_check[self.rewardType], GetCVarBool(cvar_check[self.rewardType]))
614 else 595 end
615 for filterKey, value in pairs(WorldPlan.UsedFilters) do 596 if not GetCVarBool(cvar_check[self.rewardType]) then
616 if self[filterKey] ~= value then
617 self.filtered = true 597 self.filtered = true
598
618 end 599 end
600
619 end 601 end
620 end 602 end
621 603
622 if not TQ_IsActive(self.questID) then 604 if not TQ_IsActive(self.questID) then
623 self.used = nil 605 self.used = nil
624 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then 606 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
625 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then 607 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
626 self.used = nil 608 self.used = nil
627 end 609 end
628 end 610 end
629 print(' |cFFFF4400IsShowable()|r', self.isNew, self.isAnimating, self.used, self.filtered, self.title) 611 print(' |cFF'.. (((self.rewardType == REWARD_CASH) and 'FFFF00') or '0088FF') ..'IsShowable()|r ', cvar_check[self.rewardType], 'used:', self.used, 'filtered:', self.filtered, self.title)
630 return self.used, self.filtered 612 return self.used, self.filtered
631 end 613 end
632 614
633 function QuestPOI:UpdateTimer (timeLeft, timeType) 615 function QuestPOI:UpdateTimer (timeLeft, timeType)
634 print('|cFF0088FFUpdatePinTimer()|r') 616 print('|cFF0088FFUpdatePinTimer()|r')
635 end 617 end
636 618
637 --- Fixes icons upon size update 619 --- Fixes icons upon size update
638 function QuestPOI:UpdateSize (style, subStyle) 620 function QuestPOI:UpdateSize ()
639 style = style or self.style 621
640 subStyle = subStyle or self.subStyle 622 local style,subStyle = self:GetTypeInfo(self.rewardType)
641 623 if self.filtered then
624 subStyle = style.minimized
625 end
642 --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle) 626 --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle)
643 627
644 self.currentWidth = subStyle.PinSize
645 self.borderSize = subStyle.Border
646 self.trackingBorderSize = subStyle.TrackingBorder
647 self.tagSize = subStyle.TagSize
648 self.TimeleftStage = subStyle.TimeleftStage
649 self.NoIcon = subStyle.NoIcon
650
651
652 self:SetSize(self.currentWidth, self.currentWidth)
653
654 local icon = self.icon 628 local icon = self.icon
655 local iconBorder = self.iconBorder 629 local iconBorder = self.RewardBorder
656 local trackingBorder = self.supertrackBorder 630 local trackingBorder = self.HighlightBorder
657 local tag = self.tagIcon 631 local tag = self.tagIcon
658 local pinMask = style.pinMask 632
659 local rewardMask = style.rewardMask 633 local iconWidth = subStyle.iconWidth
660 634 local borderWidth = iconWidth + (subStyle.borderWidth * 2)
661 if self.NoIcon then 635 local highlightWidth = borderWidth + (subStyle.highlightWidth * 2)
662 self.icon:Hide() 636
663 else 637 local iconTexture = self.itemTexture
664 self.icon:Show() 638
665 icon:SetMask(nil) 639 self:SetSize(iconWidth, iconWidth)
666 icon:SetMask(rewardMask) 640 icon:SetSize(iconWidth, iconWidth)
667 icon:SetTexture(self.icon:GetTexture()) 641 iconBorder:SetSize(borderWidth, borderWidth)
668 end 642 trackingBorder:SetSize(highlightWidth, highlightWidth)
669 iconBorder:SetMask(nil) 643
670 trackingBorder:SetMask(nil) 644
671 645 iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
672 646 trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
673 local borderWidth = self.borderSize 647
674 local trackingWidth = self.trackingBorderSize 648
675 649 if style.hasNumeric then
676 iconBorder:ClearAllPoints() 650 self.count:SetTextColor(unpack(style.numberRGB))
677 iconBorder:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', -borderWidth + (style.x or 0), -borderWidth + (style.y or 0)) 651 if subStyle.numberFontObject then
678 iconBorder:SetPoint('TOPRIGHT', self, 'TOPRIGHT', borderWidth + (style.x or 0), borderWidth + (style.y or 0)) 652 --wqprint('change font', _G[subStyle.numberFontObject]:GetName())
679 653 self.count:SetFontObject(_G[subStyle.numberFontObject])
680 trackingBorder:ClearAllPoints() 654 end
681 trackingBorder:SetPoint('BOTTOMLEFT', iconBorder, 'BOTTOMLEFT', -trackingWidth, -trackingWidth) 655 end
682 trackingBorder:SetPoint('TOPRIGHT', iconBorder, 'TOPRIGHT', trackingWidth, trackingWidth) 656
683 657 self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric)
658
659 --[[
684 if self.tagSize then 660 if self.tagSize then
685 tag:Show() 661 tag:Show()
686 tag:ClearAllPoints() 662 tag:ClearAllPoints()
687 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth) 663 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth)
688 else 664 else
689 tag:Hide() 665 tag:Hide()
690 end 666 end
691 667
692 qprint('using mask:', pinMask, self.name ) 668 if self.NoIcon then
693 iconBorder:SetMask(pinMask) 669 self.icon:Hide()
694 trackingBorder:SetMask(pinMask) 670 else
671 self.icon:Show()
672 if style.rewardMask then
673 icon:SetMask(rewardMask)
674 else
675 icon:SetMask(iconTexture)
676 end
677 if style.pinMask then
678 iconBorder:Show()
679 trackingBorder:Show()
680 iconBorder:SetMask(pinMask)
681 trackingBorder:SetMask(pinMask)
682 else
683 iconBorder:Hide()
684 trackingBorder:Hide()
685 end
686 end
687
688
689 icon:SetTexture(iconTexture)
695 iconBorder:SetTexture(iconBorder:GetTexture()) 690 iconBorder:SetTexture(iconBorder:GetTexture())
696 trackingBorder:SetTexture(trackingBorder:GetTexture()) 691 trackingBorder:SetTexture(trackingBorder:GetTexture())
697 end 692 --]]
693 self.currentWidth = subStyle.iconWidth
694 self.borderWidth = subStyle.borderWidth
695 self.highlightWidth = subStyle.highlightWidth
696 self.tagSize = subStyle.TagSize
697 self.maxAlertLevel = subStyle.maxAlertLevel
698 self.NoIcon = subStyle.NoIcon
699 self.style = style
700 self.subStyle = subStyle
701 if self.rewardType == REWARD_CASH then
702 qprint('using mask:', pinMask or iconTexture, rewardMask or iconTexture, self.used, self.filtered)
703 end
704
705 end