Mercurial > wow > worldplan
comparison FilterBar.lua @ 33:be4db60219ca
WorldPlan:
- Toggling a reward filter cancels out other types by default. Use right mouse to clear.
- Fixed filter bar info falling out of sync after player-triggered world map updates.
ClassPlan:
- Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
| author | Nenue |
|---|---|
| date | Wed, 02 Nov 2016 17:25:07 -0400 |
| parents | e8679ecb48d8 |
| children | 21bcff08b0f4 |
comparison
equal
deleted
inserted
replaced
| 32:e8679ecb48d8 | 33:be4db60219ca |
|---|---|
| 3 -- Created: 10/27/2016 8:55 PM | 3 -- Created: 10/27/2016 8:55 PM |
| 4 -- %file-revision% | 4 -- %file-revision% |
| 5 -- | 5 -- |
| 6 | 6 |
| 7 local print = DEVIAN_WORKSPACE and function(...) _G.print('FilterBar', ...) end or nop | 7 local print = DEVIAN_WORKSPACE and function(...) _G.print('FilterBar', ...) end or nop |
| 8 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end | |
| 8 local wipe, ipairs, pairs = table.wipe, ipairs, pairs | 9 local wipe, ipairs, pairs = table.wipe, ipairs, pairs |
| 9 | 10 |
| 10 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD | 11 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD |
| 11 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER | 12 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER |
| 12 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT | 13 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT |
| 16 | 17 |
| 17 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP | 18 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP |
| 18 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE | 19 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE |
| 19 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON | 20 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON |
| 20 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION | 21 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION |
| 21 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL | 22 |
| 23 local familiars = { | |
| 24 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, | |
| 25 [40277] = {npc = 97804, name = 'Tiffany Nelson'}, | |
| 26 [40298] = {npc = 99182, name = 'Sir Galveston'}, | |
| 27 [40282] = {npc= 99150, name = 'Grixis Tinypop'}, | |
| 28 [40278] = {npc = 98270, name = 'Robert Craig'}, | |
| 29 [48195] = {npc = 105250, name = 'Aulier'}, | |
| 30 [41990] = {npc = 105674, name = 'Varenne'}, | |
| 31 [41860] = {npc = 104970, name = 'Xorvasc'}, | |
| 32 [40299] = {npc = 99210, name = 'Bodhi Sunwayver'}, | |
| 33 [42442] = {npc = 107489, name = 'Amalia'}, | |
| 34 [40280] = {npc = 99077, name = 'Bredda Tenderhide'}, | |
| 35 [41687] = {npc = 104553, name = 'Odrogg'}, | |
| 36 [41944] = {npc = 105455, name = 'Trapper Jarrun'}, | |
| 37 [40337] = {npc = 97709, name = 'Master Tamer Flummox'}, | |
| 38 [40279] = {npc = 99035, name = 'Durian Strongfruit'} | |
| 39 } | |
| 40 local familiars_id = 9696 | |
| 41 | |
| 22 local DEFAULT_FILTER_LAYOUT = { | 42 local DEFAULT_FILTER_LAYOUT = { |
| 23 PinSize = 22, | 43 PinSize = 22, |
| 24 Border = 3, | 44 Border = 3, |
| 25 TrackingBorder = 2, | 45 TrackingBorder = 2, |
| 26 TagSize = 12, | 46 TagSize = 12, |
| 49 buttons = {}, | 69 buttons = {}, |
| 50 } | 70 } |
| 51 WorldPlanFilterPinMixin = {} | 71 WorldPlanFilterPinMixin = {} |
| 52 | 72 |
| 53 function WorldPlanSummaryMixin:OnLoad() | 73 function WorldPlanSummaryMixin:OnLoad() |
| 54 self:RegisterEvent('QUEST_LOG_UPDATE') | |
| 55 self:RegisterEvent('WORLD_MAP_UPDATE') | |
| 56 | |
| 57 WorldPlan:AddHandler(self, defaults) | 74 WorldPlan:AddHandler(self, defaults) |
| 58 | |
| 59 for index, info in ipairs(DEFAULT_FILTER_LIST) do | 75 for index, info in ipairs(DEFAULT_FILTER_LIST) do |
| 60 info.zone = DEFAULT_FILTER_LAYOUT | 76 info.zone = DEFAULT_FILTER_LAYOUT |
| 61 info.continent = DEFAULT_FILTER_LAYOUT | 77 info.continent = DEFAULT_FILTER_LAYOUT |
| 62 info.pinMask = "Interface\\Minimap\\UI-Minimap-Background" | 78 info.pinMask = "Interface\\Minimap\\UI-Minimap-Background" |
| 63 | 79 |
| 66 | 82 |
| 67 end | 83 end |
| 68 | 84 |
| 69 | 85 |
| 70 function WorldPlanSummaryMixin:OnEvent(event) | 86 function WorldPlanSummaryMixin:OnEvent(event) |
| 71 self:Refresh() | 87 print('|cFF00FF88'..self:GetName()..':OnEvent()', event) |
| 88 self.isStale = true | |
| 72 end | 89 end |
| 73 | 90 |
| 74 local bountyIndex | 91 local bountyIndex |
| 75 local debug_headers = {} | 92 local debug_headers = {} |
| 76 | 93 |
| 77 function WorldPlanSummaryMixin:Setup() | 94 function WorldPlanSummaryMixin:Setup() |
| 95 print('|cFF00FF88'..self:GetName()..':Setup()') | |
| 78 self:GetFilters() | 96 self:GetFilters() |
| 79 end | 97 end |
| 80 | 98 |
| 81 | 99 |
| 82 function WorldPlanSummaryMixin:OnEvent(event,...) | |
| 83 self.isStale = true | |
| 84 end | |
| 85 function WorldPlanSummaryMixin:OnUpdate() | 100 function WorldPlanSummaryMixin:OnUpdate() |
| 86 if self.isStale then | 101 if self.isStale then |
| 102 wprint('|cFF00FF00pushing update') | |
| 87 self:Refresh() | 103 self:Refresh() |
| 88 end | 104 end |
| 89 end | 105 end |
| 90 | 106 |
| 91 function WorldPlanSummaryMixin:OnShow() | 107 function WorldPlanSummaryMixin:OnShow() |
| 92 self:Refresh() | 108 print('|cFF00FF88'..self:GetName()..':OnShow()') |
| 109 if self.isStale then | |
| 110 self:Refresh() | |
| 111 end | |
| 93 end | 112 end |
| 94 | 113 |
| 95 function WorldPlanSummaryMixin:GetFilters() | 114 function WorldPlanSummaryMixin:GetFilters() |
| 96 | 115 |
| 116 print('|cFF00FFFF'..self:GetName()..':GetFilters()') | |
| 97 | 117 |
| 98 wipe(self.filterList) | 118 wipe(self.filterList) |
| 99 | 119 |
| 100 for index, info in ipairs(DEFAULT_FILTER_LIST) do | 120 for index, info in ipairs(DEFAULT_FILTER_LIST) do |
| 101 tinsert(self.filterList, info) | 121 tinsert(self.filterList, info) |
| 125 function WorldPlanSummaryMixin:Reset() | 145 function WorldPlanSummaryMixin:Reset() |
| 126 self.pinLayout = self:GetTypeInfo(255) | 146 self.pinLayout = self:GetTypeInfo(255) |
| 127 self:GetFilters() | 147 self:GetFilters() |
| 128 end | 148 end |
| 129 | 149 |
| 130 function WorldPlanSummaryMixin:Refresh(forced) | 150 function WorldPlanSummaryMixin:Refresh() |
| 131 self:Update(forced) | 151 self:Update() |
| 132 end | 152 end |
| 133 | 153 |
| 134 local filterFill = "Interface\\BUTTONS\\YELLOWORANGE64" | 154 local filterFill = "Interface\\BUTTONS\\YELLOWORANGE64" |
| 135 local filterMask = "Interface\\Minimap\\UI-Minimap-Background" | 155 local filterMask = "Interface\\Minimap\\UI-Minimap-Background" |
| 136 | 156 |
| 137 local questResults = {{}} | 157 local questResults = {{}} |
| 138 function WorldPlanSummaryMixin:Update(forced) | 158 function WorldPlanSummaryMixin:Update() |
| 139 local blocks = self.buttons | 159 local blocks = self.buttons |
| 140 local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton | 160 local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton |
| 141 local numHeaders = 0 | 161 local numHeaders = 0 |
| 142 print('|cFF00FF88'..tostring(self)..':Refresh()|r', 'currentMap=',self.currentMapID) | 162 print('|cFF00FF88'..self:GetName()..':Update()|r', 'currentMap=',WorldPlan.currentMapID) |
| 143 | 163 |
| 144 | 164 |
| 145 local quests = WorldPlanQuests.QuestsByZone[self.currentMapID] or WorldPlanQuests.QuestsByID | 165 local quests = WorldPlanQuests.QuestsByZone[WorldPlan.currentMapID] or WorldPlanQuests.QuestsByID |
| 146 local foundQuests = questResults[1] | 166 local foundQuests = questResults[1] |
| 147 for index, info in ipairs(self.filterList) do | 167 for index, info in ipairs(self.filterList) do |
| 148 local numQuests = 0 | 168 local numQuests = 0 |
| 149 local resultIndex = numHeaders + 1 | 169 local resultIndex = numHeaders + 1 |
| 150 questResults[resultIndex] = questResults[resultIndex] or {} | 170 questResults[resultIndex] = questResults[resultIndex] or {} |
| 265 | 285 |
| 266 local r, g, b, a = 1,1,1,1 | 286 local r, g, b, a = 1,1,1,1 |
| 267 local desaturated = false | 287 local desaturated = false |
| 268 if self.cVar then | 288 if self.cVar then |
| 269 self.iconBorder:SetVertexColor(1, 1, 1, 1) | 289 self.iconBorder:SetVertexColor(1, 1, 1, 1) |
| 270 if GetCVarBool(self.cVar) == true then | 290 if GetCVarBool(self.cVar) then |
| 271 self.icon:SetVertexColor(1,1,1,1) | 291 self.icon:SetVertexColor(1,1,1,1) |
| 272 self:SetAlpha(1) | 292 self:SetAlpha(1) |
| 273 else | 293 else |
| 274 self.icon:SetVertexColor(.5, .5, .5, 1) | 294 self.icon:SetVertexColor(.5, .5, .5, 1) |
| 275 self:SetAlpha(0.5) | 295 self:SetAlpha(0.5) |
| 298 end | 318 end |
| 299 | 319 |
| 300 function WorldPlanFilterPinMixin:OnUpdate () | 320 function WorldPlanFilterPinMixin:OnUpdate () |
| 301 end | 321 end |
| 302 | 322 |
| 323 | |
| 303 function WorldPlanFilterPinMixin:OnLeave () | 324 function WorldPlanFilterPinMixin:OnLeave () |
| 304 if GameTooltip:IsOwned(self) then | 325 if GameTooltip:IsOwned(self) then |
| 305 GameTooltip:Hide() | 326 GameTooltip:Hide() |
| 306 end | 327 end |
| 307 end | 328 end |
| 318 local operation = opPrefix | 339 local operation = opPrefix |
| 319 | 340 |
| 320 | 341 |
| 321 if not filterKey then | 342 if not filterKey then |
| 322 wipe(WorldPlan.UsedFilters) | 343 wipe(WorldPlan.UsedFilters) |
| 344 for i, info in ipairs(DEFAULT_FILTER_LIST) do | |
| 345 if info.cVar then | |
| 346 SetCVar(info.cVar, 1) | |
| 347 end | |
| 348 end | |
| 349 | |
| 323 elseif self.cVar then | 350 elseif self.cVar then |
| 324 SetCVar(self.cVar, (GetCVarBool(self.cVar) and 0) or 1) | 351 for i, info in ipairs(DEFAULT_FILTER_LIST) do |
| 352 if info.cVar then | |
| 353 if (info.cVar ~= self.cVar) and (button == 'LeftButton') then | |
| 354 SetCVar(info.cVar, 0) | |
| 355 else | |
| 356 SetCVar(info.cVar, 1) | |
| 357 end | |
| 358 end | |
| 359 end | |
| 325 else | 360 else |
| 326 local setInclude = (button == 'LeftButton') | 361 local setInclude = (button == 'LeftButton') |
| 327 local flushValue | 362 local flushValue |
| 328 print('') | 363 print('') |
| 329 if WorldPlan.UsedFilters[filterKey] == filterValue then | 364 if WorldPlan.UsedFilters[filterKey] == filterValue then |
| 330 WorldPlan.UsedFilters[filterKey] = nil | 365 WorldPlan.UsedFilters[filterKey] = nil |
| 331 else | 366 else |
| 332 WorldPlan.UsedFilters[filterKey] = filterValue | 367 WorldPlan.UsedFilters[filterKey] = filterValue |
| 333 end | 368 end |
| 334 end | 369 end |
| 335 WorldPlan:Refresh() | 370 WorldPlan:Refresh(true) |
| 336 end | 371 end |
