comparison 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
comparison
equal deleted inserted replaced
94:dfd53f7c0fe5 95:b29b35cb8539
21 21
22 local HEADERS_SPACING = 3 22 local HEADERS_SPACING = 3
23 local BUTTONS_SPACING = 1 23 local BUTTONS_SPACING = 1
24 local BUTTONS_HEIGHT = 20 24 local BUTTONS_HEIGHT = 20
25 local TOGGLE_SIZE = 20 25 local TOGGLE_SIZE = 20
26 local HEADERS_HEIGHT = 40 26 local HEADERS_HEIGHT = 24
27 27
28 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP 28 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
29 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE 29 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
30 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON 30 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON
31 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION 31 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION
199 199
200 ToggleButton.OnShow(self.Toggle) 200 ToggleButton.OnShow(self.Toggle)
201 end 201 end
202 202
203 function Module:Reset() 203 function Module:Reset()
204
205
206
204 self:UpdateFilters('SUMMARY_RESET') 207 self:UpdateFilters('SUMMARY_RESET')
205 self:UpdateMatches('SUMMARY_RESET') 208 self:UpdateMatches('SUMMARY_RESET')
206 self:UpdateLayout('SUMMARY_RESET') 209 self:UpdateLayout('SUMMARY_RESET')
207 end 210 end
208 211
220 print('|cFF00FFFF'..self:GetName()..':GetFilters()', event) 223 print('|cFF00FFFF'..self:GetName()..':GetFilters()', event)
221 224
222 wipe(db.FilterList) 225 wipe(db.FilterList)
223 226
224 for index, info in ipairs(db.DefaultFilters) do 227 for index, info in ipairs(db.DefaultFilters) do
228 info.used = true
225 tinsert(db.FilterList, info) 229 tinsert(db.FilterList, info)
226 end 230 end
227 self.bounties = db.Bounties 231 self.bounties = db.Bounties
228 self.BountyFilters = {} 232 self.BountyFilters = {}
233 local numBounties = 0
229 for index, data in ipairs(self.bounties) do 234 for index, data in ipairs(self.bounties) do
230 if not IsQuestComplete(data.questID) then 235 if not IsQuestComplete(data.questID) then
231 236 numBounties = numBounties + 1
232 local info = self.BountyFilters[index] 237 local info = self.BountyFilters[index]
233 if not info then 238 if not info then
234 info = {} 239 info = {}
235 self.BountyFilters[index] = info 240 self.BountyFilters[index] = info
236 layoutDirty = true 241 layoutDirty = true
239 layoutDirty = true 244 layoutDirty = true
240 end 245 end
241 end 246 end
242 247
243 local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID)) 248 local questTitle = GetQuestLogTitle(GetQuestLogIndexByID(data.questID))
249 info.used = true
244 info.filterKey = 'factionID' 250 info.filterKey = 'factionID'
245 info.filterFunc = IsBountyCriteria 251 info.filterFunc = IsBountyCriteria
246 info.filterValue = data.questID 252 info.filterValue = data.questID
247 info.label = questTitle 253 info.label = questTitle
248 info.texture = data.icon 254 info.texture = data.icon
249 print('loading emissary', questTitle) 255 print('loading emissary', questTitle)
250 256
251 tinsert(db.FilterList, info) 257 tinsert(db.FilterList, info)
252 --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", }, 258 --{ filterKey= 'worldQuestType', filterValue = LE_QUEST_TAG_TYPE_PROFESSION, label = 'Profession', texture = "Interface\\LFGFRAME\\UI-LFR-PORTRAIT", },
253 end 259 end
254 260 end
255 end 261
262 for i = numBounties + 1, #self.BountyFilters do
263 self.BountyFilters[i].used = nil
264 end
265
256 end 266 end
257 267
258 function Module:UpdateMatches(event) 268 function Module:UpdateMatches(event)
259 print('|cFF00FF00UpdateMatches()', event) 269 print('|cFF00FF00UpdateMatches()', event)
260 local quests = db.QuestsByID 270 local quests = db.QuestsByID
266 wipe(info.GlobalMatches) 276 wipe(info.GlobalMatches)
267 wipe(info.LocalMatches) 277 wipe(info.LocalMatches)
268 print(info.filterKey, info.filterValue, info.filterFunc and 'func test' or 'compare') 278 print(info.filterKey, info.filterValue, info.filterFunc and 'func test' or 'compare')
269 for questID, pin in pairs(quests) do 279 for questID, pin in pairs(quests) do
270 print('', questID, pin.dataLoaded, (not IsQuestComplete(questID))) 280 print('', questID, pin.dataLoaded, (not IsQuestComplete(questID)))
271 if pin.dataLoaded and not IsQuestComplete(questID) then 281 if pin.dataLoaded and (not IsQuestComplete(questID)) then
272
273 local keyName, keyValue = info.filterKey, info.filterValue 282 local keyName, keyValue = info.filterKey, info.filterValue
274 local isMatch 283 local isMatch
275 if info.filterFunc then 284 if info.filterFunc then
276
277 isMatch = info.filterFunc(pin, keyValue) 285 isMatch = info.filterFunc(pin, keyValue)
278 print(' running special function, result =', isMatch) 286 print(' running special function, result =', isMatch)
279
280 elseif pin[keyName] and (pin[keyName] == keyValue) then 287 elseif pin[keyName] and (pin[keyName] == keyValue) then
281 isMatch = true 288 isMatch = true
282 print(' rote match') 289 print(' rote match')
283 end 290 end
284 if isMatch then 291 if isMatch then
285 tinsert(info.GlobalMatches, pin) 292 tinsert(info.GlobalMatches, pin)
286 if questsForMap[questID] then 293 if questsForMap[questID] then
287 print(' local map') 294 print(' local map')
288 tinsert(info.LocalMatches, pin) 295 tinsert(info.LocalMatches, pin)
289 end 296 end
290 297 end
291 end 298 end
292 end
293
294 end 299 end
295 print('global', #info.GlobalMatches, 'local', #info.LocalMatches) 300 print('global', #info.GlobalMatches, 'local', #info.LocalMatches)
296 end 301 end
297 end 302 end
298 303
409 if currentHeader then 414 if currentHeader then
410 currentHeader:SetSize(headerWidth - BUTTONS_SPACING + HEADERS_SPACING, HEADERS_HEIGHT) 415 currentHeader:SetSize(headerWidth - BUTTONS_SPACING + HEADERS_SPACING, HEADERS_HEIGHT)
411 layoutWidth = layoutWidth + headerWidth + HEADERS_SPACING 416 layoutWidth = layoutWidth + headerWidth + HEADERS_SPACING
412 end 417 end
413 418
414 self:SetSize(layoutWidth, BUTTONS_HEIGHT + BUTTONS_SPACING * 2) 419 self:SetSize(layoutWidth, BUTTONS_HEIGHT + (BUTTONS_SPACING * 2))
415 self:ClearAllPoints() 420 self:ClearAllPoints()
416 self:SetPoint('TOP') 421 self:SetPoint('BOTTOM')
417 self.isStale = nil 422 self.isStale = nil
418 layoutDirty = nil 423 layoutDirty = nil
419 end 424 end
420 425
421 function Module:Cleanup() 426 function Module:Cleanup()