comparison WorldQuests.lua @ 54:b289eb3e6a32

- Fix stray pin text arising from pins that are never shown.
author Nenue
date Sat, 31 Dec 2016 17:31:39 -0500
parents 6439015d74b1
children 6a2e85836219
comparison
equal deleted inserted replaced
53:44baf4f35c7c 54:b289eb3e6a32
130 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level 130 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level
131 self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL') 131 self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
132 self:RegisterEvent('SKILL_LINES_CHANGED') 132 self:RegisterEvent('SKILL_LINES_CHANGED')
133 end 133 end
134 134
135 function Module:OnMapInfo() 135 function Module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID)
136 print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible()) 136 print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible())
137 if self.isContinent ~= isContinent then
138 self.sizesDirty = true
139 end
140 self.isContinent = isContinent
137 if self:IsVisible() then 141 if self:IsVisible() then
138 self:Refresh(true) 142 self:Refresh(true)
139 else 143 else
140 self.isStale = true 144 self.isStale = true
141 end 145 end
219 end 223 end
220 end 224 end
221 225
222 if not pin.dataLoaded then 226 if not pin.dataLoaded then
223 pin:GetData() 227 pin:GetData()
224 C_TaskQuest.RequestPreloadRewardData(info.questId) 228 end
225 end 229
230
226 231
227 pin:IsFiltered() 232 pin:IsFiltered()
228 pin:IsShowable() 233 pin:IsShowable()
229 pin.isStale = true 234 pin.isStale = true
230 rprint(pin:GetID(), pin.filtered, pin.used) 235 rprint(pin:GetID(), pin.filtered, pin.used)
243 print('-', i, zone[i]) 248 print('-', i, zone[i])
244 zone[id] = nil 249 zone[id] = nil
245 end 250 end
246 db.TasksByID[id] = nil 251 db.TasksByID[id] = nil
247 end 252 end
248 pin:SetShown(false) 253 pin:Hide()
249 pin:ClearAllPoints() 254 pin.Overlay:Hide()
250 tinsert(db.FreePins, pin) 255 tinsert(db.FreePins, pin)
251 256
252 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title) 257 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
253 end 258 end
254 259
417 db:print(id, pin.worldQuestType, pin.rewardType, pin.title) 422 db:print(id, pin.worldQuestType, pin.rewardType, pin.title)
418 end 423 end
419 end 424 end
420 425
421 function Module:Refresh(fromUser) 426 function Module:Refresh(fromUser)
422 self.isUserTriggered = fromUser
423 self.currentMapID = GetCurrentMapAreaID() 427 self.currentMapID = GetCurrentMapAreaID()
424 rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') 428 rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
425 print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') 429 print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal')
426 if not self:IsVisible() then 430 if not self:IsVisible() then
427 print(' not visible, flag for later') 431 print(' not visible, flag for later')
435 end 439 end
436 440
437 self:UpdateAnchors(nil, fromUser) 441 self:UpdateAnchors(nil, fromUser)
438 self:Cleanup (fromUser) 442 self:Cleanup (fromUser)
439 self.isStale = nil 443 self.isStale = nil
440 self.isUserTriggered = nil 444 self.sizesDirty = nil
441 end 445 end
442 446
443 -- update visibility states of all pins 447 -- update visibility states of all pins
444 function Module:SetFilteredPins(pins) 448 function Module:SetFilteredPins(pins)
445 print(' |cFFFFFF00'..self:GetName()..':SetFilteredPins()|r', pins) 449 print(' |cFFFFFF00'..self:GetName()..':SetFilteredPins()|r', pins)
463 rprint('|cFF00FF00update|r', x, y, pin.mapID, pin.questID, pin.title) 467 rprint('|cFF00FF00update|r', x, y, pin.mapID, pin.questID, pin.title)
464 468
465 if x and y then 469 if x and y then
466 pin.x = x 470 pin.x = x
467 pin.y = y 471 pin.y = y
468 pin.throttle = 1
469 pin:SetFrameLevel(PinBaseIndex+pin:GetID()) 472 pin:SetFrameLevel(PinBaseIndex+pin:GetID())
470 pin:SetAnchor(self.hostFrame, pin.x, pin.y, self.hostWidth, self.hostHeight) 473 pin:SetAnchor(self.hostFrame, pin.x, pin.y, self.hostWidth, self.hostHeight)
471 tinsert(self.UsedPositions, pin) 474 --tinsert(self.UsedPositions, pin)
472 end 475 end
473 476 if self.sizesDirty then
477 if self:IsVisible() then
478 pin:Refresh()
479 else
480 pin.isStale = true
481 end
482 end
474 if mapID then 483 if mapID then
475 if not db.QuestsByZone[mapID] then 484 if not db.QuestsByZone[mapID] then
476 db.QuestsByZone[mapID] = {} 485 db.QuestsByZone[mapID] = {}
477 end 486 end
478 db.QuestsByZone[mapID][questID] = pin 487 db.QuestsByZone[mapID][questID] = pin