comparison WorldQuests.lua @ 62:abcdef801db5

- more region hiding fixes
author Nick@Zahhak
date Sat, 11 Feb 2017 14:25:57 -0500
parents a133ee697ca2
children 8e130c92698f
comparison
equal deleted inserted replaced
61:a133ee697ca2 62:abcdef801db5
87 if button.questID and db.QuestsByID[button.questID] then 87 if button.questID and db.QuestsByID[button.questID] then
88 db.QuestsByID[button.questID]:SetShown(false) 88 db.QuestsByID[button.questID]:SetShown(false)
89 end 89 end
90 end 90 end
91 91
92 function Module:OnUpdateQuestBonusObjectives() 92 local SpellCanTargetQuest = SpellCanTargetQuest
93 print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives') 93 function Module:UpdateBlizzButtons()
94
94 local func = SpellCanTargetQuest() and InternalShowButton or InternalHideButton 95 local func = SpellCanTargetQuest() and InternalShowButton or InternalHideButton
95 print(SpellCanTargetQuest())
96 for i = 1, NUM_WORLDMAP_TASK_POIS do 96 for i = 1, NUM_WORLDMAP_TASK_POIS do
97 local button = _G['WorldMapFrameTaskPOI'..i] 97 local button = _G['WorldMapFrameTaskPOI'..i]
98 if button and button.worldQuest then 98 if button and button.worldQuest then
99 func(button, i) 99 func(button, i)
100 end 100 end
101 end 101 end
102 end 102 end
103 103
104 function Module:OnUpdateQuestBonusObjectives()
105 print('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
106 self:UpdateBlizzButtons()
107 end
108
104 function Module:OnClickWorldMapActionButton() 109 function Module:OnClickWorldMapActionButton()
105 self.IsTargeting = SpellCanTargetQuest() 110 self:UpdateBlizzButtons()
106 self:OnUpdateQuestBonusObjectives()
107 end 111 end
108 112
109 local defaults = {} 113 local defaults = {}
110 local REWARD_UNKNOWN = 768 114 local REWARD_UNKNOWN = 768
111 function Module:OnLoad() 115 function Module:OnLoad()
128 132
129 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level 133 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level
130 self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL') 134 self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
131 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') 135 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
132 self:RegisterEvent('SKILL_LINES_CHANGED') 136 self:RegisterEvent('SKILL_LINES_CHANGED')
137 self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
133 end 138 end
134 139
135 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID) 140 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID)
136 print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible()) 141 print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible())
137 if self.isZoomedOut ~= isZoomedOut then 142 if self.isZoomedOut ~= isZoomedOut then
158 local questPOI = self:AcquirePin(questID) 163 local questPOI = self:AcquirePin(questID)
159 questPOI:GetQuestInfo() 164 questPOI:GetQuestInfo()
160 questPOI.isStale = true 165 questPOI.isStale = true
161 self.isStale = true 166 self.isStale = true
162 else 167 else
163 self:Refresh(true) 168 self:Refresh()
164 end 169 end
165 print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale) 170 print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale)
166 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then 171 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
167 local questID = ... 172 local questID = ...
168 if questID and db.QuestsByID[questID] then 173 if questID and db.QuestsByID[questID] then
169 self:ReleasePin(db.QuestsByID[questID]) 174 self:ReleasePin(db.QuestsByID[questID])
170 rprint('|cFFFF4400release|r', questID) 175 rprint('|cFFFF4400release|r', questID)
171 end 176 end
172 elseif event == 'SKILL_LINES_CHANGED' then 177 elseif event == 'SKILL_LINES_CHANGED' then
173 self:Refresh(true) 178 self:Refresh()
179 elseif event == 'CURRENT_SPELL_CAST_CHANGED' then
180
181 self:Refresh()
174 elseif event == 'ARTIFACT_UPDATE' then 182 elseif event == 'ARTIFACT_UPDATE' then
175 local ak = C_ArtifactUI.GetArtifactKnowledgeMultiplier() 183 local ak = C_ArtifactUI.GetArtifactKnowledgeMultiplier()
176 if ak and (ak ~= self.akLevel) then 184 if ak and (ak ~= self.akLevel) then
185 print('push artifact knowledge update', self.akLevel, 'to', ak)
177 self.akLevel = ak 186 self.akLevel = ak
178 self.ArtifactPowerDirty = true 187 for index, pin in pairs( db.QuestsByID) do
179 -- artifact knowledge changed 188 pin.dataLoaded = nil
180 self:Refresh(true) 189 end
190 self:Refresh()
181 end 191 end
182 end 192 end
183 end 193 end
184 194
185 local totalPins = 0 195 local totalPins = 0
233 pin.y = info.y or pin.y 243 pin.y = info.y or pin.y
234 rprint('|cFFFF4400coords|r', info.x, info.y) 244 rprint('|cFFFF4400coords|r', info.x, info.y)
235 end 245 end
236 end 246 end
237 247
238 if (not pin.dataLoaded) or self.ArtifactPowerDirty then 248 if (not pin.dataLoaded) then
239 pin:GetData() 249 pin:GetData()
240 end 250 end
241 251
242 pin:CheckFilterRules() 252 pin:CheckFilterRules()
243 pin.isStale = true 253 pin.isStale = true
257 print('-', i, zone[i]) 267 print('-', i, zone[i])
258 zone[id] = nil 268 zone[id] = nil
259 end 269 end
260 db.TasksByID[id] = nil 270 db.TasksByID[id] = nil
261 end 271 end
262 pin:SetShown(false) 272 pin:HideFrames()
263 pin.Overlay:SetShown(false)
264 pin.timeLabel:SetShown(false)
265 tinsert(db.FreePins, pin) 273 tinsert(db.FreePins, pin)
266 274
267 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title) 275 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
268 end 276 end
269 277
446 454
447 for index, pin in pairs(db.QuestsByID) do 455 for index, pin in pairs(db.QuestsByID) do
448 pin.used = nil 456 pin.used = nil
449 end 457 end
450 458
451 self:UpdateAnchors(nil) 459 if SpellCanTargetQuest() then
452 460 self:UpdateBlizzButtons()
461 else
462 self:UpdateAnchors(nil)
463 end
453 464
454 print('|cFFFFFF00'..self:GetName()..':Cleanup()|r') 465 print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
455 rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r') 466 rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
456 --local showQuestPOI = db.Config.EnablePins 467 --local showQuestPOI = db.Config.EnablePins
457 for questID, pin in pairs(db.QuestsByID) do 468 for questID, pin in pairs(db.QuestsByID) do
464 pin:SetShown(true) 475 pin:SetShown(true)
465 else 476 else
466 if oV == true then 477 if oV == true then
467 print('|cFFFF4400 -|r', questID, pin.title) 478 print('|cFFFF4400 -|r', questID, pin.title)
468 end 479 end
469 pin:SetShown(false) 480 pin:HideFrames()
470 end 481 end
471 end 482 end
472 483
473 self.isStale = nil 484 self.isStale = nil
474 self.sizesDirty = nil 485 self.sizesDirty = nil
475
476 self.ArtifactPowerDirty = nil
477 end 486 end
478 487
479 -- update visibility states of all pins 488 -- update visibility states of all pins
480 function Module:MarkAllPins(pins) 489 function Module:MarkAllPins(pins)
481 print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins) 490 print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins)
537 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo() 546 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
538 if isMicroDungeon then 547 if isMicroDungeon then
539 return 548 return
540 end 549 end
541 550
551
542 numPins = 0 552 numPins = 0
543 local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID) 553 local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID)
544 if taskInfo then 554 if taskInfo then
545 self:UpdateMap(taskInfo, self.currentMapID) 555 self:UpdateMap(taskInfo, self.currentMapID)
546 end 556 end