# HG changeset patch # User Nenue # Date 1496015442 14400 # Node ID 8cdd62e7a22494b1f2b4f9aa81e8ce427f42070e # Parent b68af1e44bdc22f9e3215a6dcf0bf1241dafdd15 - Solved the quest pins remaining visible issue diff -r b68af1e44bdc -r 8cdd62e7a224 QuestPOI.lua --- a/QuestPOI.lua Thu May 18 16:44:05 2017 -0400 +++ b/QuestPOI.lua Sun May 28 19:50:42 2017 -0400 @@ -40,8 +40,8 @@ local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or nop local QuestPOI = WorldPlanPOIMixin -local pinBaseIndex = 1520 -local overlayBaseIndex = 1580 +local pinBaseIndex = 1400 +local overlayBaseIndex = 1450 local previousHighlight local FADE_TIMING_MULTIPLIER = 3 @@ -324,7 +324,7 @@ function QuestPOI:OnEvent(event, questID) if (self.questID == questID) and IsQuestComplete(self.questID) then - db.log(self.questID .. " Marked completed.") + db.log(event .. ' for ' .. self:GetName().. ' triggered.') self:Release() end end @@ -335,9 +335,9 @@ -- reset flags self:SetAlpha(db.PinAlpha) self.isAnimating = nil - if db.Config.DebugEnabled then - db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') - end + --if db.Config.DebugEnabled then + -- db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') + --end self.hideReason = nil end @@ -530,15 +530,11 @@ return end - if self.maxAlertLevel then + if self.isStale then + self:Refresh() + elseif self.maxAlertLevel then self:UpdateStatus() end - - - if self.isStale then - self:Refresh() - end - end @@ -743,23 +739,6 @@ return false end end - - - - --[[ set reward category - local numRewards = GetNumQuestLogRewards(questID) - local numCurrency = GetNumQuestLogRewardCurrencies(questID) - local money = GetQuestLogRewardMoney(questID) - if numRewards >= 1 then - rewardType, rewardIcon, rewardCount, rewardName, itemID, quality = WorldPlanQuests:GetRewardHeader(questID) - elseif numCurrency >= 1 then - rewardName, rewardIcon, rewardCount = GetQuestLogRewardCurrencyInfo(1, questID) - rewardType = REWARD_CURRENCY - elseif money >= 1 then - rewardName = GetMoneyString(money) - end - --]] - end end @@ -804,7 +783,6 @@ return end - if owner then self:SetParent(owner) self.Overlay:SetParent(owner) @@ -848,7 +826,7 @@ self.checkCriteria = nil local isCriteria, isBounty, isSpellTarget - print(' ' ..self:GetID() .. ':|cFFFFFF00OnCriteria()' ) + print('|cFFFFFF00OnCriteria(' ..self:GetID() .. ')' ) for index, bounty in pairs(db.Bounties) do if (not IsQuestComplete(bounty.questID)) and IsQuestCriteriaForBounty(self.questID, bounty.questID) then @@ -936,8 +914,10 @@ print('queued for Refresh') self.isStale = true return nil + elseif IsQuestComplete(self.questID) then + self:Release() + return nil end - if self.checkCriteria then self:OnCriteria() end @@ -1071,21 +1051,21 @@ self.tagIcon:SetAtlas(self.tagAtlas) self.EliteBorder:SetShown(self.isElite and not self.filtered) - self:UpdateStatus() if self.isBounty then - --print('is bounty') + print('is bounty') iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) trackingBorder:SetVertexColor(unpack(BORDER_SELECTED_BOUNTY)) elseif self.isCriteria then - --print('is criteria of a bounty') + print('is criteria of a bounty') iconBorder:SetVertexColor(trackingBorder:GetVertexColor()) trackingBorder:SetVertexColor(unpack(BORDER_CRITERIA)) else - + print('is nothing') iconBorder:SetVertexColor(unpack(borderColor)) trackingBorder:SetVertexColor(0,0,0,.5) end + self:UpdateStatus() if SpellCanTargetQuest() then if self.isSpellTarget then @@ -1125,9 +1105,6 @@ tl = timeState self.timeLabel:SetText(text) end - if style then - self.RewardBorder:SetVertexColor(style.r, style.g, style.b, style.a) - end end self.alertLevel = tl @@ -1154,8 +1131,9 @@ end function QuestPOI:Release(msg) - print('|cFFFF4400'..self:GetID()..':Release()', self.hideReason) + print('|cFFFF4400Release('..self:GetID()..')', self.hideReason) self.hideReason = msg or 'Released by script.' + self:ClearAllPoints() self:SetShown(false) self:HideOrShowFrames(false) diff -r b68af1e44bdc -r 8cdd62e7a224 WorldQuests.lua --- a/WorldQuests.lua Thu May 18 16:44:05 2017 -0400 +++ b/WorldQuests.lua Sun May 28 19:50:42 2017 -0400 @@ -45,6 +45,7 @@ local BountyBoard = WorldMapFrame.UIElementsFrame.BountyBoard local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton local defaults = {} +local completedQuests = {} local continentScanned local layoutDirty = true @@ -135,6 +136,7 @@ elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then local questID = ... if questID and db.QuestsByID[questID] then + completedQuests[questID] = true db.QuestsByID[questID]:Release() end self:Refresh(event) @@ -331,7 +333,8 @@ end function Module:UpdateBounties(...) - print('|cFF00FF88BountyInfo()|r', ...) + bountiesDirty = nil + print('|cFF00FF88BountyInfo()|r', ...) wipe(db.BountiesByFactionID) wipe(db.BountiesByQuestID) @@ -353,7 +356,6 @@ print(' ', index, info.factionID, GetQuestLogTitle(GetQuestLogIndexByID(info.questID)), info.complete, (index == selectedBountyIndex) and 'SELECTED' or '') end end - bountiesDirty = nil end -- check current artifact knowledge and update pins accordingly @@ -410,6 +412,11 @@ print(msg, lastRefresh, ...) end + + if bountiesDirty then + self:UpdateBounties() + end + if not db.Config.EnablePins then numShown = 0 self.refreshBenchMark = GetTime() @@ -577,12 +584,16 @@ if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then return nil end - if IsQuestComplete(questID) then + local pin = db.QuestsByID[questID] + -- check to avoid creating unnecessary frames + if IsQuestComplete(questID) or completedQuests[questID] then + completedQuests[questID] = true + if pin then + pin:Release() + end return nil end - - local pin = db.QuestsByID[questID] if not pin then local numFree = #db.FreePins if numFree >= 1 then @@ -606,10 +617,7 @@ tinsert(db.UsedPins, pin) end - if IsQuestComplete(questID) then - pin:Release() - return nil - elseif info then + if info then pin.inProgress = info.inProgress pin.floor = info.floor pin.numObjectives = info.numObjectives or 0