# HG changeset patch # User Nenue # Date 1483036280 18000 # Node ID dbd81d49af02017d63a93c3bb278e2caad961c3c # Parent c0b88bd1e40bde7ba28ef327614aa3c051b644bb - Solve more frame data flagging issues - Unify method for resolving filter and visibility states - Flight Map modifications respect filter settings - Solve initial draw issues with tag icon, filter state handling - Solve issues with text layer synchronization during map changes diff -r c0b88bd1e40b -r dbd81d49af02 FlightMap.lua --- a/FlightMap.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/FlightMap.lua Thu Dec 29 13:31:20 2016 -0500 @@ -91,38 +91,40 @@ for i, info in ipairs(taskInfo) do if HaveQuestData(info.questId) then if QuestUtils_IsQuestWorldQuest(info.questId) then - local pin = db.QuestsByID[info.questId] - if not db.QuestsByID[info.questId] then - pin = WorldPlanQuests:AcquirePin(info, zoneMapID) + local pin = WorldPlanQuests:AcquirePin(info, zoneMapID) + if pin then + + print(pin:GetID(), pin.used, pin.filtered) + + if pin.used then + print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) + pinsToRemove[info.questId] = nil; + + local frame = self.activePins[info.questId] + if not frame then + frame = self:GetMap():AcquirePin("WorldPlanFlightPin") + print(alpha1, alpha2, alpha3) + print(scale1, scale2, scale3) + frame:SetAlphaLimits(alpha1, alpha2, alpha3) + frame:SetScalingLimits(scale1, scale2, scale3); + frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); + frame:Show() + self.activePins[info.questId] = frame + end + frame:SetPosition(info.x, info.y) + frame.pin = pin + + pin.owningFrame = frame:GetMap() + pin.throttle = 1 + pin.isStale = true + + pin:SetParent(frame) + pin:ClearAllPoints() + pin:SetPoint('CENTER', frame, 'CENTER') + end + pin:SetShown(pin.used) end - pin:IsShowable() - if pin.used then - print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) - pinsToRemove[info.questId] = nil; - - local frame = self.activePins[info.questId] - if not frame then - frame = self:GetMap():AcquirePin("WorldPlanFlightPin") - print(alpha1, alpha2, alpha3) - print(scale1, scale2, scale3) - frame:SetAlphaLimits(alpha1, alpha2, alpha3) - frame:SetScalingLimits(scale1, scale2, scale3); - frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); - frame:Show() - self.activePins[info.questId] = frame - end - frame:SetPosition(info.x, info.y) - frame.pin = pin - - pin.owningFrame = frame:GetMap() - pin.isStale = true - pin:SetParent(frame) - pin:ClearAllPoints() - pin:SetPoint('CENTER', frame, 'CENTER') - - end - pin:SetShown(pin.used) end end end @@ -140,9 +142,21 @@ end end + + + function WorldPlanDataProvider:OnEvent() end +function WorldPlanDataPinMixin:OnLoad() + self.UpdateTooltip = self.OnMouseEnter; + + -- Flight points can nudge world quests. + self:SetNudgeTargetFactor(0.015); + self:SetNudgeZoomedOutFactor(1.0); + self:SetNudgeZoomedInFactor(0.25); +end + function WorldPlanDataPinMixin:OnShow() end diff -r c0b88bd1e40b -r dbd81d49af02 QuestPOI.lua --- a/QuestPOI.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/QuestPOI.lua Thu Dec 29 13:31:20 2016 -0500 @@ -25,6 +25,7 @@ local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end +local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end local QuestPOI = WorldPlanPOIMixin @@ -60,7 +61,7 @@ -- Pin color/display variables db.TooltipExtras = db.TooltipExtras or {} -- idiot-proofing - +db.PinAlpha = 1 local familiars = { [42159] = 'Nightwatcher Merayl', @@ -109,22 +110,18 @@ local _, name, _, completed, _, _, _, _, _, icon = GetAchievementInfo(achievementID) if not completed then - WorldMapTooltip:AddLine(" ") - WorldMapTooltip:AddLine("Achievements:") - WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name) - local numItems = GetAchievementNumCriteria(achievementID) local numNeeded = 0 local tooltipLines = {} for i =1, numItems do local criteriaName, criteriaType, completed, _, _, _, _, subAchievementID = GetAchievementCriteriaInfo(achievementID, i) - print(GetAchievementCriteriaInfo(achievementID, i)) + --print(GetAchievementCriteriaInfo(achievementID, i)) if not completed then - print('::', criteriaName, completed, subAchievementID) + --print('::', criteriaName, completed, subAchievementID) if criteriaType == 8 then local _, _, _, completed, _, _, _, _, _, subIcon = GetAchievementInfo(subAchievementID) - print(' -', criteriaName, completed, subIcon) + --print(' -', criteriaName, completed, subIcon) if not completed then local numCompleted = 0 local numSubItems = GetAchievementNumCriteria(subAchievementID) @@ -132,7 +129,7 @@ for j = 1, numSubItems do local subName, _, completed = GetAchievementCriteriaInfo(subAchievementID, j) - print(' -',subName, completed) + --print(' -',subName, completed) if completed then numCompleted = numCompleted + 1 else @@ -154,14 +151,14 @@ end end end - if numNeeded >= 1 then + if hasInfo then + WorldMapTooltip:AddLine(" ") + WorldMapTooltip:AddLine("Achievements:") + WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name) for i, line in ipairs(tooltipLines) do WorldMapTooltip:AddLine(line) end - else - WorldMapTooltip:AddLine('Criteria completed!', 0, 1, 0) end - end return hasInfo end @@ -193,13 +190,12 @@ function QuestPOI:OnEnter() if not WorldMapFrame:IsVisible() then WorldMap_HijackTooltip(self.owningFrame) - else - if self.filtered then - return - end + end + if self.filtered then + return end WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT"); - print('doing tooltip stuff') + --print('doing tooltip stuff') -- Can't add stuff after, so most of the blizzard tooltip hook is simply copied over local questID = self.questID @@ -267,10 +263,10 @@ -- attempt to pull pin data local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo function QuestPOI:GetData () - qprint('|cFF00FF88'..self:GetName()..':GetWorldQuestInfo()|r') + dprint('|cFF00FF88'..self:GetID()..':GetData()|r') local questID = self.questID if not questID then - rprint('|cFFFF4400bad pin|r', self:GetName()) + dprint('|cFFFF4400bad pin|r', self:GetName()) return nil end @@ -278,10 +274,14 @@ -- if the title is nil, then wait and try later if not questTitle then self.isPending = true - rprint('|cFFBB8844nodata|r|cFF00FFFF', self.questId) + dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId) else self.title, self.factionID, self.capped = questTitle, factionID, capped - rprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and 'late|r' or 'jit|r'), self.title, '|r', self.factionID) + dprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and '|cFFFF4400delayed|r' or '|cFF00FF00success|r'), self.title, '|r', self.factionID) + if self.dataLoaded then + dprint(' |cFFFF4400overwriting data|r') + end + -- set tag details local worldQuestType self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID); @@ -312,6 +312,7 @@ qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) if self.itemTexture and self.itemName and self.title then + self.dataLoaded = true self.isPending = nil self.throttle = 1 self.updateRate = PIN_REFRESH_DELAY @@ -348,9 +349,9 @@ rewardType = REWARD_CASH end - print(' '..self.questID..':|cFFFFFF00SetRewardInfo():', rewardType) + qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numRewards, rewardType) self.itemNumber = tonumber(rewardCount or self.itemNumber) - self.rewardType = rewardType or REWARD_GEAR + self.rewardType = rewardType self.quality = quality self.itemTexture = rewardIcon or self.itemTexture @@ -373,20 +374,15 @@ end -- run from OnShow if .isNew is set -function QuestPOI:OnNew() +function QuestPOI:StartFade() if not self.isAnimating then --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') self:SetAlpha(0) - if db.Config.FadeWhileGrouped then - self.FadeIn.FadeIn:SetToAlpha(0.15) - self.PendingFade.FadeIn:SetToAlpha(0.15) - self.PendingFade.FadeOut:SetFromAlpha(0.15) - else - self.FadeIn.FadeIn:SetToAlpha(1) - self.PendingFade.FadeIn:SetToAlpha(1) - self.PendingFade.FadeOut:SetFromAlpha(1) - end + 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 @@ -394,58 +390,73 @@ end end +function QuestPOI:EndFade() + self.isAnimating = nil + self:SetAlpha(db.PinAlpha) +end + function QuestPOI:OnShow () if self.isNew then qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) --qprint('|cFFFFFF00popping new pin handler') - self:OnNew() + self:StartFade() elseif not self.isAnimating then self:SetAlpha(1) -- fix stuck alpha end - if self.isNew or self.isStale then + if self.isStale then + qprint('|cFF0088FFflagged for refresh') self:Refresh() end --WorldPlan:print(self:GetAlpha()) + if not self.Overlay:IsShown() then + self:StartFade() + end + + + self.Overlay:SetShown(true) end function QuestPOI:OnHide() - --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') - if not self:IsShown() then - self.isAnimating = nil - self:SetAlpha(1) - end - + qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') + self.isAnimating = nil + self:SetAlpha(db.PinAlpha) self.Overlay:SetShown(false) end -function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight) - qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID) - self:ClearAllPoints() - local dX, dY = TQ_GetQuestLocation(self.questID) - if not dX or dX == 0 then - local _, x, y = QuestPOIGetIconInfo(self.questID) - if x and floor(x) ~= 0 then - dX, dY = x, y - else - dX, dY = self.x, self.y +local overlayBaseIndex = 1300 +function QuestPOI:SetAnchor(dX, dY, mapWidth, mapHeight) + local oX, oY = self.x, self.y + if not (dX and dY) then + local dX, dY = TQ_GetQuestLocation(self.questID) + if not dX or dX == 0 then + local _, x, y = QuestPOIGetIconInfo(self.questID) + if x and floor(x) ~= 0 then + dX, dY = x, y + else + dX, dY = self.x, self.y + end end end - local oX, oY = self.x, self.y - self.x = dX - self.y = dY - - + if not (mapHeight and mapWidth) then + mapWidth, mapHeight = self:GetParent():GetSize() + end local pX = (dX * mapWidth) local pY = (-dY * mapHeight) - if oX ~= dX then - wqprint(' |cFF00FF00'..self.questID..':|r', oX, dX, format("%0.2f %0.2f", pX, pY)) - end - self:SetParent(WorldMapPOIFrame) - self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY) + self.x = dX + self.y = dY + self:ClearAllPoints() + self:SetPoint('CENTER', self:GetParent(), 'TOPLEFT', pX, pY) + self:SetShown(self.used) + + self.Overlay:SetParent(self:GetParent()) + self.Overlay:ClearAllPoints() + self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) + self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) + self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) end function QuestPOI:OnLoad() @@ -489,10 +500,11 @@ -- query for reward data if it wasn't found in the original scan local questID = self.questID if self.isPending then - self:GetData() - if not (self.PendingFade:IsPlaying() or self.isAnimating) then + print('|cFFFF4400'..self:GetID()..':|r polling reward info') + if not (self.isAnimating) then self.PendingFade:Play() end + self:GetData() return else if self.PendingFade:IsPlaying() then @@ -525,12 +537,15 @@ -function QuestPOI:Refresh () - print('|cFF00FF88'..self:GetName()..'|r:Refresh()') +function QuestPOI:Refresh (fromUser) + + --rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) + + local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType local style,subStyle = self:GetTypeInfo(self.rewardType) - if self.filtered then + if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then subStyle = style.minimized end self.style = style @@ -587,11 +602,9 @@ icon:SetVertexColor(style.r, style.g, style.b) end - local borderStyle = style iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") iconBorder:SetTexture(PENDING_BORDER) - - iconBorder:SetVertexColor(borderStyle.r, borderStyle.g, borderStyle.b, 1) + iconBorder:SetVertexColor(style.r, style.g, style.b, 1) iconBorder:SetDesaturated(true) iconBorder:SetAlpha(subStyle.alpha or 1) @@ -599,15 +612,9 @@ trackingBorder:SetTexture(PENDING_BORDER) trackingBorder:SetVertexColor(0,0,0,1) - self.tagIcon:SetShown(self.tagSize and true or false) + self.tagIcon:SetShown((not self.filtered) and true or false) self.tagIcon:SetAtlas(self.tagAtlas) - self.tagIcon:SetAlpha(subStyle.alpha or 1) - self.Overlay:SetShown(true) - self.Overlay:ClearAllPoints(self) - self.Overlay:SetParent(self:GetParent()) - self.Overlay:SetFrameLevel(self:GetFrameLevel()+200) - self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) - self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) + self.EliteBorder:SetShown(self.isElite and not self.filtered) @@ -639,7 +646,7 @@ filtered = true end end - return filtered + self.filtered = filtered end function QuestPOI:IsShowable () @@ -647,27 +654,22 @@ local qType = self.worldQuestType if not self.worldQuest then - print('ignoring showable check') + --print('ignoring showable check') return self.used, self.filtered end self.used = TQ_IsActive(self.questID) - if qType == LE_QUEST_TAG_TYPE_PROFESSION then - qprint('hide flags:', (not self.isKnownProfession), (db.Config.ShowAllProfessionQuests == false)) if (not self.isKnownProfession) and (db.Config.ShowAllProfessionQuests == false) then - qprint(self.used) self.used = nil - qprint(self.used) end end - print(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title) - return self.used + rprint(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title) end --- Fixes icons upon size update function QuestPOI:UpdateSize () - qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', self.style, self.subStyle) + --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle) local style = self.style local subStyle = self.subStyle diff -r c0b88bd1e40b -r dbd81d49af02 WorldPlan.lua --- a/WorldPlan.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/WorldPlan.lua Thu Dec 29 13:31:20 2016 -0500 @@ -61,7 +61,7 @@ minimized = { r = 0, g = 0, b = 0, a = 0.1, iconWidth = 8, - borderWidth = 1, + borderWidth = 0, alpha = 0.5, highlightWidth = 0, maxAlertLevel = 0, @@ -97,9 +97,90 @@ WorldPlanData[key] = true end end + for _, module in ipairs(db.OrderedModules) do + if module.OnConfigUpdate then + module:OnConfigUpdate() + end + end _G.WorldPlan:Refresh() end +-- insert visual options into the tracking button menu +local DropDown_Initialize = function (self, callback, dropType) + if self ~= WorldMapFrameDropDown then + return + end + local config = WorldPlanData + local info = UIDropDownMenu_CreateInfo() + info.text = "" + info.isTitle = true + UIDropDownMenu_AddButton(info) + info.text = "|cFF00AAFFWorldPlan|r" + info.isTitle = true + UIDropDownMenu_AddButton(info) + info.isTitle = nil + info.disabled = nil + info.keepShownOnClick = true + info.tooltipOnButton = 1 + + info.text = "Enable" + info.isNotRadio = true + info.value = "EnablePins" + info.checked = config.EnablePins + info.tooltipTitle = "Enable World Quest Overlays" + info.tooltipText = "Toggle the detail layers here." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Display All Profession Quests" + info.isNotRadio = true + info.value = "ShowAllProfessionQuests" + info.checked = config.ShowAllProfessionQuests + info.tooltipTitle = "Hidden Quests" + info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Show Continent Pins" + info.isNotRadio = true + info.value = "DisplayContinentPins" + info.checked = config.DisplayContinentPins + info.tooltipTitle = "Continent Pins" + info.tooltipText = "Display quest pins on the continent map (may get cramped)." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Show Summary" + info.isNotRadio = true + info.value = "DisplayContinentSummary" + info.tooltipTitle = "Summary Bar" + info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." + info.checked = config.DisplayContinentSummary + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + --[[ + + info.text = "Nudge Pins" + info.isNotRadio = true + info.value = "NudgePins" + info.tooltipTitle = "Pin Nudging" + info.tooltipText = "Adjust the position of quest pins that overlap." + info.checked = config.NudgePins + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Fade Whiled Grouped" + info.isNotRadio = true + info.value = "FadeWhileGrouped" + info.tooltipTitle = "Group Fade" + info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." + info.checked = config.FadeWhileGrouped + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + --]] +end + + function db.print(...) for i = 1, select('#', ...) do tinsert(db.ReportChunks, tostring(select(i, ...))) @@ -292,12 +373,15 @@ if not module.RegisterEvent then module.RegisterEvent = self.RegisterEvent end + if module.OnConfigUpdate then + module:OnConfigUpdate() + end end self.initialized = true - hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) + hooksecurefunc("UIDropDownMenu_Initialize", DropDown_Initialize) hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button) print("|cFF0088FFWorldMapTrackingOptionsDropDown_OnClick|r") @@ -457,80 +541,6 @@ self.isStale = nil end --- insert visual options into the tracking button menu -WorldPlanCore.OnDropDownInitialize = function (self, callback, dropType) - if self ~= WorldMapFrameDropDown then - return - end - local config = WorldPlanData - local info = UIDropDownMenu_CreateInfo() - info.text = "" - info.isTitle = true - UIDropDownMenu_AddButton(info) - info.text = "|cFF00AAFFWorldPlan|r" - info.isTitle = true - UIDropDownMenu_AddButton(info) - info.isTitle = nil - info.disabled = nil - info.keepShownOnClick = true - info.tooltipOnButton = 1 - - info.text = "Enable" - info.isNotRadio = true - info.value = "EnablePins" - info.checked = config.EnablePins - info.tooltipTitle = "Enable World Quest Overlays" - info.tooltipText = "Toggle the detail layers here." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Display All Profession Quests" - info.isNotRadio = true - info.value = "ShowAllProfessionQuests" - info.checked = config.ShowAllProfessionQuests - info.tooltipTitle = "Hidden Quests" - info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Show Continent Pins" - info.isNotRadio = true - info.value = "DisplayContinentPins" - info.checked = config.DisplayContinentPins - info.tooltipTitle = "Continent Pins" - info.tooltipText = "Display quest pins on the continent map (may get cramped)." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Show Summary" - info.isNotRadio = true - info.value = "DisplayContinentSummary" - info.tooltipTitle = "Summary Bar" - info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." - info.checked = config.DisplayContinentSummary - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - --[[ - - info.text = "Nudge Pins" - info.isNotRadio = true - info.value = "NudgePins" - info.tooltipTitle = "Pin Nudging" - info.tooltipText = "Adjust the position of quest pins that overlap." - info.checked = config.NudgePins - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Fade Whiled Grouped" - info.isNotRadio = true - info.value = "FadeWhileGrouped" - info.tooltipTitle = "Group Fade" - info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." - info.checked = config.FadeWhileGrouped - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - --]] -end -------------------------------------------------------------------------------------------------------------------- ------------------- diff -r c0b88bd1e40b -r dbd81d49af02 WorldPlan.xml --- a/WorldPlan.xml Tue Dec 27 19:46:40 2016 -0500 +++ b/WorldPlan.xml Thu Dec 29 13:31:20 2016 -0500 @@ -39,7 +39,7 @@