comparison ui/CombatLogTab.lua @ 53:be5dc6c02f77 v19

minor tweaks for combat logging
author yellowfive
date Tue, 02 Dec 2014 16:57:32 -0800
parents 6f1bb8fcf64d
children
comparison
equal deleted inserted replaced
52:57e5795c8c29 53:be5dc6c02f77
199 SetCVar("advancedCombatLogging", 1) 199 SetCVar("advancedCombatLogging", 1)
200 LoggingCombat(true) 200 LoggingCombat(true)
201 end 201 end
202 202
203 -- if auto-logging is enabled, do a check when the addon is loaded to make sure that state is set correctly 203 -- if auto-logging is enabled, do a check when the addon is loaded to make sure that state is set correctly
204 if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled" or AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled" then 204 if tab:IsAutoLoggingEnabled() then
205 tab:UpdateAutoLogging() 205 tab:UpdateAutoLogging()
206 end 206 end
207 207
208 tab:SetScript("OnShow", function() 208 tab:SetScript("OnShow", function()
209 tab:Update() 209 tab:Update()
361 self.btnUnwipe:Hide() 361 self.btnUnwipe:Hide()
362 end 362 end
363 363
364 end 364 end
365 365
366 -- returns true if any auto-logging options are enabled
367 function AskMrRobot.CombatLogTab:IsAutoLoggingEnabled()
368 -- see if any auto-logging is enabled
369 for k,v in pairs(AmrDb.LogData._autoLog) do
370 if v == "enabled" then
371 return true
372 end
373 end
374 return false
375 end
376
366 -- called to update logging state when auto-logging is enabled 377 -- called to update logging state when auto-logging is enabled
367 function AskMrRobot.CombatLogTab:UpdateAutoLogging() 378 function AskMrRobot.CombatLogTab:UpdateAutoLogging()
368 379
369 -- get the info about the instance 380 -- get the info about the instance
370 --local zone, zonetype, difficultyIndex, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID = GetInstanceInfo() 381 --local zone, zonetype, difficultyIndex, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID = GetInstanceInfo()
381 end 392 end
382 393
383 AmrDb.LogData._lastZone = zone 394 AmrDb.LogData._lastZone = zone
384 AmrDb.LogData._lastDiff = difficultyIndex 395 AmrDb.LogData._lastDiff = difficultyIndex
385 396
386 if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] == "enabled" or AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] == "enabled" then 397 if self:IsAutoLoggingEnabled() then
387 if tonumber(instanceMapID) == AskMrRobot.instanceIds.Highmaul or tonumber(instanceMapID) == AskMrRobot.instanceIds.BlackrockFoundry then 398 if AskMrRobot.IsSupportedInstanceId(instanceMapID) and AmrDb.LogData._autoLog[tonumber(instanceMapID)] == "enabled" then
388 -- if in SoO, make sure logging is on 399 -- we are in a supported zone that we want to auto-log, turn logging on
400 -- (supported check is probably redundant, but just in case someone has old settings lying around)
389 if not AskMrRobot.CombatLogTab.IsLogging() then 401 if not AskMrRobot.CombatLogTab.IsLogging() then
390 self:StartLogging() 402 self:StartLogging()
391 end 403 end
392 else 404 else
393 -- not in SoO, turn logging off 405 -- not in a zone that we want to auto-log, turn logging off
394 if AskMrRobot.CombatLogTab.IsLogging() then 406 if AskMrRobot.CombatLogTab.IsLogging() then
395 self:StopLogging() 407 self:StopLogging()
396 end 408 end
397 end 409 end
398 end 410 end
436 448
437 -- initialize the AmrDb.LogData variable 449 -- initialize the AmrDb.LogData variable
438 function AskMrRobot.CombatLogTab.InitializeVariable() 450 function AskMrRobot.CombatLogTab.InitializeVariable()
439 if not AmrDb.LogData then AmrDb.LogData = {} end 451 if not AmrDb.LogData then AmrDb.LogData = {} end
440 if not AmrDb.LogData._autoLog then AmrDb.LogData._autoLog = {} end 452 if not AmrDb.LogData._autoLog then AmrDb.LogData._autoLog = {} end
441 if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] then 453
442 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.Highmaul] = "disabled" 454 for k,v in pairs(AskMrRobot.supportedInstanceIds) do
443 end 455 if not AmrDb.LogData._autoLog[k] then
444 if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] then 456 AmrDb.LogData._autoLog[k] = "disabled"
445 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.BlackrockFoundry] = "disabled" 457 end
446 end 458 end
459
447 AmrDb.LogData._wipes = AmrDb.LogData._wipes or {} 460 AmrDb.LogData._wipes = AmrDb.LogData._wipes or {}
448 end 461 end
449 462
450 local function GetPlayerExtraData(data, unitId, petId) 463 local function GetPlayerExtraData(data, unitId, petId)
451 464