Mercurial > wow > worldplan
changeset 36:21bcff08b0f4
WorldPlan:
- Quest pins are now placed on the flight map. Their visibility rules will mirror the filter options from the world map.
- Filter controls polish:
- First click negates other reward type filters. Subsequent clicks will then toggle individual reward types until the filters are reset via Right-click.
- Adheres to the Blizzard CVars added in patch 7.1
- Numerous optimizations to how data and visual updates are handled; should see an even better load time, and snappier world map interaction.
ClassPlan:
- The 'Available Missions' list is now recorded. It can be reviewed by clicking on the mission list heading.
- Information filtering by character and realm.
author | Nenue |
---|---|
date | Fri, 04 Nov 2016 01:40:39 -0400 |
parents | 26dfa661daa7 |
children | 78cf1f19856a |
files | FilterBar.lua FlightMap.lua FlightMap.xml QuestPOI.lua WorldPlan.lua WorldPlan.toc WorldPlan.xml WorldQuests.lua |
diffstat | 8 files changed, 415 insertions(+), 329 deletions(-) [+] |
line wrap: on
line diff
--- a/FilterBar.lua Thu Nov 03 17:29:15 2016 -0400 +++ b/FilterBar.lua Fri Nov 04 01:40:39 2016 -0400 @@ -40,9 +40,9 @@ local familiars_id = 9696 local DEFAULT_FILTER_LAYOUT = { - PinSize = 22, - Border = 3, - TrackingBorder = 2, + iconWidth = 24, + borderWidth = 3, + highlightWidth = 2, TagSize = 12, TimeleftStage = 3, showNumber = true, @@ -161,7 +161,9 @@ local numHeaders = 0 print('|cFF00FF88'..self:GetName()..':Update()|r', 'currentMap=',WorldPlan.currentMapID) - + local layout = DEFAULT_FILTER_LAYOUT + local borderWidth = layout.iconWidth + (layout.borderWidth * 2) + local highlightWidth = borderWidth + (layout.highlightWidth * 2) local quests = WorldPlanQuests.QuestsByZone[WorldPlan.currentMapID] or WorldPlanQuests.QuestsByID local foundQuests = questResults[1] for index, info in ipairs(self.filterList) do @@ -186,25 +188,22 @@ local button = blocks[numHeaders] if not blocks[numHeaders] then button = CreateFrame('Button', 'WorldPlanFilterButton'..numHeaders, WorldMapScrollFrame, 'WorldPlanFilterPin') + button:SetSize(borderWidth, borderWidth) - button:SetSize(24,24) - button.icon:ClearAllPoints() - button.icon:SetAllPoints(button) + button.icon:SetSize(layout.iconWidth, layout.iconWidth) + button.RewardBorder:SetSize(borderWidth, borderWidth) + button.HighlightBorder:SetSize(highlightWidth, highlightWidth) + button.RewardBorder:SetMask(filterMask) + button.RewardBorder:SetDesaturated(true) - button.iconBorder:SetPoint('TOPLEFT', button, 'TOPLEFT', -2, 2) - button.iconBorder:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', 2, -2) - button.iconBorder:SetMask(filterMask) - button.iconBorder:SetTexture(filterFill) - button.iconBorder:SetDesaturated(true) - - button.supertrackBorder:Hide() + button.HighlightBorder:Hide() blocks[numHeaders] = button end button.info = info button.questList = questResults[resultIndex] button:SetID(index) - button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0 + button.spacing = ((relativeFrame.cVar and (not info.cVar)) or (relativeFrame.filterKey ~= info.filterKey)) and 5 or 0 button.relativeFrame = relativeFrame button:Refresh((numHeaders == 1), numQuests) button:Show() @@ -233,21 +232,12 @@ function WorldPlanFilterPinMixin:OnEnter() if self.questList and #self.questList >= 1 then GameTooltip:SetOwner(self, 'ANCHOR_LEFT') - GameTooltip_ClearInsertedFrames(GameTooltip) GameTooltip:AddLine(self.info.label) for index, pin in ipairs(self.questList) do local colorInfo = (pin.quality and ITEM_QUALITY_COLORS[pin.quality]) or rgbWhite - GameTooltip:AddLine(pin.title ..(pin.cheevos and " |cFFFFFF00!|R" or ''), colorInfo.r, colorInfo.g, colorInfo.b) - GameTooltip:AddTexture(pin.itemTexture) - local cLine = GameTooltip:NumLines() - 1 - --print(cLine, _G['GameTooltipTexture'..cLine]:GetTexture()) - if type(pin.itemTexture) == 'number' then - --- voodoo workaround for IDs getting coerced to string - _G['GameTooltipTexture'..cLine]:Show() - _G['GameTooltipTexture'..cLine]:SetTexture(pin.itemTexture) - end - GameTooltip:Show() + GameTooltip:AddLine('|T'.. tostring(pin.itemTexture)..':16:16|t ' .. pin.title ..(pin.cheevos and " |cFFFFFF00!|R" or ''), colorInfo.r, colorInfo.g, colorInfo.b) end + GameTooltip:Show() end end @@ -279,14 +269,14 @@ if isFirst then self:SetPoint('TOP', self.relativeFrame, 'BOTTOM', 0, -5) else - self:SetPoint('TOPRIGHT', self.relativeFrame, 'BOTTOMRIGHT', 0, -(3 + (self.spacing or 0))) + self:SetPoint('TOPRIGHT', self.relativeFrame, 'BOTTOMRIGHT', 0, -(self.spacing or 0)) end print('anchor to', self.relativeFrame:GetName(), info.mask) local r, g, b, a = 1,1,1,1 local desaturated = false if self.cVar then - self.iconBorder:SetVertexColor(1, 1, 1, 1) + self.RewardBorder:SetVertexColor(1, 1, 1, 1) if GetCVarBool(self.cVar) then self.icon:SetVertexColor(1,1,1,1) self:SetAlpha(1) @@ -298,12 +288,20 @@ self:SetAlpha(1) if WorldPlan.UsedFilters[self.filterKey] then if WorldPlan.UsedFilters[self.filterKey] == self.filterValue then - self.iconBorder:SetVertexColor(0, 1, 0) + self.RewardBorder:SetVertexColor(0, 1, 0) else - self.iconBorder:SetVertexColor(1, 0, 0) + self.RewardBorder:SetVertexColor(1, 0, 0) end else - self.iconBorder:SetVertexColor(1, 1, 1, 1) + if self.filterKey == 'worldQuestType' then + self.RewardBorder:SetVertexColor(0, 1, 1) + elseif self.filterKey == 'factionID' then + self.RewardBorder:SetVertexColor(1, 1, 0) + else + + self.RewardBorder:SetVertexColor(0.5, 0.5, 0.5) + end + end end @@ -315,6 +313,7 @@ self:SetFrameStrata('HIGH') self:SetFrameLevel(151) self:SetScript('OnUpdate', nil) + WorldPlanPOIMixin.OnLoad(self) end function WorldPlanFilterPinMixin:OnUpdate () @@ -329,43 +328,69 @@ -- shift-click: reset filter -- click: rotate through include(1), exclude(-1), ignore(nil) +local filtered_report = {} function WorldPlanFilterPinMixin:OnClick (button) print('|cFF00FF88'..self:GetName()..':OnClick()|r', filterKey, filterValue, operation) local filterKey = self.filterKey local filterValue = self.filterValue + local cVar = self.cVar + local parent = self:GetParent() + local operation = opPrefix + local setDirty = false - - local operation = opPrefix - - - if not filterKey then + local resetMode = (button == 'RightButton') + wipe(filtered_report) + if not (filterKey or cVar) then wipe(WorldPlan.UsedFilters) for i, info in ipairs(DEFAULT_FILTER_LIST) do if info.cVar then + if GetCVar(info.cVar) ~= 1 then + tinsert(filtered_report, '|cFF888888'.. tostring(info.label) ..'|r') + end SetCVar(info.cVar, 1) end end - elseif self.cVar then + elseif cVar then + WorldPlan:print('Toggling cvar filter:', cVar) + if (not parent.isDirty) or resetMode then for i, info in ipairs(DEFAULT_FILTER_LIST) do if info.cVar then - if (info.cVar ~= self.cVar) and (button == 'LeftButton') then - SetCVar(info.cVar, 0) + local value = GetCVar(info.cVar) + if resetMode then + value = 1 + parent.isDirty = nil else - SetCVar(info.cVar, 1) + + if (cVar ~= info.cVar) then + value = 0 + else + value = 1 + end + setDirty = true + end + SetCVar(info.cVar, value) end end + if setDirty then + parent.isDirty = true + end + else + SetCVar(cVar, (GetCVarBool(cVar) and 0) or 1) + end else - local setInclude = (button == 'LeftButton') local flushValue print('') if WorldPlan.UsedFilters[filterKey] == filterValue then WorldPlan.UsedFilters[filterKey] = nil + tinsert(filtered_report, '|cFFFF0000'.. tostring(filterKey) ..'|r') else WorldPlan.UsedFilters[filterKey] = filterValue + tinsert(filtered_report, '|cFF00FF00'.. tostring(filterKey) ..'|r') end end + WorldPlan:print('Changed:', table.concat(filtered_report, ', ')) WorldPlan:Refresh(true) end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FlightMap.lua Fri Nov 04 01:40:39 2016 -0400 @@ -0,0 +1,132 @@ + +local print = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end +local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end +local wipe, pairs, ipairs = wipe, pairs, ipairs +local HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest = HaveQuestData, QuestUtils_IsQuestWorldQuest, C_MapCanvas, C_TaskQuest + +WorldPlanFlightMapHandler = { + TaskQueue = {} +} +WorldPlanDataProvider = {} +WorldPlanDataPinMixin = {} + +function WorldPlanFlightMapHandler:OnLoad() + print('MapCanvas Module') + self:RegisterEvent('ADDON_LOADED') +end +function WorldPlanFlightMapHandler:OnEvent(event, arg) + if arg == "Blizzard_FlightMap" then + print('sending data provider') + local dataProvider = Mixin(MapCanvasDataProviderMixin, WorldPlanDataProvider) + WorldPlanDataPinMixin = Mixin(MapCanvasPinMixin, WorldPlanDataPinMixin) + WorldPlanDataPinMixin.OnNext = function(...) self:OnNext(...) end + FlightMapFrame:AddDataProvider(dataProvider) + end +end + +function WorldPlanFlightMapHandler:OnNext(func) + tinsert(self.TaskQueue, func) +end + +function WorldPlanFlightMapHandler:OnUpdate() + if #self.TaskQueue >= 1 then + print('firing scheduled task ('.. tostring(#self.TaskQueue) ..' remaining)') + local func = tremove(self.TaskQueue, 1) + func() + end +end + +function WorldPlanDataProvider:OnShow() + assert(self.ticker == nil); + self.ticker = C_Timer.NewTicker(10, function() self:RefreshAllData() end); +end +function WorldPlanDataProvider:OnHide() + self.ticker:Cancel(); + self.ticker = nil; +end + +function WorldPlanDataProvider:OnAdded(mapCanvas) + self.activePins = {}; + self.owningMap = mapCanvas +end + + +function WorldPlanDataProvider:RefreshAllData() + local print = print + print('|cFFFF0088'..self.owningMap:GetName()..':RefreshAllData()|r') + + + local pinsToRemove = {}; + for questId in pairs(self.activePins) do + pinsToRemove[questId] = true; + end + + + local mapAreaID = self:GetMap():GetMapID(); + for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do + local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); + print(zoneMapID, zoneName) + if zoneDepth <= 1 then -- Exclude subzones + local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneMapID, mapAreaID); + + if taskInfo then + for i, info in ipairs(taskInfo) do + if HaveQuestData(info.questId) then + if QuestUtils_IsQuestWorldQuest(info.questId) then + local pin = WorldPlanQuests:AcquirePin(info.questId, zoneMapID) + pin:RefreshData(info) + 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") + frame:SetAlphaLimits(1, 0.7, 1) + frame:SetScalingLimits(1, 3, 1.5); + 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.isStale = true + pin:SetParent(frame) + pin:ClearAllPoints() + pin:SetPoint('CENTER', frame, 'CENTER') + + end + pin:SetShown(pin.used) + end + end + end + end + end + end + + for questId in pairs(pinsToRemove) do + self:GetMap():RemovePin(self.activePins[questId]); + self.activePins[questId] = nil; + end + --self:GetMap():RemoveAllPinsByTemplate("WorldQuestPinTemplate"); + +end + +function WorldPlanDataPinMixin:OnShow() + print('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r') +end + +function WorldPlanDataPinMixin:OnMouseEnter () + self.pin:OnEnter() +end + +function WorldPlanDataPinMixin:OnMouseLeave () + self.pin:OnLeave() +end + +function WorldPlanDataPinMixin:RemoveAllData() + wipe(self.activePins); + self:GetMap():RemoveAllPinsByTemplate("WorldPlanFlightPin"); +end \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FlightMap.xml Fri Nov 04 01:40:39 2016 -0400 @@ -0,0 +1,18 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ +..\FrameXML\UI.xsd"> + <Script file="FlightMap.lua" /> + + <Frame name="WorldPlanFlightMapHandler" mixin="WorldPlanFlightMapHandler" parent="WorldPlan"> + + + <Scripts> + <OnLoad method="OnLoad" /> + <OnEvent method="OnEvent" /> + <OnUpdate method="OnUpdate" /> + </Scripts> + </Frame> + + <Frame name="WorldPlanFlightPin" mixin="WorldPlanDataPinMixin" hidden="true" flattenRenderLayers="true" frameStrata="MEDIUM" enableMouseMotion="true" virtual="true"> + <Size x="50" y="50"/> + </Frame> +</Ui> \ No newline at end of file
--- a/QuestPOI.lua Thu Nov 03 17:29:15 2016 -0400 +++ b/QuestPOI.lua Fri Nov 04 01:40:39 2016 -0400 @@ -53,29 +53,29 @@ local subStyles = { continent = { - PinSize = 14, - Border = 2, - TrackingBorder = 1, + iconWidth = 14, + borderWidth = 2, + highlightWidth = 1, TagSize = 6, - TimeleftStage = 0, + maxAlertLevel = 0, showNumber = false, numberFontObject = 'WorldPlanFont' }, zone = { - PinSize = 22, - Border = 3, - TrackingBorder = 2, + iconWidth = 22, + borderWidth = 3, + highlightWidth = 2, TagSize = 12, - TimeleftStage = 3, + maxAlertLevel = 3, showNumber = true, numberFontObject = 'WorldPlanNumberFontThin' }, minimized = { - PinSize = 4, - Border = 0, - TrackingBorder = 1, + iconWidth = 4, + borderWidth = 0, + highlightWidth = 1, NoIcon = true, - TimeleftStage = 1, + maxAlertLevel = 1, showNumber = false, } } @@ -167,7 +167,10 @@ end function WorldPlanPOIMixin:OnEnter() - WorldMap_HijackTooltip(self) + if not WorldMapFrame:IsVisible() then + WorldMap_HijackTooltip(self) + end + local completed = select(4,GetAchievementInfo(familiars_id)) if not completed then if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then @@ -367,7 +370,6 @@ end function WorldPlanPOIMixin:OnShow () - qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) -- pop this on principle if self.isNew or self.isStale then @@ -377,12 +379,14 @@ -- is it a new quest? if self.isNew then - print('|cFFFFFF00popping new pin handler') + qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) + --qprint('|cFFFFFF00popping new pin handler') self:OnNew() elseif not self.isAnimating then self:SetAlpha(1) end + self.Overlay:SetShown(true) --WorldPlan:print(self:GetAlpha()) end @@ -393,6 +397,7 @@ self:SetAlpha(1) end + self.Overlay:SetShown(false) end function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) @@ -423,8 +428,9 @@ function WorldPlanPOIMixin:OnLoad() qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db) self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') - self.style = WorldPlan.db.defaultPinStyle - self.subStyle = WorldPlan.db.defaultPinStyle.continent + + self.count = self.Overlay.count + self.timeLabel = self.Overlay.timeLabel end function WorldPlanPOIMixin:OnEvent(event, ...) @@ -450,7 +456,7 @@ return end if self.isStale and not self.isAnimating then - print('|cFFFFFF00push poi update') + wprint('|cFFFFFF00push poi update') self:Refresh() return end @@ -471,10 +477,10 @@ -- update time elements - local tl = self.timeThreschold + local tl = self.alertLevel local timeLeft = TQ_GetQuestTimeLeftMinutes(questID) if timeLeft > 0 then - local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.TimeleftStage) + local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel) if tl ~= timeState then tl = timeState self.timeLabel:SetText(text) @@ -488,7 +494,7 @@ end end end - self.timeThreschold = tl + self.alertLevel = tl if self:IsMouseOver() then self.MouseGlow:Show() @@ -506,81 +512,50 @@ local questID = self:GetID() - local style,subStyle = WorldPlanQuests:GetTypeInfo(self.rewardType) - if self.filtered then - subStyle = style.minimized - end - self.style = style - self.subStyle = subStyle - - - local borderMask = style.mask - local borderFill = style.texture - local iconBorder = self.iconBorder + local iconBorder = self.RewardBorder + local trackingBorder = self.HighlightBorder local icon = self.icon local count = self.count - self.hasNumeric = style.hasNumeric - self.numberRGB = style.numberRGB - self.showNumber = subStyle.showNumber --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 - - - if self.hasNumeric then - if subStyle.numberFontObject then - --wqprint('change font', _G[subStyle.numberFontObject]:GetName()) - self.count:SetFontObject(_G[subStyle.numberFontObject]) - end --wqprint('filtered:', self.filtered, 'showNumber:', self.showNumber) - self.count:SetShown(self.showNumber) self.count:SetText(self.itemNumber) - self.count:SetTextColor(unpack(self.numberRGB)) - else - self.count:SetShown(false) - self.count:SetText(nil) - end - + end + if self.itemTexture then + icon:SetTexture(self.itemTexture) + icon:SetMask("Interface\\Minimap\\UI-Minimap-Background") end - SetMaskedTexture(iconBorder, borderFill, borderMask) local border = self:GetTypeInfo(self.rewardType) 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.EliteBorder:Show() - else - self.EliteBorder:Hide() - end + self.EliteBorder:SetShown(self.isElite and not self.filtered) --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') --print(' - subStyle:', (self.filtered == true), self.subStyle) + self.Overlay:SetShown(self:IsShown()) + self.Overlay:SetParent(self:GetParent()) + self.Overlay:SetFrameLevel(self:GetFrameLevel()+200) + self.Overlay:SetAllPoints(self) + self:UpdateSize() @@ -598,24 +573,31 @@ function QuestPOI:IsShowable () - local print = wqprint + local print = qprint local db = WorldPlan.db local qType = self.worldQuestType local rType = self.rewardType self.filtered = nil self.used = true + for filterKey, value in pairs(WorldPlan.UsedFilters) do + print('|cFFFF4400', filterKey, self[filterKey]) + if self[filterKey] ~= value then + self.filtered = true + end + end self.questId = self:GetID() if self.rewardType then - if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then - self.filtered = true - end - else - for filterKey, value in pairs(WorldPlan.UsedFilters) do - if self[filterKey] ~= value then + if cvar_check[self.rewardType] then + if self.rewardType == REWARD_CASH then + print('##', cvar_check[self.rewardType], GetCVarBool(cvar_check[self.rewardType])) + end + if not GetCVarBool(cvar_check[self.rewardType]) then self.filtered = true + end + end end @@ -626,7 +608,7 @@ self.used = nil end end - print(' |cFFFF4400IsShowable()|r', self.isNew, self.isAnimating, self.used, self.filtered, self.title) + print(' |cFF'.. (((self.rewardType == REWARD_CASH) and 'FFFF00') or '0088FF') ..'IsShowable()|r ', cvar_check[self.rewardType], 'used:', self.used, 'filtered:', self.filtered, self.title) return self.used, self.filtered end @@ -635,52 +617,46 @@ end --- Fixes icons upon size update -function QuestPOI:UpdateSize (style, subStyle) - style = style or self.style - subStyle = subStyle or self.subStyle +function QuestPOI:UpdateSize () + local style,subStyle = self:GetTypeInfo(self.rewardType) + if self.filtered then + subStyle = style.minimized + end --qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle) - self.currentWidth = subStyle.PinSize - self.borderSize = subStyle.Border - self.trackingBorderSize = subStyle.TrackingBorder - self.tagSize = subStyle.TagSize - self.TimeleftStage = subStyle.TimeleftStage - self.NoIcon = subStyle.NoIcon + local icon = self.icon + local iconBorder = self.RewardBorder + local trackingBorder = self.HighlightBorder + local tag = self.tagIcon + local iconWidth = subStyle.iconWidth + local borderWidth = iconWidth + (subStyle.borderWidth * 2) + local highlightWidth = borderWidth + (subStyle.highlightWidth * 2) - self:SetSize(self.currentWidth, self.currentWidth) + local iconTexture = self.itemTexture - local icon = self.icon - local iconBorder = self.iconBorder - local trackingBorder = self.supertrackBorder - local tag = self.tagIcon - local pinMask = style.pinMask - local rewardMask = style.rewardMask + self:SetSize(iconWidth, iconWidth) + icon:SetSize(iconWidth, iconWidth) + iconBorder:SetSize(borderWidth, borderWidth) + trackingBorder:SetSize(highlightWidth, highlightWidth) - if self.NoIcon then - self.icon:Hide() - else - self.icon:Show() - icon:SetMask(nil) - icon:SetMask(rewardMask) - icon:SetTexture(self.icon:GetTexture()) + + iconBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0)) + trackingBorder:SetPoint('CENTER', (style.x or 0), (style.y or 0)) + + + if style.hasNumeric then + self.count:SetTextColor(unpack(style.numberRGB)) + if subStyle.numberFontObject then + --wqprint('change font', _G[subStyle.numberFontObject]:GetName()) + self.count:SetFontObject(_G[subStyle.numberFontObject]) + end end - iconBorder:SetMask(nil) - trackingBorder:SetMask(nil) + self.count:SetShown((subStyle.showNumber and self.itemNumber) and style.hasNumeric) - local borderWidth = self.borderSize - local trackingWidth = self.trackingBorderSize - - iconBorder:ClearAllPoints() - iconBorder:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', -borderWidth + (style.x or 0), -borderWidth + (style.y or 0)) - iconBorder:SetPoint('TOPRIGHT', self, 'TOPRIGHT', borderWidth + (style.x or 0), borderWidth + (style.y or 0)) - - trackingBorder:ClearAllPoints() - trackingBorder:SetPoint('BOTTOMLEFT', iconBorder, 'BOTTOMLEFT', -trackingWidth, -trackingWidth) - trackingBorder:SetPoint('TOPRIGHT', iconBorder, 'TOPRIGHT', trackingWidth, trackingWidth) - + --[[ if self.tagSize then tag:Show() tag:ClearAllPoints() @@ -689,9 +665,41 @@ tag:Hide() end - qprint('using mask:', pinMask, self.name ) - iconBorder:SetMask(pinMask) - trackingBorder:SetMask(pinMask) + if self.NoIcon then + self.icon:Hide() + else + self.icon:Show() + if style.rewardMask then + icon:SetMask(rewardMask) + else + icon:SetMask(iconTexture) + end + if style.pinMask then + iconBorder:Show() + trackingBorder:Show() + iconBorder:SetMask(pinMask) + trackingBorder:SetMask(pinMask) + else + iconBorder:Hide() + trackingBorder:Hide() + end + end + + + icon:SetTexture(iconTexture) iconBorder:SetTexture(iconBorder:GetTexture()) trackingBorder:SetTexture(trackingBorder:GetTexture()) + --]] + self.currentWidth = subStyle.iconWidth + self.borderWidth = subStyle.borderWidth + self.highlightWidth = subStyle.highlightWidth + self.tagSize = subStyle.TagSize + self.maxAlertLevel = subStyle.maxAlertLevel + self.NoIcon = subStyle.NoIcon + self.style = style + self.subStyle = subStyle + if self.rewardType == REWARD_CASH then + qprint('using mask:', pinMask or iconTexture, rewardMask or iconTexture, self.used, self.filtered) + end + end \ No newline at end of file
--- a/WorldPlan.lua Thu Nov 03 17:29:15 2016 -0400 +++ b/WorldPlan.lua Fri Nov 04 01:40:39 2016 -0400 @@ -11,12 +11,13 @@ QuestsByID = {}, TaskQueue = {}, } +WorldPlanQuestsMixin = { + QuestsByZone = {}, + QuestsByID = {}, + freePins = {}, +} WorldPlanPOIMixin = {} -local WorldPlan = WorldPlanCore - local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end - -local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end local WP_VERSION = "1.0" local tinsert, pairs, floor = table.insert, pairs, floor local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS @@ -35,25 +36,26 @@ continent = { PinSize = 14, Border = 2, - TrackingBorder = 1, + highlightWidth = 1, TagSize = 6, - TimeleftStage = 0, + maxAlertLevel = 0, showNumber = true, numberFontObject = 'WorldPlanFont' }, zone = { - PinSize = 22, - Border = 3, - TrackingBorder = 2, + iconWidth = 22, + borderWidth = 3, + highlightWidth = 2, TagSize = 12, - TimeleftStage = 3, + maxAlertLevel = 3, showNumber = true, numberFontObject = 'WorldPlanNumberFontThin' }, minimized = { - PinSize = 6, - Border = 0, - TrackingBorder = 1, + iconWidth = 6, + borderWidth = 0, + highlightWidth = 0, + maxAlertLevel = 1, NoIcon = true, TimeleftStage = 1, showNumber = false, @@ -95,7 +97,7 @@ _G.WorldPlan:Refresh() end -function WorldPlan:print(...) +function WorldPlanCore:print(...) local msg for i = 1, select('#', ...) do msg = (msg and (msg .. ' ') or '') .. tostring(select(i, ...)) @@ -104,7 +106,7 @@ end local current_type_owner -function WorldPlan:AddHandler (frame, defaults) +function WorldPlanCore:AddHandler (frame, defaults) print('|cFFFFFF00'..self:GetName()..':AddHandler()', frame:GetName()) tinsert(self.modules, frame) self.defaults[frame] = defaults @@ -113,7 +115,7 @@ end end -function WorldPlan:OnLoad () +function WorldPlanCore:OnLoad () self.Types = setmetatable({}, { __newindex = function(t, k, v) @@ -141,9 +143,8 @@ self:AddTypeInfo(self, index, { r = color.r, g = color.g, b = color.b, hex = color.hex, }) end - WorldPlan = self - WorldPlan:print('v'..WP_VERSION) + WorldPlanCore:print('v'..WP_VERSION) self:RegisterEvent("QUESTLINE_UPDATE") self:RegisterEvent("QUEST_LOG_UPDATE") @@ -156,7 +157,7 @@ self:SetParent(WorldMapFrame) end -function WorldPlan:OnShow() +function WorldPlanCore:OnShow() print(self:GetName()..':OnShow()') if self.isStale then self:Refresh() @@ -165,21 +166,11 @@ hooksecurefunc(self, 'SetScript', function(...) self:print('|cFFFFFF00'..self:GetName()..':SetScript()|r', ...) end) end -function WorldPlan:OnEvent (event, ...) +function WorldPlanCore:OnEvent (event, ...) print() print(event, 'init:', self.initialized) if event == 'ADDON_LOADED' then - local addon = ... - if addon == "Blizzard_FlightMap" then - mprint('sending data provider') - local dataProvider = Mixin(MapCanvasDataProviderMixin, WorldPlanDataProvider) - WorldPlanDataPinMixin = Mixin(MapCanvasPinMixin, WorldPlanDataPinMixin) - for k,v in pairs(dataProvider) do - mprint((v == WorldPlanDataProvider[k]) and ('|cFF00FF00'..tostring(k)..'|r') or ('|cFFFF4400'..tostring(k)..'|r')) - end - FlightMapFrame:AddDataProvider(dataProvider) - end if IsLoggedIn() and not self.initialized then self:Setup() end @@ -228,7 +219,7 @@ end end -function WorldPlan:Setup () +function WorldPlanCore:Setup () if not WorldPlanData then WorldPlanData = {key = 0 } end @@ -272,13 +263,13 @@ end) end -function WorldPlan:AddTypeInfo(owner, id, info) +function WorldPlanCore:AddTypeInfo(owner, id, info) self.Types[owner] = self.Types[owner] or {} self.Types[owner][id] = info print('Type('..owner:GetName()..')('..id..') = '.. tostring(info)) end -function WorldPlan:GetTypeInfo(owner, typeID) +function WorldPlanCore:GetTypeInfo(owner, typeID) local info, extraInfo if not owner then --print('## deferring to default type list') @@ -322,7 +313,7 @@ }, -- 7 days + 1 minute } -- Generates a timeleft string - function WorldPlan:GetTimeInfo(timeLeft, limit) + function WorldPlanCore:GetTimeInfo(timeLeft, limit) limit = limit or #timeStates for index = 1, limit do local state = timeStates[index] @@ -338,7 +329,7 @@ end end -function WorldPlan:Refresh (forced) +function WorldPlanCore:Refresh (forced) print('|cFFFFFF00'..self:GetName()..':Refresh()|r forced:', forced, 'init:', self.initialized) if not self.initialized then return @@ -353,7 +344,7 @@ end -- insert visual options into the tracking button menu -WorldPlan.OnDropDownInitialize = function (self, callback, dropType) +WorldPlanCore.OnDropDownInitialize = function (self, callback, dropType) if self ~= WorldMapFrameDropDown then return end @@ -430,8 +421,8 @@ SLASH_WORLDPLAN2 = "/wp" SlashCmdList.WORLDPLAN = function() print('command pop') - WorldPlan:GetPinsForMap() - WorldPlan:RefreshPins() + WorldPlanCore:GetPinsForMap() + WorldPlanCore:RefreshPins() SetTimedCallbackForAllPins(0, function(self) self.FadeIn:Play() self.FlashIn:Play() end) SetTimedCallbackForAllPins(5, function(self) self.PendingFade:Play() end)
--- a/WorldPlan.toc Thu Nov 03 17:29:15 2016 -0400 +++ b/WorldPlan.toc Fri Nov 04 01:40:39 2016 -0400 @@ -12,6 +12,7 @@ WorldPlan.xml WorldQuests.xml FilterBar.xml +FlightMap.xml ClassPlan.xml ClassPlanMissions.xml ClassPlanShipments.xml
--- a/WorldPlan.xml Thu Nov 03 17:29:15 2016 -0400 +++ b/WorldPlan.xml Fri Nov 04 01:40:39 2016 -0400 @@ -60,43 +60,40 @@ </AnimationGroup> </Animations> <Layers> - <Layer level="ARTWORK"> - + <Layer level="BACKGROUND" textureSubLevel="-2"> + <Texture parentKey="MouseGlow" file="Interface\WorldMap\UI-QuestPoi-IconGlow" alphaMode="ADD" hidden="true"> + <Anchors> + <Anchor point="BOTTOMLEFT" x="-12" y="-12" /> + <Anchor point="TOPRIGHT" x="12" y="12" /> + </Anchors> + </Texture> + <Texture parentKey="HighlightBorder" desaturated="true"> + <Anchors> + <Anchor point="CENTER" /> + </Anchors> + </Texture> + <Texture parentKey="EliteBorder" atlas="worldquest-questmarker-dragon" useAtlasSize="true" hidden="true"> + <Anchors> + <Anchor point="TOPRIGHT" x="6" y="6" /> + <Anchor point="BOTTOMLEFT" x="-6" y="-6" /> + </Anchors> + </Texture> + </Layer> + <Layer level="BACKGROUND" textureSubLevel="1"> <Texture parentKey="icon" setAllPoints="true"> <Anchors> - <Anchor point="TOPLEFT" /> + <Anchor point="CENTER" /> </Anchors> </Texture> </Layer> <Layer level="BORDER"> - <Texture parentKey="iconBorder" file="Interface\BUTTONS\GREENGRAD64" desaturated="true" /> - </Layer> - <Layer level="BACKGROUND"> - <Texture parentKey="MouseGlow" file="Interface\WorldMap\UI-QuestPoi-IconGlow" alphaMode="ADD" hidden="true"> + <Texture parentKey="RewardBorder" file="Interface\UNITPOWERBARALT\Generic1Target_Circular_Frame" desaturated="true"> <Anchors> - <Anchor point="TOPRIGHT" x="14" y="14" /> - <Anchor point="BOTTOMLEFT" x="-14" y="-14" /> - </Anchors> - </Texture> - <Texture parentKey="supertrackBorder" desaturated="true" /> - <Texture parentKey="EliteBorder" atlas="worldquest-questmarker-dragon" hidden="true"> - <Anchors> - <Anchor point="TOPLEFT" relativeKey="$parent.iconBorder" x="-6" y="6"/> - <Anchor point="BOTTOMRIGHT" relativeKey="$parent.iconBorder" x="6" y="-6"/> + <Anchor point="CENTER" /> </Anchors> </Texture> </Layer> <Layer level="OVERLAY"> - <FontString name="$parentCount" inherits="WorldPlanNumberFontThin" parentKey="count"> - <Anchors> - <Anchor point="BOTTOM" relativeKey="$parent.icon" x="0" y="0" /> - </Anchors> - </FontString> - <FontString name="$parentTimeLeft" inherits="WorldPlanNumberFont" parentKey="timeLabel"> - <Anchors> - <Anchor point="BOTTOM" relativePoint="TOP" relativeKey="$parent.label" x="0" y="0" /> - </Anchors> - </FontString> <Texture parentKey="dot" hidden="true" setAllPoints="false"> <Size x="6" y="6" /> <Color a="1" r="1" g="0" b="0" /> @@ -111,10 +108,14 @@ <Anchor point="BOTTOMRIGHT" x="1" y="-1" /> </Anchors> </Texture> - </Layer> <Layer level="HIGHLIGHT"> - <Texture parentKey="highlight" setAllPoints="true" alphaMode="ADD" alpha="0" file="Interface\Tooltips\UI-Tooltip-Background" desaturated="true" /> + <Texture parentKey="highlight" alphaMode="ADD" alpha="0" file="Interface\Tooltips\UI-Tooltip-Background" desaturated="true"> + <Anchors> + <Anchor point="BOTTOMLEFT" x="-3" y="-3" /> + <Anchor point="TOPRIGHT" x="3" y="3" /> + </Anchors> + </Texture> </Layer> </Layers> @@ -128,6 +129,24 @@ <OnEnter method="OnEnter" /> <OnLeave method="OnLeave" /> </Scripts> + <Frames> + <Frame parentKey="Overlay" setAllPoints="true"> + <Layers> + <Layer level="OVERLAY"> + <FontString inherits="WorldPlanNumberFontThin" parentKey="count"> + <Anchors> + <Anchor point="BOTTOM" x="0" y="0" /> + </Anchors> + </FontString> + <FontString inherits="WorldPlanNumberFont" parentKey="timeLabel"> + <Anchors> + <Anchor point="TOP" x="0" y="0" /> + </Anchors> + </FontString> + </Layer> + </Layers> + </Frame> + </Frames> </Button> <Button name="WorldPlanFilterPin" virtual="true" inherits="WorldPlanQuestPin" mixin="WorldPlanFilterPinMixin"> <Scripts> @@ -155,8 +174,5 @@ </Scripts> </Frame> - <Frame name="WorldPlanPinContainer" mixin="WorldPlanDataPinMixin" hidden="true" flattenRenderLayers="true" frameStrata="MEDIUM" enableMouseMotion="true" virtual="true"> - <Size x="50" y="50"/> - </Frame> </Ui> \ No newline at end of file
--- a/WorldQuests.lua Thu Nov 03 17:29:15 2016 -0400 +++ b/WorldQuests.lua Fri Nov 04 01:40:39 2016 -0400 @@ -3,13 +3,6 @@ -- Created: 11/2/2016 3:40 PM -- %file-revision% -WorldPlanDataProvider = {} -WorldPlanDataPinMixin = {} -WorldPlanQuestsMixin = { - QuestsByZone = {}, - QuestsByID = {}, - freePins = {}, -} local WorldQuests = WorldPlanQuestsMixin local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo @@ -84,7 +77,7 @@ WorldPlan:AddTypeInfo(self, REWARD_ARTIFACT_POWER, { r = 1, g = .25, b = .5, hasNumeric = true, numberRGB = rgbWhite }) WorldPlan:AddTypeInfo(self, REWARD_GEAR, { r = .1, g = .2, b = 1 }) WorldPlan:AddTypeInfo(self, REWARD_CURRENCY, { r = 1, g = 1, b = 0, hasNumeric = true, numberRGB = {1,1,0}, }) - WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = 0, g = 0, b = 0, }) + WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = .7, g = .6, b = .32, pinMask = false, rewardMask = false }) for areaID, fileName in pairs(WORLD_QUEST_MAPS) do self.QuestsByZone[areaID] = {} @@ -318,101 +311,3 @@ end - - -function WorldPlanDataProvider:OnShow() - assert(self.ticker == nil); - self.ticker = C_Timer.NewTicker(10, function() self:RefreshAllData() end); -end -function WorldPlanDataProvider:OnHide() - self.ticker:Cancel(); - self.ticker = nil; -end - -function WorldPlanDataProvider:OnAdded(mapCanvas) - self.activePins = {}; - self.owningMap = mapCanvas -end - - - -function WorldPlanDataProvider:RefreshAllData() - local print = mprint - print('|cFFFF0088'..self.owningMap:GetName()..':RefreshAllData()|r') - - - local pinsToRemove = {}; - for questId in pairs(self.activePins) do - pinsToRemove[questId] = true; - end - - SetMapZoom(8) - - local mapAreaID = self:GetMap():GetMapID(); - for zoneIndex = 1, C_MapCanvas.GetNumZones(mapAreaID) do - local zoneMapID, zoneName, zoneDepth, left, right, top, bottom = C_MapCanvas.GetZoneInfo(mapAreaID, zoneIndex); - print(zoneMapID, zoneName) - if zoneDepth <= 1 then -- Exclude subzones - local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(zoneMapID, mapAreaID); - - if taskInfo then - for i, info in ipairs(taskInfo) do - if HaveQuestData(info.questId) then - if QuestUtils_IsQuestWorldQuest(info.questId) then - local pin = WorldPlanQuests:AcquirePin(info.questId, zoneMapID) - pin:RefreshData(info) - 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("WorldPlanPinContainer") - frame:SetAlphaLimits(1, 0.7, 1) - frame:SetScalingLimits(1, 3, 1.5); - frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanPinContainer")); - frame:Show() - self.activePins[info.questId] = frame - end - frame:SetPosition(info.x, info.y) - frame.pin = pin - - pin.isStale = true - pin:SetParent(frame) - pin:ClearAllPoints() - pin:SetPoint('CENTER', frame, 'CENTER') - - end - pin:SetShown(pin.used) - end - end - end - end - end - end - - for questId in pairs(pinsToRemove) do - self:GetMap():RemovePin(self.activePins[questId]); - self.activePins[questId] = nil; - end - self:GetMap():RemoveAllPinsByTemplate("WorldQuestPinTemplate"); - -end - -function WorldPlanDataPinMixin:OnShow() - mprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r') -end - -function WorldPlanDataPinMixin:OnMouseEnter () - self.pin:OnEnter() -end - -function WorldPlanDataPinMixin:OnMouseLeave () - self.pin:OnLeave() -end - -function WorldPlanDataPinMixin:RemoveAllData() - wipe(self.activePins); - self:GetMap():RemoveAllPinsByTemplate("WorldQuestPinTemplate"); -end \ No newline at end of file