Mercurial > wow > askmrrobot
comparison CombatLog.lua @ 69:69db1c3025ac v27
fixed some bugs with 6.2 item link format changes, added bib overwolf support
author | yellowfive |
---|---|
date | Mon, 06 Jul 2015 17:39:57 -0700 |
parents | e638168c3395 |
children | 6bbe64d587b4 |
comparison
equal
deleted
inserted
replaced
68:6c523f147709 | 69:69db1c3025ac |
---|---|
214 _panelUndoWipe = nil | 214 _panelUndoWipe = nil |
215 _chkAutoAll = nil | 215 _chkAutoAll = nil |
216 _autoChecks = nil | 216 _autoChecks = nil |
217 end | 217 end |
218 | 218 |
219 -- update the game's logging state | |
220 local function updateGameLogging(enabled) | |
221 if enabled then | |
222 -- always enable advanced combat logging via our addon, gathers more detailed data for better analysis | |
223 SetCVar("advancedCombatLogging", 1) | |
224 LoggingCombat(true) | |
225 else | |
226 LoggingCombat(false) | |
227 end | |
228 end | |
229 | |
230 local function isAnyAutoLoggingEnabled() | |
231 local anyChecked = false | |
232 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do | |
233 for k, difficultyId in pairs(Amr.Difficulties) do | |
234 if Amr.db.profile.Logging.Auto[instanceId][difficultyId] then | |
235 anyChecked = true | |
236 break | |
237 end | |
238 end | |
239 if anyChecked then break end | |
240 end | |
241 | |
242 return anyChecked | |
243 end | |
244 | |
219 local function isAllAutoLoggingEnabled() | 245 local function isAllAutoLoggingEnabled() |
220 -- see if all auto-logging options are enabled | 246 -- see if all auto-logging options are enabled |
221 local allChecked = true | 247 local allChecked = true |
222 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do | 248 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do |
223 for k, difficultyId in pairs(Amr.Difficulties) do | 249 for k, difficultyId in pairs(Amr.Difficulties) do |
231 | 257 |
232 return allChecked | 258 return allChecked |
233 end | 259 end |
234 | 260 |
235 -- check current zone and auto-logging settings, and enable logging if appropriate | 261 -- check current zone and auto-logging settings, and enable logging if appropriate |
236 local function updateAutoLogging(force) | 262 local function updateAutoLogging(force, noWait) |
263 | |
264 local hasAuto = isAnyAutoLoggingEnabled() | |
265 | |
266 -- before doing anything, make sure logging matches the user's current setting, deals with any inconsistency due to a crash or disconnect | |
267 if hasAuto then | |
268 updateGameLogging(Amr:IsLogging()) | |
269 end | |
237 | 270 |
238 -- get the info about the instance | 271 -- get the info about the instance |
239 local zone, _, difficultyId, _, _, _, _, instanceId = GetInstanceInfo() | 272 local zone, _, difficultyId, _, _, _, _, instanceId = GetInstanceInfo() |
240 | 273 |
274 if Amr.IsSupportedInstanceId(instanceId) and difficultyId == 0 and not noWait then | |
275 -- the game is sometimes returning no difficulty id for raid zones... not sure why, wait 10 seconds and check again | |
276 Amr.Wait(10, function() | |
277 updateAutoLogging(false, false) | |
278 end) | |
279 return | |
280 end | |
281 | |
241 if not force and zone == Amr.db.char.Logging.LastZone and difficultyId == Amr.db.char.Logging.LastDiff then | 282 if not force and zone == Amr.db.char.Logging.LastZone and difficultyId == Amr.db.char.Logging.LastDiff then |
242 -- do nothing if the zone hasn't actually changed, otherwise we may override the user's manual enable/disable | 283 -- do nothing if the zone hasn't actually changed, otherwise we may override the user's manual enable/disable |
243 return | 284 return |
244 end | 285 end |
245 | 286 |
246 Amr.db.char.Logging.LastZone = zone | 287 Amr.db.char.Logging.LastZone = zone |
247 Amr.db.char.Logging.LastDiff = difficultyId | 288 Amr.db.char.Logging.LastDiff = difficultyId |
248 | 289 |
249 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then | 290 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then |
250 -- we are in a supported zone that we want to auto-log, turn logging on | 291 -- we are in a supported zone that we want to auto-log, turn logging on |
292 | |
251 -- (supported check is probably redundant, but just in case someone has old settings lying around) | 293 -- (supported check is probably redundant, but just in case someone has old settings lying around) |
252 if not Amr:IsLogging() then | 294 if not Amr:IsLogging() then |
253 Amr:StartLogging() | 295 Amr:StartLogging() |
254 end | 296 end |
255 else | 297 elseif hasAuto then |
256 -- not in a zone that we want to auto-log, turn logging off | 298 -- not in a zone that we want to auto-log, turn logging off |
257 if Amr:IsLogging() then | 299 if Amr:IsLogging() then |
258 Amr:StopLogging() | 300 Amr:StopLogging() |
259 end | 301 end |
260 end | 302 end |
356 -- delete the last wipe date if it is more than 10 days old | 398 -- delete the last wipe date if it is more than 10 days old |
357 if Amr.db.char.Logging.LastWipe and difftime(now, Amr.db.char.Logging.LastWipe) > oldDuration then | 399 if Amr.db.char.Logging.LastWipe and difftime(now, Amr.db.char.Logging.LastWipe) > oldDuration then |
358 Amr.db.char.Logging.LastWipe = nil | 400 Amr.db.char.Logging.LastWipe = nil |
359 end | 401 end |
360 | 402 |
361 -- always enable advanced combat logging via our addon, gathers more detailed data for better analysis | 403 -- enable game log file |
362 SetCVar("advancedCombatLogging", 1) | 404 updateGameLogging(true) |
363 LoggingCombat(true) | |
364 Amr.db.char.Logging.Enabled = true | 405 Amr.db.char.Logging.Enabled = true |
365 | 406 |
366 self:Print(L.LogChatStart) | 407 self:Print(L.LogChatStart) |
367 | 408 |
368 self:UpdateMinimap() | 409 self:UpdateMinimap() |
369 self:RefreshLogUi() | 410 self:RefreshLogUi() |
370 end | 411 end |
371 | 412 |
372 function Amr:StopLogging() | 413 function Amr:StopLogging() |
373 | 414 |
374 LoggingCombat(false) | 415 updateGameLogging(false) |
375 Amr.db.char.Logging.Enabled = false | 416 Amr.db.char.Logging.Enabled = false |
376 | 417 |
377 self:Print(L.LogChatStop) | 418 self:Print(L.LogChatStop) |
378 | 419 |
379 self:UpdateMinimap() | 420 self:UpdateMinimap() |