comparison WorldPlan.lua @ 9:a2b623043970 v1.0-rc

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
author Nenue
date Sun, 23 Oct 2016 17:18:31 -0400
parents 802abb8a10ea
children 06c9a30d48da
comparison
equal deleted inserted replaced
8:802abb8a10ea 9:a2b623043970
20 local WorldPlan = WorldPlanCore 20 local WorldPlan = WorldPlanCore
21 local QuestPOI = WorldPlanPOIMixin 21 local QuestPOI = WorldPlanPOIMixin
22 local FilterPin = WorldPlanFilterPinMixin 22 local FilterPin = WorldPlanFilterPinMixin
23 local WP_VERSION = "1.0" 23 local WP_VERSION = "1.0"
24 24
25 local db
25 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end 26 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
26 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end 27 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
27 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end 28 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
29 local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
30 local fbprint = DEVIAN_WORKSPACE and function(...) _G.print('FilterBar', ...) end or function() end
28 31
29 local wipe, tremove, tinsert, pairs, floor, tContains = table.wipe, table.remove, table.insert, pairs, floor, tContains 32 local wipe, tremove, tinsert, pairs, floor, tContains = table.wipe, table.remove, table.insert, pairs, floor, tContains
30 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID 33 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID
31 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented 34 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented
32 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes 35 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
47 50
48 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID 51 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID
49 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo 52 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo
50 53
51 54
52 local SearchFaction
53 local PinBaseIndex = 1600 55 local PinBaseIndex = 1600
54 local ShowAllProfessionQuests = false
55 local DisplayContinentSummary = true
56 local DisplayContinentPins = true
57 local NotifyWhenNewQuests = true
58 local PinRewardFilter, PinTagFilter
59 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 56 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
60 57
61 -- maps where we do our own anchors 58 -- maps where we do our own anchors
62 local CONTINENT_MAPS = { [BROKEN_ISLES_ID] = BROKEN_ISLES_ID, } 59 local CONTINENT_MAPS = { [BROKEN_ISLES_ID] = BROKEN_ISLES_ID, }
63 local WORLD_QUEST_MAPS = { [DALARAN_ID] = 'Dalaran70', [AZSUNA_ID] = 'Azsuna', [VALSHARAH_ID] = "Val'sharah", 60 local WORLD_QUEST_MAPS = { [DALARAN_ID] = 'Dalaran70', [AZSUNA_ID] = 'Azsuna', [VALSHARAH_ID] = "Val'sharah",
64 [HIGHMOUNTAIN_ID] = 'Highmountain', [STORMHEIM_ID] = 'Stormheim', [SURAMAR_ID] = 'Suramar', [EOA_ID] = 'EyeOfAszhara', } 61 [HIGHMOUNTAIN_ID] = 'Highmountain', [STORMHEIM_ID] = 'Stormheim', [SURAMAR_ID] = 'Suramar', [EOA_ID] = 'EyeOfAszhara', }
65 -- default color templates 62 -- default color templates
66 local ARTIFACT_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_ARTIFACT] 63 local ARTIFACT_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_ARTIFACT]
67 local MONEY_COLOR = {hex ='|cFFFFFF00', r=1, g=1, b=0} 64 local MONEY_COLOR = {hex ='|cFFFFFF00', r=1, g=1, b=0}
68 local COMMON_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_COMMON] 65 local COMMON_COLOR = ITEM_QUALITY_COLORS[LE_ITEM_QUALITY_COMMON]
69
70 -- operating flags
71 local superTrackedID
72 local currentMapName
73 local hasNewQuestPins
74 local isContinentMap
75 66
76 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark" 67 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
77 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up" 68 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
78 69
79 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background" 70 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
162 --continentBorder = 1, 153 --continentBorder = 1,
163 --zoneBorder = 1, 154 --zoneBorder = 1,
164 } 155 }
165 156
166 157
158
159 local defaults = {
160 defaultPinStyle = POI_DEFAULT_TYPE,
161 rewardStyle = POI_REWARD_TYPE,
162 filterStyle = POI_FILTER_STYLE,
163 ShowAllProfessionQuests = true,
164 DisplayContinentSummary = true,
165 DisplayContinentPins = true,
166 NotifyWhenNewQuests = true,
167 EnablePins = true,
168 FadeWhileGrouped = true,
169 }
170
167 -- Summary header structure 171 -- Summary header structure
168 local POI_FILTER_OPTIONS = { 172 local POI_FILTER_OPTIONS = {
169 { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" }, 173 { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" },
170 { filterKey= 'rewardType', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" }, 174 { filterKey= 'rewardType', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" },
171 { filterKey= 'rewardType', filterValue = REWARD_CURRENCY,label = 'Currency', texture = "Interface\\ICONS\\inv_misc_elvencoins" }, 175 { filterKey= 'rewardType', filterValue = REWARD_CURRENCY,label = 'Currency', texture = "Interface\\ICONS\\inv_misc_elvencoins" },
174 { filterKey= 'rewardType', filterValue = REWARD_REAGENT, label = 'Reagents', texture = 1417744 }, 178 { filterKey= 'rewardType', filterValue = REWARD_REAGENT, label = 'Reagents', texture = 1417744 },
175 { filterKey= 'rewardType', filterValue = REWARD_CASH, label = 'Reagents', texture = ICON_MONEY }, 179 { filterKey= 'rewardType', filterValue = REWARD_CASH, label = 'Reagents', texture = ICON_MONEY },
176 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 }, 180 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 },
177 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", }, 181 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", },
178 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, 182 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
183 { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", },
179 } 184 }
180 WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID 185 WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID
181 WorldPlanCore.FilterOptions = POI_FILTER_OPTIONS
182 WorldPlanCore.FilterStyle = POI_FILTER_STYLE 186 WorldPlanCore.FilterStyle = POI_FILTER_STYLE
183 187
184 188 WorldPlanCore.FilterOptions = {}
189
190
191 -- operating flags
192 local superTrackedID
193 local currentMapName
194 local hasNewQuestPins
195 local isContinentMap
185 local numPins = 0 196 local numPins = 0
186 local QuestsByZone = {} 197 local QuestsByZone = {}
187 local QuestsByFaction = {} 198 local QuestsByFaction = {}
188 local QuestsByReward = {} 199 local QuestsByReward = {}
189 local QuestsByTag = {} 200 local QuestsByTag = {}
190 local QuestsByID = {} 201 local QuestsByID = {}
191 local QuestPositions = {} 202 local QuestPositions = {}
192 local FilterInclusions = {rewardType = {}, worldQuestType = {}} 203 local FilterInclusions = {rewardType = {}, worldQuestType = {}, factionID = {}}
193 local FilterExclusions = {rewardType = {}, worldQuestType = {} } 204 local FilterExclusions = {rewardType = {}, worldQuestType = {}, factionID = {}}
194 local NotificationTypes = {} 205 local NotificationTypes = {}
195 local ZoneInfo = {} 206 local ZoneInfo = {}
196 local SummaryHeaders = {} 207 local SummaryHeaders = {}
197 WorldPlanCore.QuestsByID = QuestsByID
198 WorldPlanCore.QuestsByZone = QuestsByZone
199 208
200 local FreePins = {} 209 local FreePins = {}
201 local NumPinFrames = 1 210 local NumPinFrames = 1
202 211
203 local hasPendingQuestData 212 local hasPendingQuestData
204 local notifyPlayed 213 local notifyPlayed
205 local scanner, wmtt, WorldMapPOIFrame 214 local scanner, wmtt, WorldMapPOIFrame
206 215
216 WorldPlanCore.QuestsByID = QuestsByID
217 WorldPlanCore.QuestsByZone = QuestsByZone
207 218
208 local tasksQueue = {} 219 local tasksQueue = {}
209 local function OnNext (func) 220 local function OnNext (func)
210 if #tasksQueue == 0 then 221 if #tasksQueue == 0 then
211 _G.WorldPlan:SetScript('OnUpdate', function() 222 _G.WorldPlan:SetScript('OnUpdate', function()
297 WorldPlanData[key] = nil 308 WorldPlanData[key] = nil
298 else 309 else
299 WorldPlanData[key] = true 310 WorldPlanData[key] = true
300 end 311 end
301 end 312 end
313 WorldPlan:RefreshAll()
302 end 314 end
303 315
304 function WorldPlan:print(...) 316 function WorldPlan:print(...)
305 local msg 317 local msg
306 for i = 1, select('#', ...) do 318 for i = 1, select('#', ...) do
327 self:RegisterEvent("ADDON_LOADED") 339 self:RegisterEvent("ADDON_LOADED")
328 340
329 WorldPlan.modules = { 341 WorldPlan.modules = {
330 WorldQuests, FilterBar, WorldPlanFlightMapMixin, 342 WorldQuests, FilterBar, WorldPlanFlightMapMixin,
331 } 343 }
332 hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize)
333 end 344 end
334 345
335 function WorldPlan:OnEvent (event, ...) 346 function WorldPlan:OnEvent (event, ...)
336 print() 347 print()
337 print(event, ...) 348 print(event, ...)
344 end 355 end
345 if IsLoggedIn() and not self.initialized then 356 if IsLoggedIn() and not self.initialized then
346 self:Setup() 357 self:Setup()
347 end 358 end
348 elseif event == 'WORLD_MAP_UPDATE' then 359 elseif event == 'WORLD_MAP_UPDATE' then
360 self.currentMapID = GetCurrentMapAreaID()
349 self:RefreshAll() 361 self:RefreshAll()
350 end 362 end
351 for i, module in ipairs(self.modules) do 363 for i, module in ipairs(self.modules) do
352 if module.OnEvent then 364 if module.OnEvent then
353 print('forwarding to', tostring(module)) 365 print('forwarding to', tostring(module))
361 if not WorldPlanData then 373 if not WorldPlanData then
362 WorldPlanData = {key = 0 } 374 WorldPlanData = {key = 0 }
363 end 375 end
364 WorldPlanData.key = (WorldPlanData.key or 0) + 1 376 WorldPlanData.key = (WorldPlanData.key or 0) + 1
365 self.db = WorldPlanData 377 self.db = WorldPlanData
378 self.db.WorldQuests = self.db.WorldQuests or {}
379 db = self.db
380 for k,v in pairs(defaults) do
381 db[k] = v
382 end
383
384 self.currentMapID = GetCurrentMapAreaID()
366 385
367 for i, module in ipairs(self.modules) do 386 for i, module in ipairs(self.modules) do
387 module.db = self.db
368 if module.Setup then module:Setup() end 388 if module.Setup then module:Setup() end
369 if not module.RegisterEvent then 389 if not module.RegisterEvent then
370 module.RegisterEvent = self.RegisterEvent 390 module.RegisterEvent = self.RegisterEvent
371 end 391 end
372 end 392 end
373 self.initialized = true 393 self.initialized = true
374 394
395 hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize)
375 end 396 end
376 397
377 function WorldPlan:RefreshAll (forced) 398 function WorldPlan:RefreshAll (forced)
399 if not self.initialized then
400 return
401 end
402
403 POI_DEFAULT_TYPE = db.defaultPinStyle
404 POI_REWARD_TYPE = db.rewardStyle
405 POI_FILTER_STYLE = db.filterStyle
406
407
408 for i, module in ipairs(self.modules) do
409 if module.Reset then
410 print(module, 'Reset()')
411 module:Reset()
412 end
413 end
414
378 for i, module in ipairs(self.modules) do 415 for i, module in ipairs(self.modules) do
379 if module.Refresh then 416 if module.Refresh then
417 print(module, 'Refresh()')
380 module:Refresh() 418 module:Refresh()
419 end
420 end
421
422 for i, module in ipairs(self.modules) do
423 if module.Cleanup then
424 print(module, 'Cleanup()')
425 module:Cleanup()
381 end 426 end
382 end 427 end
383 end 428 end
384 function WorldPlan:UpdateAnchors () 429 function WorldPlan:UpdateAnchors ()
385 for i, module in ipairs(self.modules) do 430 for i, module in ipairs(self.modules) do
392 -- insert visual options into the tracking button menu 437 -- insert visual options into the tracking button menu
393 WorldPlan.OnDropDownInitialize = function (self, callback, dropType) 438 WorldPlan.OnDropDownInitialize = function (self, callback, dropType)
394 if self ~= WorldMapFrameDropDown then 439 if self ~= WorldMapFrameDropDown then
395 return 440 return
396 end 441 end
442 local db = WorldPlan.db
397 443
398 local info = UIDropDownMenu_CreateInfo() 444 local info = UIDropDownMenu_CreateInfo()
399 info.text = "" 445 info.text = ""
400 info.isTitle = true 446 info.isTitle = true
401 UIDropDownMenu_AddButton(info) 447 UIDropDownMenu_AddButton(info)
405 info.isTitle = nil 451 info.isTitle = nil
406 info.disabled = nil 452 info.disabled = nil
407 info.keepShownOnClick = true 453 info.keepShownOnClick = true
408 info.tooltipOnButton = 1 454 info.tooltipOnButton = 1
409 455
410 info.text = "Hidden World Quests" 456 info.text = "Enable"
457 info.isNotRadio = true
458 info.value = "EnablePins"
459 info.checked = db.EnablePins
460 info.tooltipTitle = "Enable World Quest Overlays"
461 info.tooltipText = "Toggle the detail layers here."
462 info.func = DropDown_OnClick
463 UIDropDownMenu_AddButton(info)
464
465 info.text = "Display All Profession Quests"
411 info.isNotRadio = true 466 info.isNotRadio = true
412 info.value = "ShowAllProfessionQuests" 467 info.value = "ShowAllProfessionQuests"
413 info.checked = ShowAllProfessionQuests 468 info.checked = db.ShowAllProfessionQuests
414 info.tooltipTitle = "Hidden Quests" 469 info.tooltipTitle = "Hidden Quests"
415 info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." 470 info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI."
416 info.func = DropDown_OnClick 471 info.func = DropDown_OnClick
417 UIDropDownMenu_AddButton(info) 472 UIDropDownMenu_AddButton(info)
418 473
419 info.text = "Show Continent Pins" 474 info.text = "Show Continent Pins"
420 info.isNotRadio = true 475 info.isNotRadio = true
421 info.value = "DisplayContinentPins" 476 info.value = "DisplayContinentPins"
422 info.checked = DisplayContinentPins 477 info.checked = db.DisplayContinentPins
423 info.tooltipTitle = "Continent Pins" 478 info.tooltipTitle = "Continent Pins"
424 info.tooltipText = "Display quest pins on the continent map (may get cramped)." 479 info.tooltipText = "Display quest pins on the continent map (may get cramped)."
425 info.func = DropDown_OnClick 480 info.func = DropDown_OnClick
426 UIDropDownMenu_AddButton(info) 481 UIDropDownMenu_AddButton(info)
427 482
428 info.text = "Show Summary" 483 info.text = "Show Summary"
429 info.isNotRadio = true 484 info.isNotRadio = true
430 info.value = "DisplayContinentSummary" 485 info.value = "DisplayContinentSummary"
431 info.tooltipTitle = "Summary Bar" 486 info.tooltipTitle = "Summary Bar"
432 info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." 487 info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info."
433 info.checked = DisplayContinentSummary 488 info.checked = db.DisplayContinentSummary
489 info.func = DropDown_OnClick
490 UIDropDownMenu_AddButton(info)
491
492 info.text = "Fade In Groups"
493 info.isNotRadio = true
494 info.value = "FadeWhileGrouped"
495 info.tooltipTitle = "Group Fade"
496 info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see."
497 info.checked = db.DisplayContinentSummary
434 info.func = DropDown_OnClick 498 info.func = DropDown_OnClick
435 UIDropDownMenu_AddButton(info) 499 UIDropDownMenu_AddButton(info)
436 end 500 end
437 501
438 function WorldQuests:Setup() 502 function WorldQuests:Setup()
439 -- refresh positions any time blizzard does so (i.e. mousewheel zoom) 503 -- refresh positions any time blizzard does so (i.e. mousewheel zoom)
440 hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function() 504 hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function()
441 self:Refresh() 505 self:Refresh(true)
442 end) 506 end)
443 507
444 -- hide the original world quest POIs 508 -- hide the original world quest POIs
445 hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function() 509 hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function()
446 for i = 1, NUM_WORLDMAP_TASK_POIS do 510 for i = 1, NUM_WORLDMAP_TASK_POIS do
448 if button and button.worldQuest then 512 if button and button.worldQuest then
449 button:Hide() 513 button:Hide()
450 end 514 end
451 end 515 end
452 end) 516 end)
453
454 517
455 end 518 end
456 519
457 function WorldQuests:OnEvent (event, ...) 520 function WorldQuests:OnEvent (event, ...)
458 print('|cFFFFFF00'..tostring(self)..':OnEvent()'..event..'|r', ...) 521 print('|cFFFFFF00'..tostring(self)..':OnEvent()'..event..'|r', ...)
467 local questID = ... 530 local questID = ...
468 if questID and QuestsByID[questID] then 531 if questID and QuestsByID[questID] then
469 self:ReleasePin(QuestsByID[questID]) 532 self:ReleasePin(QuestsByID[questID])
470 end 533 end
471 elseif event == 'SKILL_LINES_CHANGED' then 534 elseif event == 'SKILL_LINES_CHANGED' then
472 self:Refresh() 535 self:Refresh(true)
473 end 536 end
474 end 537 end
475 538
476 function WorldQuests:AcquirePin (questID, pinTable) 539 function WorldQuests:AcquirePin (questID, pinTable)
477 local pin = QuestsByID[questID] 540 local pin = QuestsByID[questID]
539 print('|cFFFF4400Clearing out', pin:GetName(),id) 602 print('|cFFFF4400Clearing out', pin:GetName(),id)
540 end 603 end
541 604
542 -- create of update quest pins for a map and its underlying zones 605 -- create of update quest pins for a map and its underlying zones
543 function WorldQuests:GetPinsForMap (mapID) 606 function WorldQuests:GetPinsForMap (mapID)
607 local print = wqprint
544 mapID = mapID or GetCurrentMapAreaID() 608 mapID = mapID or GetCurrentMapAreaID()
545 superTrackedID = GetSuperTrackedQuestID() 609 superTrackedID = GetSuperTrackedQuestID()
546 if not mapID then 610 if not mapID then
547 -- info not available yet 611 -- info not available yet
548 return 612 return
573 end 637 end
574 end 638 end
575 end 639 end
576 if hasNewQuestPins and not self.fullSearch then 640 if hasNewQuestPins and not self.fullSearch then
577 print('|cFF00FF00NEW PINS DO ANCHOR THINGS') 641 print('|cFF00FF00NEW PINS DO ANCHOR THINGS')
578 self:Refresh () 642 self:Refresh (true)
579 hasNewQuestPins = nil 643 hasNewQuestPins = nil
580 end 644 end
581 end 645 end
582 646
583 -- create or update the pin using the given questID and C_TaskQuest results 647 -- create or update the pin using the given questID and C_TaskQuest results
597 if not HaveQuestData(questID) then 661 if not HaveQuestData(questID) then
598 print('|cFFFF4400Retrieval failed.') 662 print('|cFFFF4400Retrieval failed.')
599 TQ_RequestPreloadRewardData(questID) 663 TQ_RequestPreloadRewardData(questID)
600 hasPendingQuestData = true 664 hasPendingQuestData = true
601 else 665 else
602 print('|cFF00FF88HaveQuestData|r') 666 wqprint('|cFF00FF88Quest Data Received|r')
603 pin.mapID = pin.mapID or C_TaskQuest.GetQuestZoneID(questID) 667 pin.mapID = pin.mapID or C_TaskQuest.GetQuestZoneID(questID)
604 668
605 -- set reward category 669 -- set reward category
606 local numRewards = GetNumQuestLogRewards(questID) 670 local numRewards = GetNumQuestLogRewards(questID)
607 local numCurrency = GetNumQuestLogRewardCurrencies(questID) 671 local numCurrency = GetNumQuestLogRewardCurrencies(questID)
686 end 750 end
687 return QuestsByID[questID] 751 return QuestsByID[questID]
688 end 752 end
689 753
690 function WorldQuests:Refresh(forced) 754 function WorldQuests:Refresh(forced)
691 print('pushing |cFF00FF88'..tostring(self)..':Refresh()|r') 755 local print = wqprint
756 print('|cFF00FF88'..tostring(self)..':Refresh()|r')
692 if not WorldMapPOIFrame:IsVisible() then 757 if not WorldMapPOIFrame:IsVisible() then
693 return 758 return
694 end 759 end
695 self:Reset() 760 if forced then
761 self:Reset()
762 end
696 self:UpdateAnchors() 763 self:UpdateAnchors()
697 self:Cleanup () 764
765 if forced then
766 self:Cleanup ()
767 end
698 end 768 end
699 769
700 -- prepares elements for a map update 770 -- prepares elements for a map update
701 function WorldQuests:Reset () 771 function WorldQuests:Reset ()
772 local print = wqprint
773 print('|cFF00FF88'..tostring(self)..':Reset()|r')
702 wipe(QuestPositions) 774 wipe(QuestPositions)
703 wipe(QuestsByReward) 775 wipe(QuestsByReward)
704 wipe(QuestsByTag) 776 wipe(QuestsByTag)
705 for questID, pin in pairs(QuestsByID) do 777 for questID, pin in pairs(QuestsByID) do
706 pin.used = nil 778 pin.used = nil
707 end 779 end
708 qprint(tostring(self)..':|cFFFFFF00Reset()|r')
709 end 780 end
710 781
711 -- update visibility states of all pins 782 -- update visibility states of all pins
712 function WorldQuests:UpdateAnchors (submapID) 783 function WorldQuests:UpdateAnchors (submapID)
784 local print = wqprint
785 local db = WorldPlan.db
713 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo() 786 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
714 if isMicroDungeon then 787 if isMicroDungeon then
715 return 788 return
716 end 789 end
717 790
718 local currentMap = GetCurrentMapAreaID() 791 local currentMap = GetCurrentMapAreaID()
719 local submapID = submapID or currentMap 792 local submapID = submapID or currentMap
720 793
721 if submapID == BROKEN_ISLES_ID and (not DisplayContinentPins) then 794 if submapID == BROKEN_ISLES_ID and (not db.DisplayContinentPins) then
722 print('not updating map for reasons') 795 print('not updating map for reasons')
723 return 796 return
724 end 797 end
725 print('|cFF88FF00'..tostring(self)..':UpdateAnchors|r', submapID, GetMapNameByID(submapID), 'pin count:', numPins) 798 print('|cFF88FF00'..tostring(self)..':UpdateAnchors|r', submapID, GetMapNameByID(submapID), 'pin count:', numPins)
726 local numZones = MC_GetNumZones(submapID) 799 local numZones = MC_GetNumZones(submapID)
734 807
735 if pins then 808 if pins then
736 local hostFrame = WorldMapPOIFrame 809 local hostFrame = WorldMapPOIFrame
737 local mapWidth, mapHeight = hostFrame:GetSize() 810 local mapWidth, mapHeight = hostFrame:GetSize()
738 for questID, pin in pairs(pins) do 811 for questID, pin in pairs(pins) do
739 if pin:IsShowable(true) then 812 pin:IsShowable()
740 pin:SetFrameLevel(PinBaseIndex+numPins) 813 if pin.used then
814 pin:SetFrameLevel(PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins)
815 print('level', PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins)
741 pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight) 816 pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight)
742 pin.used = true
743 numPins = numPins + 1 817 numPins = numPins + 1
744 end 818 end
745 end 819 end
746 end 820 end
747 end 821 end
748
749
750
751 822
752 -- shows, animates, or hides pins based on their current visibility flags 823 -- shows, animates, or hides pins based on their current visibility flags
753 local debug_show = {} 824 local debug_show = {}
754 local debug_animate = {} 825 local debug_animate = {}
755 local debug_hide = {} 826 local debug_hide = {}
756 function WorldQuests:Cleanup () 827 function WorldQuests:Cleanup ()
757 local showQuestPOI = GetCVarBool("questPOI") 828 local print = wqprint
829 local showQuestPOI = db.EnablePins
758 print('|cFFFFFF00'..tostring(self)..':Cleanup()|r') 830 print('|cFFFFFF00'..tostring(self)..':Cleanup()|r')
759 wipe(QuestsByReward) 831 local mapID = GetCurrentMapAreaID()
760 wipe(QuestsByTag) 832 isContinentMap = (mapID == BROKEN_ISLES_ID)
833
761 wipe(debug_show) 834 wipe(debug_show)
762 wipe(debug_animate) 835 wipe(debug_animate)
763 wipe(debug_hide) 836 wipe(debug_hide)
764 local mapID = GetCurrentMapAreaID()
765 isContinentMap = (mapID == BROKEN_ISLES_ID)
766
767 -- continent or zone sizing 837 -- continent or zone sizing
768 local subStyle = isContinentMap and 'continent' or 'zone' 838 local fadeGrouped = (db.FadeWhileGrouped and IsInGroup())
769 839
770 numPins = 0 840 numPins = 0
771 for questID, pin in pairs(QuestsByID) do 841 for questID, pin in pairs(QuestsByID) do
772 -- can we show it? 842 -- can we show it?
773 if showQuestPOI and (pin.used) then 843 if showQuestPOI and (pin.used) then
774 pin.subStyle = pin.filtered and 'minimized' or subStyle 844 pin:Refresh()
775 pin:GetSizeMetrics() 845
776 846 if fadeGrouped then
777 847 pin:SetAlpha(0.25)
848 else
849 pin:SetAlpha(1)
850 end
778 -- is it a new quest? 851 -- is it a new quest?
779 if pin.isNew then 852 if pin.isNew then
780 if not pin.isAnimating then 853 if not pin.isAnimating then
781 pin.isAnimating = true 854 pin.isAnimating = true
782 OnNext(function() 855 OnNext(function()
791 PlaySoundKitID(23404) 864 PlaySoundKitID(23404)
792 end 865 end
793 end 866 end
794 end 867 end
795 tinsert(debug_animate,questID) 868 tinsert(debug_animate,questID)
869 else
870
871 print('animating? ', questID, 'filtered:', pin.filtered)
796 end 872 end
797 -- trap new but animating pins here 873 -- trap new but animating pins here
798 else 874 else
799 -- hard show existing pin 875 -- hard show existing pin
876 print('refresh #', questID, 'filtered:', pin.filtered)
800 pin:Show() 877 pin:Show()
801 tinsert(debug_show,questID) 878 tinsert(debug_show,questID)
802 end 879 end
803 else 880 else
881 if pin:IsShown() then
882 tinsert(debug_hide,questID)
883 end
884 pin.isAnimating = nil
885 pin.FadeIn:Stop()
804 pin:Hide() 886 pin:Hide()
805 tinsert(debug_hide,questID)
806 end
807
808 -- is it part of the current map?
809 if pin.used then
810 local rewardType = pin.rewardType
811 local tagType = pin.worldQuestType
812 if rewardType then
813 QuestsByReward[rewardType] = QuestsByReward[rewardType] or {}
814 tinsert(QuestsByReward[rewardType], pin)
815 end
816 if tagType then
817 QuestsByTag[tagType] = QuestsByTag[tagType] or {}
818 tinsert(QuestsByTag[tagType], pin)
819 end
820 end 887 end
821 end 888 end
822 print(' adding:', table.concat(debug_animate, ',' )) 889 print(' adding:', table.concat(debug_animate, ',' ))
823 print(' showing:', table.concat(debug_show, ',' )) 890 print(' refresh:', table.concat(debug_show, ',' ))
891 print(' hiding:', table.concat(debug_hide, ',' ))
824 hasNewQuestPins = nil 892 hasNewQuestPins = nil
825 notifyPlayed = nil 893 notifyPlayed = nil
826 end 894 end
827 895
828 -- data provider manipulations for the taxi map 896 -- data provider manipulations for the taxi map
869 local GetTime, mod = GetTime, mod 937 local GetTime, mod = GetTime, mod
870 938
871 939
872 940
873 941
874 function QuestPOI:Refresh () 942 function WorldQuests:FilterCheckByID(questID)
875 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) 943 local pin = WorldQuests:GetPinByQuestID(questID)
876 qprint(self.style) 944 return pin:IsShowable()
877 945 end
878 local questID = self.questId 946
879 local style = self.style 947
880 local borderMask = style.mask 948 function QuestPOI:IsShowable ()
881 local borderFill = style.texture 949 local print = wqprint
882 local iconBorder = self.iconBorder 950 local db = WorldPlan.db
883 local icon = self.icon
884 local count = self.count
885
886 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
887 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
888 icon:SetAllPoints(self)
889
890 if self.itemName then
891 local color = self.rewardColor or COMMON_COLOR
892 if self.itemNumber and self.target then
893 self.count:SetText(color.hex .. tostring(self.itemNumber))
894 else
895 self.count:SetText(nil)
896 end
897 end
898
899 SetMaskedTexture(iconBorder, borderFill, borderMask)
900 local border = (self.rewardType and POI_REWARD_TYPE[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or COMMON_COLOR)
901 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
902 iconBorder:SetDesaturated(true)
903
904 local trackingBorder = self.supertrackBorder
905
906 self.highlight:SetMask(nil)
907 if questID == GetSuperTrackedQuestID() then
908 trackingBorder:SetVertexColor(0,0,0,1)
909 else
910 trackingBorder:SetVertexColor(0,0,0,0.5)
911 end
912 self.highlight:SetAllPoints(trackingBorder)
913
914 SetMaskedTexture(trackingBorder, borderFill, borderMask)
915 self.highlight:SetMask(borderMask)
916
917 local qType = self.worldQuestType
918 self.tagIcon:SetAtlas(self.tagAtlas)
919 self.tagIcon:SetTexCoord(0,1,0,1)
920
921
922 if self.isElite then
923 self.EliteDecal:Show()
924 else
925 self.EliteDecal:Hide()
926 end
927
928 if style.showNumber then
929 self.label:SetText(self.itemNumber)
930 else
931 self.label:SetText(nil)
932 end
933 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
934 end
935
936
937
938
939 function QuestPOI:IsShowable (ignoreFilters)
940 local qType = self.worldQuestType 951 local qType = self.worldQuestType
941 local rType = self.rewardType 952 local rType = self.rewardType
942 self.filtered = nil 953 self.filtered = nil
943 print(' |cFFFF4400IsShowable()|r', self.tradeskillLineIndex, self.title) 954 self.whiteListed = nil
955 self.used = true
956
944 957
945 local whiteListed, blackListed 958 local whiteListed, blackListed
946 for filterKey, includes in pairs(FilterInclusions) do 959 for filterKey, includes in pairs(FilterInclusions) do
947 local controlValue = self[filterKey] 960 local controlValue = self[filterKey]
948 if FilterInclusions[filterKey][controlValue] then 961 if FilterInclusions[filterKey][controlValue] then
949 whiteListed = true 962 self.filtered = nil
963 self.whiteListed = true
950 break 964 break
951 end 965 end
952 if FilterExclusions[filterKey][controlValue] then 966 if FilterExclusions[filterKey][controlValue] then
953 blackListed = true 967 self.filtered = true
954 end 968 end
955 end 969 end
956 print(blackListed, whiteListed)
957 self.filtered = (blackListed and (not whiteListed))
958 970
959 if not TQ_IsActive(self.questID) then 971 if not TQ_IsActive(self.questID) then
960 print(' quest is dead') 972 self.used = nil
961 return false
962 end 973 end
963 if qType == LE_QUEST_TAG_TYPE_PROFESSION then 974 if qType == LE_QUEST_TAG_TYPE_PROFESSION then
964 975 if not (db.ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then
965 if not (ShowAllProfessionQuests or (self.tradeskillLineIndex and GetProfessionInfo(self.tradeskillLineIndex))) then 976 self.used = nil
966 print(' non-profession') 977 end
967 return false 978 end
968 end 979 print(' |cFFFF4400IsShowable()|r', self.used, self.filtered, self.title)
969 end 980 return self.used, self.filtered
970 return true
971 end 981 end
972 982
973 function QuestPOI:UpdateTimer (timeLeft, timeType) 983 function QuestPOI:UpdateTimer (timeLeft, timeType)
974 print('|cFF0088FFUpdatePinTimer()|r') 984 print('|cFF0088FFUpdatePinTimer()|r')
975 end 985 end
976 986
977 --- Re-acquires size information and triggers things 987 --- Fixes icons upon size update
978 function QuestPOI:GetSizeMetrics (style, subStyle) 988 function QuestPOI:UpdateSize (style, subStyle)
979 self.style = self.style or POI_DEFAULT_TYPE 989 self.style = self.style or POI_DEFAULT_TYPE
980 self.subStyle = self.subStyle or 'continent' 990 self.subStyle = self.subStyle or 'continent'
981 991
982 style = style or self.style 992 style = style or self.style
983 subStyle = style[subStyle or self.subStyle] 993 subStyle = style[subStyle or self.subStyle]
989 self.tagSize = subStyle.TagSize 999 self.tagSize = subStyle.TagSize
990 self.TimeleftStage = subStyle.TimeleftStage 1000 self.TimeleftStage = subStyle.TimeleftStage
991 self.NoIcon = subStyle.NoIcon 1001 self.NoIcon = subStyle.NoIcon
992 1002
993 self:SetSize(self.currentWidth, self.currentWidth) 1003 self:SetSize(self.currentWidth, self.currentWidth)
994 end 1004
995
996 -- triggered by OnSizeChanged script
997 function QuestPOI:OnSizeChanged ()
998 local iconBorder = self.iconBorder 1005 local iconBorder = self.iconBorder
999 local trackingBorder = self.supertrackBorder 1006 local trackingBorder = self.supertrackBorder
1000 local tag = self.tagIcon 1007 local tag = self.tagIcon
1001 local style = self.style or POI_DEFAULT_TYPE 1008 local style = self.style or POI_DEFAULT_TYPE
1002 local mask = style.mask or POI_BORDER_FILL 1009 local mask = style.mask or POI_BORDER_FILL
1023 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth) 1030 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth)
1024 else 1031 else
1025 tag:Hide() 1032 tag:Hide()
1026 end 1033 end
1027 1034
1035 --qprint('using mask:', mask, self.name )
1028 self.icon:SetMask(mask) 1036 self.icon:SetMask(mask)
1037 self.icon:SetTexture(self.icon:GetTexture())
1029 self.iconBorder:SetMask(mask) 1038 self.iconBorder:SetMask(mask)
1030 self.supertrackBorder:SetMask(mask) 1039 self.supertrackBorder:SetMask(mask)
1031 1040
1032 if self.NoIcon then 1041 if self.NoIcon then
1033 self.icon:Hide() 1042 self.icon:Hide()
1056 end 1065 end
1057 end 1066 end
1058 return passesFilter 1067 return passesFilter
1059 end 1068 end
1060 1069
1070
1071 local bountyIndex
1061 local debug_headers = {} 1072 local debug_headers = {}
1062 function FilterBar:Refresh() 1073
1063 local mapID = GetCurrentMapAreaID() 1074 function FilterBar:Setup()
1075 self:GetFilters()
1076 end
1077
1078 function FilterBar:OnEvent(event,...)
1079 if event == 'QUEST_LOG_UPDATE' then
1080 self:Reset()
1081 self:Refresh()
1082 end
1083 end
1084
1085 function FilterBar:GetFilters()
1086
1087 local print = fbprint
1088 wipe(WorldPlan.FilterOptions)
1089
1090 for index, info in ipairs(POI_FILTER_OPTIONS) do
1091 tinsert(WorldPlan.FilterOptions, info)
1092 end
1093 self.bounties, self.numBounties = GetQuestBountyInfoForMapID(WorldPlan.currentMapID)
1094 self.BountyFilters = {}
1095 for index, data in ipairs(self.bounties) do
1096 local info = self.BountyFilters[index]
1097 if not info then
1098 info = {}
1099 self.BountyFilters[index] = info
1100 end
1101
1102 local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
1103
1104 info.filterKey = 'factionID'
1105 info.filterValue = data.factionID
1106 info.label = questTitle
1107 info.texture = data.icon
1108 print('loading emissary', questTitle)
1109 tinsert(WorldPlan.FilterOptions, info)
1110 --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
1111 end
1112 end
1113
1114 function FilterBar:Reset()
1115 self:GetFilters()
1116 end
1117
1118 function FilterBar:Refresh(forced)
1119 local print = fbprint
1064 local blocks = self.SummaryHeaders 1120 local blocks = self.SummaryHeaders
1121 local relativeFrame = WorldMapFrame.UIElementsFrame.TrackingOptionsButton
1065 local numHeaders = 0 1122 local numHeaders = 0
1066 local lastButton 1123 print('|cFF00FF88'..tostring(self)..':Refresh()|r', 'currentMap=',WorldPlan.currentMapID)
1067 local pinSize, borderSize, trackingSize = 20, 2, 2 1124
1068 print('|cFF00FF88'..tostring(self)..':Refresh()|r') 1125
1069 for index, info in pairs(POI_FILTER_OPTIONS) do 1126 local quests = QuestsByZone[WorldPlan.currentMapID] or QuestsByID
1127
1128
1129 for index, info in ipairs(WorldPlan.FilterOptions) do
1070 local numQuests = 0 1130 local numQuests = 0
1071 local quests = QuestsByZone[mapID] or QuestsByID
1072 1131
1073 for questID, pin in pairs(quests) do 1132 for questID, pin in pairs(quests) do
1074 if pin.used then 1133 if pin.used then
1075 if not info.filterKey then 1134 if not info.filterKey then
1076 numQuests = numQuests + 1 1135 numQuests = numQuests + 1
1077 elseif pin[info.filterKey] == info.filterValue then 1136 elseif pin[info.filterKey] == info.filterValue then
1078 numQuests = numQuests + 1 1137 numQuests = numQuests + 1
1079 end 1138 end
1080 end 1139 end
1081 end 1140 end
1082 print(tostring(index).. ' ("'..tostring(info.label)..'"'.. tostring(rewardFilter).. ', '..tostring(tagFilter) .. ', '..tostring(numQuests)..')') 1141 print(tostring(index).. ' ("'..tostring(info.label)..'" f('.. tostring(info.filterKey).. '='..tostring(info.filterValue) .. '), '..tostring(numQuests)..')')
1083 1142
1084 if numQuests >= 1 then 1143 if numQuests >= 1 then
1085 numHeaders = numHeaders + 1 1144 numHeaders = numHeaders + 1
1086 local button = blocks[numHeaders] 1145 local button = blocks[numHeaders]
1087 if not blocks[numHeaders] then 1146 if not blocks[numHeaders] then
1094 button.supertrackBorder:SetDesaturated(true) 1153 button.supertrackBorder:SetDesaturated(true)
1095 blocks[numHeaders] = button 1154 blocks[numHeaders] = button
1096 end 1155 end
1097 1156
1098 button:SetID(index) 1157 button:SetID(index)
1099 button.lastButton = lastButton 1158 button.spacing = ((info.filterKey ~= relativeFrame.filterKey) and 10) or 0
1159 button.relativeFrame = relativeFrame
1100 button:Refresh(info, (numHeaders == 1), numQuests) 1160 button:Refresh(info, (numHeaders == 1), numQuests)
1101 button:Show() 1161 button:Show()
1102 lastButton = button 1162 print(' using', button.label:GetText())
1103 end 1163 relativeFrame = button
1104 1164 end
1105 end 1165
1166 end
1167
1168 self.numHeaders = numHeaders
1169 for i = numHeaders + 1, #WorldPlan.FilterOptions do
1170 if self.SummaryHeaders[i] then
1171 self.SummaryHeaders[i]:Hide()
1172 end
1173 end
1174 end
1175
1176 function FilterBar:Cleanup()
1177
1106 -- hide trailing buttons 1178 -- hide trailing buttons
1107 for i = numHeaders + 1, #POI_FILTER_OPTIONS do
1108 if blocks[i] then
1109 blocks[i]:Hide()
1110 end
1111 end
1112 end 1179 end
1113 1180
1114 1181
1115 function FilterPin:Refresh(info, isFirst, numQuests) 1182 function FilterPin:Refresh(info, isFirst, numQuests)
1116 info = info or POI_FILTER_OPTIONS[self:GetID()] 1183 local print = fbprint
1117 isFirst = isFirst or self.isFirst 1184 isFirst = isFirst or self.isFirst
1118 numQuests = numQuests or self.numQuests 1185 numQuests = numQuests or self.numQuests
1119 1186
1120 self.isFirst = isFirst 1187 if info then
1121 self.numQuests = numQuests 1188 self.isFirst = isFirst
1122 self.filterKey = info.filterKey 1189 self.numQuests = numQuests
1123 self.filterValue = info.filterValue 1190 self.filterKey = info.filterKey
1124 self.tagID = info.tagID 1191 self.filterValue = info.filterValue
1125 1192 self.tagID = info.tagID
1126 self.icon:ClearAllPoints() 1193
1127 self.icon:SetTexture(info.texture) 1194 self.icon:ClearAllPoints()
1128 self.icon:SetAllPoints(self) 1195 self.icon:SetTexture(info.texture)
1129 self.supertrackBorder:Hide() 1196 self.icon:SetAllPoints(self)
1130 self.label:SetText(numQuests) 1197 self.supertrackBorder:Hide()
1131 self:Show() 1198 self.label:SetText(numQuests)
1132 1199 self:Show()
1200 end
1201
1202
1203 self.itemTexture = self.texture
1133 1204
1134 if isFirst then 1205 if isFirst then
1135 self:SetPoint('TOP', WorldMapFrame.UIElementsFrame.TrackingOptionsButton, 'BOTTOM', 0, -5) 1206 self:SetPoint('TOP', self.relativeFrame, 'BOTTOM', 0, -5)
1136 else 1207 else
1137 self:SetPoint('TOPRIGHT', self.lastButton, 'BOTTOMRIGHT', 0, -(3*2 + 1 + (info.spacing or 0))) 1208 self:SetPoint('TOPRIGHT', self.relativeFrame, 'BOTTOMRIGHT', 0, -(3*2 + 1 + (self.spacing or 0)))
1138 end 1209
1139 1210 end
1140 print(self.filterKey, self.filterValue) 1211 print('anchor to', self.relativeFrame:GetName())
1212
1141 local r, g, b, a = 1,1,1,1 1213 local r, g, b, a = 1,1,1,1
1142 if self.filterKey then 1214 if self.filterKey then
1143 if FilterInclusions[self.filterKey][self.filterValue] == true then 1215 if FilterInclusions[self.filterKey][self.filterValue] == true then
1144 r, g, b = 0, 1, 0 1216 r, g, b = 0, 1, 0
1145 elseif FilterExclusions[self.filterKey][self.filterValue] then 1217 elseif FilterExclusions[self.filterKey][self.filterValue] then
1146 r, g, b = 1, 0, 0 1218 r, g, b = 1, 0, 0
1147 end 1219 end
1148 end 1220 end
1149 self.iconBorder:SetVertexColor(r, g, b, a) 1221 self.iconBorder:SetVertexColor(r, g, b, a)
1150 1222 self:UpdateSize()
1151
1152 self:GetSizeMetrics()
1153 end 1223 end
1154 1224
1155 function FilterPin:OnLoad() 1225 function FilterPin:OnLoad()
1156 self:RegisterForClicks('AnyUp') 1226 self:RegisterForClicks('AnyUp')
1157 self:SetFrameStrata('HIGH') 1227 self:SetFrameStrata('HIGH')
1170 end 1240 end
1171 1241
1172 -- shift-click: reset filter 1242 -- shift-click: reset filter
1173 -- click: rotate through include(1), exclude(-1), ignore(nil) 1243 -- click: rotate through include(1), exclude(-1), ignore(nil)
1174 function FilterPin:OnClick (button) 1244 function FilterPin:OnClick (button)
1245 local print = fbprint
1175 local filterKey = self.filterKey 1246 local filterKey = self.filterKey
1176 local filterValue = self.filterValue 1247 local filterValue = self.filterValue
1177 1248
1178 print('click', filterKey, filterValue) 1249
1250 local operation = opPrefix
1251 local setExclude = (button == 'RightButton')
1252 local filterTable = setExclude and FilterExclusions or FilterInclusions
1253 local opposingTable = setExclude and FilterInclusions or FilterExclusions
1254
1179 1255
1180 if not filterKey then 1256 if not filterKey then
1181 -- resetting 1257 -- resetting
1182 for k,v in pairs(FilterInclusions) do 1258 for k,v in pairs(FilterInclusions) do
1183 wipe(v) 1259 wipe(v)
1184 end 1260 end
1185 for k,v in pairs(FilterExclusions) do 1261 for k,v in pairs(FilterExclusions) do
1186 wipe(v) 1262 wipe(v)
1187 end 1263 end
1188 else 1264 else
1189 local setExclude = (button == 'RightButton') 1265
1190 if IsControlKeyDown() then 1266 if filterTable[filterKey][filterValue] then
1191 if setExclude then 1267 filterTable[filterKey][filterValue] = nil
1192 if FilterExclusions[filterKey][filterValue] then 1268 else
1193 FilterExclusions[filterKey][filterValue] = nil 1269 filterTable[filterKey][filterValue] = true
1194 else 1270 opposingTable[filterKey][filterValue] = nil
1195 FilterExclusions[filterKey][filterValue] = true 1271 end
1272
1273 local overrideFilters = IsControlKeyDown()
1274 local overrideOpposing = IsShiftKeyDown()
1275
1276 for k, info in ipairs(POI_FILTER_OPTIONS) do
1277 if (info.filterKey == filterKey) and (info.filterValue ~= filterValue) then
1278 if overrideFilters then
1279 filterTable[info.filterKey][info.filterValue] = nil
1280 opposingTable[info.filterKey][info.filterValue] = true
1281 elseif overrideOpposing then
1282 filterTable[info.filterKey][info.filterValue] = nil
1283 opposingTable[info.filterKey][info.filterValue] = nil
1284 end
1196 end 1285 end
1197 FilterInclusions[filterKey][filterValue] = nil 1286 end
1198 else 1287
1199 if FilterInclusions[filterKey][filterValue] == true then 1288
1200 FilterInclusions[filterKey][filterValue] = nil 1289 end
1201 else 1290
1202 FilterInclusions[filterKey][filterValue] = true 1291 print('|cFF00FF88Filter Update:', filterKey, filterValue, operation)
1203 end
1204 FilterExclusions[filterKey][filterValue] = nil
1205 end
1206 elseif IsShiftKeyDown() then
1207 FilterInclusions[filterKey][filterValue] = nil
1208 FilterExclusions[filterKey][filterValue] = nil
1209 else
1210 print('limit to', filterKey, filterValue)
1211 if setExclude then
1212 FilterExclusions[filterKey][filterValue] = true
1213 FilterInclusions[filterKey][filterValue] = nil
1214 else
1215 FilterInclusions[filterKey][filterValue] = true
1216 FilterExclusions[filterKey][filterValue] = nil
1217 end
1218
1219 for k, info in ipairs(POI_FILTER_OPTIONS) do
1220 if info.filterKey and ((info.filterKey ~= filterKey) or (info.filterValue ~= filterValue)) then
1221 if setExclude then
1222 FilterExclusions[info.filterKey][info.filterValue] = nil
1223 FilterInclusions[info.filterKey][info.filterValue] = true
1224 else
1225 FilterExclusions[info.filterKey][info.filterValue] = true
1226 FilterInclusions[info.filterKey][info.filterValue] = nil
1227 end
1228
1229 end
1230 end
1231
1232 end
1233 end
1234
1235 1292
1236 WorldPlan:RefreshAll() 1293 WorldPlan:RefreshAll()
1237 end 1294 end
1238 1295
1239 --%debug% 1296 --%debug%