Mercurial > wow > worldplan
changeset 96:8591401ec278
- Fixed quest markers for other maps becoming visible due to ambiguous interpretations of pin.used.
- Removed some redundant filter checking calls on pins obtained through Acquire()
author | Nenue |
---|---|
date | Sun, 14 May 2017 23:45:08 -0400 |
parents | b29b35cb8539 |
children | 5d90d09cb7b7 |
files | FlightMap.lua QuestPOI.lua WorldQuests.lua |
diffstat | 3 files changed, 64 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/FlightMap.lua Mon May 08 22:38:52 2017 -0400 +++ b/FlightMap.lua Sun May 14 23:45:08 2017 -0400 @@ -98,9 +98,10 @@ print(pin:GetID(), pin.used, pin.filtered) - if pin.used then + if pin.canShow then pinsToRemove[info.questId] = nil; + pin.used = true local frame = self.activePins[info.questId] if not frame then frame = self:GetMap():AcquirePin("WorldPlanFlightPin") @@ -119,6 +120,7 @@ pin.throttle = 1 pin:ClearAllPoints() pin:SetPoint('CENTER', frame, 'CENTER') + pin:SetShown(true) frame:SetSize(pin:GetSize()) --print(pin.Overlay:IsShown(), pin.Overlay:GetPoint(1)) end
--- a/QuestPOI.lua Mon May 08 22:38:52 2017 -0400 +++ b/QuestPOI.lua Sun May 14 23:45:08 2017 -0400 @@ -24,6 +24,7 @@ local SpellCanTargetQuest, GetCVarBool = SpellCanTargetQuest, GetCVarBool local SetSuperTrackedQuestID = SetSuperTrackedQuestID local HaveQuestRewardData = HaveQuestRewardData +local GetTime = GetTime local pairs, ipairs, tinsert, tremove, unpack, select = pairs, ipairs, tinsert, tremove, unpack, select @@ -429,6 +430,8 @@ WorldMapTooltip:Hide(); end + + local updateTime, markTime function QuestPOI:OnUpdate (sinceLast) -- control update check intervals @@ -441,9 +444,7 @@ local alpha = self.icon:GetAlpha() local alphaMod = ((GetTime()-self.alphaStart) *FADE_TIMING_MULTIPLIER) - if self:GetID() == 1 then - print(alpha, self.toAlpha, sinceLast, alphaMod) - end + if alpha > self.toAlpha then alpha = alpha - (sinceLast*FADE_TIMING_MULTIPLIER) @@ -516,6 +517,12 @@ if self.maxAlertLevel then self:UpdateStatus() end + + + if self.isStale then + self:Refresh() + end + end @@ -859,6 +866,9 @@ function QuestPOI:CheckFilterRules () local print = qprint local qType = self.worldQuestType + + self.canShow = false + if not TQ_IsActive(self.questID) then self.hideReason = 'Filter check ended because quest is inactive.' self.used = nil @@ -896,9 +906,8 @@ self.isStale = true end + self.canShow = true self.filtered = filtered - self.used = true - self:SetShown(true) end function QuestPOI:Refresh (event)
--- a/WorldQuests.lua Mon May 08 22:38:52 2017 -0400 +++ b/WorldQuests.lua Sun May 14 23:45:08 2017 -0400 @@ -28,6 +28,7 @@ local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestComplete = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestComplete local HaveQuestRewardData = HaveQuestRewardData local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation +local InCombatLockdown, hooksecurefunc = InCombatLockdown, hooksecurefunc local ToggleButton = {} local BROKEN_ISLES_ID, DALARAN_ID, AZSUNA_ID, VALSHARAH_ID, HIGHMOUNTAIN_ID, STORMHEIM_ID, SURAMAR_ID, EOA_ID = 1007, 1014, 1015,1018, 1024, 1017, 1033, 1096 @@ -49,6 +50,7 @@ local layoutDirty = true local bountiesDirty = true local artifactPowerDirty = true +local hooksDirty = true local currentScale = WorldMapDetailFrame:GetScale() local canTargetQuests local isDataLoaded = true @@ -211,11 +213,17 @@ WorldQuests:Refresh('CASTING_STATE_CHANGED') end -function Module:Setup() - --print('|cFFFF4400'..self:GetName()..':Setup()') - for mapID, mapName in pairs(WORLD_QUEST_MAPS) do - db.QuestsByZone[mapID] = {} +callbacks.UseWorldMapActionButtonSpellOnQuest = function(questID) + if db.QuestsByID[questID] then + db.QuestsByID[questID].isStale = true end +end + +function Module:SetupCallbacks() + if InCombatLockdown() then + return nil + end + print('SetupCallbacks()') for target, arg in pairs(callbacks) do --print(type(target)) if type(target) == 'table' then @@ -234,6 +242,16 @@ end +end + +function Module:Setup() + --print('|cFFFF4400'..self:GetName()..':Setup()') + for mapID, mapName in pairs(WORLD_QUEST_MAPS) do + db.QuestsByZone[mapID] = {} + end + + hooksDirty = self:SetupCallbacks() + self:SetAllPoints(WorldMapFrame.UIElementsFrame) self:UpdateArtifactPower() self:UpdateBounties('SETUP') @@ -290,18 +308,17 @@ function Module:UpdateNext() --print('|cFF00FF88UpdateNext()') local pin = tremove(db.UpdatedPins) + pin:CheckFilterRules() - -- criteria state is asserted independently - pin:CheckFilterRules() local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] --print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor) if pin.used then + pin:SetShown(true) pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor) - if pin:IsVisible() then - pin:Refresh() - else - pin.isStale = true - end + pin:Refresh() + else + print('|cFFFF4400flagging queued pin that got hidden:', pin.title) + pin.isStale = true end end @@ -368,17 +385,20 @@ local msg = '|cFF00FF88WorldQuests:Refresh()|r|cFF00FFFF' function Module:Refresh(...) + + if hooksDirty then + hooksDirty = self:SetupCallbacks() + end + + if not self:IsVisible() then print('|cFFFF4400Refresh()|r', ...) - --layoutDirty = true return else - -- if lastRefresh == GetTime() then print('|cFFFF4400multiple refreshes tried') end lastRefresh = GetTime() - --rprint(msg, ...) print(msg, lastRefresh, ...) end @@ -389,7 +409,6 @@ print('starting bench', self.refreshBenchMark) return end - --wprint(' '..msg) scaleConstant = db.isContinentMap and 2 or 3 canTargetQuests = SpellCanTargetQuest() @@ -399,12 +418,6 @@ end self:UpdateAnchors(...) ---[[ - if bountiesDirty then - --print(' bounties dirty, pushing that') - self:UpdateBounties() - end - --]] if artifactPowerDirty and not InCombatLockdown() then self:UpdateArtifactPower() @@ -415,12 +428,8 @@ for questID, pin in pairs(db.QuestsByID) do local oV = pin:IsShown() if pin.used then + print('show', pin.title) pin.throttle = 1 - --[[ - if oV == false then - --rprint('|cFF00FF00cleanup +|r', questID, pin.title) - end - --]] pin:SetShown(true) numShown = numShown + 1 if pin.dataLoaded then @@ -428,18 +437,16 @@ end else - --[[ - if oV == true then - rprint('|cFFFF4400 -|r', questID, pin.title) + if pin:IsShown() then + print('|cFFFF4400need to remove', pin.title) + end - --]] + pin.hideReason = "Not used in map area " .. (db.currentMapID) pin:SetShown(false) end end - --print('flags ', layoutDirty, self.isStale) - --print(' ', numShown, 'shown,', numLoaded, 'with data') -- @@ -483,16 +490,6 @@ end end --- marks a pin set for passive update -function Module:MarkAllPins(pins) - --print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins) - pins = pins or db.QuestsByID - for questID, pin in pairs(pins) do - pin.isStale = true - --rprint('|cFF00FF00filter', pin.questID, pin.filtered, 'used:', pin.used) - end -end - -- Walks the current map tree and fires updates as needed function Module:UpdateAnchors (event) wipe(self.UsedPositions) @@ -529,7 +526,7 @@ end end --- Applies map association to the pins corresponding with each TaskInfo item +-- Attempt to display the pins for quests in taskInfo function Module:UpdateQuestsForMap(taskInfo, mapID) print('|cFF00FF00UpdateQuestsForMap()|r', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID), layoutDirty) if db.QuestsByZone[mapID] then @@ -537,30 +534,28 @@ elseif db.isBrokenIsle then continentScanned = true end + print('layoutDirty =',layoutDirty) for index, info in pairs(taskInfo) do local questID, x, y = info.questId, info.x, info.y local pin = self:AcquirePin(info) - if pin then + if pin.canShow then pin.used = true - print(pin.title, pin.isStale, layoutDirty, (pin.owningFrame ~= WorldMapFrame)) - if pin:IsShown() and (layoutDirty or pin.isStale or (pin.owningFrame ~= WorldMapFrame)) then + print('using', pin.title, (pin.owningFrame ~= WorldMapFrame)) + if layoutDirty or (pin.owningFrame ~= WorldMapFrame) then local scaleFactor = SCALE_FACTORS[(not pin.filtered and scaleConstant) or 1] pin.owningFrame = WorldMapFrame pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor) if pin.isStale then pin:Refresh('WORLDMAP_REFRESH ' .. GetTime()) end - else - if layoutDirty then - pin.isStale = true - end end - - if db.QuestsByZone[mapID] and pin.used then + if db.QuestsByZone[mapID] then db.QuestsByZone[mapID][questID] = pin end + else + print('|cFFFF4400not using|r', pin.title) end end end