comparison 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
comparison
equal deleted inserted replaced
65:02f1d3bce558 66:e43e10c5576b
69 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 69 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
70 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 70 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
71 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 71 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
72 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 72 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
73 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL 73 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
74
75 local DEFAULT_STYLE = {
76 border = {1,1,1},
77 x = 0, y = 0,
78 desaturated = true,
79 iconMask = "Interface\\Minimap\\UI-Minimap-Background",
80 borderMask = "Interface\\Minimap\\UI-Minimap-Background",
81 rewardMark = "Interface\\Minimap\\UI-Minimap-Background",
82 scaleFactors = {0.25, 0.7, 1},
83 iconWidth = 18,
84 borderWidth = 2,
85 highlightWidth = 2,
86 TagSize = 8,
87 maxAlertLevel = 0,
88 numberFontObject = 'WorldPlanFont'
89 }
90 local MINIMIZED_STYLE = {
91 hideNumber = true,
92 hideIcon = true,
93 }
94 local REWARD_TYPE_STYLES = {
95 [REWARD_CASH] = {
96 border = {1,1,0},
97 hideNumber = true,
98 },
99 [REWARD_ARTIFACT_POWER] = {},
100 [REWARD_GEAR] = {
101
102 hideNumber = true,
103 },
104 [REWARD_CURRENCY] = {},
105 [REWARD_REAGENT] = {
106
107 hideNumber = true,
108 },
109 }
74 110
75 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 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
76 112
77 113
78 local STYLE_TYPE_PENDING = 768 114 local STYLE_TYPE_PENDING = 768
548 self:SetAlpha(db.PinAlpha) 584 self:SetAlpha(db.PinAlpha)
549 self.isAnimating = nil 585 self.isAnimating = nil
550 end 586 end
551 587
552 -- Places the pin and triggers display 588 -- Places the pin and triggers display
553 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) 589 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor)
554 wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, self.filtered, self.used) 590 wqprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
555 if not self.used then 591 if not self.used then
556 self:HideFrames() 592 self:HideFrames()
557 return 593 return
558 end 594 end
559 595
560 596 self:SetScale(scaleFactor)
561 self:SetParent(owner) 597 self:SetParent(owner)
562 self:ClearAllPoints() 598 self:ClearAllPoints()
563 self:SetFrameLevel(pinBaseIndex + self:GetID()) 599 self:SetFrameLevel(pinBaseIndex + self:GetID())
564 self.Overlay:SetParent(owner) 600 self.Overlay:SetParent(owner)
601 self.Overlay:SetScale(scaleFactor)
565 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) 602 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
566 if (dX and dY) then 603 if (dX and dY) then
567 if not (mapHeight and mapWidth) then 604 if not (mapHeight and mapWidth) then
568 mapWidth, mapHeight = owner:GetSize() 605 mapWidth, mapHeight = owner:GetSize()
569 end 606 end
570 if (self.x ~= dY) or (self.y ~= dY) then 607 if (self.x ~= dY) or (self.y ~= dY) or (self.scaleFactor ~= scaleFactor) then
571 self.x = dX 608 self.x = dX
572 self.y = dY 609 self.y = dY
573 local pX = (dX * mapWidth) 610 self.scaleFactor = scaleFactor
574 local pY = (-dY * mapHeight) 611 local pX = (dX * mapWidth) * (1 / scaleFactor)
612 local pY = (-dY * mapHeight) * (1 / scaleFactor)
575 self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY) 613 self:SetPoint('CENTER', owner, 'TOPLEFT', pX, pY)
576 end 614 end
577 else 615 else
578 if self.x or self.y then 616 if self.x or self.y then
579 self.x = nil 617 self.x = nil
644 return 682 return
645 end 683 end
646 if self.isNew then 684 if self.isNew then
647 --print('|cFFFFFF00push new poi stuff') 685 --print('|cFFFFFF00push new poi stuff')
648 self:OnNew() 686 self:OnNew()
649 elseif (self.isStale or (not self.title)) and not self.isAnimating then 687 elseif self.isStale then
650 --wprint('|cFFFFFF00push poi update') 688 --wprint('|cFFFFFF00push poi update')
651 self:Refresh() 689 self:Refresh()
652 return 690 return
653 end 691 end
654 692
657 if not self.dataLoaded then 695 if not self.dataLoaded then
658 --print('|cFFFF4400'..self:GetID()..':|r polling reward info') 696 --print('|cFFFF4400'..self:GetID()..':|r polling reward info')
659 if not (self.isAnimating) then 697 if not (self.isAnimating) then
660 self.PendingFade:Play() 698 self.PendingFade:Play()
661 end 699 end
662 self:GetData() 700 local dataLoaded = self:GetData()
701 if dataLoaded then
702 WorldPlanQuests.isZoomDirty = true
703 end
663 return 704 return
664 else 705 else
665 if self.PendingFade:IsPlaying() then 706 if self.PendingFade:IsPlaying() then
666 self.PendingFade:Stop() 707 self.PendingFade:Stop()
667 end 708 end
706 self:HideFrames() 747 self:HideFrames()
707 end 748 end
708 end 749 end
709 end 750 end
710 751
752
711 function QuestPOI:Refresh () 753 function QuestPOI:Refresh ()
712 754
713 rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) 755 rprint('|cFF00FF88'..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title)
714 756
715 757 local style = DEFAULT_STYLE
716 758 if self.dataLoaded and not self.filtered then
717 local styleType = (self.dataLoaded and self.rewardType) or STYLE_TYPE_PENDING 759 style = REWARD_TYPE_STYLES[self.rewardType]
718 local style,subStyle = self:GetTypeInfo(self.rewardType) 760 else
719 if (self.filtered or (not self.dataLoaded)) and (self.questID ~= GetSuperTrackedQuestID()) then 761 style = MINIMIZED_STYLE
720 subStyle = style.minimized 762 end
721 end 763
722 self.style = style 764 local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth
723 self.subStyle = subStyle 765
724 --print(style, subStyle) 766
725 self.currentWidth = subStyle.iconWidth 767
726 self.borderWidth = subStyle.borderWidth 768 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth
727 self.highlightWidth = subStyle.highlightWidth 769 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth
728 self.tagSize = subStyle.TagSize 770 local tagSize = style.TagSize or DEFAULT_STYLE.TagSize
729 self.maxAlertLevel = subStyle.maxAlertLevel 771 local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon
730 self.NoIcon = subStyle.NoIcon 772 local borderColor = style.border or DEFAULT_STYLE.border
731
732 local questID = self.questID 773 local questID = self.questID
733 local iconBorder = self.RewardBorder 774 local iconBorder = self.RewardBorder
734 local trackingBorder = self.HighlightBorder 775 local trackingBorder = self.HighlightBorder
735 local icon = self.icon 776 local icon = self.icon
736 local count = self.count 777 local count = self.count
778 local hideNumbers = style.hideNumber or DEFAULT_STYLE.hideNumber
779
780 local tagIcon = self.tagIcon
781 self.maxAlertLevel = style.maxAlertLevel or DEFAULT_STYLE.maxAlertLevel
782
783
737 self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) 784 self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID)
738 785
739 if self.itemName then 786 if self.itemName then
740 787
741 if self.itemNumber then 788 if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then
742 local numberString = self.itemNumber 789 local numberString = self.itemNumber
743 if self.itemNumber >= 1000000 then 790 if self.itemNumber >= 1000000 then
744 numberString = (floor(self.itemNumber/100000)/10) .. 'M' 791 numberString = (floor(self.itemNumber/100000)/10) .. 'M'
745 elseif self.itemNumber >= 10000 then 792 elseif self.itemNumber >= 10000 then
746 numberString = floor(self.itemNumber/1000) .. 'k' 793 numberString = floor(self.itemNumber/1000) .. 'k'
752 numberString = numberString .. '.' .. tostring(floor(decimal/100)) 799 numberString = numberString .. '.' .. tostring(floor(decimal/100))
753 end 800 end
754 numberString = numberString .. 'k' 801 numberString = numberString .. 'k'
755 end 802 end
756 self.count:SetText(numberString) 803 self.count:SetText(numberString)
804 self.count:Show()
757 else 805 else
758 self.count:SetText(nil) 806 self.count:SetText(nil)
759 end 807 self.count:Hide()
808 end
809 else
810 self.count:Hide()
760 end 811 end
761 812
762 if db.Config.ShowVerboseInfo then 813 if db.Config.ShowVerboseInfo then
763 self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5)) 814 self.Description:SetText(self.title .. "\n" .. floor(self.x*100+.5) .. "," .. floor(self.y*100+.5))
764 end 815 end
765 816
766 817
767 icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") 818 icon:SetSize(currentWidth, currentWidth)
819 icon:SetMask(style.iconMask or DEFAULT_STYLE.iconMask)
768 if self.itemTexture then 820 if self.itemTexture then
769 --iconBorder:SetTexture(WORLD_QUEST_BORDER) 821 --iconBorder:SetTexture(WORLD_QUEST_BORDER)
770 822
771 if self.NoIcon then 823 if hideIcon then
772 icon:SetTexture(PENDING_ICON) 824 icon:SetTexture(PENDING_ICON)
773 icon:SetDesaturated(true) 825 icon:SetDesaturated(true)
774 icon:SetVertexColor(style.r, style.g, style.b) 826 icon:SetVertexColor(unpack(borderColor))
775 else 827 else
776
777 icon:SetTexture(self.itemTexture) 828 icon:SetTexture(self.itemTexture)
778 icon:SetDesaturated(false) 829 icon:SetDesaturated(false)
779 icon:SetVertexColor(1, 1, 1) 830 icon:SetVertexColor(1, 1, 1)
780 end 831 end
781 else 832 else
782 -- 833 --
783 icon:SetTexture(PENDING_ICON) 834 icon:SetTexture(PENDING_ICON)
784 icon:SetDesaturated(true) 835 icon:SetDesaturated(true)
785 icon:SetVertexColor(style.r, style.g, style.b) 836 icon:SetVertexColor(unpack(borderColor))
786 end 837 end
787 838 local borderMask = style.borderMask or DEFAULT_STYLE.borderMask
788 iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") 839 local borderSize = currentWidth + (borderWidth * 2)
840
841
842 iconBorder:SetSize(borderSize, borderSize)
843 iconBorder:SetMask(borderMask)
789 iconBorder:SetTexture(PENDING_BORDER) 844 iconBorder:SetTexture(PENDING_BORDER)
790 iconBorder:SetVertexColor(style.r, style.g, style.b, 1) 845 iconBorder:SetVertexColor(unpack(borderColor))
791
792 iconBorder:SetDesaturated(true) 846 iconBorder:SetDesaturated(true)
793 iconBorder:SetAlpha(subStyle.alpha or 1) 847
794 848 local highlightSize = borderSize + (highlightWidth * 2)
795 trackingBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") 849 trackingBorder:SetSize(highlightSize, highlightSize)
850 trackingBorder:SetMask(borderMask)
796 trackingBorder:SetTexture(PENDING_BORDER) 851 trackingBorder:SetTexture(PENDING_BORDER)
852
853 self:SetSize(borderSize, borderSize)
854
855
856
857 iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
858 trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0))
797 859
798 self.tagIcon:SetShown((not self.filtered) and true or false) 860 self.tagIcon:SetShown((not self.filtered) and true or false)
799 self.tagIcon:SetAtlas(self.tagAtlas) 861 self.tagIcon:SetAtlas(self.tagAtlas)
800
801 self.EliteBorder:SetShown(self.isElite and not self.filtered) 862 self.EliteBorder:SetShown(self.isElite and not self.filtered)
802 863
803 self:UpdateSize() 864 self:UpdateSize()
804 self:UpdateStatus() 865 self:UpdateStatus()
805 self.isStale = nil 866 self.isStale = nil
860 921
861 --- Fixes icons upon size update 922 --- Fixes icons upon size update
862 function QuestPOI:UpdateSize () 923 function QuestPOI:UpdateSize ()
863 924
864 --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle) 925 --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle)
865 926 return
927 --[[
866 local style = self.style 928 local style = self.style
867 local subStyle = self.subStyle 929 local subStyle = self.subStyle
868 local icon = self.icon 930 local icon = self.icon
869 local iconBorder = self.RewardBorder 931 local iconBorder = self.RewardBorder
870 local trackingBorder = self.HighlightBorder 932 local trackingBorder = self.HighlightBorder
907 self.count:SetFontObject(_G[subStyle.numberFontObject]) 969 self.count:SetFontObject(_G[subStyle.numberFontObject])
908 end 970 end
909 else 971 else
910 self.count:SetText(nil) 972 self.count:SetText(nil)
911 end 973 end
912 end 974 --]]
975 end