comparison WorldPlan.lua @ 69:31de7e9e7849

stop hiding pins when the timeleft returns 0; use C_TQ.IsActive
author Nenue
date Wed, 05 Apr 2017 11:36:06 -0400
parents cce68795f955
children bb2baedae81f
comparison
equal deleted inserted replaced
68:cce68795f955 69:31de7e9e7849
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
12 local GetCurrentMapAreaID = GetCurrentMapAreaID 12 local GetCurrentMapAreaID = GetCurrentMapAreaID
13 local GetTime, IsLoggedIn = GetTime, IsLoggedIn 13 local GetTime, IsLoggedIn = GetTime, IsLoggedIn
14 local DEBUG_HISTORY = {}
14 15
15 -- Define tables here so the pointers match up 16 -- Define tables here so the pointers match up
16 WorldPlanCore = { defaults = {}, modules = {}, TaskQueue = {}, } 17 WorldPlanCore = { defaults = {}, modules = {}, TaskQueue = {}, }
17 WorldPlanQuestsMixin = { 18 WorldPlanQuestsMixin = {
18 UsedPositions = {}, 19 UsedPositions = {},
190 for i = 1, select('#', ...) do 191 for i = 1, select('#', ...) do
191 tinsert(db.ReportChunks, tostring(select(i, ...))) 192 tinsert(db.ReportChunks, tostring(select(i, ...)))
192 end 193 end
193 end 194 end
194 195
196 function db.log(msg)
197 WorldPlanData.Debug = WorldPlanData.Debug or {}
198 tinsert(WorldPlanData.Debug, msg)
199 tinsert(DEBUG_HISTORY, msg)
200 if WorldPlanDebug:IsShown() then
201 WorldPlanDebug:Update()
202 end
203 end
204
205 WorldPlanDebugMixin = {
206 OnLoad = function(self)
207 self:SetFont("Interface\\Addons\\Devian\\font\\SourceCodePro-Regular.ttf", 13, 'NORMAL')
208 self:SetJustifyH('LEFT')
209 self:SetFading(false)
210 self:SetMaxLines(2048)
211 self.loadedMessages = 0
212 end,
213 OnShow = function(self)
214 if self.loadedMessages < #DEBUG_HISTORY then
215 self:Update()
216 end
217 end,
218 Update = function(self)
219 for i = self.loadedMessages, #DEBUG_HISTORY do
220 self:AddMessage(DEBUG_HISTORY[i])
221 self.loadedMessages = i
222 end
223 end ,
224 OnMouseWheel = function(self, delta)
225
226 local up = delta > 0
227 if IsControlKeyDown() then
228 if up then self:ScrollToTop()
229 else self:ScrollToBottom() end
230 elseif IsShiftKeyDown() then
231 if up then self:PageUp()
232 else self:PageDown() end
233 else
234 if up then self:ScrollUp()
235 else self:ScrollDown() end
236 end
237 end
238 }
239
195 function WorldPlanCore:OnConfigUpdate() 240 function WorldPlanCore:OnConfigUpdate()
196 for _, module in ipairs(db.OrderedModules) do 241 for _, module in ipairs(db.OrderedModules) do
197 if module.OnConfigUpdate then 242 if module.OnConfigUpdate then
198 module:OnConfigUpdate() 243 module:OnConfigUpdate()
199 end 244 end
387 print('|cFFFFFF00'..self:GetName()..':Setup()|r') 432 print('|cFFFFFF00'..self:GetName()..':Setup()|r')
388 433
389 if not WorldPlanData then 434 if not WorldPlanData then
390 WorldPlanData = {key = 0} 435 WorldPlanData = {key = 0}
391 end 436 end
437
438 -- debug info
392 WorldPlanData.key = (WorldPlanData.key or 0) + 1 439 WorldPlanData.key = (WorldPlanData.key or 0) + 1
440 WorldPlanData.Debug = WorldPlanData.Debug or {}
441 for _, msg in ipairs(WorldPlanData.Debug) do
442 tinsert(DEBUG_HISTORY, msg)
443 end
444 tinsert(DEBUG_HISTORY, '--SESSION BREAK--')
445 wipe(WorldPlanData.Debug)
446
393 db.Config = WorldPlanData 447 db.Config = WorldPlanData
394 for k,v in pairs(db.DefaultConfig) do 448 for k,v in pairs(db.DefaultConfig) do
395 --[===[@non-debug@ 449 --[===[@non-debug@
396 if not db.Config[k] then 450 if not db.Config[k] then
397 db.Config[k] = v 451 db.Config[k] = v
482 WorldPlanSummary[arg2](WorldPlanSummary) 536 WorldPlanSummary[arg2](WorldPlanSummary)
483 else 537 else
484 self:print('WorldPlanSummary:Refresh(true)') 538 self:print('WorldPlanSummary:Refresh(true)')
485 WorldPlanSummary:Refresh(true) 539 WorldPlanSummary:Refresh(true)
486 end 540 end
541 elseif arg1 == 'log' then
542 WorldPlanDebug:SetShown(true)
543 elseif arg1 == 'debug' then
544 if WorldPlanData then
545 WorldPlanData.DebugEnabled = (not WorldPlanData.DebugEnabled)
546 self:print(WorldPlanData.DebugEnabled and "Debugger on." or "Debugger off.")
547 end
548
487 else 549 else
488 self:print('Refreshing data.') 550 self:print('Refreshing data.')
489 self:Refresh(true) 551 self:Refresh(true)
490 end 552 end
491 553