comparison FilterBar.lua @ 84:a12f782571c5 v1.4.5

- Fixed more filter bar issues
author Nenue
date Mon, 10 Apr 2017 17:50:06 -0400
parents 26d736fbfe67
children 98b5e08b75ed
comparison
equal deleted inserted replaced
83:a611cf505278 84:a12f782571c5
105 local debug_headers = {} 105 local debug_headers = {}
106 106
107 function Module:Setup() 107 function Module:Setup()
108 print('|cFF00FF88'..self:GetName()..':Setup()') 108 print('|cFF00FF88'..self:GetName()..':Setup()')
109 self.isStale = true 109 self.isStale = true
110 self:SetShown(true)
110 end 111 end
111 112
112 113
113 function Module:OnUpdate() 114 function Module:OnUpdate()
114 if self.isStale then 115 if self.isStale then
115 wprint('|cFF00FF00pushing update') 116 wprint('|cFF00FF00pushing update')
116 self:Refresh() 117 self:Refresh()
117 end 118 end
118 end 119 end
119 120
120 function Module:OnMapInfo(isBrokenIsle, mapAreaID) 121 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
122 print('|cFFFFFF00OnMapInfo()', isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
121 if not isBrokenIsle then 123 if not isBrokenIsle then
122 self:SetShown(false) 124 self:SetShown(false)
123 else 125 else
126 if self:IsShown() then
127 self:Refresh()
128 end
124 self:SetShown(true) 129 self:SetShown(true)
125 self:Refresh()
126 end 130 end
127 end 131 end
128 132
129 function Module:OnShow() 133 function Module:OnShow()
130 print('|cFF00FF88'..self:GetName()..':OnShow()') 134 print('|cFF00FF88'..self:GetName()..':OnShow()')
189 193
190 local layout = db.DefaultFilterType 194 local layout = db.DefaultFilterType
191 local borderWidth = layout.iconWidth + (layout.borderWidth * 2) 195 local borderWidth = layout.iconWidth + (layout.borderWidth * 2)
192 local highlightWidth = borderWidth + (layout.highlightWidth * 2) 196 local highlightWidth = borderWidth + (layout.highlightWidth * 2)
193 local mapQuests = db.QuestsByZone[db.currentMapID] or db.QuestsByID 197 local mapQuests = db.QuestsByZone[db.currentMapID] or db.QuestsByID
198 local n = 0
199 for _ in pairs(mapQuests) do
200 n = n + 1
201 end
202 print(n, 'pins to work with')
203
194 local firstCvar, lastCvar 204 local firstCvar, lastCvar
195 for index, info in ipairs(self.filterList) do 205 for index, info in ipairs(self.filterList) do
196 local numQuestsHere = 0 206 local numQuestsHere = 0
197 local numQuestsTotal = 0 207 local numQuestsTotal = 0
198 info.questList = info.questList or {} 208 info.questList = info.questList or {}
199 wipe(info.questList) 209 wipe(info.questList)
210 print(info.filterKey, info.filterValue)
200 211
201 for questID, pin in pairs(db.QuestsByID) do 212 for questID, pin in pairs(db.QuestsByID) do
202 --print(pin.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION, (db.Config.ShowAllProfessionQuests or pin.isKnownProfession)) 213 --print(pin.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION, (db.Config.ShowAllProfessionQuests or pin.isKnownProfession))
203 if pin.used then 214 if pin.used then
204 215
216 print(pin.title, mapQuests[questID])
205 if (pin.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION) or (db.Config.ShowAllProfessionQuests or pin.isKnownProfession) then 217 if (pin.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION) or (db.Config.ShowAllProfessionQuests or pin.isKnownProfession) then
206 218
207 if not info.filterKey then 219 if not info.filterKey then
208 if mapQuests[questID] then 220 if mapQuests[questID] then
209 numQuestsHere = numQuestsHere + 1 221 numQuestsHere = numQuestsHere + 1
210 end 222 end
211 numQuestsTotal = numQuestsTotal + 1 223 numQuestsTotal = numQuestsTotal + 1
212 elseif pin[info.filterKey] == info.filterValue then 224 elseif pin[info.filterKey] == info.filterValue then
213 print(pin.title, mapQuests[questID])
214 if mapQuests[questID] then 225 if mapQuests[questID] then
215 numQuestsHere = numQuestsHere + 1 226 numQuestsHere = numQuestsHere + 1
216 tinsert(info.questList, pin) 227 tinsert(info.questList, pin)
217 end 228 end
218 numQuestsTotal = numQuestsTotal + 1 229 numQuestsTotal = numQuestsTotal + 1