# HG changeset patch # User Nenue # Date 1491406566 14400 # Node ID 31de7e9e78498712bc9b30a6383b9c1284f24dc8 # Parent cce68795f9550178c6a30e459cc2958640dca174 stop hiding pins when the timeleft returns 0; use C_TQ.IsActive diff -r cce68795f955 -r 31de7e9e7849 FilterBar.lua --- a/FilterBar.lua Sun Apr 02 13:51:24 2017 -0400 +++ b/FilterBar.lua Wed Apr 05 11:36:06 2017 -0400 @@ -78,12 +78,13 @@ self:ClearAllPoints() self:SetPoint('TOPRIGHT') WorldPlan:AddHandler(self) - for index, info in ipairs(db.DefaultFilters) do + --[[for index, info in ipairs(db.DefaultFilters) do info.zone = db.DefaultFilterType info.continent = db.DefaultFilterType info.pinMask = "Interface\\Minimap\\UI-Minimap-Background" WorldPlan:AddTypeInfo(self,index, info) end + --]] end @@ -165,7 +166,6 @@ end function Module:Reset() - self.pinLayout = self:GetTypeInfo(255) self:GetFilters() end diff -r cce68795f955 -r 31de7e9e7849 QuestPOI.lua --- a/QuestPOI.lua Sun Apr 02 13:51:24 2017 -0400 +++ b/QuestPOI.lua Wed Apr 05 11:36:06 2017 -0400 @@ -59,7 +59,14 @@ local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS -local REWARD_HONOR = WORLD_QUEST_REWARD_TYPE_FLAG_HONOR + +local REWARD_TYPE_NAMES = { + [REWARD_CASH] = 'Money', + [REWARD_ARTIFACT_POWER] = 'AP', + [REWARD_GEAR] = 'Equipment', + [REWARD_CURRENCY] = 'Currency', + [REWARD_REAGENT] = 'Trade Goods' +} local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE @@ -75,6 +82,7 @@ local DEFAULT_STYLE = { border = {1,1,1}, + textColor = {1,1,1,1}, x = 0, y = 0, desaturated = true, iconMask = "Interface\\Minimap\\UI-Minimap-Background", @@ -103,7 +111,9 @@ hideNumber = true, }, - [REWARD_CURRENCY] = {}, + [REWARD_CURRENCY] = { + textColor = {1,1,0,.5} + }, [REWARD_REAGENT] = { hideNumber = true, @@ -365,7 +375,7 @@ self.worldQuestType = worldQuestType self.tagAtlas = tagAtlas - local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality = self:UpdateRewards() + local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality, xpType, xpName, xpIcon, xpCount = self:UpdateRewards() dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality) if dataLoaded then self.rewardType = rewardType @@ -375,6 +385,8 @@ self.itemQuality = quality self.dataLoaded = true self.isStale = true + self.xpType, self.xpName, self.xpIcon, self.xpCount = xpType, xpName, xpIcon, xpCount + end end @@ -382,6 +394,9 @@ return self.dataLoaded end +local ID_RESOURCES = 1220 +local ID_LEGIONFALL = 1342 + --- Returns true if data has changed (either from loading in or qualifications changed) function QuestPOI:UpdateRewards() local questID = self.questID @@ -393,6 +408,7 @@ local rewardItems, rewardCurrency = {}, {} local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality local xpIcon, xpName, xpCount, xpType + local foundPrimary if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then local money = GetQuestLogRewardMoney(questID) @@ -411,11 +427,12 @@ rewardCount = artifactXP rewardType = REWARD_ARTIFACT_POWER qprint(' artifactXP', artifactXP) + foundPrimary = true end local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID); for i = 1, numQuestCurrencies do - local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID); + local name, texture, numItems, currencyID = GetQuestLogRewardCurrencyInfo(i, questID); local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name); tinsert(rewardCurrency, { name = name, @@ -423,11 +440,21 @@ numItems = numItems, text = text }) - qprint(' currency', i, name, " |T"..tostring(texture)..":12:12|t") - rewardIcon = texture - rewardCount = numItems - rewardName = name - rewardType = REWARD_CURRENCY + + qprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t") + if currencyID == ID_RESOURCES then + rewardIcon = texture + rewardCount = numItems + rewardName = name + rewardType = REWARD_CURRENCY + foundPrimary = true + elseif currencyID == ID_LEGIONFALL then + xpIcon = texture + xpCount = numItems + xpName = name + xpType = REWARD_CURRENCY + end + end local honorAmount = GetQuestLogRewardHonor(questID); if honorAmount > 0 then @@ -439,7 +466,6 @@ local numQuestRewards = GetNumQuestLogRewards(questID); if numQuestRewards > 0 then - local foundPrimary for i = 1, numQuestRewards do local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID) @@ -496,6 +522,7 @@ isUsable = isUsable }) if not foundPrimary then + print(' -updating primary') rewardType = REWARD_GEAR rewardIcon = texture @@ -516,7 +543,7 @@ return false end - return true, rewardType, rewardName, rewardIcon, rewardCount, quality + return true, rewardType, rewardName, rewardIcon, rewardCount, quality, xpType, xpName, xpIcon, xpCount else return false @@ -546,16 +573,19 @@ function QuestPOI:StartFade() if not self.isAnimating then - --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') + qprint('|cFFFFFF00clearing new status') self:SetAlpha(0) + if self.dataLoaded then + self:Refresh() self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha) self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha) - self.isAnimating = true - self.isNew = nil - self.isStale = true - self.FadeIn:Play() + self.isAnimating = true + self.isNew = nil + self.isStale = true + self.FadeIn:Play() + end end end @@ -566,20 +596,18 @@ function QuestPOI:OnShow () - if self.isStale then - qprint('|cFF0088FFflagged for refresh') - self:Refresh() + if self.isNew then + self:StartFade() + else + if not self.isAnimating then + print('|cFF00FF00Alpha correction') + self:SetAlpha(db.PinAlpha) -- fix stuck alpha + end + if self.isStale then + print('|cFF00FF00refresh on show') + self:Refresh() + end end - - if self.isNew then - qprint('|cFFFFFF00popping new pin handler') - self:StartFade() - end - - if not self.isAnimating then - self:SetAlpha(db.PinAlpha) -- fix stuck alpha - end - self:ShowFrames() end @@ -589,12 +617,17 @@ -- 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 + self.hideReason = nil end -- Applies position and sizing parameters to the pin data function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) if not self.used then + self.hideReason = 'SetAnchor() on an unused frame.' self:HideFrames() return end @@ -616,7 +649,7 @@ local scaleChanged if scaleFactor and (self.scaleFactor ~= scaleFactor) then - print('scaleFactor') + --print('scaleFactor') self:SetScale(scaleFactor) self.Overlay:SetScale(scaleFactor) self.scaleFactor = scaleFactor @@ -645,8 +678,6 @@ print('|cFFFFFF00' ..self:GetName()..':ShowFrames()') -- do not SetShown() here end - - self.count:SetShown(true) self.Overlay:SetShown(true) self.count:SetShown(true) self.timeLabel:SetShown(true) @@ -654,10 +685,12 @@ function QuestPOI:HideFrames() if self:IsShown() then - print(self:GetName()..':HideFrames()') + if not self.hideReason then + self.hideReason = "HideFrames() called" + end + --print(self:GetName()..':HideFrames()') self:SetShown(false) end - self.count:SetShown(false) self.Overlay:SetShown(false) self.count:SetShown(false) self.timeLabel:SetShown(false) @@ -709,35 +742,24 @@ --@end-debug@ -- query for reward data if it wasn't found in the original scan - local questID = self.questID + if not self.dataLoaded then print('|cFFFF4400'..self:GetID()..':|r polling reward info') - if not (self.isAnimating) then - self.PendingFade:Play() - end + local dataLoaded = self:GetData() if dataLoaded and not tContains(db.UpdatedPins, self) then - print('|cFF00FF88'..self:GetID()..':|r reward info loaded! queue it up') - + print('|cFF00FF88'..self:GetID()..':|r delayed reward info, queueing for update') + self.PendingFade:Stop() tinsert(db.UpdatedPins, self) end return - else - if self.PendingFade:IsPlaying() then - print('|cFFFF4400'..self:GetID()..':|r cancel fader') - self.PendingFade:Stop() - end - - if self.isStale then - print(self.questID, '|cFFFFFF00flagged for update') - self:CheckFilterRules() - self:Refresh() - return - end end - self:UpdateStatus() + if self.maxAlertLevel then + self:UpdateStatus() + end + end -- Called at static intervals and with Refresh @@ -755,10 +777,6 @@ tl = timeState self.timeLabel:SetText(text) end - else - if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then - self:HideFrames() - end end if tl and (timeLeft < 120) then @@ -771,10 +789,9 @@ self.alertLevel = tl self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) else - if not self.completed then - self.completed = true - self:HideFrames() - end + self.hideReason = "No longer active." + self:HideFrames() + end end @@ -799,6 +816,7 @@ local tagSize = style.TagSize or DEFAULT_STYLE.TagSize local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon local borderColor = style.border or DEFAULT_STYLE.border + local textColor = style.textColor or DEFAULT_STYLE.textColor local questID = self.questID local iconBorder = self.RewardBorder local trackingBorder = self.HighlightBorder @@ -829,7 +847,9 @@ end numberString = numberString .. 'k' end + self.count:SetText(numberString) + self.count:SetTextColor(unpack(textColor)) self.count:Show() else self.count:SetText(nil) @@ -907,16 +927,24 @@ } - function QuestPOI:CheckFilterRules () local print = qprint local qType = self.worldQuestType local filtered local canShow = TQ_IsActive(self.questID) - if SpellCanTargetQuest() then - -- hiding so player can click a valid target - self.used = nil - elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then + + if db.canTargetQuests then + self:EnableMouse(false) + if not IsQuestIDValidSpellTarget(self.questID) then + self.hideReason = "Not a valid spell target." + self:SetShown(false) + return + end + else + self:EnableMouse(true) + end + + if qType == LE_QUEST_TAG_TYPE_PROFESSION then if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then canShow = nil end @@ -942,10 +970,11 @@ end self.filtered = filtered end - self.used = canShow - - + if not canShow then + self.hideReason = "Failed filter check." + end + self:SetShown(canShow) end --- Fixes icons upon size update diff -r cce68795f955 -r 31de7e9e7849 WorldPlan.lua --- a/WorldPlan.lua Sun Apr 02 13:51:24 2017 -0400 +++ b/WorldPlan.lua Wed Apr 05 11:36:06 2017 -0400 @@ -11,6 +11,7 @@ local BROKEN_ISLES_ID = 1007 local GetCurrentMapAreaID = GetCurrentMapAreaID local GetTime, IsLoggedIn = GetTime, IsLoggedIn +local DEBUG_HISTORY = {} -- Define tables here so the pointers match up WorldPlanCore = { defaults = {}, modules = {}, TaskQueue = {}, } @@ -192,6 +193,50 @@ end end +function db.log(msg) + WorldPlanData.Debug = WorldPlanData.Debug or {} + tinsert(WorldPlanData.Debug, msg) + tinsert(DEBUG_HISTORY, msg) + if WorldPlanDebug:IsShown() then + WorldPlanDebug:Update() + end +end + +WorldPlanDebugMixin = { + OnLoad = function(self) + self:SetFont("Interface\\Addons\\Devian\\font\\SourceCodePro-Regular.ttf", 13, 'NORMAL') + self:SetJustifyH('LEFT') + self:SetFading(false) + self:SetMaxLines(2048) + self.loadedMessages = 0 + end, + OnShow = function(self) + if self.loadedMessages < #DEBUG_HISTORY then + self:Update() + end + end, + Update = function(self) + for i = self.loadedMessages, #DEBUG_HISTORY do + self:AddMessage(DEBUG_HISTORY[i]) + self.loadedMessages = i + end + end , + OnMouseWheel = function(self, delta) + + local up = delta > 0 + if IsControlKeyDown() then + if up then self:ScrollToTop() + else self:ScrollToBottom() end + elseif IsShiftKeyDown() then + if up then self:PageUp() + else self:PageDown() end + else + if up then self:ScrollUp() + else self:ScrollDown() end + end +end +} + function WorldPlanCore:OnConfigUpdate() for _, module in ipairs(db.OrderedModules) do if module.OnConfigUpdate then @@ -389,7 +434,16 @@ if not WorldPlanData then WorldPlanData = {key = 0} end + + -- debug info WorldPlanData.key = (WorldPlanData.key or 0) + 1 + WorldPlanData.Debug = WorldPlanData.Debug or {} + for _, msg in ipairs(WorldPlanData.Debug) do + tinsert(DEBUG_HISTORY, msg) + end + tinsert(DEBUG_HISTORY, '--SESSION BREAK--') + wipe(WorldPlanData.Debug) + db.Config = WorldPlanData for k,v in pairs(db.DefaultConfig) do --[===[@non-debug@ @@ -484,6 +538,14 @@ self:print('WorldPlanSummary:Refresh(true)') WorldPlanSummary:Refresh(true) end + elseif arg1 == 'log' then + WorldPlanDebug:SetShown(true) + elseif arg1 == 'debug' then + if WorldPlanData then + WorldPlanData.DebugEnabled = (not WorldPlanData.DebugEnabled) + self:print(WorldPlanData.DebugEnabled and "Debugger on." or "Debugger off.") + end + else self:print('Refreshing data.') self:Refresh(true) diff -r cce68795f955 -r 31de7e9e7849 WorldPlan.xml --- a/WorldPlan.xml Sun Apr 02 13:51:24 2017 -0400 +++ b/WorldPlan.xml Wed Apr 05 11:36:06 2017 -0400 @@ -81,6 +81,7 @@ +