Mercurial > wow > worldplan
comparison FilterBar.lua @ 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 | 77c2ffb5c7f5 |
comparison
equal
deleted
inserted
replaced
40:589c444d4837 | 41:79e5e96e5f18 |
---|---|
62 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", }, | 62 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", }, |
63 } | 63 } |
64 local defaults = {} | 64 local defaults = {} |
65 | 65 |
66 WorldPlanSummaryMixin = WorldPlanSummaryMixin or {} | 66 WorldPlanSummaryMixin = WorldPlanSummaryMixin or {} |
67 WorldPlanSummaryMixin.selectedBountyIndex = {} | 67 local Module = WorldPlanSummaryMixin |
68 WorldPlanSummaryMixin.bounties = {} | 68 Module.selectedBountyIndex = {} |
69 WorldPlanSummaryMixin.filterList = {} | 69 Module.bounties = {} |
70 WorldPlanSummaryMixin.buttons = {} | 70 Module.filterList = {} |
71 WorldPlanSummaryMixin.cvarFiltersDirty = false | 71 Module.buttons = {} |
72 Module.cvarFiltersDirty = false | |
72 WorldPlanFilterPinMixin = {} | 73 WorldPlanFilterPinMixin = {} |
73 | 74 local Pin = WorldPlanFilterPinMixin |
74 function WorldPlanSummaryMixin:OnLoad() | 75 |
76 function Module:OnLoad() | |
75 self:SetParent(WorldMapFrame) | 77 self:SetParent(WorldMapFrame) |
76 WorldPlan:AddHandler(self) | 78 WorldPlan:AddHandler(self) |
77 for index, info in ipairs(db.DefaultFilters) do | 79 for index, info in ipairs(db.DefaultFilters) do |
78 info.zone = db.DefaultFilterType | 80 info.zone = db.DefaultFilterType |
79 info.continent = db.DefaultFilterType | 81 info.continent = db.DefaultFilterType |
82 end | 84 end |
83 | 85 |
84 end | 86 end |
85 | 87 |
86 | 88 |
87 function WorldPlanSummaryMixin:OnEvent(event) | 89 function Module:OnEvent(event) |
88 print('|cFF00FF88'..self:GetName()..':OnEvent()', event) | 90 print('|cFF00FF88'..self:GetName()..':OnEvent()', event) |
89 self.isStale = true | 91 self.isStale = true |
90 end | 92 end |
91 | 93 |
92 local bountyIndex | 94 local bountyIndex |
93 local debug_headers = {} | 95 local debug_headers = {} |
94 | 96 |
95 function WorldPlanSummaryMixin:Setup() | 97 function Module:Setup() |
96 print('|cFF00FF88'..self:GetName()..':Setup()') | 98 print('|cFF00FF88'..self:GetName()..':Setup()') |
97 end | 99 end |
98 | 100 |
99 | 101 |
100 function WorldPlanSummaryMixin:OnUpdate() | 102 function Module:OnUpdate() |
101 if self.isStale then | 103 if self.isStale then |
102 wprint('|cFF00FF00pushing update') | 104 wprint('|cFF00FF00pushing update') |
103 self:Refresh() | 105 self:Refresh() |
104 end | 106 end |
105 end | 107 end |
106 | 108 |
107 function WorldPlanSummaryMixin:OnShow() | 109 function Module:OnMapInfo(isBrokenIsle, mapAreaID) |
110 if not isBrokenIsle then | |
111 self:SetShown(false) | |
112 else | |
113 self:SetShown(true) | |
114 self:Refresh() | |
115 end | |
116 end | |
117 | |
118 function Module:OnShow() | |
108 print('|cFF00FF88'..self:GetName()..':OnShow()') | 119 print('|cFF00FF88'..self:GetName()..':OnShow()') |
109 if self.isStale then | 120 if self.isStale then |
110 self:Refresh() | 121 self:Refresh() |
111 end | 122 end |
112 end | 123 end |
113 | 124 |
114 function WorldPlanSummaryMixin:GetFilters() | 125 local tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID = tinsert, GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID |
126 function Module:GetFilters() | |
115 | 127 |
116 print('|cFF00FFFF'..self:GetName()..':GetFilters()') | 128 print('|cFF00FFFF'..self:GetName()..':GetFilters()') |
117 | 129 |
118 wipe(self.filterList) | 130 wipe(self.filterList) |
119 | 131 |
140 tinsert(self.filterList, info) | 152 tinsert(self.filterList, info) |
141 --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, | 153 --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, |
142 end | 154 end |
143 end | 155 end |
144 | 156 |
145 function WorldPlanSummaryMixin:Reset() | 157 function Module:Reset() |
146 self.pinLayout = self:GetTypeInfo(255) | 158 self.pinLayout = self:GetTypeInfo(255) |
147 self:GetFilters() | 159 self:GetFilters() |
148 end | 160 end |
149 | 161 |
150 function WorldPlanSummaryMixin:Refresh() | 162 function Module:Refresh() |
151 self:GetFilters() | 163 self:GetFilters() |
152 self:Update() | 164 self:Update() |
153 end | 165 end |
154 | 166 |
155 local filterFill = "Interface\\BUTTONS\\YELLOWORANGE64" | 167 local filterFill = "Interface\\BUTTONS\\YELLOWORANGE64" |
156 local filterMask = "Interface\\Minimap\\UI-Minimap-Background" | 168 local filterMask = "Interface\\Minimap\\UI-Minimap-Background" |
157 | 169 |
158 local questResults = {{}} | 170 local questResults = {{}} |
159 function WorldPlanSummaryMixin:Update() | 171 function Module:Update() |
160 local blocks = self.buttons | 172 local blocks = self.buttons |
161 | 173 |
162 local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton | 174 local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton |
163 if FlightMapFrame and FlightMapFrame:IsVisible() then | 175 if FlightMapFrame and FlightMapFrame:IsVisible() then |
164 relativeFrame = FlightMapFrame | 176 relativeFrame = FlightMapFrame |
248 wipe(questResults[i]) | 260 wipe(questResults[i]) |
249 end | 261 end |
250 end | 262 end |
251 | 263 |
252 | 264 |
253 if firstCvar and lastCvar then | |
254 self.CVarsHighlight:ClearAllPoints() | |
255 self.CVarsHighlight:SetPoint('TOPLEFT', firstCvar, 'TOPLEFT', -1, 1) | |
256 self.CVarsHighlight:SetPoint('BOTTOMRIGHT', lastCvar, 'BOTTOMRIGHT', 1, -1) | |
257 end | |
258 self.CVarsHighlight:SetShown(self.cvarFiltersDirty or false) | |
259 | |
260 | 265 |
261 self.isStale = nil | 266 self.isStale = nil |
262 end | 267 end |
263 | 268 |
264 function WorldPlanSummaryMixin:Cleanup() | 269 function Module:Cleanup() |
265 -- hide trailing buttons | 270 -- hide trailing buttons |
266 end | 271 end |
267 | 272 |
268 local rgbWhite = {r = 1, g= 1, b= 1, hex = '|cFFFFFFFF'} | 273 local rgbWhite = {r = 1, g= 1, b= 1, hex = '|cFFFFFFFF'} |
269 function WorldPlanFilterPinMixin:OnEnter() | 274 function Pin:OnEnter() |
270 if #self.questList >= 1 then | 275 if #self.questList >= 1 then |
271 GameTooltip:SetOwner(self, 'ANCHOR_LEFT') | 276 GameTooltip:SetOwner(self, 'ANCHOR_LEFT') |
272 GameTooltip:AddLine(self.info.label) | 277 GameTooltip:AddLine(self.info.label) |
273 for index, pin in ipairs(self.questList) do | 278 for index, pin in ipairs(self.questList) do |
274 local colorInfo = (pin.quality and ITEM_QUALITY_COLORS[pin.quality]) or rgbWhite | 279 local colorInfo = (pin.quality and ITEM_QUALITY_COLORS[pin.quality]) or rgbWhite |
277 GameTooltip:AddLine(self.numQuestsTotal .. ' total') | 282 GameTooltip:AddLine(self.numQuestsTotal .. ' total') |
278 GameTooltip:Show() | 283 GameTooltip:Show() |
279 end | 284 end |
280 end | 285 end |
281 | 286 |
282 function WorldPlanFilterPinMixin:OnLeave() | 287 function Pin:OnLeave() |
283 if GameTooltip:IsOwned(self) then | 288 if GameTooltip:IsOwned(self) then |
284 GameTooltip:Hide() | 289 GameTooltip:Hide() |
285 end | 290 end |
286 end | 291 end |
287 | 292 |
288 function WorldPlanFilterPinMixin:Refresh() | 293 function Pin:Refresh() |
289 local info = self.info | 294 local info = self.info |
290 self.filterKey = info.filterKey | 295 self.filterKey = info.filterKey |
291 self.filterValue = info.filterValue | 296 self.filterValue = info.filterValue |
292 self.tagID = info.tagID | 297 self.tagID = info.tagID |
293 | 298 |
315 local desaturated = false | 320 local desaturated = false |
316 if (self.numQuestsHere > 0) then | 321 if (self.numQuestsHere > 0) then |
317 if self.cVar then | 322 if self.cVar then |
318 if GetCVarBool(self.cVar) then | 323 if GetCVarBool(self.cVar) then |
319 self.count:SetTextColor(1,1,1) | 324 self.count:SetTextColor(1,1,1) |
320 r,g,b = 0, 1, 0 | 325 r,g,b,a = 0, 0, 0, 1 |
321 else | 326 else |
322 self:GetParent().cvarFiltersDirty = true | 327 self:GetParent().cvarFiltersDirty = true |
323 self.count:SetTextColor(1,0,0) | 328 self.count:SetTextColor(1,0,0) |
324 self.icon:SetDesaturated(true) | 329 self.icon:SetDesaturated(true) |
325 r,g,b = 1, 0, 0 | 330 r,g,b,a = 1, 0, 0, 0.5 |
326 end | 331 end |
327 else | 332 else |
328 if db.UsedFilters[self.filterKey] then | 333 if db.UsedFilters[self.filterKey] then |
329 if db.UsedFilters[self.filterKey] == self.filterValue then | 334 if db.UsedFilters[self.filterKey] == self.filterValue then |
330 self.count:SetTextColor(0,1,0) | 335 self.count:SetTextColor(0,1,0) |
331 r,g,b = 0, 1, 0 | 336 r, g, b = 0, 1, 0 |
332 else | 337 else |
333 self.count:SetTextColor(1,0,0) | 338 self.count:SetTextColor(1,0,0) |
334 r, g, b = 1, 0, 0 | 339 r, g, b = 1, 0, 0 |
335 end | 340 end |
336 else | 341 else |
342 r, g, b = 1, 1, 0 | 347 r, g, b = 1, 1, 0 |
343 end | 348 end |
344 end | 349 end |
345 end | 350 end |
346 end | 351 end |
347 self.RewardBorder:SetColorTexture(r, g, b, a) | 352 self.RewardBorder:SetColorTexture(r, g, b) |
353 self:SetAlpha(a) | |
348 | 354 |
349 --self:UpdateSize() | 355 --self:UpdateSize() |
350 end | 356 end |
351 | 357 |
352 function WorldPlanFilterPinMixin:OnLoad() | 358 function Pin:OnLoad() |
353 self:RegisterForClicks('AnyUp') | 359 self:RegisterForClicks('AnyUp') |
354 self:SetFrameStrata('HIGH') | 360 self:SetFrameStrata('HIGH') |
355 self:SetFrameLevel(151) | 361 self:SetFrameLevel(151) |
356 self:SetScript('OnUpdate', nil) | 362 self:SetScript('OnUpdate', nil) |
357 self.questList = {} | 363 self.questList = {} |
358 end | 364 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level |
359 | 365 end |
360 function WorldPlanFilterPinMixin:OnUpdate () | 366 |
367 function Pin:OnUpdate () | |
361 end | 368 end |
362 | 369 |
363 -- shift-click: reset filter | 370 -- shift-click: reset filter |
364 -- click: rotate through include(1), exclude(-1), ignore(nil) | 371 -- click: rotate through include(1), exclude(-1), ignore(nil) |
365 local filtered_report = {} | 372 local filtered_report = {} |
366 local RESET_FILTER = "|cFFFFFFFF+%s|r" | 373 local RESET_FILTER = "|cFFFFFFFF+%s|r" |
367 local FILTER_EXCLUDE_TYPE = '|cFFFF0000-%s|r' | 374 local FILTER_EXCLUDE_TYPE = '|cFFFF0000-%s|r' |
368 local FILTER_INCLUDE_TYPE = '|cFF00FF00+%s|r' | 375 local FILTER_INCLUDE_TYPE = '|cFF00FF00+%s|r' |
369 function WorldPlanFilterPinMixin:OnClick (button) | 376 function Pin:OnClick (button) |
370 | 377 |
371 local filterKey = self.filterKey | 378 local filterKey = self.filterKey |
372 local filterValue = self.filterValue | 379 local filterValue = self.filterValue |
373 local cVar = self.cVar | 380 local cVar = self.cVar |
374 local parent = self:GetParent() | 381 local parent = self:GetParent() |