diff FilterBar.lua @ 95:b29b35cb8539

- Fixed quest completion checking and handling - Changed animation method to hopefully stop weird flickering. - Pins are now visible before full reward data is loaded - Filter bar redesigned: - aligned horizontally along the top of the map display - filter buttons display a '+' when there are matches in both current and other zones, and '*' when there only matches in other zones - button tooltips separate local and global quests - button categories are highlighted and labeled when the cursor is over them - Fixed invalid POI targets appearing when the spell targeting cursor is active - ClassOrderPlan can be closed with the game menu button
author Nenue
date Mon, 08 May 2017 22:38:52 -0400
parents 98b5e08b75ed
children b67ba1078824
line wrap: on
line diff
--- a/FilterBar.lua	Sat Apr 15 11:05:32 2017 -0400
+++ b/FilterBar.lua	Mon May 08 22:38:52 2017 -0400
@@ -23,7 +23,7 @@
 local BUTTONS_SPACING = 1
 local BUTTONS_HEIGHT = 20
 local TOGGLE_SIZE = 20
-local HEADERS_HEIGHT = 40
+local HEADERS_HEIGHT = 24
 
 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
@@ -201,6 +201,9 @@
 end
 
 function Module:Reset()
+
+
+
   self:UpdateFilters('SUMMARY_RESET')
   self:UpdateMatches('SUMMARY_RESET')
   self:UpdateLayout('SUMMARY_RESET')
@@ -222,13 +225,15 @@
   wipe(db.FilterList)
 
   for index, info in ipairs(db.DefaultFilters) do
+    info.used = true
     tinsert(db.FilterList, info)
   end
   self.bounties = db.Bounties
   self.BountyFilters = {}
+  local numBounties = 0
   for index, data in ipairs(self.bounties) do
     if not IsQuestComplete(data.questID) then
-
+      numBounties = numBounties + 1
       local info = self.BountyFilters[index]
       if not info then
         info  = {}
@@ -241,6 +246,7 @@
       end
 
       local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
+      info.used = true
       info.filterKey = 'factionID'
       info.filterFunc = IsBountyCriteria
       info.filterValue = data.questID
@@ -251,8 +257,12 @@
       tinsert(db.FilterList, info)
       --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
     end
+  end
 
+  for i = numBounties + 1, #self.BountyFilters do
+    self.BountyFilters[i].used = nil
   end
+
 end
 
 function Module:UpdateMatches(event)
@@ -268,15 +278,12 @@
     print(info.filterKey, info.filterValue, info.filterFunc and 'func test' or 'compare')
     for questID, pin in pairs(quests) do
       print('', questID, pin.dataLoaded, (not IsQuestComplete(questID)))
-      if pin.dataLoaded and not IsQuestComplete(questID) then
-
+      if pin.dataLoaded and (not IsQuestComplete(questID)) then
         local keyName, keyValue = info.filterKey, info.filterValue
         local isMatch
         if info.filterFunc then
-
           isMatch = info.filterFunc(pin, keyValue)
           print('  running special function, result =', isMatch)
-
         elseif pin[keyName] and (pin[keyName] == keyValue) then
           isMatch = true
           print('  rote match')
@@ -287,10 +294,8 @@
             print('  local map')
             tinsert(info.LocalMatches, pin)
           end
-
         end
       end
-
     end
     print('global', #info.GlobalMatches, 'local', #info.LocalMatches)
   end
@@ -411,9 +416,9 @@
     layoutWidth = layoutWidth + headerWidth + HEADERS_SPACING
   end
 
-  self:SetSize(layoutWidth, BUTTONS_HEIGHT + BUTTONS_SPACING * 2)
+  self:SetSize(layoutWidth, BUTTONS_HEIGHT + (BUTTONS_SPACING * 2))
   self:ClearAllPoints()
-  self:SetPoint('TOP')
+  self:SetPoint('BOTTOM')
   self.isStale = nil
   layoutDirty = nil
 end