comparison WorldQuests.lua @ 60:3d8e83ddf603

- hide text regions directly when their associated pin has been removed from the map
author Nick@Zahhak
date Wed, 08 Feb 2017 05:58:56 -0500
parents bc09961d5a98
children a133ee697ca2
comparison
equal deleted inserted replaced
59:bc09961d5a98 60:3d8e83ddf603
46 self:Refresh() 46 self:Refresh()
47 end 47 end
48 end 48 end
49 49
50 local InternalDoRefresh = function (self) 50 local InternalDoRefresh = function (self)
51 WorldPlanQuests:Refresh(true) 51 WorldPlanQuests:Refresh()
52 end 52 end
53 53
54 function Module:Setup() 54 function Module:Setup()
55 print('|cFFFF4400'..self:GetName()..':Setup()') 55 print('|cFFFF4400'..self:GetName()..':Setup()')
56 56
257 print('-', i, zone[i]) 257 print('-', i, zone[i])
258 zone[id] = nil 258 zone[id] = nil
259 end 259 end
260 db.TasksByID[id] = nil 260 db.TasksByID[id] = nil
261 end 261 end
262 pin:Hide() 262 pin:SetShown(false)
263 pin.Overlay:Hide() 263 pin.Overlay:SetShown(false)
264 tinsert(db.FreePins, pin) 264 tinsert(db.FreePins, pin)
265 265
266 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title) 266 print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
267 end 267 end
268 268
430 for id, pin in pairs(db.QuestsByID) do 430 for id, pin in pairs(db.QuestsByID) do
431 db:print(id, pin.worldQuestType, pin.rewardType, pin.title) 431 db:print(id, pin.worldQuestType, pin.rewardType, pin.title)
432 end 432 end
433 end 433 end
434 434
435 function Module:Refresh(fromUser) 435 function Module:Refresh()
436 self.currentMapID = GetCurrentMapAreaID() 436 self.currentMapID = GetCurrentMapAreaID()
437 rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') 437 rprint('|cFF00FF88'..self:GetName()..':Refresh()|r')
438 print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') 438 print('|cFF00FF88'..self:GetName()..':Refresh()|r')
439 if not self:IsVisible() then 439 if not self:IsVisible() then
440 print(' not visible, flag for later') 440 print(' not visible, flag for later')
441 self.isStale = true 441 self.isStale = true
442 return self:MarkAllPins() 442 return self:MarkAllPins()
443 end 443 end
444 wprint(' |cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') 444 wprint(' |cFF00FF88'..self:GetName()..':Refresh()|r')
445 445
446 for index, pin in pairs(db.QuestsByID) do 446 for index, pin in pairs(db.QuestsByID) do
447 pin.used = nil 447 pin.used = nil
448 end 448 end
449 449
450 self:UpdateAnchors(nil, fromUser) 450 self:UpdateAnchors(nil)
451 self:Cleanup (fromUser) 451
452
453 print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
454 rprint('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
455 --local showQuestPOI = db.Config.EnablePins
456 for questID, pin in pairs(db.QuestsByID) do
457 local oV = pin:IsShown()
458 if pin.used then
459 pin.throttle = 1
460 if oV == false then
461 print('|cFF00FF00cleanup +|r', questID, pin.title)
462 end
463 pin:SetShown(true)
464 else
465 if oV == true then
466 print('|cFFFF4400 -|r', questID, pin.title)
467 end
468 pin:SetShown(false)
469 end
470 end
471
452 self.isStale = nil 472 self.isStale = nil
453 self.sizesDirty = nil 473 self.sizesDirty = nil
454 474
455 self.ArtifactPowerDirty = nil 475 self.ArtifactPowerDirty = nil
456 end 476 end
503 for index, info in pairs(taskInfo) do 523 for index, info in pairs(taskInfo) do
504 self:UpdateQuestButton(info, mapID) 524 self:UpdateQuestButton(info, mapID)
505 end 525 end
506 end 526 end
507 527
508 function Module:UpdateAnchors (fromUser) 528 function Module:UpdateAnchors ()
509 wipe(self.UsedPositions) 529 wipe(self.UsedPositions)
510 print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser) 530 print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()')
511 self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize() 531 self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
512 self.nudgeThrescholdX = 16/self.hostWidth 532 self.nudgeThrescholdX = 16/self.hostWidth
513 self.nudgeThrescholdY = 16/self.hostHeight 533 self.nudgeThrescholdY = 16/self.hostHeight
514 local print = rprint 534 local print = rprint
515 print('|cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser) 535 print('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
516 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo() 536 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
517 if isMicroDungeon then 537 if isMicroDungeon then
518 return 538 return
519 end 539 end
520 540
533 end 553 end
534 end 554 end
535 end 555 end
536 end 556 end
537 557
538 -- shows, animates, or hides pins based on their current visibility flags 558
539 function Module:Cleanup (fromUser)
540
541 print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
542 local print = rprint
543 print('|cFFFFFF00'..self:GetName()..':Cleanup()|r')
544 --local showQuestPOI = db.Config.EnablePins
545 for questID, pin in pairs(db.QuestsByID) do
546 local oV = pin:IsShown()
547 if pin.used then
548 pin.throttle = 1
549 if oV == false then
550 print('|cFF00FF00cleanup +|r', questID, pin.title)
551 end
552 pin:Show()
553 else
554 if oV == true then
555 print('|cFFFF4400 -|r', questID, pin.title)
556 end
557 pin:Hide()
558 end
559 end
560 end
561