Mercurial > wow > worldplan
comparison WorldPlan.lua @ 40:589c444d4837
WowAce/Curseforge migration push
| author | Nenue |
|---|---|
| date | Sun, 25 Dec 2016 13:04:57 -0500 |
| parents | 21bcff08b0f4 |
| children | 79e5e96e5f18 |
comparison
equal
deleted
inserted
replaced
| 39:89ddef0594bc | 40:589c444d4837 |
|---|---|
| 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 | 4 local addonFileName, db = ... |
| 5 WorldPlanCore = { | 5 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end |
| 6 defaults = {}, | 6 local WP_VERSION = "1.0" |
| 7 modules = {}, | 7 local tinsert, pairs, floor = tinsert, pairs, floor |
| 8 FilterOptions = {}, | 8 local tremove, ipairs, wipe, unpack = tremove, ipairs, wipe, unpack |
| 9 UsedFilters = {}, | 9 local select, type, tostring, tonumber = select, type, tostring, tonumber |
| 10 QuestsByZone = {}, | 10 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS |
| 11 QuestsByID = {}, | 11 local BROKEN_ISLES_ID = 1007 |
| 12 TaskQueue = {}, | 12 local GetCurrentMapAreaID = GetCurrentMapAreaID |
| 13 } | 13 local GetTime, IsLoggedIn = GetTime, IsLoggedIn |
| 14 | |
| 15 -- Define tables here so the pointers match up | |
| 16 WorldPlanCore = { defaults = {}, modules = {}, TaskQueue = {}, } | |
| 14 WorldPlanQuestsMixin = { | 17 WorldPlanQuestsMixin = { |
| 15 QuestsByZone = {}, | 18 UsedPositions = {}, |
| 16 QuestsByID = {}, | |
| 17 freePins = {}, | |
| 18 } | 19 } |
| 19 WorldPlanPOIMixin = {} | 20 WorldPlanPOIMixin = {} |
| 20 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end | 21 WorldPlanSummaryMixin = {} |
| 21 local WP_VERSION = "1.0" | 22 db.filtersDirty = true |
| 22 local tinsert, pairs, floor = table.insert, pairs, floor | 23 db.questsDirty = true |
| 23 local ITEM_QUALITY_COLORS = ITEM_QUALITY_COLORS | 24 db.OrderedModules = {} |
| 24 local BROKEN_ISLES_ID = 1007 | 25 db.LoadedModules = {} |
| 25 local GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID = GetCurrentMapAreaID, GetMapNameByID, GetSuperTrackedQuestID | 26 db.UsedFilters = {} |
| 27 db.QuestsByZone = {} | |
| 28 db.QuestsByID = {} | |
| 29 db.TasksByID = {} | |
| 30 db.FreePins = {} | |
| 31 db.UsedPins = {} | |
| 32 db.ReportChunks = {} | |
| 26 | 33 |
| 27 -- default color templates | 34 -- default color templates |
| 28 local DEFAULT_TYPE = { | 35 db.DefaultType = { |
| 29 a = 1, | 36 a = 1, |
| 30 r = 1, g = 1, b = 1, | 37 r = 1, g = 1, b = 1, |
| 31 x = 0, y = 0, | 38 x = 0, y = 0, |
| 32 desaturated = true, | 39 desaturated = true, |
| 33 pinMask = "Interface\\Minimap\\UI-Minimap-Background", | 40 pinMask = "Interface\\Minimap\\UI-Minimap-Background", |
| 34 rewardMask = "Interface\\Minimap\\UI-Minimap-Background", | 41 rewardMask = "Interface\\Minimap\\UI-Minimap-Background", |
| 35 texture = "Interface\\BUTTONS\\YELLOWORANGE64", | 42 texture = "Interface\\BUTTONS\\YELLOWORANGE64", |
| 36 continent = { | 43 continent = { |
| 37 PinSize = 14, | 44 iconWidth = 14, |
| 38 Border = 2, | 45 borderWidth = 2, |
| 39 highlightWidth = 1, | 46 highlightWidth = 1, |
| 40 TagSize = 6, | 47 TagSize = 8, |
| 41 maxAlertLevel = 0, | 48 maxAlertLevel = 0, |
| 42 showNumber = true, | 49 showNumber = true, |
| 43 numberFontObject = 'WorldPlanFont' | 50 numberFontObject = 'WorldPlanFont' |
| 44 }, | 51 }, |
| 45 zone = { | 52 zone = { |
| 50 maxAlertLevel = 3, | 57 maxAlertLevel = 3, |
| 51 showNumber = true, | 58 showNumber = true, |
| 52 numberFontObject = 'WorldPlanNumberFontThin' | 59 numberFontObject = 'WorldPlanNumberFontThin' |
| 53 }, | 60 }, |
| 54 minimized = { | 61 minimized = { |
| 55 iconWidth = 6, | 62 r = 0, g = 0, b = 0, a = 0.1, |
| 56 borderWidth = 0, | 63 iconWidth = 8, |
| 64 borderWidth = 2, | |
| 65 alpha = 0.5, | |
| 57 highlightWidth = 0, | 66 highlightWidth = 0, |
| 58 maxAlertLevel = 1, | 67 maxAlertLevel = 0, |
| 59 NoIcon = true, | 68 NoIcon = true, |
| 69 | |
| 70 TagSize = 8, | |
| 60 TimeleftStage = 1, | 71 TimeleftStage = 1, |
| 61 showNumber = false, | 72 showNumber = false, |
| 73 alpha = 0.1, | |
| 62 } | 74 } |
| 63 } | 75 } |
| 64 | 76 |
| 65 | 77 db.DefaultConfig = { |
| 66 | |
| 67 | |
| 68 local defaults = { | |
| 69 ShowAllProfessionQuests = false, | 78 ShowAllProfessionQuests = false, |
| 70 DisplayContinentSummary = true, | 79 DisplayContinentSummary = true, |
| 71 DisplayContinentPins = true, | 80 DisplayContinentPins = true, |
| 72 NotifyWhenNewQuests = true, | 81 NotifyWhenNewQuests = true, |
| 73 EnablePins = true, | 82 EnablePins = true, |
| 74 FadeWhileGrouped = false, | 83 FadeWhileGrouped = false, |
| 84 FlightMapAlphaLimits = {1, 1, 1}, | |
| 85 FlightMapScalingLimits = {1, 3, 1.5}, | |
| 75 } | 86 } |
| 76 | 87 |
| 77 -- operating flags | |
| 78 local superTrackedID | |
| 79 local currentMapName | |
| 80 local hasNewQuestPins | |
| 81 local isContinentMap | |
| 82 local hasPendingQuestData | |
| 83 local notifyPlayed | |
| 84 local scanner, wmtt, WorldMapPOIFrame | |
| 85 | 88 |
| 86 | 89 |
| 87 -- tracking menu toggler | 90 -- tracking menu toggler |
| 88 local DropDown_OnClick = function(self) | 91 local DropDown_OnClick = function(self) |
| 89 local key = self.value | 92 local key = self.value |
| 95 end | 98 end |
| 96 end | 99 end |
| 97 _G.WorldPlan:Refresh() | 100 _G.WorldPlan:Refresh() |
| 98 end | 101 end |
| 99 | 102 |
| 100 function WorldPlanCore:print(...) | 103 function db.print(...) |
| 101 local msg | |
| 102 for i = 1, select('#', ...) do | 104 for i = 1, select('#', ...) do |
| 103 msg = (msg and (msg .. ' ') or '') .. tostring(select(i, ...)) | 105 tinsert(db.ReportChunks, tostring(select(i, ...))) |
| 104 end | 106 end |
| 105 DEFAULT_CHAT_FRAME:AddMessage("|cFF0088FFWorldPlan|r: " .. msg) | 107 end |
| 106 end | 108 |
| 107 | 109 function WorldPlanCore:print(...) db.print(...) end |
| 108 local current_type_owner | 110 |
| 109 function WorldPlanCore:AddHandler (frame, defaults) | 111 function WorldPlanCore:AddHandler (frame) |
| 110 print('|cFFFFFF00'..self:GetName()..':AddHandler()', frame:GetName()) | 112 if not db.LoadedModules[frame] then |
| 111 tinsert(self.modules, frame) | 113 print('|cFFFFFF00'..self:GetName()..':AddHandler()', frame:GetName(), self.initialized) |
| 112 self.defaults[frame] = defaults | 114 db.LoadedModules[frame] = true |
| 113 frame.GetTypeInfo = function(frame, typeID) | 115 tinsert(db.OrderedModules, frame) |
| 114 return self:GetTypeInfo(frame, typeID) | 116 |
| 117 if frame.defaults then | |
| 118 db.DefaultConfig[frame:GetName()] = frame.defaults | |
| 119 end | |
| 120 | |
| 121 frame.GetTypeInfo = function(frame, typeID) | |
| 122 return self:GetTypeInfo(frame, typeID) | |
| 123 end | |
| 124 | |
| 125 frame.owningFrame = self | |
| 126 else | |
| 127 | |
| 128 print('|cFFFF4400'..self:GetName()..':AddHandler()', frame:GetName()) | |
| 115 end | 129 end |
| 116 end | 130 end |
| 117 | 131 |
| 118 function WorldPlanCore:OnLoad () | 132 function WorldPlanCore:OnLoad () |
| 119 | 133 |
| 122 if type(v) == 'table' then | 136 if type(v) == 'table' then |
| 123 print('adding owner', k) | 137 print('adding owner', k) |
| 124 v = setmetatable(v, { | 138 v = setmetatable(v, { |
| 125 __newindex = function(t2,k2,v2) | 139 __newindex = function(t2,k2,v2) |
| 126 if type(v2) == 'table' then | 140 if type(v2) == 'table' then |
| 127 print('adding type', k2) | 141 --print('adding type', k2) |
| 128 v2 = setmetatable(v2, {__index = function(t3,k3) | 142 v2 = setmetatable(v2, {__index = function(t3,k3) |
| 129 --print('##deferring to default key', k3) | 143 --print('##deferring to default key', k3) |
| 130 return DEFAULT_TYPE[k3] | 144 return db.DefaultType[k3] |
| 131 end}) | 145 end}) |
| 132 end | 146 end |
| 133 rawset(t2,k2,v2) | 147 rawset(t2,k2,v2) |
| 134 end}) | 148 end}) |
| 135 end | 149 end |
| 142 for index, color in pairs(ITEM_QUALITY_COLORS) do | 156 for index, color in pairs(ITEM_QUALITY_COLORS) do |
| 143 self:AddTypeInfo(self, index, { r = color.r, g = color.g, b = color.b, hex = color.hex, }) | 157 self:AddTypeInfo(self, index, { r = color.r, g = color.g, b = color.b, hex = color.hex, }) |
| 144 end | 158 end |
| 145 | 159 |
| 146 | 160 |
| 147 WorldPlanCore:print('v'..WP_VERSION) | 161 db.print('v'..WP_VERSION) |
| 162 | |
| 148 | 163 |
| 149 self:RegisterEvent("QUESTLINE_UPDATE") | 164 self:RegisterEvent("QUESTLINE_UPDATE") |
| 150 self:RegisterEvent("QUEST_LOG_UPDATE") | 165 self:RegisterEvent("QUEST_LOG_UPDATE") |
| 151 self:RegisterEvent("WORLD_MAP_UPDATE") | 166 self:RegisterEvent("WORLD_MAP_UPDATE") |
| 167 self:RegisterEvent("SPELLS_CHANGED") | |
| 168 self:RegisterEvent('PLAYER_ENTERING_WORLD') | |
| 152 self:RegisterEvent("WORLD_QUEST_COMPLETED_BY_SPELL") | 169 self:RegisterEvent("WORLD_QUEST_COMPLETED_BY_SPELL") |
| 153 self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED") | 170 self:RegisterEvent("SUPER_TRACKED_QUEST_CHANGED") |
| 154 self:RegisterEvent("SKILL_LINES_CHANGED") | 171 self:RegisterEvent("SKILL_LINES_CHANGED") |
| 155 self:RegisterEvent("ARTIFACT_XP_UPDATE") | 172 self:RegisterEvent("ARTIFACT_XP_UPDATE") |
| 156 self:RegisterEvent("ADDON_LOADED") | 173 self:RegisterEvent("ADDON_LOADED") |
| 157 self:SetParent(WorldMapFrame) | 174 self:RegisterEvent("PLAYER_LOGIN") |
| 175 --self:SetParent(WorldMapFrame) | |
| 158 end | 176 end |
| 159 | 177 |
| 160 function WorldPlanCore:OnShow() | 178 function WorldPlanCore:OnShow() |
| 161 print(self:GetName()..':OnShow()') | 179 --print(self:GetName()..':OnShow()') |
| 162 if self.isStale then | 180 --hooksecurefunc(self, 'SetScript', function(...) self:print('|cFFFFFF00'..self:GetName()..':SetScript()|r', ...) end) |
| 163 self:Refresh() | 181 end |
| 164 end | 182 |
| 165 | 183 function WorldPlanCore:GetMapInfo() |
| 166 hooksecurefunc(self, 'SetScript', function(...) self:print('|cFFFFFF00'..self:GetName()..':SetScript()|r', ...) end) | 184 |
| 167 end | 185 db.currentMapID = GetCurrentMapAreaID() |
| 186 db.isContinentMap = (db.currentMapID == BROKEN_ISLES_ID) | |
| 187 db.useContinentType = (WorldMapDetailFrame:GetScale() < 1) | |
| 188 | |
| 189 end | |
| 190 | |
| 168 | 191 |
| 169 function WorldPlanCore:OnEvent (event, ...) | 192 function WorldPlanCore:OnEvent (event, ...) |
| 170 print() | 193 |
| 171 print(event, 'init:', self.initialized) | 194 print('|cFF00FF88'..self:GetName().. ':OnEvent()|r', event, GetTime(), 'init:', self.initialized) |
| 172 if event == 'ADDON_LOADED' then | 195 if event == 'ADDON_LOADED' then |
| 173 | 196 |
| 174 if IsLoggedIn() and not self.initialized then | 197 if IsLoggedIn() and not self.initialized then |
| 175 self:Setup() | 198 self:Setup() |
| 176 end | 199 end |
| 177 else | 200 else |
| 178 if event == 'WORLD_MAP_UPDATE' then | 201 if (event == 'WORLD_MAP_UPDATE') or (event == 'PLAYER_ENTERING_WORLD') then |
| 179 self.currentMapID = GetCurrentMapAreaID() | 202 print('|cFFFF4400currentMapID =', db.currentMapID, ...) |
| 180 self.isContinentMap = (self.currentMapID == BROKEN_ISLES_ID) | 203 self:GetMapInfo() |
| 181 --self:print('|cFFFF4400currentMapID =', self.currentMapID) | 204 end |
| 182 self.isStale = true | 205 |
| 183 end | 206 for i, module in ipairs(db.OrderedModules) do |
| 184 | |
| 185 for i, module in ipairs(self.modules) do | |
| 186 if module.OnEvent then | 207 if module.OnEvent then |
| 187 print(' |cFF0088FF'..module:GetName() .. ':OnEvent()|r') | 208 print(' |cFF00FFFF'..module:GetName() .. ':OnEvent()|r') |
| 188 module:OnEvent(event, ...) | 209 module:OnEvent(event, ...) |
| 189 end | 210 end |
| 190 end | 211 end |
| 191 end | 212 end |
| 192 end | 213 end |
| 204 --self:print('|cFF00FF00running scheduled task #', #self.TaskQueue) | 225 --self:print('|cFF00FF00running scheduled task #', #self.TaskQueue) |
| 205 func() | 226 func() |
| 206 end | 227 end |
| 207 | 228 |
| 208 if self.isStale then | 229 if self.isStale then |
| 209 print('|cFF00FF00pushing global update') | 230 -- these need to happen in load order |
| 210 self.isStale = nil | 231 for i, module in ipairs(db.OrderedModules) do |
| 211 self:Refresh() | 232 if module:IsVisible() and module.isStale then |
| 212 else | |
| 213 for i, module in ipairs(self.modules) do | |
| 214 if module.isStale then | |
| 215 print('|cFF00FF00internal '..module:GetName()..':Refresh()|r') | 233 print('|cFF00FF00internal '..module:GetName()..':Refresh()|r') |
| 216 module:Refresh() | 234 module:Refresh() |
| 217 end | 235 end |
| 218 end | 236 end |
| 219 end | 237 self.isStale = nil |
| 238 end | |
| 239 | |
| 240 if #db.ReportChunks >= 1 then | |
| 241 | |
| 242 DEFAULT_CHAT_FRAME:AddMessage("|cFF0088FF"..addonFileName.."|r: " .. table.concat(db.ReportChunks, ', ')) | |
| 243 wipe(db.ReportChunks) | |
| 244 end | |
| 245 | |
| 220 end | 246 end |
| 221 | 247 |
| 222 function WorldPlanCore:Setup () | 248 function WorldPlanCore:Setup () |
| 249 print('|cFFFFFF00'..self:GetName()..':Setup()|r') | |
| 250 | |
| 223 if not WorldPlanData then | 251 if not WorldPlanData then |
| 224 WorldPlanData = {key = 0 } | 252 WorldPlanData = {key = 0} |
| 225 end | 253 end |
| 226 WorldPlanData.key = (WorldPlanData.key or 0) + 1 | 254 WorldPlanData.key = (WorldPlanData.key or 0) + 1 |
| 227 self.db = WorldPlanData | 255 db.Config = WorldPlanData |
| 228 self.db.WorldQuests = self.db.WorldQuests or {} | 256 for k,v in pairs(db.DefaultConfig) do |
| 229 db = self.db | |
| 230 for k,v in pairs(defaults) do | |
| 231 --[===[@non-debug@ | 257 --[===[@non-debug@ |
| 232 if not db[k] then | 258 if not db.Config[k] then |
| 233 db[k] = v | 259 db.Config[k] = v |
| 234 end | 260 end |
| 235 | 261 |
| 236 --@end-non-debug@]===] | 262 --@end-non-debug@]===] |
| 237 --@debug@ | 263 --@debug@ |
| 238 db[k] = v | 264 db.Config[k] = v |
| 239 --@end-debug@ | 265 --@end-debug@ |
| 240 end | 266 end |
| 241 | 267 |
| 242 self.currentMapID = GetCurrentMapAreaID() | 268 |
| 243 | 269 db.currentMapID = GetCurrentMapAreaID() |
| 244 for i, module in ipairs(self.modules) do | 270 |
| 245 module.db = self.db | 271 for i, module in ipairs(db.OrderedModules) do |
| 272 db.Config[module:GetName()] = db.Config[module:GetName()] or {} | |
| 246 if module.Setup then module:Setup() end | 273 if module.Setup then module:Setup() end |
| 247 if not module.RegisterEvent then | 274 if not module.RegisterEvent then |
| 248 module.RegisterEvent = self.RegisterEvent | 275 module.RegisterEvent = self.RegisterEvent |
| 249 end | 276 end |
| 250 end | 277 end |
| 278 | |
| 279 | |
| 251 self.initialized = true | 280 self.initialized = true |
| 252 | 281 |
| 253 hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) | 282 hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) |
| 254 | 283 |
| 255 hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button) | 284 hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button) |
| 259 value == "worldQuestFilterProfessionMaterials" or value == "worldQuestFilterGold" or | 288 value == "worldQuestFilterProfessionMaterials" or value == "worldQuestFilterGold" or |
| 260 value == "worldQuestFilterEquipment") then | 289 value == "worldQuestFilterEquipment") then |
| 261 self:Refresh(true) | 290 self:Refresh(true) |
| 262 end | 291 end |
| 263 end) | 292 end) |
| 264 end | 293 |
| 265 | 294 |
| 295 hooksecurefunc("WorldMapFrame_Update", function() | |
| 296 print('|cFFFF4400WorldMapFrame_Update|r') | |
| 297 self:GetMapInfo() | |
| 298 end) | |
| 299 | |
| 300 | |
| 301 SLASH_WORLDPLAN1 = "/worldplan" | |
| 302 SLASH_WORLDPLAN2 = "/wp" | |
| 303 | |
| 304 | |
| 305 | |
| 306 SlashCmdList.WORLDPLAN = function(args) | |
| 307 local arg1, arg2, extraArgs = args:match("(%S+)%s*(%S*)%s*(.*)") | |
| 308 | |
| 309 if arg1 == 'wq' then | |
| 310 if arg2 and WorldPlanQuests[arg2] then | |
| 311 self:print('WorldPlanQuests:'..arg2..'()') | |
| 312 WorldPlanQuests[arg2](WorldPlanQuests) | |
| 313 elseif arg2 == 'flightscale' and extraArgs then | |
| 314 local val1, val2, val3 = extraArgs:match("(%S+)%s*(%S*)%s*(%S*)") | |
| 315 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
| 316 db.Config.FlightMapScalingLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
| 317 self:print('FlightMapFrame scaling limits updated:', unpack(db.Config.FlightMapScalingLimits)) | |
| 318 else | |
| 319 self:print('FlightMapFrame scaling limits:', unpack(db.Config.FlightMapScalingLimits)) | |
| 320 end | |
| 321 elseif arg2 == 'flightalpha' and extraArgs then | |
| 322 local val1, val2, val3 = extraArgs:match("(%S+)%s*(%S*)%s*(%S*)") | |
| 323 if tonumber(val1) and tonumber(val2) and tonumber(val3) then | |
| 324 db.Config.FlightMapAlphaLimits = {tonumber(val1), tonumber(val2), tonumber(val3)} | |
| 325 self:print('FlightMapFrame alpha limits updated:', unpack(db.Config.FlightMapAlphaLimits)) | |
| 326 else | |
| 327 self:print('FlightMapFrame alpha limits:', unpack(db.Config.FlightMapAlphaLimits)) | |
| 328 end | |
| 329 else | |
| 330 | |
| 331 self:print('WorldPlanQuests:Refresh(true)') | |
| 332 WorldPlanQuests:Refresh(true) | |
| 333 end | |
| 334 elseif arg1 == 'filter' then | |
| 335 if arg2 and WorldPlanSummary[arg2] then | |
| 336 self:print('WorldPlanSummary:'..arg2..'()') | |
| 337 WorldPlanSummary[arg2](WorldPlanSummary) | |
| 338 else | |
| 339 self:print('WorldPlanSummary:Refresh(true)') | |
| 340 WorldPlanSummary:Refresh(true) | |
| 341 end | |
| 342 else | |
| 343 self:print('Refreshing data.') | |
| 344 self:Refresh(true) | |
| 345 end | |
| 346 | |
| 347 end | |
| 348 end | |
| 349 | |
| 350 -- registers a template table | |
| 266 function WorldPlanCore:AddTypeInfo(owner, id, info) | 351 function WorldPlanCore:AddTypeInfo(owner, id, info) |
| 267 self.Types[owner] = self.Types[owner] or {} | 352 self.Types[owner] = self.Types[owner] or {} |
| 268 self.Types[owner][id] = info | 353 self.Types[owner][id] = info |
| 269 print('Type('..owner:GetName()..')('..id..') = '.. tostring(info)) | 354 print('Type('..owner:GetName()..')('..id..') = '.. tostring(info)) |
| 270 end | 355 end |
| 271 | 356 |
| 357 -- recall a template table, with situational details filled in | |
| 272 function WorldPlanCore:GetTypeInfo(owner, typeID) | 358 function WorldPlanCore:GetTypeInfo(owner, typeID) |
| 273 local info, extraInfo | 359 local info, extraInfo |
| 274 if not owner then | 360 if not owner then |
| 275 --print('## deferring to default type list') | 361 --print('## deferring to default type list') |
| 276 else | 362 else |
| 278 end | 364 end |
| 279 | 365 |
| 280 owner = owner or self | 366 owner = owner or self |
| 281 if (not typeID) or (not self.Types[owner][typeID]) then | 367 if (not typeID) or (not self.Types[owner][typeID]) then |
| 282 --print('## sending list default') | 368 --print('## sending list default') |
| 283 info = DEFAULT_TYPE | 369 info = db.DefaultType |
| 284 else | 370 else |
| 285 --print('## sent list definition', typeID) | 371 --print('## sent list definition', typeID) |
| 286 info = self.Types[owner][typeID] | 372 info = self.Types[owner][typeID] |
| 287 end | 373 end |
| 288 | 374 |
| 289 if isContinentMap then | 375 local subType = 'continent' |
| 290 extraInfo = info.continent | 376 if ( |
| 291 --print('### continent subtype', extraInfo) | 377 FlightMapFrame |
| 292 else | 378 and FlightMapFrame:IsVisible() |
| 293 extraInfo = info.zone | 379 and FlightMapFrame:IsZoomedIn() |
| 294 | 380 ) or ( |
| 295 --print('### zone subtype', extraInfo) | 381 not db.isContinentMap |
| 296 end | 382 ) or ( |
| 297 return info, extraInfo | 383 db.useContinentType == false |
| 384 ) then | |
| 385 subType = 'zone' | |
| 386 end | |
| 387 | |
| 388 return info, info[subType] or db.DefaultType[subType] | |
| 298 end | 389 end |
| 299 | 390 |
| 300 do | 391 do |
| 301 local timeStates = { | 392 local timeStates = { |
| 302 {maxSeconds = 60, | 393 {maxSeconds = 60, |
| 312 r=0, g=1, b=0, | 403 r=0, g=1, b=0, |
| 313 }, -- 7 days + 1 minute | 404 }, -- 7 days + 1 minute |
| 314 } | 405 } |
| 315 -- Generates a timeleft string | 406 -- Generates a timeleft string |
| 316 function WorldPlanCore:GetTimeInfo(timeLeft, limit) | 407 function WorldPlanCore:GetTimeInfo(timeLeft, limit) |
| 317 limit = limit or #timeStates | |
| 318 for index = 1, limit do | 408 for index = 1, limit do |
| 319 local state = timeStates[index] | 409 local state = timeStates[index] |
| 320 if timeLeft <= state.maxSeconds then | 410 if timeLeft <= state.maxSeconds then |
| 321 local text | 411 local text |
| 322 if state.format then | 412 if state.format then |
| 333 print('|cFFFFFF00'..self:GetName()..':Refresh()|r forced:', forced, 'init:', self.initialized) | 423 print('|cFFFFFF00'..self:GetName()..':Refresh()|r forced:', forced, 'init:', self.initialized) |
| 334 if not self.initialized then | 424 if not self.initialized then |
| 335 return | 425 return |
| 336 end | 426 end |
| 337 | 427 |
| 338 for i, module in ipairs(self.modules) do | 428 for i, module in ipairs(db.OrderedModules) do |
| 339 if module.Refresh then | 429 if module.Refresh then |
| 340 print('|cFF00FF00external '..module:GetName()..':Refresh()|r') | 430 print('|cFF00FF00external '..module:GetName()..':Refresh()|r') |
| 341 module:Refresh(forced) | 431 module:Refresh(forced) |
| 342 end | 432 end |
| 343 end | 433 end |
| 434 | |
| 435 self.isStale = nil | |
| 344 end | 436 end |
| 345 | 437 |
| 346 -- insert visual options into the tracking button menu | 438 -- insert visual options into the tracking button menu |
| 347 WorldPlanCore.OnDropDownInitialize = function (self, callback, dropType) | 439 WorldPlanCore.OnDropDownInitialize = function (self, callback, dropType) |
| 348 if self ~= WorldMapFrameDropDown then | 440 if self ~= WorldMapFrameDropDown then |
| 349 return | 441 return |
| 350 end | 442 end |
| 351 local db = WorldPlan.db | 443 local config = WorldPlanData |
| 352 | |
| 353 local info = UIDropDownMenu_CreateInfo() | 444 local info = UIDropDownMenu_CreateInfo() |
| 354 info.text = "" | 445 info.text = "" |
| 355 info.isTitle = true | 446 info.isTitle = true |
| 356 UIDropDownMenu_AddButton(info) | 447 UIDropDownMenu_AddButton(info) |
| 357 info.text = "|cFF00AAFFWorldPlan|r" | 448 info.text = "|cFF00AAFFWorldPlan|r" |
| 363 info.tooltipOnButton = 1 | 454 info.tooltipOnButton = 1 |
| 364 | 455 |
| 365 info.text = "Enable" | 456 info.text = "Enable" |
| 366 info.isNotRadio = true | 457 info.isNotRadio = true |
| 367 info.value = "EnablePins" | 458 info.value = "EnablePins" |
| 368 info.checked = db.EnablePins | 459 info.checked = config.EnablePins |
| 369 info.tooltipTitle = "Enable World Quest Overlays" | 460 info.tooltipTitle = "Enable World Quest Overlays" |
| 370 info.tooltipText = "Toggle the detail layers here." | 461 info.tooltipText = "Toggle the detail layers here." |
| 371 info.func = DropDown_OnClick | 462 info.func = DropDown_OnClick |
| 372 UIDropDownMenu_AddButton(info) | 463 UIDropDownMenu_AddButton(info) |
| 373 | 464 |
| 374 info.text = "Display All Profession Quests" | 465 info.text = "Display All Profession Quests" |
| 375 info.isNotRadio = true | 466 info.isNotRadio = true |
| 376 info.value = "ShowAllProfessionQuests" | 467 info.value = "ShowAllProfessionQuests" |
| 377 info.checked = db.ShowAllProfessionQuests | 468 info.checked = config.ShowAllProfessionQuests |
| 378 info.tooltipTitle = "Hidden Quests" | 469 info.tooltipTitle = "Hidden Quests" |
| 379 info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." | 470 info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." |
| 380 info.func = DropDown_OnClick | 471 info.func = DropDown_OnClick |
| 381 UIDropDownMenu_AddButton(info) | 472 UIDropDownMenu_AddButton(info) |
| 382 | 473 |
| 383 info.text = "Show Continent Pins" | 474 info.text = "Show Continent Pins" |
| 384 info.isNotRadio = true | 475 info.isNotRadio = true |
| 385 info.value = "DisplayContinentPins" | 476 info.value = "DisplayContinentPins" |
| 386 info.checked = db.DisplayContinentPins | 477 info.checked = config.DisplayContinentPins |
| 387 info.tooltipTitle = "Continent Pins" | 478 info.tooltipTitle = "Continent Pins" |
| 388 info.tooltipText = "Display quest pins on the continent map (may get cramped)." | 479 info.tooltipText = "Display quest pins on the continent map (may get cramped)." |
| 389 info.func = DropDown_OnClick | 480 info.func = DropDown_OnClick |
| 390 UIDropDownMenu_AddButton(info) | 481 UIDropDownMenu_AddButton(info) |
| 391 | 482 |
| 392 info.text = "Show Summary" | 483 info.text = "Show Summary" |
| 393 info.isNotRadio = true | 484 info.isNotRadio = true |
| 394 info.value = "DisplayContinentSummary" | 485 info.value = "DisplayContinentSummary" |
| 395 info.tooltipTitle = "Summary Bar" | 486 info.tooltipTitle = "Summary Bar" |
| 396 info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." | 487 info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." |
| 397 info.checked = db.DisplayContinentSummary | 488 info.checked = config.DisplayContinentSummary |
| 398 info.func = DropDown_OnClick | 489 info.func = DropDown_OnClick |
| 399 UIDropDownMenu_AddButton(info) | 490 UIDropDownMenu_AddButton(info) |
| 400 | 491 |
| 401 info.text = "Fade In Groups" | 492 |
| 493 info.text = "Nudge Pins" | |
| 494 info.isNotRadio = true | |
| 495 info.value = "NudgePins" | |
| 496 info.tooltipTitle = "Pin Nudging" | |
| 497 info.tooltipText = "Adjust the position of quest pins that overlap." | |
| 498 info.checked = config.NudgePins | |
| 499 info.func = DropDown_OnClick | |
| 500 UIDropDownMenu_AddButton(info) | |
| 501 | |
| 502 info.text = "Fade Whiled Grouped" | |
| 402 info.isNotRadio = true | 503 info.isNotRadio = true |
| 403 info.value = "FadeWhileGrouped" | 504 info.value = "FadeWhileGrouped" |
| 404 info.tooltipTitle = "Group Fade" | 505 info.tooltipTitle = "Group Fade" |
| 405 info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." | 506 info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." |
| 406 info.checked = db.FadeWhileGrouped | 507 info.checked = config.FadeWhileGrouped |
| 407 info.func = DropDown_OnClick | 508 info.func = DropDown_OnClick |
| 408 UIDropDownMenu_AddButton(info) | 509 UIDropDownMenu_AddButton(info) |
| 409 end | 510 end |
| 410 | 511 |
| 411 -------------------------------------------------------------------------------------------------------------------- | 512 -------------------------------------------------------------------------------------------------------------------- |
| 415 | 516 |
| 416 | 517 |
| 417 | 518 |
| 418 | 519 |
| 419 | 520 |
| 420 SLASH_WORLDPLAN1 = "/worldplan" | |
| 421 SLASH_WORLDPLAN2 = "/wp" | |
| 422 SlashCmdList.WORLDPLAN = function() | |
| 423 print('command pop') | |
| 424 WorldPlanCore:GetPinsForMap() | |
| 425 WorldPlanCore:RefreshPins() | |
| 426 | |
| 427 SetTimedCallbackForAllPins(0, function(self) self.FadeIn:Play() self.FlashIn:Play() end) | |
| 428 SetTimedCallbackForAllPins(5, function(self) self.PendingFade:Play() end) | |
| 429 SetTimedCallbackForAllPins(8, function(self) self.PendingFade:Stop() end) | |
| 430 end | |
| 431 --%end-debug% | 521 --%end-debug% |
