# HG changeset patch # User Nenue # Date 1477257511 14400 # Node ID a2b623043970cc8c791a3711106ce790b5992784 # Parent 802abb8a10eae28975d673f809f142421a72d42e WorldQuests: - Filter interface controls reworked: Left-Click toggles inclusive filtering, right-click toggle exclusion, and holding ctrl or shift will flip or reset the other filters of that type respectively. - Fix QuestPOI texture masks disappearing when toggling filter options * new masks aren't applied until SetTexture() is called, making a seemingly redundant call necessary for the change to manifest - Implemented configuration data storage and retrieval; tracking menu options should actually do something now. - Ignore remaining time for Profession quests that aren't part of the player's profession loadout - Alternate tooltip data appears for Pet Battle quests involved in the Family Familar achievement. A list of outstanding criteria is provided in the POI tooltip, and the quest name is highlighted in the filter tooltip. ClassPlan: - actually handle the mission complete icon diff -r 802abb8a10ea -r a2b623043970 ClassPlan.lua --- a/ClassPlan.lua Sun Oct 23 07:19:53 2016 -0400 +++ b/ClassPlan.lua Sun Oct 23 17:18:31 2016 -0400 @@ -26,6 +26,7 @@ playerFirst = false, prototypes = {} } + ClassPlanMissionMixin = { templateName = 'ClassPlanMissionEntry', events = {'GARRISON_MISSION_LIST_UPDATE', 'GARRISON_MISSION_STARTED', 'GARRISON_MISSION_FINISHED', 'GARRISON_LANDINGPAGE_SHIPMENTS'},} @@ -580,6 +581,11 @@ self.Icon:SetAtlas(self.typeAtlas, false) end + if self.isComplete then + self.Done:Show() + else + self.Done:Hide() + end end diff -r 802abb8a10ea -r a2b623043970 QuestPOI.lua --- a/QuestPOI.lua Sun Oct 23 07:19:53 2016 -0400 +++ b/QuestPOI.lua Sun Oct 23 17:18:31 2016 -0400 @@ -5,6 +5,7 @@ -- local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes +local TQ_IsActive = C_TaskQuest.IsActive local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end @@ -12,6 +13,16 @@ local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end local QuestPOI = WorldPlanPOIMixin +local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" +local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" + +local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background" +local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64" +local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE" +local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64" +local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64" +local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64" + local familiars = { [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, [40277] = {npc = 97804, name = 'Tiffany Nelson'}, @@ -51,6 +62,13 @@ }, -- 7 days + 1 minute } +-- update a masked texture without messing up its blending mask +local SetMaskedTexture = function(region, file, mask) + mask = mask or POI_BORDER_MASK + region:SetMask(nil) + region:SetTexture(file) + region:SetMask(mask) +end function QuestPOI:OnEnter() local completed = select(4,GetAchievementInfo(familiars_id)) @@ -118,7 +136,7 @@ self.x = dX self.y = dY - print(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY)) + qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY)) local pX = (dX * mapWidth) local pY = (-dY * mapHeight) @@ -198,8 +216,11 @@ end else -- remove self in a timely manner - if not self.isPending then - self:Hide() + if not TQ_IsActive(self.questID) then + print('|cFFFF4400'..self:GetName()..' pin hard timeout') + if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then + self:Hide() + end end end self.timeThreschold = tl @@ -212,6 +233,84 @@ end + +function QuestPOI:Refresh () + local db = WorldPlan.db + local print = qprint + print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) + print(self.style) + + + + local questID = self.questId + local style = self.style + local borderMask = style.mask + local borderFill = style.texture + local iconBorder = self.iconBorder + local icon = self.icon + local count = self.count + + + local subStyle = self.filtered and 'minimized' or 'continent' + if subStyle ~= self.subStyle then + print( ' - changed subStyle, need to redo masks') + end + self.subStyle = subStyle + print(' - subStyle:', (self.filtered == true), self.subStyle) + + --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) + SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) + icon:SetAllPoints(self) + + if self.itemName then + local color = self.rewardColor or COMMON_COLOR + if self.itemNumber and self.target then + self.count:SetText(color.hex .. tostring(self.itemNumber)) + else + self.count:SetText(nil) + end + end + + SetMaskedTexture(iconBorder, borderFill, borderMask) + local border = (self.rewardType and db.rewardStyle[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or db.defaultStyle) + iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) + iconBorder:SetDesaturated(true) + + local trackingBorder = self.supertrackBorder + + self.highlight:SetMask(nil) + if questID == GetSuperTrackedQuestID() then + trackingBorder:SetVertexColor(0,0,0,1) + else + trackingBorder:SetVertexColor(0,0,0,0.5) + end + self.highlight:SetAllPoints(trackingBorder) + + SetMaskedTexture(trackingBorder, borderFill, borderMask) + self.highlight:SetMask(borderMask) + + local qType = self.worldQuestType + self.tagIcon:SetAtlas(self.tagAtlas) + self.tagIcon:SetTexCoord(0,1,0,1) + + + if self.isElite then + self.EliteDecal:Show() + else + self.EliteDecal:Hide() + end + + if style.showNumber then + self.label:SetText(self.itemNumber) + else + self.label:SetText(nil) + end + qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') + + + self:UpdateSize() +end + function WorldPlanFilterPinMixin:OnEnter () local filter = WorldPlan.FilterOptions[self:GetID()] local mapID = GetCurrentMapAreaID() diff -r 802abb8a10ea -r a2b623043970 WorldPlan.lua --- a/WorldPlan.lua Sun Oct 23 07:19:53 2016 -0400 +++ b/WorldPlan.lua Sun Oct 23 17:18:31 2016 -0400 @@ -22,9 +22,12 @@ local FilterPin = WorldPlanFilterPinMixin local WP_VERSION = "1.0" +local db local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end +local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end +local fbprint = DEVIAN_WORKSPACE and function(...) _G.print('FilterBar', ...) end or function() end local wipe, tremove, tinsert, pairs, floor, tContains = table.wipe, table.remove, table.insert, pairs, floor, tContains local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID @@ -49,13 +52,7 @@ local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo -local SearchFaction local PinBaseIndex = 1600 -local ShowAllProfessionQuests = false -local DisplayContinentSummary = true -local DisplayContinentPins = true -local NotifyWhenNewQuests = true -local PinRewardFilter, PinTagFilter 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 -- maps where we do our own anchors @@ -67,12 +64,6 @@ local MONEY_COLOR = {hex ='|cFFFFFF00', r=1, g=1, b=0} local COMMON_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_COMMON] --- operating flags -local superTrackedID -local currentMapName -local hasNewQuestPins -local isContinentMap - local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" @@ -164,6 +155,19 @@ } + +local defaults = { + defaultPinStyle = POI_DEFAULT_TYPE, + rewardStyle = POI_REWARD_TYPE, + filterStyle = POI_FILTER_STYLE, + ShowAllProfessionQuests = true, + DisplayContinentSummary = true, + DisplayContinentPins = true, + NotifyWhenNewQuests = true, + EnablePins = true, + FadeWhileGrouped = true, +} + -- Summary header structure local POI_FILTER_OPTIONS = { { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" }, @@ -176,12 +180,19 @@ { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 }, { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", }, { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, + { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", }, } WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID -WorldPlanCore.FilterOptions = POI_FILTER_OPTIONS WorldPlanCore.FilterStyle = POI_FILTER_STYLE +WorldPlanCore.FilterOptions = {} + +-- operating flags +local superTrackedID +local currentMapName +local hasNewQuestPins +local isContinentMap local numPins = 0 local QuestsByZone = {} local QuestsByFaction = {} @@ -189,13 +200,11 @@ local QuestsByTag = {} local QuestsByID = {} local QuestPositions = {} -local FilterInclusions = {rewardType = {}, worldQuestType = {}} -local FilterExclusions = {rewardType = {}, worldQuestType = {} } +local FilterInclusions = {rewardType = {}, worldQuestType = {}, factionID = {}} +local FilterExclusions = {rewardType = {}, worldQuestType = {}, factionID = {}} local NotificationTypes = {} local ZoneInfo = {} local SummaryHeaders = {} -WorldPlanCore.QuestsByID = QuestsByID -WorldPlanCore.QuestsByZone = QuestsByZone local FreePins = {} local NumPinFrames = 1 @@ -204,6 +213,8 @@ local notifyPlayed local scanner, wmtt, WorldMapPOIFrame +WorldPlanCore.QuestsByID = QuestsByID +WorldPlanCore.QuestsByZone = QuestsByZone local tasksQueue = {} local function OnNext (func) @@ -299,6 +310,7 @@ WorldPlanData[key] = true end end + WorldPlan:RefreshAll() end function WorldPlan:print(...) @@ -329,7 +341,6 @@ WorldPlan.modules = { WorldQuests, FilterBar, WorldPlanFlightMapMixin, } - hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) end function WorldPlan:OnEvent (event, ...) @@ -346,6 +357,7 @@ self:Setup() end elseif event == 'WORLD_MAP_UPDATE' then + self.currentMapID = GetCurrentMapAreaID() self:RefreshAll() end for i, module in ipairs(self.modules) do @@ -363,8 +375,16 @@ end WorldPlanData.key = (WorldPlanData.key or 0) + 1 self.db = WorldPlanData + self.db.WorldQuests = self.db.WorldQuests or {} + db = self.db + for k,v in pairs(defaults) do + db[k] = v + end + + self.currentMapID = GetCurrentMapAreaID() for i, module in ipairs(self.modules) do + module.db = self.db if module.Setup then module:Setup() end if not module.RegisterEvent then module.RegisterEvent = self.RegisterEvent @@ -372,14 +392,39 @@ end self.initialized = true + hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) end function WorldPlan:RefreshAll (forced) + if not self.initialized then + return + end + + POI_DEFAULT_TYPE = db.defaultPinStyle + POI_REWARD_TYPE = db.rewardStyle + POI_FILTER_STYLE = db.filterStyle + + + for i, module in ipairs(self.modules) do + if module.Reset then + print(module, 'Reset()') + module:Reset() + end + end + for i, module in ipairs(self.modules) do if module.Refresh then + print(module, 'Refresh()') module:Refresh() end end + + for i, module in ipairs(self.modules) do + if module.Cleanup then + print(module, 'Cleanup()') + module:Cleanup() + end + end end function WorldPlan:UpdateAnchors () for i, module in ipairs(self.modules) do @@ -394,6 +439,7 @@ if self ~= WorldMapFrameDropDown then return end + local db = WorldPlan.db local info = UIDropDownMenu_CreateInfo() info.text = "" @@ -407,10 +453,19 @@ info.keepShownOnClick = true info.tooltipOnButton = 1 - info.text = "Hidden World Quests" + info.text = "Enable" + info.isNotRadio = true + info.value = "EnablePins" + info.checked = db.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 = ShowAllProfessionQuests + info.checked = db.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 @@ -419,7 +474,7 @@ info.text = "Show Continent Pins" info.isNotRadio = true info.value = "DisplayContinentPins" - info.checked = DisplayContinentPins + info.checked = db.DisplayContinentPins info.tooltipTitle = "Continent Pins" info.tooltipText = "Display quest pins on the continent map (may get cramped)." info.func = DropDown_OnClick @@ -430,7 +485,16 @@ 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 = DisplayContinentSummary + info.checked = db.DisplayContinentSummary + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Fade In Groups" + 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 = db.DisplayContinentSummary info.func = DropDown_OnClick UIDropDownMenu_AddButton(info) end @@ -438,7 +502,7 @@ function WorldQuests:Setup() -- refresh positions any time blizzard does so (i.e. mousewheel zoom) hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function() - self:Refresh() + self:Refresh(true) end) -- hide the original world quest POIs @@ -451,7 +515,6 @@ end end) - end function WorldQuests:OnEvent (event, ...) @@ -469,7 +532,7 @@ self:ReleasePin(QuestsByID[questID]) end elseif event == 'SKILL_LINES_CHANGED' then - self:Refresh() + self:Refresh(true) end end @@ -541,6 +604,7 @@ -- create of update quest pins for a map and its underlying zones function WorldQuests:GetPinsForMap (mapID) + local print = wqprint mapID = mapID or GetCurrentMapAreaID() superTrackedID = GetSuperTrackedQuestID() if not mapID then @@ -575,7 +639,7 @@ end if hasNewQuestPins and not self.fullSearch then print('|cFF00FF00NEW PINS DO ANCHOR THINGS') - self:Refresh () + self:Refresh (true) hasNewQuestPins = nil end end @@ -599,7 +663,7 @@ TQ_RequestPreloadRewardData(questID) hasPendingQuestData = true else - print('|cFF00FF88HaveQuestData|r') + wqprint('|cFF00FF88Quest Data Received|r') pin.mapID = pin.mapID or C_TaskQuest.GetQuestZoneID(questID) -- set reward category @@ -688,28 +752,37 @@ end function WorldQuests:Refresh(forced) - print('pushing |cFF00FF88'..tostring(self)..':Refresh()|r') + local print = wqprint + print('|cFF00FF88'..tostring(self)..':Refresh()|r') if not WorldMapPOIFrame:IsVisible() then return end - self:Reset() + if forced then + self:Reset() + end self:UpdateAnchors() - self:Cleanup () + + if forced then + self:Cleanup () + end end -- prepares elements for a map update function WorldQuests:Reset () + local print = wqprint + print('|cFF00FF88'..tostring(self)..':Reset()|r') wipe(QuestPositions) wipe(QuestsByReward) wipe(QuestsByTag) for questID, pin in pairs(QuestsByID) do pin.used = nil end - qprint(tostring(self)..':|cFFFFFF00Reset()|r') end -- update visibility states of all pins function WorldQuests:UpdateAnchors (submapID) + local print = wqprint + local db = WorldPlan.db local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo() if isMicroDungeon then return @@ -718,7 +791,7 @@ local currentMap = GetCurrentMapAreaID() local submapID = submapID or currentMap - if submapID == BROKEN_ISLES_ID and (not DisplayContinentPins) then + if submapID == BROKEN_ISLES_ID and (not db.DisplayContinentPins) then print('not updating map for reasons') return end @@ -736,45 +809,45 @@ local hostFrame = WorldMapPOIFrame local mapWidth, mapHeight = hostFrame:GetSize() for questID, pin in pairs(pins) do - if pin:IsShowable(true) then - pin:SetFrameLevel(PinBaseIndex+numPins) + pin:IsShowable() + if pin.used then + pin:SetFrameLevel(PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins) + print('level', PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins) pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight) - pin.used = true numPins = numPins + 1 end end end end - - - -- shows, animates, or hides pins based on their current visibility flags local debug_show = {} local debug_animate = {} local debug_hide = {} function WorldQuests:Cleanup () - local showQuestPOI = GetCVarBool("questPOI") + local print = wqprint + local showQuestPOI = db.EnablePins print('|cFFFFFF00'..tostring(self)..':Cleanup()|r') - wipe(QuestsByReward) - wipe(QuestsByTag) + local mapID = GetCurrentMapAreaID() + isContinentMap = (mapID == BROKEN_ISLES_ID) + wipe(debug_show) wipe(debug_animate) wipe(debug_hide) - local mapID = GetCurrentMapAreaID() - isContinentMap = (mapID == BROKEN_ISLES_ID) - -- continent or zone sizing - local subStyle = isContinentMap and 'continent' or 'zone' + local fadeGrouped = (db.FadeWhileGrouped and IsInGroup()) numPins = 0 for questID, pin in pairs(QuestsByID) do -- can we show it? if showQuestPOI and (pin.used) then - pin.subStyle = pin.filtered and 'minimized' or subStyle - pin:GetSizeMetrics() + pin:Refresh() - + if fadeGrouped then + pin:SetAlpha(0.25) + else + pin:SetAlpha(1) + end -- is it a new quest? if pin.isNew then if not pin.isAnimating then @@ -793,34 +866,29 @@ end end tinsert(debug_animate,questID) + else + + print('animating? ', questID, 'filtered:', pin.filtered) end -- trap new but animating pins here else -- hard show existing pin + print('refresh #', questID, 'filtered:', pin.filtered) pin:Show() tinsert(debug_show,questID) end else + if pin:IsShown() then + tinsert(debug_hide,questID) + end + pin.isAnimating = nil + pin.FadeIn:Stop() pin:Hide() - tinsert(debug_hide,questID) - end - - -- is it part of the current map? - if pin.used then - local rewardType = pin.rewardType - local tagType = pin.worldQuestType - if rewardType then - QuestsByReward[rewardType] = QuestsByReward[rewardType] or {} - tinsert(QuestsByReward[rewardType], pin) - end - if tagType then - QuestsByTag[tagType] = QuestsByTag[tagType] or {} - tinsert(QuestsByTag[tagType], pin) - end end end print(' adding:', table.concat(debug_animate, ',' )) - print(' showing:', table.concat(debug_show, ',' )) + print(' refresh:', table.concat(debug_show, ',' )) + print(' hiding:', table.concat(debug_hide, ',' )) hasNewQuestPins = nil notifyPlayed = nil end @@ -871,111 +939,53 @@ -function QuestPOI:Refresh () - print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) - qprint(self.style) - - local questID = self.questId - local style = self.style - local borderMask = style.mask - local borderFill = style.texture - local iconBorder = self.iconBorder - local icon = self.icon - local count = self.count - - --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) - SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) - icon:SetAllPoints(self) - - if self.itemName then - local color = self.rewardColor or COMMON_COLOR - if self.itemNumber and self.target then - self.count:SetText(color.hex .. tostring(self.itemNumber)) - else - self.count:SetText(nil) - end - end - - SetMaskedTexture(iconBorder, borderFill, borderMask) - local border = (self.rewardType and POI_REWARD_TYPE[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or COMMON_COLOR) - iconBorder:SetVertexColor(border.r, border.g, border.b, border.a) - iconBorder:SetDesaturated(true) - - local trackingBorder = self.supertrackBorder - - self.highlight:SetMask(nil) - if questID == GetSuperTrackedQuestID() then - trackingBorder:SetVertexColor(0,0,0,1) - else - trackingBorder:SetVertexColor(0,0,0,0.5) - end - self.highlight:SetAllPoints(trackingBorder) - - SetMaskedTexture(trackingBorder, borderFill, borderMask) - self.highlight:SetMask(borderMask) - - local qType = self.worldQuestType - self.tagIcon:SetAtlas(self.tagAtlas) - self.tagIcon:SetTexCoord(0,1,0,1) - - - if self.isElite then - self.EliteDecal:Show() - else - self.EliteDecal:Hide() - end - - if style.showNumber then - self.label:SetText(self.itemNumber) - else - self.label:SetText(nil) - end - qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') +function WorldQuests:FilterCheckByID(questID) + local pin = WorldQuests:GetPinByQuestID(questID) + return pin:IsShowable() end - - -function QuestPOI:IsShowable (ignoreFilters) +function QuestPOI:IsShowable () + local print = wqprint + local db = WorldPlan.db local qType = self.worldQuestType local rType = self.rewardType self.filtered = nil - print(' |cFFFF4400IsShowable()|r', self.tradeskillLineIndex, self.title) + self.whiteListed = nil + self.used = true + local whiteListed, blackListed for filterKey, includes in pairs(FilterInclusions) do local controlValue = self[filterKey] if FilterInclusions[filterKey][controlValue] then - whiteListed = true + self.filtered = nil + self.whiteListed = true break end if FilterExclusions[filterKey][controlValue] then - blackListed = true + self.filtered = true end end - print(blackListed, whiteListed) - self.filtered = (blackListed and (not whiteListed)) if not TQ_IsActive(self.questID) then - print(' quest is dead') - return false + self.used = nil end if qType == LE_QUEST_TAG_TYPE_PROFESSION then - - if not (ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then - print(' non-profession') - return false + if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then + self.used = nil end end - return true + print(' |cFFFF4400IsShowable()|r', self.used, self.filtered, self.title) + return self.used, self.filtered end function QuestPOI:UpdateTimer (timeLeft, timeType) print('|cFF0088FFUpdatePinTimer()|r') end ---- Re-acquires size information and triggers things -function QuestPOI:GetSizeMetrics (style, subStyle) +--- Fixes icons upon size update +function QuestPOI:UpdateSize (style, subStyle) self.style = self.style or POI_DEFAULT_TYPE self.subStyle = self.subStyle or 'continent' @@ -991,10 +1001,7 @@ self.NoIcon = subStyle.NoIcon self:SetSize(self.currentWidth, self.currentWidth) -end --- triggered by OnSizeChanged script -function QuestPOI:OnSizeChanged () local iconBorder = self.iconBorder local trackingBorder = self.supertrackBorder local tag = self.tagIcon @@ -1025,7 +1032,9 @@ tag:Hide() end + --qprint('using mask:', mask, self.name ) self.icon:SetMask(mask) + self.icon:SetTexture(self.icon:GetTexture()) self.iconBorder:SetMask(mask) self.supertrackBorder:SetMask(mask) @@ -1058,17 +1067,67 @@ return passesFilter end + +local bountyIndex local debug_headers = {} -function FilterBar:Refresh() - local mapID = GetCurrentMapAreaID() + +function FilterBar:Setup() + self:GetFilters() +end + +function FilterBar:OnEvent(event,...) + if event == 'QUEST_LOG_UPDATE' then + self:Reset() + self:Refresh() + end +end + +function FilterBar:GetFilters() + + local print = fbprint + wipe(WorldPlan.FilterOptions) + + for index, info in ipairs(POI_FILTER_OPTIONS) do + tinsert(WorldPlan.FilterOptions, info) + end + self.bounties, self.numBounties = GetQuestBountyInfoForMapID(WorldPlan.currentMapID) + self.BountyFilters = {} + for index, data in ipairs(self.bounties) do + local info = self.BountyFilters[index] + if not info then + info = {} + self.BountyFilters[index] = info + end + + local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID)) + + info.filterKey = 'factionID' + info.filterValue = data.factionID + info.label = questTitle + info.texture = data.icon + print('loading emissary', questTitle) + tinsert(WorldPlan.FilterOptions, info) + --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, + end +end + +function FilterBar:Reset() + self:GetFilters() +end + +function FilterBar:Refresh(forced) + local print = fbprint local blocks = self.SummaryHeaders + local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton local numHeaders = 0 - local lastButton - local pinSize, borderSize, trackingSize = 20, 2, 2 - print('|cFF00FF88'..tostring(self)..':Refresh()|r') - for index, info in pairs(POI_FILTER_OPTIONS) do + print('|cFF00FF88'..tostring(self)..':Refresh()|r', 'currentMap=',WorldPlan.currentMapID) + + + local quests = QuestsByZone[WorldPlan.currentMapID] or QuestsByID + + + for index, info in ipairs(WorldPlan.FilterOptions) do local numQuests = 0 - local quests = QuestsByZone[mapID] or QuestsByID for questID, pin in pairs(quests) do if pin.used then @@ -1079,7 +1138,7 @@ end end end - print(tostring(index).. ' ("'..tostring(info.label)..'"'.. tostring(rewardFilter).. ', '..tostring(tagFilter) .. ', '..tostring(numQuests)..')') + print(tostring(index).. ' ("'..tostring(info.label)..'" f('.. tostring(info.filterKey).. '='..tostring(info.filterValue) .. '), '..tostring(numQuests)..')') if numQuests >= 1 then numHeaders = numHeaders + 1 @@ -1096,48 +1155,61 @@ end button:SetID(index) - button.lastButton = lastButton + button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0 + button.relativeFrame = relativeFrame button:Refresh(info, (numHeaders == 1), numQuests) button:Show() - lastButton = button + print(' using', button.label:GetText()) + relativeFrame = button end end - -- hide trailing buttons - for i = numHeaders + 1, #POI_FILTER_OPTIONS do - if blocks[i] then - blocks[i]:Hide() + + self.numHeaders = numHeaders + for i = numHeaders + 1, #WorldPlan.FilterOptions do + if self.SummaryHeaders[i] then + self.SummaryHeaders[i]:Hide() end end end +function FilterBar:Cleanup() + + -- hide trailing buttons +end + function FilterPin:Refresh(info, isFirst, numQuests) - info = info or POI_FILTER_OPTIONS[self:GetID()] + local print = fbprint isFirst = isFirst or self.isFirst numQuests = numQuests or self.numQuests - self.isFirst = isFirst - self.numQuests = numQuests - self.filterKey = info.filterKey - self.filterValue = info.filterValue - self.tagID = info.tagID + if info then + self.isFirst = isFirst + self.numQuests = numQuests + self.filterKey = info.filterKey + self.filterValue = info.filterValue + self.tagID = info.tagID - self.icon:ClearAllPoints() - self.icon:SetTexture(info.texture) - self.icon:SetAllPoints(self) - self.supertrackBorder:Hide() - self.label:SetText(numQuests) - self:Show() + self.icon:ClearAllPoints() + self.icon:SetTexture(info.texture) + self.icon:SetAllPoints(self) + self.supertrackBorder:Hide() + self.label:SetText(numQuests) + self:Show() + end + self.itemTexture = self.texture + if isFirst then - self:SetPoint('TOP', WorldMapFrame.UIElementsFrame.TrackingOptionsButton, 'BOTTOM', 0, -5) + self:SetPoint('TOP', self.relativeFrame, 'BOTTOM', 0, -5) else - self:SetPoint('TOPRIGHT', self.lastButton, 'BOTTOMRIGHT', 0, -(3*2 + 1 + (info.spacing or 0))) + self:SetPoint('TOPRIGHT', self.relativeFrame, 'BOTTOMRIGHT', 0, -(3*2 + 1 + (self.spacing or 0))) + end + print('anchor to', self.relativeFrame:GetName()) - print(self.filterKey, self.filterValue) local r, g, b, a = 1,1,1,1 if self.filterKey then if FilterInclusions[self.filterKey][self.filterValue] == true then @@ -1147,9 +1219,7 @@ end end self.iconBorder:SetVertexColor(r, g, b, a) - - - self:GetSizeMetrics() + self:UpdateSize() end function FilterPin:OnLoad() @@ -1172,10 +1242,16 @@ -- shift-click: reset filter -- click: rotate through include(1), exclude(-1), ignore(nil) function FilterPin:OnClick (button) + local print = fbprint local filterKey = self.filterKey local filterValue = self.filterValue - print('click', filterKey, filterValue) + + local operation = opPrefix + local setExclude = (button == 'RightButton') + local filterTable = setExclude and FilterExclusions or FilterInclusions + local opposingTable = setExclude and FilterInclusions or FilterExclusions + if not filterKey then -- resetting @@ -1186,52 +1262,33 @@ wipe(v) end else - local setExclude = (button == 'RightButton') - if IsControlKeyDown() then - if setExclude then - if FilterExclusions[filterKey][filterValue] then - FilterExclusions[filterKey][filterValue] = nil - else - FilterExclusions[filterKey][filterValue] = true - end - FilterInclusions[filterKey][filterValue] = nil - else - if FilterInclusions[filterKey][filterValue] == true then - FilterInclusions[filterKey][filterValue] = nil - else - FilterInclusions[filterKey][filterValue] = true - end - FilterExclusions[filterKey][filterValue] = nil - end - elseif IsShiftKeyDown() then - FilterInclusions[filterKey][filterValue] = nil - FilterExclusions[filterKey][filterValue] = nil + + if filterTable[filterKey][filterValue] then + filterTable[filterKey][filterValue] = nil else - print('limit to', filterKey, filterValue) - if setExclude then - FilterExclusions[filterKey][filterValue] = true - FilterInclusions[filterKey][filterValue] = nil - else - FilterInclusions[filterKey][filterValue] = true - FilterExclusions[filterKey][filterValue] = nil - end + filterTable[filterKey][filterValue] = true + opposingTable[filterKey][filterValue] = nil + end + + local overrideFilters = IsControlKeyDown() + local overrideOpposing = IsShiftKeyDown() for k, info in ipairs(POI_FILTER_OPTIONS) do - if info.filterKey and ((info.filterKey ~= filterKey) or (info.filterValue ~= filterValue)) then - if setExclude then - FilterExclusions[info.filterKey][info.filterValue] = nil - FilterInclusions[info.filterKey][info.filterValue] = true - else - FilterExclusions[info.filterKey][info.filterValue] = true - FilterInclusions[info.filterKey][info.filterValue] = nil + if (info.filterKey == filterKey) and (info.filterValue ~= filterValue) then + if overrideFilters then + filterTable[info.filterKey][info.filterValue] = nil + opposingTable[info.filterKey][info.filterValue] = true + elseif overrideOpposing then + filterTable[info.filterKey][info.filterValue] = nil + opposingTable[info.filterKey][info.filterValue] = nil end - end end - end + end + print('|cFF00FF88Filter Update:', filterKey, filterValue, operation) WorldPlan:RefreshAll() end diff -r 802abb8a10ea -r a2b623043970 WorldPlan.xml --- a/WorldPlan.xml Sun Oct 23 07:19:53 2016 -0400 +++ b/WorldPlan.xml Sun Oct 23 17:18:31 2016 -0400 @@ -134,7 +134,6 @@ -