Mercurial > wow > worldplan
changeset 41:79e5e96e5f18 v1.0-rc10
- Clear Garrison minimap button pulse when shown
author | Nenue |
---|---|
date | Sun, 25 Dec 2016 15:17:35 -0500 |
parents | 589c444d4837 |
children | f494175a2d15 |
files | ClassPlan.lua FilterBar.lua FilterBar.xml QuestPOI.lua WorldPlan.lua WorldQuests.lua |
diffstat | 6 files changed, 92 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/ClassPlan.lua Sun Dec 25 13:04:57 2016 -0500 +++ b/ClassPlan.lua Sun Dec 25 15:17:35 2016 -0500 @@ -209,7 +209,8 @@ self.initialized = true self:SetShown(self.data.IsShown) - + GarrisonMinimap_HidePulse(GarrisonLandingPageMinimapButton, 1) -- buildings + GarrisonMinimap_HidePulse(GarrisonLandingPageMinimapButton, 5) -- missions end end
--- a/FilterBar.lua Sun Dec 25 13:04:57 2016 -0500 +++ b/FilterBar.lua Sun Dec 25 15:17:35 2016 -0500 @@ -64,14 +64,16 @@ local defaults = {} WorldPlanSummaryMixin = WorldPlanSummaryMixin or {} -WorldPlanSummaryMixin.selectedBountyIndex = {} -WorldPlanSummaryMixin.bounties = {} -WorldPlanSummaryMixin.filterList = {} -WorldPlanSummaryMixin.buttons = {} -WorldPlanSummaryMixin.cvarFiltersDirty = false +local Module = WorldPlanSummaryMixin +Module.selectedBountyIndex = {} +Module.bounties = {} +Module.filterList = {} +Module.buttons = {} +Module.cvarFiltersDirty = false WorldPlanFilterPinMixin = {} +local Pin = WorldPlanFilterPinMixin -function WorldPlanSummaryMixin:OnLoad() +function Module:OnLoad() self:SetParent(WorldMapFrame) WorldPlan:AddHandler(self) for index, info in ipairs(db.DefaultFilters) do @@ -84,7 +86,7 @@ end -function WorldPlanSummaryMixin:OnEvent(event) +function Module:OnEvent(event) print('|cFF00FF88'..self:GetName()..':OnEvent()', event) self.isStale = true end @@ -92,26 +94,36 @@ local bountyIndex local debug_headers = {} -function WorldPlanSummaryMixin:Setup() +function Module:Setup() print('|cFF00FF88'..self:GetName()..':Setup()') end -function WorldPlanSummaryMixin:OnUpdate() +function Module:OnUpdate() if self.isStale then wprint('|cFF00FF00pushing update') self:Refresh() end end -function WorldPlanSummaryMixin:OnShow() +function Module:OnMapInfo(isBrokenIsle, mapAreaID) + if not isBrokenIsle then + self:SetShown(false) + else + self:SetShown(true) + self:Refresh() + end +end + +function Module:OnShow() print('|cFF00FF88'..self:GetName()..':OnShow()') if self.isStale then self:Refresh() end end -function WorldPlanSummaryMixin:GetFilters() +local tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID = tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID +function Module:GetFilters() print('|cFF00FFFF'..self:GetName()..':GetFilters()') @@ -142,12 +154,12 @@ end end -function WorldPlanSummaryMixin:Reset() +function Module:Reset() self.pinLayout = self:GetTypeInfo(255) self:GetFilters() end -function WorldPlanSummaryMixin:Refresh() +function Module:Refresh() self:GetFilters() self:Update() end @@ -156,7 +168,7 @@ local filterMask = "Interface\\Minimap\\UI-Minimap-Background" local questResults = {{}} -function WorldPlanSummaryMixin:Update() +function Module:Update() local blocks = self.buttons local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton @@ -250,23 +262,16 @@ end - if firstCvar and lastCvar then - self.CVarsHighlight:ClearAllPoints() - self.CVarsHighlight:SetPoint('TOPLEFT', firstCvar, 'TOPLEFT', -1, 1) - self.CVarsHighlight:SetPoint('BOTTOMRIGHT', lastCvar, 'BOTTOMRIGHT', 1, -1) - end - self.CVarsHighlight:SetShown(self.cvarFiltersDirty or false) - self.isStale = nil end -function WorldPlanSummaryMixin:Cleanup() +function Module:Cleanup() -- hide trailing buttons end local rgbWhite = {r = 1, g= 1, b= 1, hex = '|cFFFFFFFF'} -function WorldPlanFilterPinMixin:OnEnter() +function Pin:OnEnter() if #self.questList >= 1 then GameTooltip:SetOwner(self, 'ANCHOR_LEFT') GameTooltip:AddLine(self.info.label) @@ -279,13 +284,13 @@ end end -function WorldPlanFilterPinMixin:OnLeave() +function Pin:OnLeave() if GameTooltip:IsOwned(self) then GameTooltip:Hide() end end -function WorldPlanFilterPinMixin:Refresh() +function Pin:Refresh() local info = self.info self.filterKey = info.filterKey self.filterValue = info.filterValue @@ -317,18 +322,18 @@ if self.cVar then if GetCVarBool(self.cVar) then self.count:SetTextColor(1,1,1) - r,g,b = 0, 1, 0 + r,g,b,a = 0, 0, 0, 1 else self:GetParent().cvarFiltersDirty = true self.count:SetTextColor(1,0,0) self.icon:SetDesaturated(true) - r,g,b = 1, 0, 0 + r,g,b,a = 1, 0, 0, 0.5 end else if db.UsedFilters[self.filterKey] then if db.UsedFilters[self.filterKey] == self.filterValue then self.count:SetTextColor(0,1,0) - r,g,b = 0, 1, 0 + r, g, b = 0, 1, 0 else self.count:SetTextColor(1,0,0) r, g, b = 1, 0, 0 @@ -344,20 +349,22 @@ end end end - self.RewardBorder:SetColorTexture(r, g, b, a) + self.RewardBorder:SetColorTexture(r, g, b) + self:SetAlpha(a) --self:UpdateSize() end -function WorldPlanFilterPinMixin:OnLoad() +function Pin:OnLoad() self:RegisterForClicks('AnyUp') self:SetFrameStrata('HIGH') self:SetFrameLevel(151) self:SetScript('OnUpdate', nil) self.questList = {} + -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level end -function WorldPlanFilterPinMixin:OnUpdate () +function Pin:OnUpdate () end -- shift-click: reset filter @@ -366,7 +373,7 @@ local RESET_FILTER = "|cFFFFFFFF+%s|r" local FILTER_EXCLUDE_TYPE = '|cFFFF0000-%s|r' local FILTER_INCLUDE_TYPE = '|cFF00FF00+%s|r' -function WorldPlanFilterPinMixin:OnClick (button) +function Pin:OnClick (button) local filterKey = self.filterKey local filterValue = self.filterValue
--- a/FilterBar.xml Sun Dec 25 13:04:57 2016 -0500 +++ b/FilterBar.xml Sun Dec 25 15:17:35 2016 -0500 @@ -16,7 +16,7 @@ </Layer> </Layers> </Frame> - <Button name="WorldPlanFilterPin" virtual="true" mixin="WorldPlanFilterPinMixin"> + <Button name="WorldPlanFilterPin" virtual="true" flattenRenderLayers="true" mixin="WorldPlanFilterPinMixin"> <Scripts> <OnClick method="OnClick" /> <OnLoad method="OnLoad" />
--- a/QuestPOI.lua Sun Dec 25 13:04:57 2016 -0500 +++ b/QuestPOI.lua Sun Dec 25 15:17:35 2016 -0500 @@ -263,9 +263,6 @@ self.MouseGlow:Hide() WorldMapTooltip:Hide(); end -function QuestPOI:OnMouseDown() - TaskPOI_OnClick(self) -end -- attempt to pull pin data local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo @@ -469,6 +466,8 @@ self.timeLabel = self.Overlay.timeLabel self.updateRate = PIN_REQUEST_DELAY self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' + + self:SetScript('OnMouseDown', TaskPOI_OnClick) end function QuestPOI:OnEvent(event, ...) @@ -636,21 +635,21 @@ function QuestPOI:IsFiltered () + local filtered + local usingFilters for filterKey, value in pairs(db.UsedFilters) do + usingFilters = true print('|cFFFF4400', filterKey, self[filterKey]) if self[filterKey] ~= value then - return true + filtered = true end end if self.rewardType and 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 - return true + if not GetCVarBool(cvar_check[self.rewardType]) then + filtered = true end end - print(' '..self.questID..':|cFFFFFF00IsFiltered()|r') + return filtered end function QuestPOI:IsShowable ()
--- a/WorldPlan.lua Sun Dec 25 13:04:57 2016 -0500 +++ b/WorldPlan.lua Sun Dec 25 15:17:35 2016 -0500 @@ -180,12 +180,36 @@ --hooksecurefunc(self, 'SetScript', function(...) self:print('|cFFFFFF00'..self:GetName()..':SetScript()|r', ...) end) end -function WorldPlanCore:GetMapInfo() +local BROKEN_ISLE_MAPS = { + [1007] = true, -- Broken Isle + [1014] = true, -- Dalaran + [1021] = true, -- Broken Shoree + [1024] = true, -- Highmountain + [1017] = true, -- Azsuna + [1018] = true, -- Val'Sharah + [1033] = true, -- Suramar + [1077] = true, -- Dreamgrove + [1096] = true, -- Eye of Azshara + [1080] = true, -- Thunder Totem + [1072] = true, -- True Shot Lodge, - db.currentMapID = GetCurrentMapAreaID() - db.isContinentMap = (db.currentMapID == BROKEN_ISLES_ID) +} + +function WorldPlanCore:SetCurrentMap() + local mapAreaID = GetCurrentMapAreaID() + local isBrokenIsle = BROKEN_ISLE_MAPS[mapAreaID] + + + db.currentMapID = mapAreaID + db.isContinentMap = (mapAreaID == BROKEN_ISLES_ID) db.useContinentType = (WorldMapDetailFrame:GetScale() < 1) + for _, module in ipairs(db.OrderedModules) do + if module.OnMapInfo then + print(' |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r') + module:OnMapInfo(isBrokenIsle, mapAreaID) + end + end end @@ -198,16 +222,9 @@ self:Setup() end else - if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') then + if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') or (event == 'PLAYER_LOGIN') then print('|cFFFF4400currentMapID =', db.currentMapID, ...) - self:GetMapInfo() - end - - for i, module in ipairs(db.OrderedModules) do - if module.OnEvent then - print(' |cFF00FFFF'..module:GetName() .. ':OnEvent()|r') - module:OnEvent(event, ...) - end + self:SetCurrentMap() end end end @@ -294,7 +311,12 @@ hooksecurefunc("WorldMapFrame_Update", function() print('|cFFFF4400WorldMapFrame_Update|r') - self:GetMapInfo() + for _,module in ipairs(db.OrderedModules) do + if module.OnWorldMapFrameUpdate then + print(' |cFFFF4400'..module:GetName()..'|r') + module:OnWorldMapFrameUpdate() + end + end end)
--- a/WorldQuests.lua Sun Dec 25 13:04:57 2016 -0500 +++ b/WorldQuests.lua Sun Dec 25 15:17:35 2016 -0500 @@ -98,6 +98,7 @@ db.QuestsByZone[areaID] = {} end + -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL') self:RegisterEvent('SKILL_LINES_CHANGED') @@ -105,10 +106,14 @@ end +function WorldQuests:OnMapInfo() + self:Refresh(true) +end + function WorldQuests:OnEvent (event, ...) print('|cFFFFFF00'..self:GetName()..':OnEvent() '..event..'|r', GetTime(), ...) - if event == 'QUEST_LOG_UPDATE' or event == 'PLAYER_LOGIN' then + if event == 'QUEST_LOG_UPDATE' then local questID, added = ... if questID and added then local questPOI = self:AcquirePin(questID) @@ -119,8 +124,6 @@ self:Refresh(true) end print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale) - elseif event == 'WORLD_MAP_UPDATE' then - self:Refresh(true) elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then local questID = ... if questID and db.QuestsByID[questID] then