Mercurial > wow > askmrrobot
comparison ui/CombatLogTab.lua @ 41:0e78d6424532 v13
added region to import/export, some prep for new combat logging
| author | yellowfive |
|---|---|
| date | Fri, 24 Oct 2014 12:08:47 -0700 |
| parents | e77e01abce98 |
| children | 90175bdc50e6 |
comparison
equal
deleted
inserted
replaced
| 40:a489324103e5 | 41:0e78d6424532 |
|---|---|
| 423 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" | 423 AmrDb.LogData._autoLog[AskMrRobot.instanceIds.SiegeOfOrgrimmar] = "disabled" |
| 424 end | 424 end |
| 425 AmrDb.LogData._wipes = AmrDb.LogData._wipes or {} | 425 AmrDb.LogData._wipes = AmrDb.LogData._wipes or {} |
| 426 end | 426 end |
| 427 | 427 |
| 428 local function GetPlayerExtraData(data, index) | 428 local function GetPlayerExtraData(data, unitId, petId) |
| 429 | |
| 430 local unitId = "raid" .. index | |
| 431 | 429 |
| 432 local guid = UnitGUID(unitId) | 430 local guid = UnitGUID(unitId) |
| 433 if guid == nil then | 431 if guid == nil then |
| 434 return nil | 432 return |
| 435 end | 433 end |
| 436 | 434 |
| 437 local fields = {} | 435 local fields = {} |
| 438 | 436 |
| 439 local buffs = {} | 437 local buffs = {} |
| 445 table.insert(fields, "_") | 443 table.insert(fields, "_") |
| 446 else | 444 else |
| 447 table.insert(fields, AskMrRobot.toCompressedNumberList(buffs)) | 445 table.insert(fields, AskMrRobot.toCompressedNumberList(buffs)) |
| 448 end | 446 end |
| 449 | 447 |
| 450 local petGuid = UnitGUID("raidpet" .. index) | 448 local petGuid = UnitGUID(petId) |
| 451 if petGuid then | 449 if petGuid then |
| 452 table.insert(fields, guid .. "," .. petGuid) | 450 table.insert(fields, guid .. "," .. petGuid) |
| 453 else | 451 else |
| 454 table.insert(fields, '_') | 452 table.insert(fields, '_') |
| 455 end | 453 end |
| 456 | 454 |
| 457 local name = GetRaidRosterInfo(index) | 455 local name = GetUnitName(unitId, true) -- GetRaidRosterInfo(rosterIndex) |
| 458 local realm = GetRealmName() | 456 local realm = GetRealmName() |
| 457 local region = AskMrRobot.regionNames[GetCurrentRegion()] | |
| 459 local splitPos = string.find(name, "-") | 458 local splitPos = string.find(name, "-") |
| 460 if splitPos ~= nil then | 459 if splitPos ~= nil then |
| 461 realm = string.sub(name, splitPos + 1) | 460 realm = string.sub(name, splitPos + 1) |
| 462 name = string.sub(name, 1, splitPos - 1) | 461 name = string.sub(name, 1, splitPos - 1) |
| 463 end | 462 end |
| 464 | 463 |
| 465 data[realm .. ":" .. name] = table.concat(fields, ";") | 464 data[region .. ":" .. realm .. ":" .. name] = table.concat(fields, ";") |
| 466 end | 465 end |
| 467 | 466 |
| 468 function AskMrRobot.CombatLogTab.SaveExtras(timestamp) | 467 function AskMrRobot.CombatLogTab.SaveExtras(timestamp) |
| 469 | 468 |
| 470 if not AskMrRobot.CombatLogTab.IsLogging() then | 469 if not AskMrRobot.CombatLogTab.IsLogging() then |
| 471 return | 470 return |
| 472 end | 471 end |
| 473 | 472 |
| 474 -- we only get extra information for people if in a raid | 473 local units = {} |
| 475 if not IsInRaid() then | 474 local petUnits = {} |
| 476 return | 475 |
| 477 end | 476 if IsInRaid() then |
| 477 for i = 1,40 do | |
| 478 table.insert(units, "raid" .. i) | |
| 479 table.insert(petUnits, "raidpet" .. i) | |
| 480 end | |
| 481 elseif IsInGroup() then | |
| 482 table.insert(units, "player") | |
| 483 table.insert(petUnits, "pet") | |
| 484 for i = 1,4 do | |
| 485 table.insert(units, "party" .. i) | |
| 486 table.insert(petUnits, "partypet" .. i) | |
| 487 end | |
| 488 else | |
| 489 return | |
| 490 end | |
| 478 | 491 |
| 479 local data = {} | 492 local data = {} |
| 480 for i = 1,40 do | 493 for i = 1,#units do |
| 481 GetPlayerExtraData(data, i) | 494 GetPlayerExtraData(data, units[i], petUnits[i]) |
| 482 end | 495 end |
| 483 | 496 |
| 484 for name,val in pairs(data) do | 497 for name,val in pairs(data) do |
| 485 -- record aura stuff, we never check for duplicates, need to know it at each point in time | 498 -- record aura stuff, we never check for duplicates, need to know it at each point in time |
| 486 if AmrDb.LogData._currentExtra[name] == nil then | 499 if AmrDb.LogData._currentExtra[name] == nil then |
| 487 AmrDb.LogData._currentExtra[name] = {} | 500 AmrDb.LogData._currentExtra[name] = {} |
| 491 end | 504 end |
| 492 | 505 |
| 493 -- read a message sent to the addon channel with a player's info at the time an encounter started | 506 -- read a message sent to the addon channel with a player's info at the time an encounter started |
| 494 function AskMrRobot.CombatLogTab:ReadAddonMessage(message) | 507 function AskMrRobot.CombatLogTab:ReadAddonMessage(message) |
| 495 | 508 |
| 496 -- message will be of format: timestamp\nrealm\nname\n[stuff] | 509 -- message will be of format: timestamp\nregion\nrealm\nname\n[stuff] |
| 497 local parts = {} | 510 local parts = {} |
| 498 for part in string.gmatch(message, "([^\n]+)") do | 511 for part in string.gmatch(message, "([^\n]+)") do |
| 499 tinsert(parts, part) | 512 tinsert(parts, part) |
| 500 end | 513 end |
| 501 | 514 |
| 502 local timestamp = parts[1] | 515 local timestamp = parts[1] |
| 503 local name = parts[2] .. ":" .. parts[3] | 516 local name = parts[2] .. ":" .. parts[3] .. ":" .. parts[4] |
| 504 local data = parts[4] | 517 local data = parts[5] |
| 505 | 518 |
| 506 if (data == "done") then | 519 if (data == "done") then |
| 507 -- we have finished receiving this message; now process it to reduce the amount of duplicate data | 520 -- we have finished receiving this message; now process it to reduce the amount of duplicate data |
| 508 local setup = AmrDb.LogData._current2[name][timestamp] | 521 local setup = AmrDb.LogData._current2[name][timestamp] |
| 509 | 522 |
