Mercurial > wow > worldplan
comparison QuestPOI.lua @ 103:8cdd62e7a224
- Solved the quest pins remaining visible issue
| author | Nenue |
|---|---|
| date | Sun, 28 May 2017 19:50:42 -0400 |
| parents | fbd4ead2a19f |
| children | 9f664a0ef8a8 |
comparison
equal
deleted
inserted
replaced
| 101:b68af1e44bdc | 103:8cdd62e7a224 |
|---|---|
| 38 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or nop | 38 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or nop |
| 39 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or nop | 39 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or nop |
| 40 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or nop | 40 local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or nop |
| 41 local QuestPOI = WorldPlanPOIMixin | 41 local QuestPOI = WorldPlanPOIMixin |
| 42 | 42 |
| 43 local pinBaseIndex = 1520 | 43 local pinBaseIndex = 1400 |
| 44 local overlayBaseIndex = 1580 | 44 local overlayBaseIndex = 1450 |
| 45 local previousHighlight | 45 local previousHighlight |
| 46 | 46 |
| 47 local FADE_TIMING_MULTIPLIER = 3 | 47 local FADE_TIMING_MULTIPLIER = 3 |
| 48 local DATA_DEBUG = false | 48 local DATA_DEBUG = false |
| 49 local PIN_REFRESH_DELAY = 1 | 49 local PIN_REFRESH_DELAY = 1 |
| 322 self:HideOrShowFrames(true) | 322 self:HideOrShowFrames(true) |
| 323 end | 323 end |
| 324 | 324 |
| 325 function QuestPOI:OnEvent(event, questID) | 325 function QuestPOI:OnEvent(event, questID) |
| 326 if (self.questID == questID) and IsQuestComplete(self.questID) then | 326 if (self.questID == questID) and IsQuestComplete(self.questID) then |
| 327 db.log(self.questID .. " Marked completed.") | 327 db.log(event .. ' for ' .. self:GetName().. ' triggered.') |
| 328 self:Release() | 328 self:Release() |
| 329 end | 329 end |
| 330 end | 330 end |
| 331 | 331 |
| 332 function QuestPOI:OnHide() | 332 function QuestPOI:OnHide() |
| 333 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()') | 333 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()') |
| 334 self:HideOrShowFrames(false) | 334 self:HideOrShowFrames(false) |
| 335 -- reset flags | 335 -- reset flags |
| 336 self:SetAlpha(db.PinAlpha) | 336 self:SetAlpha(db.PinAlpha) |
| 337 self.isAnimating = nil | 337 self.isAnimating = nil |
| 338 if db.Config.DebugEnabled then | 338 --if db.Config.DebugEnabled then |
| 339 db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') | 339 -- db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') |
| 340 end | 340 --end |
| 341 self.hideReason = nil | 341 self.hideReason = nil |
| 342 end | 342 end |
| 343 | 343 |
| 344 function QuestPOI:OnEnter() | 344 function QuestPOI:OnEnter() |
| 345 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then | 345 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then |
| 528 --print('|cFFFF4400OnUpdate(|r'..self:GetID()..'|cFFFF4400)|r poll failed') | 528 --print('|cFFFF4400OnUpdate(|r'..self:GetID()..'|cFFFF4400)|r poll failed') |
| 529 end | 529 end |
| 530 return | 530 return |
| 531 end | 531 end |
| 532 | 532 |
| 533 if self.maxAlertLevel then | |
| 534 self:UpdateStatus() | |
| 535 end | |
| 536 | |
| 537 | |
| 538 if self.isStale then | 533 if self.isStale then |
| 539 self:Refresh() | 534 self:Refresh() |
| 540 end | 535 elseif self.maxAlertLevel then |
| 541 | 536 self:UpdateStatus() |
| 537 end | |
| 542 end | 538 end |
| 543 | 539 |
| 544 | 540 |
| 545 function QuestPOI:StartFading() | 541 function QuestPOI:StartFading() |
| 546 if not self.toAlpha then | 542 if not self.toAlpha then |
| 741 | 737 |
| 742 else | 738 else |
| 743 return false | 739 return false |
| 744 end | 740 end |
| 745 end | 741 end |
| 746 | |
| 747 | |
| 748 | |
| 749 --[[ set reward category | |
| 750 local numRewards = GetNumQuestLogRewards(questID) | |
| 751 local numCurrency = GetNumQuestLogRewardCurrencies(questID) | |
| 752 local money = GetQuestLogRewardMoney(questID) | |
| 753 if numRewards >= 1 then | |
| 754 rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID) | |
| 755 elseif numCurrency >= 1 then | |
| 756 rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) | |
| 757 rewardType = REWARD_CURRENCY | |
| 758 elseif money >= 1 then | |
| 759 rewardName = GetMoneyString(money) | |
| 760 end | |
| 761 --]] | |
| 762 | |
| 763 end | 742 end |
| 764 end | 743 end |
| 765 | 744 |
| 766 | 745 |
| 767 function QuestPOI:UpdateArtifactPower(rewardLink) | 746 function QuestPOI:UpdateArtifactPower(rewardLink) |
| 802 self.hideReason = 'SetAnchor() on an unused frame.' | 781 self.hideReason = 'SetAnchor() on an unused frame.' |
| 803 self:HideOrShowFrames(false) | 782 self:HideOrShowFrames(false) |
| 804 return | 783 return |
| 805 end | 784 end |
| 806 | 785 |
| 807 | |
| 808 if owner then | 786 if owner then |
| 809 self:SetParent(owner) | 787 self:SetParent(owner) |
| 810 self.Overlay:SetParent(owner) | 788 self.Overlay:SetParent(owner) |
| 811 self:SetFrameStrata('HIGH') | 789 self:SetFrameStrata('HIGH') |
| 812 self:SetFrameLevel(pinBaseIndex + self:GetID()) | 790 self:SetFrameLevel(pinBaseIndex + self:GetID()) |
| 846 -- Non-hieriarchical display states, checked separately from used/filtered states | 824 -- Non-hieriarchical display states, checked separately from used/filtered states |
| 847 function QuestPOI:OnCriteria() | 825 function QuestPOI:OnCriteria() |
| 848 self.checkCriteria = nil | 826 self.checkCriteria = nil |
| 849 local isCriteria, isBounty, isSpellTarget | 827 local isCriteria, isBounty, isSpellTarget |
| 850 | 828 |
| 851 print(' ' ..self:GetID() .. ':|cFFFFFF00OnCriteria()' ) | 829 print('|cFFFFFF00OnCriteria(' ..self:GetID() .. ')' ) |
| 852 | 830 |
| 853 for index, bounty in pairs(db.Bounties) do | 831 for index, bounty in pairs(db.Bounties) do |
| 854 if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then | 832 if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then |
| 855 isCriteria = true | 833 isCriteria = true |
| 856 if db.selectedBounty == bounty then | 834 if db.selectedBounty == bounty then |
| 934 | 912 |
| 935 if not self:IsShown() then | 913 if not self:IsShown() then |
| 936 print('queued for Refresh') | 914 print('queued for Refresh') |
| 937 self.isStale = true | 915 self.isStale = true |
| 938 return nil | 916 return nil |
| 939 end | 917 elseif IsQuestComplete(self.questID) then |
| 940 | 918 self:Release() |
| 919 return nil | |
| 920 end | |
| 941 if self.checkCriteria then | 921 if self.checkCriteria then |
| 942 self:OnCriteria() | 922 self:OnCriteria() |
| 943 end | 923 end |
| 944 if self.checkFilters then | 924 if self.checkFilters then |
| 945 self:OnFilters() | 925 self:OnFilters() |
| 1069 | 1049 |
| 1070 self.tagIcon:SetShown((not self.filtered) and true or false) | 1050 self.tagIcon:SetShown((not self.filtered) and true or false) |
| 1071 self.tagIcon:SetAtlas(self.tagAtlas) | 1051 self.tagIcon:SetAtlas(self.tagAtlas) |
| 1072 self.EliteBorder:SetShown(self.isElite and not self.filtered) | 1052 self.EliteBorder:SetShown(self.isElite and not self.filtered) |
| 1073 | 1053 |
| 1074 self:UpdateStatus() | |
| 1075 | 1054 |
| 1076 if self.isBounty then | 1055 if self.isBounty then |
| 1077 --print('is bounty') | 1056 print('is bounty') |
| 1078 iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) | 1057 iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) |
| 1079 trackingBorder:SetVertexColor(unpack(BORDER_SELECTED_BOUNTY)) | 1058 trackingBorder:SetVertexColor(unpack(BORDER_SELECTED_BOUNTY)) |
| 1080 elseif self.isCriteria then | 1059 elseif self.isCriteria then |
| 1081 --print('is criteria of a bounty') | 1060 print('is criteria of a bounty') |
| 1082 iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) | 1061 iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) |
| 1083 trackingBorder:SetVertexColor(unpack(BORDER_CRITERIA)) | 1062 trackingBorder:SetVertexColor(unpack(BORDER_CRITERIA)) |
| 1084 else | 1063 else |
| 1085 | 1064 print('is nothing') |
| 1086 iconBorder:SetVertexColor(unpack(borderColor)) | 1065 iconBorder:SetVertexColor(unpack(borderColor)) |
| 1087 trackingBorder:SetVertexColor(0,0,0,.5) | 1066 trackingBorder:SetVertexColor(0,0,0,.5) |
| 1088 end | 1067 end |
| 1068 self:UpdateStatus() | |
| 1089 | 1069 |
| 1090 if SpellCanTargetQuest() then | 1070 if SpellCanTargetQuest() then |
| 1091 if self.isSpellTarget then | 1071 if self.isSpellTarget then |
| 1092 icon:SetVertexColor(1,1,1) | 1072 icon:SetVertexColor(1,1,1) |
| 1093 self:EnableMouse(false) | 1073 self:EnableMouse(false) |
| 1123 local text, timeState, style = self:GetTimeInfo(timeLeft, self.maxAlertLevel) | 1103 local text, timeState, style = self:GetTimeInfo(timeLeft, self.maxAlertLevel) |
| 1124 if tl ~= timeState then | 1104 if tl ~= timeState then |
| 1125 tl = timeState | 1105 tl = timeState |
| 1126 self.timeLabel:SetText(text) | 1106 self.timeLabel:SetText(text) |
| 1127 end | 1107 end |
| 1128 if style then | |
| 1129 self.RewardBorder:SetVertexColor(style.r, style.g, style.b, style.a) | |
| 1130 end | |
| 1131 end | 1108 end |
| 1132 | 1109 |
| 1133 self.alertLevel = tl | 1110 self.alertLevel = tl |
| 1134 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) | 1111 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) |
| 1135 else | 1112 else |
| 1152 self.count:SetShown(isShown) | 1129 self.count:SetShown(isShown) |
| 1153 self.timeLabel:SetShown(isShown) | 1130 self.timeLabel:SetShown(isShown) |
| 1154 end | 1131 end |
| 1155 | 1132 |
| 1156 function QuestPOI:Release(msg) | 1133 function QuestPOI:Release(msg) |
| 1157 print('|cFFFF4400'..self:GetID()..':Release()', self.hideReason) | 1134 print('|cFFFF4400Release('..self:GetID()..')', self.hideReason) |
| 1158 self.hideReason = msg or 'Released by script.' | 1135 self.hideReason = msg or 'Released by script.' |
| 1136 self:ClearAllPoints() | |
| 1159 self:SetShown(false) | 1137 self:SetShown(false) |
| 1160 self:HideOrShowFrames(false) | 1138 self:HideOrShowFrames(false) |
| 1161 | 1139 |
| 1162 if self.questID then | 1140 if self.questID then |
| 1163 db.QuestsByID[self.questID] = nil | 1141 db.QuestsByID[self.questID] = nil |
