comparison WorldQuests.lua @ 74:2ba11b25aa7f

flight map data handler adjustments
author Nenue
date Sat, 08 Apr 2017 17:07:58 -0400
parents 25f7dbc20a72
children 78d78dc77822
comparison
equal deleted inserted replaced
73:25f7dbc20a72 74:2ba11b25aa7f
227 self:RefreshIfChanged(event) 227 self:RefreshIfChanged(event)
228 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then 228 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
229 local questID = ... 229 local questID = ...
230 self:UpdateBounties(event) 230 self:UpdateBounties(event)
231 if questID and db.QuestsByID[questID] then 231 if questID and db.QuestsByID[questID] then
232 self:ReleasePin(db.QuestsByID[questID]) 232 db.QuestsByID[questID].complete = true
233 rprint('|cFFFF4400release|r', questID)
234 end 233 end
235 self:Refresh(event) 234 self:Refresh(event)
236 elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then 235 elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then
237 self:Refresh(event) 236 self:Refresh(event)
238 elseif event == 'ARTIFACT_UPDATE' then 237 elseif event == 'ARTIFACT_UPDATE' then
359 pin.floor = info.floor 358 pin.floor = info.floor
360 pin.numObjectives = info.numObjectives or 0 359 pin.numObjectives = info.numObjectives or 0
361 if info.x and info.y then 360 if info.x and info.y then
362 pin.x = info.x or pin.x 361 pin.x = info.x or pin.x
363 pin.y = info.y or pin.y 362 pin.y = info.y or pin.y
364 rprint('|cFFFF4400coords|r', info.x, info.y) 363 --rprint('|cFFFF4400coords|r', info.x, info.y)
365 end 364 end
366 end 365 end
367 366
368 if (not pin.dataLoaded) then 367 if (not pin.dataLoaded) then
369 local dataLoaded = pin:GetData() 368 local dataLoaded = pin:GetData()
511 end 510 end
512 511
513 512
514 if self:IsVisible() then 513 if self:IsVisible() then
515 print('|cFF00FFFFRefreshIfChanged()|r', refreshReason) 514 print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
516 self:Refresh() 515 self:Refresh('WORLDMAP_QUEUED')
517 else 516 else
518 rprint('|cFF00FFFFRefreshIfChanged()|r flagging for later refresh', refreshReason) 517 rprint('|cFF00FFFFRefreshIfChanged()|r flagging for later refresh', refreshReason)
519 self.isStale = true 518 self.isStale = true
520 end 519 end
521 end 520 end
535 local pin = self:AcquirePin(info) 534 local pin = self:AcquirePin(info)
536 if not pin then 535 if not pin then
537 return 536 return
538 end 537 end
539 538
539
540 local doUpdate = pin:GetCriteriaState() or pin.isStale
540 --print(' |- ', pin.questID, pin.title) 541 --print(' |- ', pin.questID, pin.title)
541 rprint('|cFF00FF00update|r', pin.questID, pin.title) 542 rprint('|cFF00FF00update|r', pin.questID, pin.title)
543
544 print(doUpdate)
545
542 if x and y then 546 if x and y then
543 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] 547 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
544 pin:SetFrameLevel(PinBaseIndex+pin:GetID()) 548 pin:SetFrameLevel(PinBaseIndex+pin:GetID())
545 pin.owningFrame = WorldMapFrame 549 pin.owningFrame = WorldMapFrame
546 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor) 550 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
551 doUpdate = true
547 --tinsert(self.UsedPositions, pin) 552 --tinsert(self.UsedPositions, pin)
548 end 553 end
549 554
550 local isCriteria, isBounty 555 if doUpdate then
551 if pin.factionID then 556 print(' changed', pin.title, pin.isCriteria, pin.isBounty, pin.scaleFactor)
552 if db.BountiesByFactionID[pin.factionID] then
553 isCriteria = true
554 end
555 if selectedBountyQuestID then
556 isBounty = IsQuestCriteriaForBounty(pin.questID, selectedBountyQuestID) and true or nil
557 end
558 end
559
560 local isSpellTarget
561 if canTargetQuests then
562 isSpellTarget = IsQuestIDValidSpellTarget(pin.questID)
563 end
564
565 if (pin.isBounty ~= isBounty) or (pin.isCriteria ~= isCriteria) or (pin.isSpellTarget ~= isSpellTarget) then
566 pin.isSpellTarget = isSpellTarget
567 pin.isBounty = isBounty
568 pin.isCriteria = isCriteria
569 if pin:IsVisible() then 557 if pin:IsVisible() then
570 --print(' changed', pin.title)
571 --numUpdated = numUpdated + 1 558 --numUpdated = numUpdated + 1
572 pin:Refresh('BOUNTY_UPDATE') 559 pin:Refresh('WORLDMAP_REFRESH')
573 else 560 else
574 --numHidden = numHidden + 1 561 --numHidden = numHidden + 1
575 pin.isStale = true 562 pin.isStale = true
576 end 563 end
577 end
578
579 if self:IsVisible() and (pin.isStale) then
580 pin:Refresh()
581 end 564 end
582 565
583 if mapID then 566 if mapID then
584 if not db.QuestsByZone[mapID] then 567 if not db.QuestsByZone[mapID] then
585 db.QuestsByZone[mapID] = {} 568 db.QuestsByZone[mapID] = {}
598 581
599 -- Used to refresh the visible quest markers 582 -- Used to refresh the visible quest markers
600 function Module:UpdateAnchors () 583 function Module:UpdateAnchors ()
601 wipe(self.UsedPositions) 584 wipe(self.UsedPositions)
602 print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()') 585 print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()')
603 self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize() 586 local hostWidth, hostHeight = WorldMapPOIFrame:GetSize()
604 self.nudgeThrescholdX = 16/self.hostWidth 587
605 self.nudgeThrescholdY = 16/self.hostHeight 588 if (hostWidth ~= self.hostWidth) or (hostHeight ~= self.hostHeight) then
589 self.hostWidth, self.hostHeight = hostWidth, hostHeight
590 layoutDirty = true
591 end
592
606 593
607 rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()') 594 rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
608 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo() 595 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
609 if isMicroDungeon then 596 if isMicroDungeon then
610 return 597 return