comparison ui/CombatLogTab.lua @ 17:e77e01abce98

Warlords of Draenor pre-patch
author Adam tegen <adam.tegen@gmail.com>
date Mon, 13 Oct 2014 21:28:32 -0500
parents 218628cb4a29
children 0e78d6424532
comparison
equal deleted inserted replaced
16:9793e8b683d2 17:e77e01abce98
1 local _, AskMrRobot = ... 1 local _, AskMrRobot = ...
2 local L = AskMrRobot.L; 2 local L = AskMrRobot.L;
3 3
4 -- initialize the ExportTab class 4 -- initialize the CombatLogTab class
5 AskMrRobot.CombatLogTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame) 5 AskMrRobot.CombatLogTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
6 6
7 -- these are valid keys in AmrLogData, all others will be deleted 7 -- these are valid keys in AmrDb.LogData, all others will be deleted
8 local _logDataKeys = { 8 local _logDataKeys = {
9 ["_logging"] = true, 9 ["_logging"] = true,
10 ["_autoLog"] = true, 10 ["_autoLog"] = true,
11 ["_lastZone"] = true, 11 ["_lastZone"] = true,
12 ["_lastDiff"] = true, 12 ["_lastDiff"] = true,
86 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_LABEL, 86 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_LABEL,
87 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_TOOLTIP_TITLE, 87 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_TOOLTIP_TITLE,
88 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_DESCRIPTION, 88 L.AMR_COMBATLOGTAB_CHECKBOX_AUTOLOG_SOO_DESCRIPTION,
89 function(self, value) 89 function(self, value)
90 if value then 90 if value then
91 AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "enabled" 91 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "enabled"
92 else 92 else
93 AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" 93 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled"
94 end 94 end
95 95
96 AmrLogData._lastZone = nil 96 AmrDb.LogData._lastZone = nil
97 AmrLogData._lastDiff = nil 97 AmrDb.LogData._lastDiff = nil
98 tab:UpdateAutoLogging() 98 tab:UpdateAutoLogging()
99 end 99 end
100 ) 100 )
101 autoChk:SetChecked(AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled") 101 autoChk:SetChecked(AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled")
102 autoChk:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -10) 102 autoChk:SetPoint("TOPLEFT", btn, "BOTTOMLEFT", 0, -10)
103 autoChk:SetHeight(30) 103 autoChk:SetHeight(30)
104 104
105 105
106 local text = CreateText(content, "GameFontNormalLarge", autoChk, 0, -20, L.AMR_COMBATLOGTAB_INFIGHT) 106 local text = CreateText(content, "GameFontNormalLarge", autoChk, 0, -20, L.AMR_COMBATLOGTAB_INFIGHT)
169 btn:SetScript("OnClick", function() 169 btn:SetScript("OnClick", function()
170 170
171 local t = time() 171 local t = time()
172 AskMrRobot.SaveAll() 172 AskMrRobot.SaveAll()
173 AskMrRobot.ExportToAddonChat(t) 173 AskMrRobot.ExportToAddonChat(t)
174 AskMrRobot.ExportLoggingData(t) 174 AskMrRobot.CombatLogTab.SaveExtras(t)
175 end) 175 end)
176 ]] 176 ]]
177 177
178 -- when we start up, ensure that logging is still enabled if it was enabled when they last used the addon 178 -- when we start up, ensure that logging is still enabled if it was enabled when they last used the addon
179 if (tab:IsLogging()) then 179 if (AskMrRobot.CombatLogTab.IsLogging()) then
180 SetCVar("advancedCombatLogging", 1) 180 SetCVar("advancedCombatLogging", 1)
181 LoggingCombat(true) 181 LoggingCombat(true)
182 end 182 end
183 183
184 -- if auto-logging is enabled, do a check when the addon is loaded to make sure that state is set correctly 184 -- if auto-logging is enabled, do a check when the addon is loaded to make sure that state is set correctly
185 if AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled" then 185 if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled" then
186 tab:UpdateAutoLogging() 186 tab:UpdateAutoLogging()
187 end 187 end
188 188
189 tab:SetScript("OnShow", function() 189 tab:SetScript("OnShow", function()
190 tab:Update() 190 tab:Update()
191 end) 191 end)
192 192
193 return tab 193 return tab
194 end 194 end
195 195
196 function AskMrRobot.CombatLogTab:IsLogging() 196 function AskMrRobot.CombatLogTab.IsLogging()
197 return AmrLogData._logging == true 197 return AmrDb.LogData._logging == true
198 end 198 end
199 199
200 function AskMrRobot.CombatLogTab:StartLogging() 200 function AskMrRobot.CombatLogTab:StartLogging()
201 201
202 local now = time() 202 local now = time()
203 local oldDuration = 60 * 60 * 24 * 10 203 local oldDuration = 60 * 60 * 24 * 10
204 204
205 -- archive the current logging session so that users don't accidentally blow away data before uploading it 205 -- archive the current logging session so that users don't accidentally blow away data before uploading it
206 if AmrLogData._current2 ~= nil then 206 if AmrDb.LogData._current2 ~= nil then
207 if not AmrLogData._history2 then AmrLogData._history2 = {} end 207 if not AmrDb.LogData._history2 then AmrDb.LogData._history2 = {} end
208 208
209 -- add new entries 209 -- add new entries
210 for name, timeList in AskMrRobot.spairs(AmrLogData._current2) do 210 for name, timeList in AskMrRobot.spairs(AmrDb.LogData._current2) do
211 if not AmrLogData._history2[name] then AmrLogData._history2[name] = {} end 211 if not AmrDb.LogData._history2[name] then AmrDb.LogData._history2[name] = {} end
212 for timestamp, dataString in AskMrRobot.spairs(timeList) do 212 for timestamp, dataString in AskMrRobot.spairs(timeList) do
213 AmrLogData._history2[name][timestamp] = dataString 213 AmrDb.LogData._history2[name][timestamp] = dataString
214 end 214 end
215 end 215 end
216 216
217 -- delete entries that are more than 10 days old 217 -- delete entries that are more than 10 days old
218 for name, timeList in AskMrRobot.spairs(AmrLogData._history2) do 218 for name, timeList in AskMrRobot.spairs(AmrDb.LogData._history2) do
219 for timestamp, dataString in AskMrRobot.spairs(timeList) do 219 for timestamp, dataString in AskMrRobot.spairs(timeList) do
220 if difftime(now, tonumber(timestamp)) > oldDuration then 220 if difftime(now, tonumber(timestamp)) > oldDuration then
221 timeList[timestamp] = nil 221 timeList[timestamp] = nil
222 end 222 end
223 end 223 end
225 local count = 0 225 local count = 0
226 for timestamp, dataString in pairs(timeList) do 226 for timestamp, dataString in pairs(timeList) do
227 count = count + 1 227 count = count + 1
228 end 228 end
229 if count == 0 then 229 if count == 0 then
230 AmrLogData._history2[name] = nil 230 AmrDb.LogData._history2[name] = nil
231 end 231 end
232 end 232 end
233 end 233 end
234 234
235 -- same idea with extra info (auras, pets, whatever we end up adding to it) 235 -- same idea with extra info (auras, pets, whatever we end up adding to it)
236 if AmrLogData._currentExtra ~= nil then 236 if AmrDb.LogData._currentExtra ~= nil then
237 if not AmrLogData._historyExtra then AmrLogData._historyExtra = {} end 237 if not AmrDb.LogData._historyExtra then AmrDb.LogData._historyExtra = {} end
238 238
239 -- add new entries 239 -- add new entries
240 for name, timeList in AskMrRobot.spairs(AmrLogData._currentExtra) do 240 for name, timeList in AskMrRobot.spairs(AmrDb.LogData._currentExtra) do
241 if not AmrLogData._historyExtra[name] then AmrLogData._historyExtra[name] = {} end 241 if not AmrDb.LogData._historyExtra[name] then AmrDb.LogData._historyExtra[name] = {} end
242 for timestamp, dataString in AskMrRobot.spairs(timeList) do 242 for timestamp, dataString in AskMrRobot.spairs(timeList) do
243 AmrLogData._historyExtra[name][timestamp] = dataString 243 AmrDb.LogData._historyExtra[name][timestamp] = dataString
244 end 244 end
245 end 245 end
246 246
247 -- delete entries that are more than 10 days old 247 -- delete entries that are more than 10 days old
248 for name, timeList in AskMrRobot.spairs(AmrLogData._historyExtra) do 248 for name, timeList in AskMrRobot.spairs(AmrDb.LogData._historyExtra) do
249 for timestamp, dataString in AskMrRobot.spairs(timeList) do 249 for timestamp, dataString in AskMrRobot.spairs(timeList) do
250 if difftime(now, tonumber(timestamp)) > oldDuration then 250 if difftime(now, tonumber(timestamp)) > oldDuration then
251 timeList[timestamp] = nil 251 timeList[timestamp] = nil
252 end 252 end
253 end 253 end
255 local count = 0 255 local count = 0
256 for timestamp, dataString in pairs(timeList) do 256 for timestamp, dataString in pairs(timeList) do
257 count = count + 1 257 count = count + 1
258 end 258 end
259 if count == 0 then 259 if count == 0 then
260 AmrLogData._historyExtra[name] = nil 260 AmrDb.LogData._historyExtra[name] = nil
261 end 261 end
262 end 262 end
263 end 263 end
264 264
265 265
266 -- delete _wipes entries that are more than 10 days old 266 -- delete _wipes entries that are more than 10 days old
267 if AmrLogData._wipes then 267 if AmrDb.LogData._wipes then
268 local i = 1 268 local i = 1
269 while i <= #AmrLogData._wipes do 269 while i <= #AmrDb.LogData._wipes do
270 local t = AmrLogData._wipes[i] 270 local t = AmrDb.LogData._wipes[i]
271 if difftime(now, t) > oldDuration then 271 if difftime(now, t) > oldDuration then
272 tremove(AmrLogData._wipes, i) 272 tremove(AmrDb.LogData._wipes, i)
273 else 273 else
274 i = i + 1 274 i = i + 1
275 end 275 end
276 end 276 end
277 end 277 end
278 278
279 -- delete the _lastWipe if it is more than 10 days old 279 -- delete the _lastWipe if it is more than 10 days old
280 if AmrLogData._lastWipe and difftime(now, AmrLogData._lastWipe) > oldDuration then 280 if AmrDb.LogData._lastWipe and difftime(now, AmrDb.LogData._lastWipe) > oldDuration then
281 AmrLogData_lastWipe = nil 281 AmrDb.LogData_lastWipe = nil
282 end 282 end
283 283
284 -- clean up old-style logging data from previous versions of the addon 284 -- clean up old-style logging data from previous versions of the addon
285 for k, v in AskMrRobot.spairs(AmrLogData) do 285 for k, v in AskMrRobot.spairs(AmrDb.LogData) do
286 if not _logDataKeys[k] then 286 if not _logDataKeys[k] then
287 AmrLogData[k] = nil 287 AmrDb.LogData[k] = nil
288 end 288 end
289 end 289 end
290 290
291 -- start a new logging session 291 -- start a new logging session
292 AmrLogData._current2 = {} 292 AmrDb.LogData._current2 = {}
293 AmrLogData._currentExtra = {} 293 AmrDb.LogData._currentExtra = {}
294 AmrLogData._logging = true 294 AmrDb.LogData._logging = true
295 295
296 -- always enable advanced combat logging via our addon, gathers more detailed data for better analysis 296 -- always enable advanced combat logging via our addon, gathers more detailed data for better analysis
297 SetCVar("advancedCombatLogging", 1) 297 SetCVar("advancedCombatLogging", 1)
298 298
299 LoggingCombat(true) 299 LoggingCombat(true)
304 print(L.AMR_COMBATLOGTAB_IS_LOGGING) 304 print(L.AMR_COMBATLOGTAB_IS_LOGGING)
305 end 305 end
306 306
307 function AskMrRobot.CombatLogTab:StopLogging() 307 function AskMrRobot.CombatLogTab:StopLogging()
308 LoggingCombat(false) 308 LoggingCombat(false)
309 AmrLogData._logging = false 309 AmrDb.LogData._logging = false
310 self:Update() 310 self:Update()
311 311
312 AskMrRobot.AmrUpdateMinimap() 312 AskMrRobot.AmrUpdateMinimap()
313 313
314 print(L.AMR_COMBATLOGTAB_STOPPED_LOGGING) 314 print(L.AMR_COMBATLOGTAB_STOPPED_LOGGING)
315 end 315 end
316 316
317 function AskMrRobot.CombatLogTab:ToggleLogging() 317 function AskMrRobot.CombatLogTab:ToggleLogging()
318 if self:IsLogging() then 318 if AskMrRobot.CombatLogTab.IsLogging() then
319 self:StopLogging() 319 self:StopLogging()
320 else 320 else
321 self:StartLogging() 321 self:StartLogging()
322 end 322 end
323 end 323 end
324 324
325 -- update the panel and state 325 -- update the panel and state
326 function AskMrRobot.CombatLogTab:Update() 326 function AskMrRobot.CombatLogTab:Update()
327 local isLogging = self:IsLogging() 327 local isLogging = AskMrRobot.CombatLogTab.IsLogging()
328 328
329 if isLogging then 329 if isLogging then
330 self.btnStart:SetText(L.AMR_COMBATLOGTAB_STOP_LOGGING) 330 self.btnStart:SetText(L.AMR_COMBATLOGTAB_STOP_LOGGING)
331 self.loggingStatus:SetText(L.AMR_COMBATLOGTAB_CURRENTLY_LOGGING) 331 self.loggingStatus:SetText(L.AMR_COMBATLOGTAB_CURRENTLY_LOGGING)
332 else 332 else
333 self.btnStart:SetText(L.AMR_COMBATLOGTAB_START_LOGGING) 333 self.btnStart:SetText(L.AMR_COMBATLOGTAB_START_LOGGING)
334 self.loggingStatus:SetText("") 334 self.loggingStatus:SetText("")
335 end 335 end
336 336
337 if AmrLogData._lastWipe then 337 if AmrDb.LogData._lastWipe then
338 self.lastWipeLabel:SetText(L.AMR_COMBATLOGTAB_LASTWIPE:format(date('%B %d', AmrLogData._lastWipe), date('%I:%M %p', AmrLogData._lastWipe))) 338 self.lastWipeLabel:SetText(L.AMR_COMBATLOGTAB_LASTWIPE:format(date('%B %d', AmrDb.LogData._lastWipe), date('%I:%M %p', AmrDb.LogData._lastWipe)))
339 self.btnUnwipe:Show() 339 self.btnUnwipe:Show()
340 else 340 else
341 self.lastWipeLabel:SetText("") 341 self.lastWipeLabel:SetText("")
342 self.btnUnwipe:Hide() 342 self.btnUnwipe:Hide()
343 end 343 end
354 -- Unless Blizzard fixes scenarios to not return nil, let's hardcode this into returning "scenario" -Znuff 354 -- Unless Blizzard fixes scenarios to not return nil, let's hardcode this into returning "scenario" -Znuff
355 --if zonetype == nil and difficultyIndex == 1 then 355 --if zonetype == nil and difficultyIndex == 1 then
356 --zonetype = "scenario" 356 --zonetype = "scenario"
357 --end 357 --end
358 358
359 if zone == AmrLogData._lastZone and difficultyIndex == AmrLogData._lastDiff then 359 if zone == AmrDb.LogData._lastZone and difficultyIndex == AmrDb.LogData._lastDiff then
360 -- do nothing if the zone hasn't actually changed, otherwise we may override the user's manual enable/disable 360 -- do nothing if the zone hasn't actually changed, otherwise we may override the user's manual enable/disable
361 return 361 return
362 end 362 end
363 363
364 AmrLogData._lastZone = zone 364 AmrDb.LogData._lastZone = zone
365 AmrLogData._lastDiff = difficultyIndex 365 AmrDb.LogData._lastDiff = difficultyIndex
366 366
367 if AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled" then 367 if AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] == "enabled" then
368 if tonumber(instanceMapID) == AskMrRobot.instanceIds.SiegeOfOrgrimmar then 368 if tonumber(instanceMapID) == AskMrRobot.instanceIds.SiegeOfOrgrimmar then
369 -- if in SoO, make sure logging is on 369 -- if in SoO, make sure logging is on
370 if not self:IsLogging() then 370 if not AskMrRobot.CombatLogTab.IsLogging() then
371 self:StartLogging() 371 self:StartLogging()
372 end 372 end
373 else 373 else
374 -- not in SoO, turn logging off 374 -- not in SoO, turn logging off
375 if self:IsLogging() then 375 if AskMrRobot.CombatLogTab.IsLogging() then
376 self:StopLogging() 376 self:StopLogging()
377 end 377 end
378 end 378 end
379 end 379 end
380 380
386 else 386 else
387 return "RAID" 387 return "RAID"
388 end 388 end
389 end 389 end
390 390
391 -- used to store wipes to AmrLogData so that we trim data after the wipe 391 -- used to store wipes to AmrDb.LogData so that we trim data after the wipe
392 function AskMrRobot.CombatLogTab:LogWipe() 392 function AskMrRobot.CombatLogTab:LogWipe()
393 local t = time() 393 local t = time()
394 tinsert(AmrLogData._wipes, t) 394 tinsert(AmrDb.LogData._wipes, t)
395 AmrLogData._lastWipe = t 395 AmrDb.LogData._lastWipe = t
396 396
397 if GetNumGroupMembers() > 0 then 397 --if GetNumGroupMembers() > 0 then
398 SendChatMessage(L.AMR_COMBATLOGTAB_WIPE_CHAT, RaidChatType()) 398 -- SendChatMessage(L.AMR_COMBATLOGTAB_WIPE_CHAT, RaidChatType())
399 end 399 --end
400 print(string.format(L.AMR_COMBATLOGTAB_WIPE_MSG, date('%I:%M %p', t))) 400 print(string.format(L.AMR_COMBATLOGTAB_WIPE_MSG, date('%I:%M %p', t)))
401 401
402 self:Update() 402 self:Update()
403 --AskMrRobot.wait(301, AskMrRobot.CombatLogTab.Update, self)
404 end 403 end
405 404
406 -- used to undo the wipe command 405 -- used to undo the wipe command
407 function AskMrRobot.CombatLogTab:LogUnwipe() 406 function AskMrRobot.CombatLogTab:LogUnwipe()
408 local t = AmrLogData._lastWipe 407 local t = AmrDb.LogData._lastWipe
409 if not t then 408 if not t then
410 print(L.AMR_COMBATLOGTAB_NOWIPES) 409 print(L.AMR_COMBATLOGTAB_NOWIPES)
411 else 410 else
412 tremove(AmrLogData._wipes) 411 tremove(AmrDb.LogData._wipes)
413 AmrLogData._lastWipe = nil 412 AmrDb.LogData._lastWipe = nil
414 print(string.format(L.AMR_COMBATLOGTAB_UNWIPE_MSG, date('%I:%M %p', t))) 413 print(string.format(L.AMR_COMBATLOGTAB_UNWIPE_MSG, date('%I:%M %p', t)))
415 end 414 end
416 self:Update() 415 self:Update()
417 end 416 end
418 417
419 -- initialize the AmrLogData variable 418 -- initialize the AmrDb.LogData variable
420 function AskMrRobot.CombatLogTab.InitializeVariable() 419 function AskMrRobot.CombatLogTab.InitializeVariable()
421 if not AmrLogData then AmrLogData = {} end 420 if not AmrDb.LogData then AmrDb.LogData = {} end
422 if not AmrLogData._autoLog then AmrLogData._autoLog = {} end 421 if not AmrDb.LogData._autoLog then AmrDb.LogData._autoLog = {} end
423 if not AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] then 422 if not AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] then
424 AmrLogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" 423 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled"
425 end 424 end
426 AmrLogData._wipes = AmrLogData._wipes or {} 425 AmrDb.LogData._wipes = AmrDb.LogData._wipes or {}
427 end 426 end
428 427
429 function AskMrRobot.CombatLogTab.SaveExtras(data, timestamp) 428 local function GetPlayerExtraData(data, index)
430 429
430 local unitId = "raid" .. index
431
432 local guid = UnitGUID(unitId)
433 if guid == nil then
434 return nil
435 end
436
437 local fields = {}
438
439 local buffs = {}
440 for i=1,40 do
441 local _,_,_,count,_,_,_,_,_,_,spellId = UnitAura(unitId, i, "HELPFUL")
442 table.insert(buffs, spellId)
443 end
444 if #buffs == 0 then
445 table.insert(fields, "_")
446 else
447 table.insert(fields, AskMrRobot.toCompressedNumberList(buffs))
448 end
449
450 local petGuid = UnitGUID("raidpet" .. index)
451 if petGuid then
452 table.insert(fields, guid .. "," .. petGuid)
453 else
454 table.insert(fields, '_')
455 end
456
457 local name = GetRaidRosterInfo(index)
458 local realm = GetRealmName()
459 local splitPos = string.find(name, "-")
460 if splitPos ~= nil then
461 realm = string.sub(name, splitPos + 1)
462 name = string.sub(name, 1, splitPos - 1)
463 end
464
465 data[realm .. ":" .. name] = table.concat(fields, ";")
466 end
467
468 function AskMrRobot.CombatLogTab.SaveExtras(timestamp)
469
470 if not AskMrRobot.CombatLogTab.IsLogging() then
471 return
472 end
473
474 -- we only get extra information for people if in a raid
475 if not IsInRaid() then
476 return
477 end
478
479 local data = {}
480 for i = 1,40 do
481 GetPlayerExtraData(data, i)
482 end
483
431 for name,val in pairs(data) do 484 for name,val in pairs(data) do
432 -- record aura stuff, we never check for duplicates, need to know it at each point in time 485 -- record aura stuff, we never check for duplicates, need to know it at each point in time
433 if AmrLogData._currentExtra[name] == nil then 486 if AmrDb.LogData._currentExtra[name] == nil then
434 AmrLogData._currentExtra[name] = {} 487 AmrDb.LogData._currentExtra[name] = {}
435 end 488 end
436 AmrLogData._currentExtra[name][timestamp] = val 489 AmrDb.LogData._currentExtra[name][timestamp] = val
437 end 490 end
438 end 491 end
439 492
440 -- read a message sent to the addon channel with a player's info at the time an encounter started 493 -- read a message sent to the addon channel with a player's info at the time an encounter started
441 function AskMrRobot.CombatLogTab:ReadAddonMessage(message) 494 function AskMrRobot.CombatLogTab:ReadAddonMessage(message)
450 local name = parts[2] .. ":" .. parts[3] 503 local name = parts[2] .. ":" .. parts[3]
451 local data = parts[4] 504 local data = parts[4]
452 505
453 if (data == "done") then 506 if (data == "done") then
454 -- we have finished receiving this message; now process it to reduce the amount of duplicate data 507 -- we have finished receiving this message; now process it to reduce the amount of duplicate data
455 local setup = AmrLogData._current2[name][timestamp] 508 local setup = AmrDb.LogData._current2[name][timestamp]
456 509
457 if (AmrLogData._previousSetup == nil) then 510 if (AmrDb.LogData._previousSetup == nil) then
458 AmrLogData._previousSetup = {} 511 AmrDb.LogData._previousSetup = {}
459 end 512 end
460 513
461 local previousSetup = AmrLogData._previousSetup[name] 514 local previousSetup = AmrDb.LogData._previousSetup[name]
462 515
463 if (previousSetup == setup) then 516 if (previousSetup == setup) then
464 -- if the last-seen setup for this player is the same as the current one, we don't need this entry 517 -- if the last-seen setup for this player is the same as the current one, we don't need this entry
465 AmrLogData._current2[name][timestamp] = nil 518 AmrDb.LogData._current2[name][timestamp] = nil
466 else 519 else
467 -- record the last-seen setup 520 -- record the last-seen setup
468 AmrLogData._previousSetup[name] = setup 521 AmrDb.LogData._previousSetup[name] = setup
469 end 522 end
470 523
471 else 524 else
472 -- concatenate messages with the same timestamp+name 525 -- concatenate messages with the same timestamp+name
473 if (AmrLogData._current2[name] == nil) then 526 if (AmrDb.LogData._current2[name] == nil) then
474 AmrLogData._current2[name] = {} 527 AmrDb.LogData._current2[name] = {}
475 end 528 end
476 529
477 if (AmrLogData._current2[name][timestamp] == nil) then 530 if (AmrDb.LogData._current2[name][timestamp] == nil) then
478 AmrLogData._current2[name][timestamp] = data 531 AmrDb.LogData._current2[name][timestamp] = data
479 else 532 else
480 AmrLogData._current2[name][timestamp] = AmrLogData._current2[name][timestamp] .. data 533 AmrDb.LogData._current2[name][timestamp] = AmrDb.LogData._current2[name][timestamp] .. data
481 end 534 end
482 end 535 end
483 end 536 end