comparison WorldPlan.lua @ 35:26dfa661daa7

WorldPlan: - Quest pins will appear in the flight map. They follow the filter settings applied from the world map. - Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it. - Fixed filter bar info falling out of sync after player-triggered world map updates. - Code stuff: -- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there -- WorldQuests module re-factored outside of the top level frame script. ClassPlan: - Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author Nenue
date Thu, 03 Nov 2016 17:29:15 -0400
parents 0100d923d8c3
children 21bcff08b0f4
comparison
equal deleted inserted replaced
34:0100d923d8c3 35:26dfa661daa7
9 UsedFilters = {}, 9 UsedFilters = {},
10 QuestsByZone = {}, 10 QuestsByZone = {},
11 QuestsByID = {}, 11 QuestsByID = {},
12 TaskQueue = {}, 12 TaskQueue = {},
13 } 13 }
14 WorldPlanPOIMixin = {}
14 local WorldPlan = WorldPlanCore 15 local WorldPlan = WorldPlanCore
15 16
16 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end 17 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
18
19 local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end
17 local WP_VERSION = "1.0" 20 local WP_VERSION = "1.0"
18 local tinsert, pairs, floor = table.insert, pairs, floor 21 local tinsert, pairs, floor = table.insert, pairs, floor
19 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS 22 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS
20 local BROKEN_ISLES_ID = 1007 23 local BROKEN_ISLES_ID = 1007
21 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID 24 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID
166 print() 169 print()
167 print(event, 'init:', self.initialized) 170 print(event, 'init:', self.initialized)
168 if event == 'ADDON_LOADED' then 171 if event == 'ADDON_LOADED' then
169 local addon = ... 172 local addon = ...
170 if addon == "Blizzard_FlightMap" then 173 if addon == "Blizzard_FlightMap" then
171 print('do mixin junk') 174 mprint('sending data provider')
172 self.OnFlightMapLoaded() 175 local dataProvider = Mixin(MapCanvasDataProviderMixin, WorldPlanDataProvider)
173 176 WorldPlanDataPinMixin = Mixin(MapCanvasPinMixin, WorldPlanDataPinMixin)
177 for k,v in pairs(dataProvider) do
178 mprint((v == WorldPlanDataProvider[k]) and ('|cFF00FF00'..tostring(k)..'|r') or ('|cFFFF4400'..tostring(k)..'|r'))
179 end
180
181 FlightMapFrame:AddDataProvider(dataProvider)
174 end 182 end
175 if IsLoggedIn() and not self.initialized then 183 if IsLoggedIn() and not self.initialized then
176 self:Setup() 184 self:Setup()
177 end 185 end
178 else 186 else
179 if event == 'WORLD_MAP_UPDATE' then 187 if event == 'WORLD_MAP_UPDATE' then
180 self.currentMapID = GetCurrentMapAreaID() 188 self.currentMapID = GetCurrentMapAreaID()
181 self.isContinentMap = (self.currentMapID == BROKEN_ISLES_ID) 189 self.isContinentMap = (self.currentMapID == BROKEN_ISLES_ID)
182 self:print('|cFFFF4400currentMapID =', self.currentMapID) 190 --self:print('|cFFFF4400currentMapID =', self.currentMapID)
183 --self.isStale = true 191 self.isStale = true
184 end 192 end
185 193
186 for i, module in ipairs(self.modules) do 194 for i, module in ipairs(self.modules) do
187 if module.OnEvent then 195 if module.OnEvent then
188 print(' |cFF0088FF'..module:GetName() .. ':OnEvent()|r') 196 print(' |cFF0088FF'..module:GetName() .. ':OnEvent()|r')
194 202
195 function WorldPlanCore:OnNext(func) 203 function WorldPlanCore:OnNext(func)
196 204
197 205
198 tinsert(self.TaskQueue, func) 206 tinsert(self.TaskQueue, func)
199 self:print('|cFF00FF00adding scheduled task #', #self.TaskQueue) 207 --self:print('|cFF00FF00adding scheduled task #', #self.TaskQueue)
200 end 208 end
201 209
202 function WorldPlanCore:OnUpdate() 210 function WorldPlanCore:OnUpdate()
203 if #self.TaskQueue >= 1 then 211 if #self.TaskQueue >= 1 then
204 local func = tremove(self.TaskQueue, 1) 212 local func = tremove(self.TaskQueue, 1)
408 info.func = DropDown_OnClick 416 info.func = DropDown_OnClick
409 UIDropDownMenu_AddButton(info) 417 UIDropDownMenu_AddButton(info)
410 end 418 end
411 419
412 -------------------------------------------------------------------------------------------------------------------- 420 --------------------------------------------------------------------------------------------------------------------
413 -------------------------------------------------------------------------------------------------------------------- 421 -------------------
414
415
416 -- data provider manipulations for the taxi map
417 WorldPlan.OnFlightMapLoaded = function()
418 if true then return end
419 -- todo: figure out how to layer inside the map canvas
420 local res = {}
421 local t = {}
422 for k,v in pairs(FlightMapFrame) do
423 tinsert(res, tostring(k))
424 end
425
426 table.sort(res)
427 for i, k in ipairs(res) do
428 print(k)
429 end
430 hooksecurefunc(FlightMapFrame, 'RefreshAll', function(self)
431 print('|cFF0088FFWQDP RefreshAllData ', GetTime())
432
433 WorldPlan:GetPinsForMap(self:GetMapID())
434
435 for pin in self:EnumerateAllPins() do
436 if pin.worldQuest then
437 --print('got pin #', pin.questID)
438 local wp = self.QuestsByID[pin.questID]
439 if wp then
440 wp:ClearAllPoints()
441 wp:SetParent(FlightMapFrame.ScrollContainer)
442 wp:SetFrameStrata('MEDIUM')
443 wp:SetPoint('CENTER', pin, 'CENTER')
444 wp:Show()
445 end
446 end
447 end
448 end)
449 end
450 422
451 423
452 424
453 425
454 426