diff WorldPlan.lua @ 31:d0114b51cdea

WorldPlan: - Reworking filters to utilize newly added CVars - Fleshed out POI tooltip for WQ's associated with Family Familiars - Filter button tooltip includes reward icons - Respond to tracking menu clicks when they change filter options
author Nenue
date Fri, 28 Oct 2016 19:54:00 -0400
parents 8cb750e79952
children e8679ecb48d8
line wrap: on
line diff
--- a/WorldPlan.lua	Fri Oct 28 14:06:07 2016 -0400
+++ b/WorldPlan.lua	Fri Oct 28 19:54:00 2016 -0400
@@ -92,7 +92,7 @@
     numberFontObject = 'WorldPlanNumberFontThin'
   },
   minimized = {
-    PinSize = 4,
+    PinSize = 6,
     Border = 0,
     TrackingBorder = 1,
     NoIcon = true,
@@ -102,16 +102,9 @@
 }
 
 
-local POI_FILTER_STYLE = setmetatable({
-  continentBorder = 2,
-  zoneBorder = 2,
-}, {__index = DEFAULT_TYPE})
 
 
 local defaults = {
-  defaultPinStyle = POI_DEFAULT_TYPE,
-  rewardStyle = POI_REWARD_TYPE,
-  filterStyle = POI_FILTER_STYLE,
   ShowAllProfessionQuests = false,
   DisplayContinentSummary = true,
   DisplayContinentPins = true,
@@ -134,18 +127,6 @@
 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL
-local POI_FILTER_OPTIONS = {
-  { label = 'Filters', texture = "Interface\\WorldMap\\WorldMap-Icon" },
-  { filterKey= 'rewardType', filterValue = REWARD_ARTIFACT_POWER, label = 'Artifact Power', texture = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" },
-  { filterKey= 'rewardType', filterValue = REWARD_CURRENCY,label = 'Order Resources', texture = "Interface\\ICONS\\inv_misc_elvencoins" },
-  { filterKey= 'rewardType', filterValue = REWARD_GEAR, label = 'Equipment', texture = "Interface\\ICONS\\garrison_bluearmorupgrade" },
-  { filterKey= 'rewardType', filterValue = REWARD_REAGENT, label = 'Materials', texture = 1417744 },
-  { filterKey= 'rewardType', filterValue = REWARD_CASH, label = 'Gold', texture = ICON_MONEY },
-  { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PVP, label = 'PvP', texture = "Interface\\Icons\\Ability_PVP_GladiatorMedallion", spacing = 10 },
-  { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PET_BATTLE, label = 'Pet Battle', texture = "Interface\\Icons\\PetJournalPortrait", },
-  { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_DUNGEON, label = 'Dungeon', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
-  { filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\ICONS\\70_professions_scroll_02", },
-}
 WorldPlanCore.BrokenIsleID = BROKEN_ISLES_ID
 WorldPlanCore.FilterStyle = POI_FILTER_STYLE
 
@@ -416,11 +397,6 @@
     return
   end
 
-  POI_DEFAULT_TYPE = db.defaultPinStyle
-  POI_REWARD_TYPE = db.rewardStyle
-  POI_FILTER_STYLE = db.filterStyle
-
-
   for i, module in ipairs(self.modules) do
     if module.Reset then
       print(module, 'Reset()')
@@ -549,6 +525,15 @@
     end
   end)
 
+  hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button)
+    print("|cFF0088FFWorldMapTrackingOptionsDropDown_OnClick|r")
+    local value = button.value
+    if (value == "worldQuestFilterOrderResources" or value == "worldQuestFilterArtifactPower" or
+        value == "worldQuestFilterProfessionMaterials" or value == "worldQuestFilterGold" or
+        value == "worldQuestFilterEquipment") then
+      self:Refresh(true)
+    end
+  end)
 end
 
 local defaults = {}
@@ -765,9 +750,9 @@
     local hostFrame = WorldMapPOIFrame
     local mapWidth, mapHeight = hostFrame:GetSize()
     for questID, pin in pairs(pins) do
-      pin.hasUpdate = true
       pin:IsShowable()
       if pin.used then
+        pin.hasUpdate = true
         pin:SetFrameLevel(PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins)
         print('level', PinBaseIndex+ (pin.whiteListed and 200 or 0) +numPins)
         pin:SetAnchor(WorldMapPOIFrame, currentMap, mapWidth, mapHeight)
@@ -911,9 +896,17 @@
 
   print('  |cFFFF4400IsShowable()|r', self.title)
 
-  if not self.passesBlizzFilters then
+  self.questId  = self:GetID()
+  if not (WorldMap_DoesWorldQuestInfoPassFilters(self)) then
     self.filtered = true
   end
+
+  for filterKey, value in pairs(WorldPlan.UsedFilters) do
+    if self[filterKey] ~= value then
+      self.filtered = true
+    end
+  end
+
   if not TQ_IsActive(self.questID) then
     self.used = nil
   elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then