Mercurial > wow > worldplan
comparison WorldPlan.lua @ 67:96183f981acb
Update for Legion Patch 7.2
- Pins for quests detected from the flight map should properly update as needed.
- Fixed dropdown menu configurations not getting applied.
- Added a toggle button to the world map display that performs the same function as the 'Enable' option in the dropdown menu.
- Rewrote the majority of display update handlers for a significant performance improvements while interacting with the world map.
- AP token info should now reflect artifact knowledge changes.
| author | Nenue |
|---|---|
| date | Sat, 01 Apr 2017 08:17:30 -0400 |
| parents | e43e10c5576b |
| children | cce68795f955 |
comparison
equal
deleted
inserted
replaced
| 66:e43e10c5576b | 67:96183f981acb |
|---|---|
| 1 -- WorldPlan.lua | 1 -- WorldPlan.lua |
| 2 -- Created: 8/16/2016 8:19 AM | 2 -- Created: 8/16/2016 8:19 AM |
| 3 -- %file-revision% | 3 -- %file-revision% |
| 4 local addonFileName, db = ... | 4 local addonFileName, db = ... |
| 5 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end | 5 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end |
| 6 local WP_VERSION = "1.2" | 6 local WP_VERSION = "1.4" |
| 7 local tinsert, pairs, floor = tinsert, pairs, floor | 7 local tinsert, pairs, floor = tinsert, pairs, floor |
| 8 local tremove, ipairs, wipe, unpack = tremove, ipairs, wipe, unpack | 8 local tremove, ipairs, wipe, unpack = tremove, ipairs, wipe, unpack |
| 9 local select, type, tostring, tonumber = select, type, tostring, tonumber | 9 local select, type, tostring, tonumber = select, type, tostring, tonumber |
| 10 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS | 10 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS |
| 11 local BROKEN_ISLES_ID = 1007 | 11 local BROKEN_ISLES_ID = 1007 |
| 27 db.QuestsByZone = {} | 27 db.QuestsByZone = {} |
| 28 db.QuestsByID = {} | 28 db.QuestsByID = {} |
| 29 db.TasksByID = {} | 29 db.TasksByID = {} |
| 30 db.FreePins = {} | 30 db.FreePins = {} |
| 31 db.UsedPins = {} | 31 db.UsedPins = {} |
| 32 db.UpdatedPins = {} | |
| 32 db.ReportChunks = {} | 33 db.ReportChunks = {} |
| 34 db.BountyInfo = {} | |
| 33 | 35 |
| 34 -- default color templates | 36 -- default color templates |
| 35 db.DefaultType = { | 37 db.DefaultType = { |
| 36 a = 1, | 38 a = 1, |
| 37 r = 1, g = 1, b = 1, | 39 r = 1, g = 1, b = 1, |
| 80 DisplayContinentSummary = true, | 82 DisplayContinentSummary = true, |
| 81 DisplayContinentPins = true, | 83 DisplayContinentPins = true, |
| 82 NotifyWhenNewQuests = true, | 84 NotifyWhenNewQuests = true, |
| 83 EnablePins = true, | 85 EnablePins = true, |
| 84 FadeWhileGrouped = false, | 86 FadeWhileGrouped = false, |
| 85 FlightMapAlphaLimits = {1, 1, 1}, | 87 FlightMapAlphaLimits = {1, .7, 1}, |
| 86 FlightMapScalingLimits = {1, 3, 1.5}, | 88 FlightMapScalingLimits = {1, 3, 1.5}, |
| 87 --UntrackedColor = {}, | 89 --UntrackedColor = {}, |
| 88 --TrackedColor = {}, | 90 --TrackedColor = {}, |
| 89 --CriteriaColor = {}, | 91 --CriteriaColor = {}, |
| 90 --RewardColorGold = {}, | 92 --RewardColorGold = {}, |
| 103 WorldPlanData[key] = nil | 105 WorldPlanData[key] = nil |
| 104 else | 106 else |
| 105 WorldPlanData[key] = true | 107 WorldPlanData[key] = true |
| 106 end | 108 end |
| 107 end | 109 end |
| 108 for _, module in ipairs(db.OrderedModules) do | 110 _G.WorldPlan:OnConfigUpdate() |
| 109 if module.OnConfigUpdate then | |
| 110 module:OnConfigUpdate() | |
| 111 end | |
| 112 end | |
| 113 _G.WorldPlan:Refresh() | |
| 114 end | 111 end |
| 115 | 112 |
| 116 -- insert visual options into the tracking button menu | 113 -- insert visual options into the tracking button menu |
| 117 local DropDown_Initialize = function (self, callback, dropType) | 114 local DropDown_Initialize = function (self, callback, dropType) |
| 118 if self ~= WorldMapFrameDropDown then | 115 if self ~= WorldMapFrameDropDown then |
| 191 | 188 |
| 192 function db.print(...) | 189 function db.print(...) |
| 193 for i = 1, select('#', ...) do | 190 for i = 1, select('#', ...) do |
| 194 tinsert(db.ReportChunks, tostring(select(i, ...))) | 191 tinsert(db.ReportChunks, tostring(select(i, ...))) |
| 195 end | 192 end |
| 193 end | |
| 194 | |
| 195 function WorldPlanCore:OnConfigUpdate() | |
| 196 for _, module in ipairs(db.OrderedModules) do | |
| 197 if module.OnConfigUpdate then | |
| 198 module:OnConfigUpdate() | |
| 199 end | |
| 200 end | |
| 201 db.currentMapID = nil | |
| 202 db.BountyUpdate = true | |
| 203 self:SetCurrentMap('CONFIG_UPDATE') | |
| 204 self:Refresh() | |
| 196 end | 205 end |
| 197 | 206 |
| 198 function WorldPlanCore:print(...) db.print(...) end | 207 function WorldPlanCore:print(...) db.print(...) end |
| 199 | 208 |
| 200 function WorldPlanCore:AddHandler (frame) | 209 function WorldPlanCore:AddHandler (frame) |
| 283 [1080] = true, -- Thunder Totem | 292 [1080] = true, -- Thunder Totem |
| 284 [1072] = true, -- True Shot Lodge, | 293 [1072] = true, -- True Shot Lodge, |
| 285 | 294 |
| 286 } | 295 } |
| 287 | 296 |
| 288 function WorldPlanCore:SetCurrentMap() | 297 function WorldPlanCore:SetCurrentMap(event) |
| 289 local mapAreaID = GetCurrentMapAreaID() | 298 local mapAreaID = GetCurrentMapAreaID() |
| 290 if not mapAreaID then | 299 if not mapAreaID then |
| 291 return | 300 return |
| 292 end | 301 end |
| 293 print(mapAreaID) | 302 print('SetCurrentMap()', event, mapAreaID) |
| 294 local isBrokenIsle = BROKEN_ISLE_MAPS[mapAreaID] | 303 local isBrokenIsle = BROKEN_ISLE_MAPS[mapAreaID] |
| 295 local isContinent = (mapAreaID == BROKEN_ISLES_ID) | 304 local isContinent = (mapAreaID == BROKEN_ISLES_ID) |
| 305 | |
| 296 | 306 |
| 297 if db.isContinentMap ~= isContinent then | 307 if db.isContinentMap ~= isContinent then |
| 298 for _, pin in pairs(db.QuestsByID) do | 308 for _, pin in pairs(db.QuestsByID) do |
| 299 pin.isStale = true | 309 pin.isStale = true |
| 300 end | 310 end |
| 301 end | 311 end |
| 312 local isMapOpen = WorldMapFrame:IsShown() | |
| 313 local isNewMap = isMapOpen and (mapAreaID ~= db.currentMapID) | |
| 302 db.currentMapID = mapAreaID | 314 db.currentMapID = mapAreaID |
| 303 db.isContinentMap = isContinent | 315 db.isContinentMap = isContinent |
| 316 db.isBrokenIsle = isBrokenIsle | |
| 304 db.useContinentType = (WorldMapDetailFrame:GetScale() < 1) | 317 db.useContinentType = (WorldMapDetailFrame:GetScale() < 1) |
| 305 | 318 |
| 306 | 319 |
| 307 for _, module in ipairs(db.OrderedModules) do | 320 for _, module in ipairs(db.OrderedModules) do |
| 308 if module.OnMapInfo then | 321 if module.OnMapInfo then |
| 309 print(' |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r') | 322 print(' |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r') |
| 310 module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID) | 323 module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID, isNewMap, isMapOpen) |
| 311 end | 324 end |
| 312 end | 325 end |
| 313 end | 326 end |
| 314 | |
| 315 | 327 |
| 316 function WorldPlanCore:OnEvent (event, ...) | 328 function WorldPlanCore:OnEvent (event, ...) |
| 317 | 329 |
| 318 print('|cFF00FF88'..self:GetName().. ':OnEvent()|r', event, GetTime(), 'init:', self.initialized) | 330 print('|cFF00FF88'..self:GetName().. ':OnEvent()|r', event, GetTime(), 'init:', self.initialized) |
| 319 if event == 'ADDON_LOADED' then | 331 if event == 'ADDON_LOADED' then |
| 322 self:Setup() | 334 self:Setup() |
| 323 end | 335 end |
| 324 else | 336 else |
| 325 if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') or (event == 'PLAYER_LOGIN') then | 337 if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') or (event == 'PLAYER_LOGIN') then |
| 326 print('|cFFFF4400currentMapID =', db.currentMapID, ...) | 338 print('|cFFFF4400currentMapID =', db.currentMapID, ...) |
| 327 self:SetCurrentMap() | 339 |
| 340 | |
| 341 self:SetCurrentMap(event) | |
| 328 end | 342 end |
| 329 end | 343 end |
| 330 end | 344 end |
| 331 | 345 |
| 332 function WorldPlanCore:OnNext(func) | 346 function WorldPlanCore:OnNext(func) |
