Mercurial > wow > worldplan
comparison QuestPOI.lua @ 100:fbd4ead2a19f v1.4.11
- More attempts to fix quest markers re-appearing when completed via the order hall spells. Hard to test due to cooldown.
author | Nenue |
---|---|
date | Thu, 18 May 2017 16:43:14 -0400 |
parents | d594c5c4a4a3 |
children | 4d1520186ea4 8cdd62e7a224 |
comparison
equal
deleted
inserted
replaced
99:cffecc347e90 | 100:fbd4ead2a19f |
---|---|
31 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID | 31 local floor, mod, tostring, tonumber, GetSuperTrackedQuestID = floor, mod, tostring, tonumber, GetSuperTrackedQuestID |
32 local GameTooltip = GameTooltip | 32 local GameTooltip = GameTooltip |
33 local GetItemIcon = GetItemIcon | 33 local GetItemIcon = GetItemIcon |
34 | 34 |
35 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop | 35 local print = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop |
36 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop | |
37 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop | 36 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop |
38 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop | 37 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop |
39 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 |
40 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 |
41 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 |
42 local QuestPOI = WorldPlanPOIMixin | 41 local QuestPOI = WorldPlanPOIMixin |
43 | 42 |
44 local pinBaseIndex = 1320 | 43 local pinBaseIndex = 1520 |
45 local overlayBaseIndex = 1380 | 44 local overlayBaseIndex = 1580 |
46 local previousHighlight | 45 local previousHighlight |
47 | 46 |
48 local FADE_TIMING_MULTIPLIER = 3 | 47 local FADE_TIMING_MULTIPLIER = 3 |
49 local DATA_DEBUG = false | 48 local DATA_DEBUG = false |
50 local PIN_REFRESH_DELAY = 1 | 49 local PIN_REFRESH_DELAY = 1 |
286 end | 285 end |
287 | 286 |
288 end | 287 end |
289 | 288 |
290 function QuestPOI:OnLoad() | 289 function QuestPOI:OnLoad() |
291 --qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config) | 290 --print('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config) |
292 self.debugTimer = 4 | 291 self.debugTimer = 4 |
293 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' | 292 self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r' |
294 self.count = self.Overlay.count | 293 self.count = self.Overlay.count |
295 self.timeLabel = self.Overlay.timeLabel | 294 self.timeLabel = self.Overlay.timeLabel |
296 self.Description = self.Overlay.Description | 295 self.Description = self.Overlay.Description |
297 self.updateRate = PIN_REQUEST_DELAY | 296 self.updateRate = PIN_REQUEST_DELAY |
298 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' | 297 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' |
299 | 298 self.checkFilters = true |
299 self.checkCriteria = true | |
300 self.checkCursor = true | |
301 self.worldQuest = true | |
302 self.isNew = true | |
300 | 303 |
301 self.IconBackdrop:SetVertexColor(0,0,0,1) | 304 self.IconBackdrop:SetVertexColor(0,0,0,1) |
302 self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) | 305 self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) |
303 self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) | 306 self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) |
304 end | 307 end |
413 --print(WorldMapTooltip:GetParent()) | 416 --print(WorldMapTooltip:GetParent()) |
414 --print(WorldMapTooltip:IsVisible()) | 417 --print(WorldMapTooltip:IsVisible()) |
415 end | 418 end |
416 | 419 |
417 function QuestPOI:OnMouseDown(button) | 420 function QuestPOI:OnMouseDown(button) |
421 | |
418 if button == 'RightButton' then | 422 if button == 'RightButton' then |
419 SetSuperTrackedQuestID(nil) | 423 |
424 local timers = db.IgnoreTimers | |
425 if timers[self.questID] then | |
426 timers[self.questID] = nil | |
427 else | |
428 local tl = TQ_GetQuestTimeLeftMinutes(self.questID) | |
429 if tl and (tl ~= 0) then | |
430 timers[self.questID] = time() + (tl * 60) | |
431 else | |
432 timers[self.questID] = 0 | |
433 end | |
434 end | |
435 self:Refresh() | |
420 else | 436 else |
421 TaskPOI_OnClick(self, button) | 437 TaskPOI_OnClick(self, button) |
422 end | 438 end |
423 end | 439 end |
424 | 440 |
563 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then | 579 elseif worldQuestType == LE_QUEST_TAG_TYPE_PROFESSION then |
564 self.isKnownProfession = nil | 580 self.isKnownProfession = nil |
565 local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex)) | 581 local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex)) |
566 if id then | 582 if id then |
567 self.isKnownProfession = true | 583 self.isKnownProfession = true |
568 --qprint('profession' , self.title, id) | 584 --print('profession' , self.title, id) |
569 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id] | 585 tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id] |
570 end | 586 end |
571 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then | 587 elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then |
572 tagAtlas = "worldquest-icon-dungeon" | 588 tagAtlas = "worldquest-icon-dungeon" |
573 end | 589 end |
826 end | 842 end |
827 | 843 |
828 end | 844 end |
829 | 845 |
830 -- Non-hieriarchical display states, checked separately from used/filtered states | 846 -- Non-hieriarchical display states, checked separately from used/filtered states |
831 function QuestPOI:GetCriteriaState() | 847 function QuestPOI:OnCriteria() |
848 self.checkCriteria = nil | |
832 local isCriteria, isBounty, isSpellTarget | 849 local isCriteria, isBounty, isSpellTarget |
833 | 850 |
834 | 851 print(' ' ..self:GetID() .. ':|cFFFFFF00OnCriteria()' ) |
835 | 852 |
836 for index, bounty in pairs(db.Bounties) do | 853 for index, bounty in pairs(db.Bounties) do |
837 if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then | 854 if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then |
838 isCriteria = true | 855 isCriteria = true |
839 if db.selectedBounty == bounty then | 856 if db.selectedBounty == bounty then |
840 isBounty = true | 857 isBounty = true |
841 end | 858 end |
842 --dprint('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty) | 859 --dprint('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty) |
843 end | 860 end |
844 end | 861 end |
845 isSpellTarget = IsQuestIDValidSpellTarget(self.questID) | 862 |
846 | 863 if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) then |
847 if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) or (self.isSpellTarget ~= isSpellTarget) then | |
848 --wqprint('|cFF00FF00criteria state changed') | 864 --wqprint('|cFF00FF00criteria state changed') |
849 self.isBounty = isBounty | 865 self.isBounty = isBounty |
850 self.isCriteria = isCriteria | 866 self.isCriteria = isCriteria |
851 self.isSpellTarget = isSpellTarget | 867 self.isSpellTarget = isSpellTarget |
852 self.isStale = true | 868 end |
853 return true | 869 end |
854 end | 870 |
871 function QuestPOI:OnCursor() | |
872 self.checkCursor = nil | |
873 self.isSpellTarget = IsQuestIDValidSpellTarget(self.questID) | |
855 end | 874 end |
856 | 875 |
857 local cvar_check = { | 876 local cvar_check = { |
858 [REWARD_CASH] = 'worldQuestFilterGold', | 877 [REWARD_CASH] = 'worldQuestFilterGold', |
859 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', | 878 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', |
861 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', | 880 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', |
862 [REWARD_GEAR] = 'worldQuestFilterEquipment', | 881 [REWARD_GEAR] = 'worldQuestFilterEquipment', |
863 } | 882 } |
864 | 883 |
865 | 884 |
866 function QuestPOI:CheckFilterRules () | 885 function QuestPOI:OnFilters () |
867 local print = qprint | |
868 local qType = self.worldQuestType | 886 local qType = self.worldQuestType |
869 | 887 |
870 self.canShow = false | 888 self.canShow = false |
889 self.checkFilters = nil | |
871 | 890 |
872 if not TQ_IsActive(self.questID) then | 891 if not TQ_IsActive(self.questID) then |
873 self.hideReason = 'Filter check ended because quest is inactive.' | 892 self.hideReason = 'Filter check ended because quest is inactive.' |
874 self.used = nil | 893 self.used = nil |
875 self:SetShown(false) | 894 self:SetShown(false) |
898 if not GetCVarBool(cvar_check[self.rewardType]) then | 917 if not GetCVarBool(cvar_check[self.rewardType]) then |
899 filtered = true | 918 filtered = true |
900 end | 919 end |
901 end | 920 end |
902 | 921 |
903 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r', filtered, self.title) | 922 print(' '..self.questID..':|cFFFFFF00OnFilters()|r', filtered, self.title) |
904 if self.filtered ~= filtered then | 923 if self.filtered ~= filtered then |
905 wqprint('|cFF00FF00filter changed') | 924 wqprint('|cFF00FF00filter changed') |
906 self.isStale = true | 925 self.isStale = true |
907 end | 926 end |
908 | 927 |
911 end | 930 end |
912 | 931 |
913 function QuestPOI:Refresh (event) | 932 function QuestPOI:Refresh (event) |
914 print('|cFF00FF88Refresh(|r'..self:GetID()..'|cFF00FF88)|r', event, self.title) | 933 print('|cFF00FF88Refresh(|r'..self:GetID()..'|cFF00FF88)|r', event, self.title) |
915 | 934 |
935 if not self:IsShown() then | |
936 print('queued for Refresh') | |
937 self.isStale = true | |
938 return nil | |
939 end | |
940 | |
941 if self.checkCriteria then | |
942 self:OnCriteria() | |
943 end | |
944 if self.checkFilters then | |
945 self:OnFilters() | |
946 end | |
947 if self.checkCursor then | |
948 self:OnCursor() | |
949 end | |
916 | 950 |
917 local style = DEFAULT_STYLE | 951 local style = DEFAULT_STYLE |
918 if self.filtered then | 952 if self.filtered or db.IgnoreTimers[self.questID] then |
919 print('choose minimized') | 953 print('choose minimized') |
920 style = MINIMIZED_STYLE | 954 style = MINIMIZED_STYLE |
921 elseif self.dataLoaded then | 955 elseif self.dataLoaded then |
922 print('choose reward type') | 956 print('choose reward type') |
923 style = REWARD_TYPE_STYLES[self.rewardType] | 957 style = REWARD_TYPE_STYLES[self.rewardType] |
924 else | 958 else |
925 print('choose default') | 959 print('choose default') |
926 end | 960 end |
927 | 961 |
928 local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth | 962 local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth |
929 | |
930 | |
931 | |
932 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth | 963 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth |
933 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth | 964 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth |
934 local tagSize = style.TagSize or DEFAULT_STYLE.TagSize | 965 local tagSize = style.TagSize or DEFAULT_STYLE.TagSize |
935 local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon | 966 local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon |
936 local borderColor = style.border or DEFAULT_STYLE.border | 967 local borderColor = style.border or DEFAULT_STYLE.border |
1055 iconBorder:SetVertexColor(unpack(borderColor)) | 1086 iconBorder:SetVertexColor(unpack(borderColor)) |
1056 trackingBorder:SetVertexColor(0,0,0,.5) | 1087 trackingBorder:SetVertexColor(0,0,0,.5) |
1057 end | 1088 end |
1058 | 1089 |
1059 if SpellCanTargetQuest() then | 1090 if SpellCanTargetQuest() then |
1060 if IsQuestIDValidSpellTarget(self.questID) then | 1091 if self.isSpellTarget then |
1061 icon:SetVertexColor(1,1,1) | 1092 icon:SetVertexColor(1,1,1) |
1093 self:EnableMouse(false) | |
1062 else | 1094 else |
1063 icon:SetVertexColor(1,0,0,1) | 1095 icon:SetVertexColor(0.5,0.5,0.5,1) |
1064 end | 1096 self:EnableMouse(true) |
1065 self:EnableMouse(false) | 1097 end |
1066 else | 1098 else |
1099 icon:SetVertexColor(1,1,1) | |
1067 self:EnableMouse(true) | 1100 self:EnableMouse(true) |
1068 end | 1101 end |
1102 | |
1069 self.isStale = nil | 1103 self.isStale = nil |
1070 | 1104 |
1071 -- signal filter info update | 1105 -- signal filter info update |
1072 WorldPlanSummary.isStale = true | 1106 WorldPlanSummary.isStale = true |
1107 return true | |
1073 end | 1108 end |
1074 | 1109 |
1075 -- Called at static intervals and with Refresh | 1110 -- Called at static intervals and with Refresh |
1076 function QuestPOI:UpdateStatus() | 1111 function QuestPOI:UpdateStatus() |
1077 -- update time elements | 1112 -- update time elements |
1078 self.isActive = TQ_IsActive(self.questID) | 1113 self.isActive = TQ_IsActive(self.questID) |
1079 --print(self.maxAlertLevel) | 1114 --print(self.maxAlertLevel) |
1080 local border = (self.isBounty or self.isCriteria) and self.RewardBorder or self.HighlightBorder | 1115 local border = (self.isBounty or self.isCriteria) and self.RewardBorder or self.HighlightBorder |
1081 | 1116 |
1082 if self.isActive then | 1117 if self.isActive then |
1118 | |
1083 local tl = self.alertLevel | 1119 local tl = self.alertLevel |
1084 local timeLeft = TQ_GetQuestTimeLeftMinutes(self.questID) | 1120 local timeLeft = TQ_GetQuestTimeLeftMinutes(self.questID) |
1085 if timeLeft > 0 then | 1121 if timeLeft > 0 then |
1086 | 1122 |
1087 local text, timeState, style = self:GetTimeInfo(timeLeft, self.maxAlertLevel) | 1123 local text, timeState, style = self:GetTimeInfo(timeLeft, self.maxAlertLevel) |
1142 self.icon:SetAlpha(0) | 1178 self.icon:SetAlpha(0) |
1143 self.RewardBorder:SetAlpha(0) | 1179 self.RewardBorder:SetAlpha(0) |
1144 self:UnregisterEvent('QUEST_TURNED_IN') | 1180 self:UnregisterEvent('QUEST_TURNED_IN') |
1145 self:UnregisterEvent('QUEST_LOG_UPDATE') | 1181 self:UnregisterEvent('QUEST_LOG_UPDATE') |
1146 | 1182 |
1183 self.checkCursor = true | |
1184 self.checkFilters = true | |
1185 self.checkCriteria = true | |
1186 | |
1147 for i, pin in ipairs(db.UsedPins) do | 1187 for i, pin in ipairs(db.UsedPins) do |
1148 if pin == self then | 1188 if pin == self then |
1149 print('|cFFFF4400cleared from UsedPins|r') | 1189 print('|cFFFF4400cleared from UsedPins|r') |
1150 tremove(db.UsedPins, i) | 1190 tremove(db.UsedPins, i) |
1151 break | 1191 break |