Mercurial > wow > askmrrobot
comparison CombatLog.lua @ 91:b8e9664d3229 v43
option to disable equipment manager sets, minor artifact/talent bug fixes
| author | yellowfive |
|---|---|
| date | Wed, 21 Sep 2016 00:14:22 -0700 |
| parents | 6bbe64d587b4 |
| children | 177391341e26 |
comparison
equal
deleted
inserted
replaced
| 90:db63475ef5d4 | 91:b8e9664d3229 |
|---|---|
| 87 btnReload:SetHeight(26) | 87 btnReload:SetHeight(26) |
| 88 btnReload:SetPoint("TOPLEFT", _btnToggle.frame, "TOPRIGHT", 40, 0) | 88 btnReload:SetPoint("TOPLEFT", _btnToggle.frame, "TOPRIGHT", 40, 0) |
| 89 btnReload:SetCallback("OnClick", ReloadUI) | 89 btnReload:SetCallback("OnClick", ReloadUI) |
| 90 container:AddChild(btnReload) | 90 container:AddChild(btnReload) |
| 91 | 91 |
| 92 --[[ | |
| 92 local lbl = AceGUI:Create("AmrUiLabel") | 93 local lbl = AceGUI:Create("AmrUiLabel") |
| 93 lbl:SetText(L.LogReloadNote) | 94 lbl:SetText(L.LogReloadNote) |
| 94 lbl:SetWidth(200) | 95 lbl:SetWidth(200) |
| 95 lbl:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) | 96 lbl:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) |
| 96 lbl:SetJustifyH("MIDDLE") | 97 lbl:SetJustifyH("MIDDLE") |
| 137 btnWipe:SetWidth(200) | 138 btnWipe:SetWidth(200) |
| 138 btnWipe:SetHeight(26) | 139 btnWipe:SetHeight(26) |
| 139 btnWipe:SetPoint("TOPRIGHT", btnUndoWipe.frame, "TOPLEFT", -40, 0) | 140 btnWipe:SetPoint("TOPRIGHT", btnUndoWipe.frame, "TOPLEFT", -40, 0) |
| 140 btnWipe:SetCallback("OnClick", function() Amr:Wipe() end) | 141 btnWipe:SetCallback("OnClick", function() Amr:Wipe() end) |
| 141 container:AddChild(btnWipe) | 142 container:AddChild(btnWipe) |
| 142 | 143 |
| 143 lbl = AceGUI:Create("AmrUiLabel") | 144 lbl = AceGUI:Create("AmrUiLabel") |
| 144 lbl:SetText(L.LogWipeNote) | 145 lbl:SetText(L.LogWipeNote) |
| 145 lbl:SetWidth(200) | 146 lbl:SetWidth(200) |
| 146 lbl:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) | 147 lbl:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) |
| 147 lbl:SetJustifyH("MIDDLE") | 148 lbl:SetJustifyH("MIDDLE") |
| 153 lbl2:SetWidth(200) | 154 lbl2:SetWidth(200) |
| 154 lbl2:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) | 155 lbl2:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.TextTan)) |
| 155 lbl2:SetJustifyH("MIDDLE") | 156 lbl2:SetJustifyH("MIDDLE") |
| 156 lbl2:SetPoint("TOP", lbl.frame, "BOTTOM", 0, -2) | 157 lbl2:SetPoint("TOP", lbl.frame, "BOTTOM", 0, -2) |
| 157 container:AddChild(lbl2) | 158 container:AddChild(lbl2) |
| 159 ]] | |
| 158 | 160 |
| 159 -- auto-logging controls | 161 -- auto-logging controls |
| 160 lbl = AceGUI:Create("AmrUiLabel") | 162 local lbl = AceGUI:Create("AmrUiLabel") |
| 161 lbl:SetWidth(600) | 163 lbl:SetWidth(600) |
| 162 lbl:SetText(L.LogAutoTitle) | 164 lbl:SetText(L.LogAutoTitle) |
| 163 lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) | 165 lbl:SetFont(Amr.CreateFont("Bold", 24, Amr.Colors.TextHeaderActive)) |
| 164 lbl:SetPoint("TOPLEFT", lbl2.frame, "BOTTOMLEFT", 0, -40) | 166 lbl:SetPoint("TOPLEFT", _btnToggle.frame, "BOTTOMLEFT", 0, -40) |
| 165 container:AddChild(lbl) | 167 container:AddChild(lbl) |
| 166 | 168 |
| 167 _chkAutoAll = AceGUI:Create("AmrUiCheckBox") | 169 _chkAutoAll = AceGUI:Create("AmrUiCheckBox") |
| 168 _chkAutoAll:SetText(L.LogAutoAllText) | 170 _chkAutoAll:SetText(L.LogAutoAllText) |
| 169 _chkAutoAll:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -15) | 171 _chkAutoAll:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -15) |
| 189 table.insert(autoChks, autoChk) | 191 table.insert(autoChks, autoChk) |
| 190 end | 192 end |
| 191 autoSections = nil | 193 autoSections = nil |
| 192 | 194 |
| 193 -- instructions | 195 -- instructions |
| 196 --[[ | |
| 194 lbl = AceGUI:Create("AmrUiLabel") | 197 lbl = AceGUI:Create("AmrUiLabel") |
| 195 lbl:SetText(L.LogInstructionsTitle) | 198 lbl:SetText(L.LogInstructionsTitle) |
| 196 lbl:SetWidth(480) | 199 lbl:SetWidth(480) |
| 197 lbl:SetFont(Amr.CreateFont("Italic", 24, Amr.Colors.Text)) | 200 lbl:SetFont(Amr.CreateFont("Italic", 24, Amr.Colors.Text)) |
| 198 lbl:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", 0, -40) | 201 lbl:SetPoint("TOPRIGHT", container.content, "TOPRIGHT", 0, -40) |
| 202 lbl2:SetText(L.LogInstructions) | 205 lbl2:SetText(L.LogInstructions) |
| 203 lbl2:SetWidth(480) | 206 lbl2:SetWidth(480) |
| 204 lbl2:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.Text)) | 207 lbl2:SetFont(Amr.CreateFont("Italic", 14, Amr.Colors.Text)) |
| 205 lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -10) | 208 lbl2:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -10) |
| 206 container:AddChild(lbl2) | 209 container:AddChild(lbl2) |
| 210 ]] | |
| 207 | 211 |
| 208 -- initialize state of controls | 212 -- initialize state of controls |
| 209 Amr:RefreshLogUi() | 213 Amr:RefreshLogUi() |
| 210 end | 214 end |
| 211 | 215 |
| 285 end | 289 end |
| 286 | 290 |
| 287 Amr.db.char.Logging.LastZone = zone | 291 Amr.db.char.Logging.LastZone = zone |
| 288 Amr.db.char.Logging.LastDiff = difficultyId | 292 Amr.db.char.Logging.LastDiff = difficultyId |
| 289 | 293 |
| 294 if not Amr.db.profile.Logging.Auto[tonumber(instanceId)] then | |
| 295 Amr.db.profile.Logging.Auto[tonumber(instanceId)] = {} | |
| 296 end | |
| 297 | |
| 290 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then | 298 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then |
| 291 -- we are in a supported zone that we want to auto-log, turn logging on | 299 -- we are in a supported zone that we want to auto-log, turn logging on |
| 292 | 300 |
| 293 -- (supported check is probably redundant, but just in case someone has old settings lying around) | 301 -- (supported check is probably redundant, but just in case someone has old settings lying around) |
| 294 if not Amr:IsLogging() then | 302 if not Amr:IsLogging() then |
| 316 end | 324 end |
| 317 | 325 |
| 318 _lblLogging:SetVisible(self:IsLogging()) | 326 _lblLogging:SetVisible(self:IsLogging()) |
| 319 | 327 |
| 320 -- hide/show undo wipe button based on whether a wipe has been called recently | 328 -- hide/show undo wipe button based on whether a wipe has been called recently |
| 321 _panelUndoWipe:SetVisible(Amr.db.char.Logging.LastWipe and true or false) | 329 if _panelUndoWipe then |
| 330 _panelUndoWipe:SetVisible(Amr.db.char.Logging.LastWipe and true or false) | |
| 331 end | |
| 322 | 332 |
| 323 local all = isAllAutoLoggingEnabled() | 333 local all = isAllAutoLoggingEnabled() |
| 324 _chkAutoAll:SetChecked(all) | 334 _chkAutoAll:SetChecked(all) |
| 325 | 335 |
| 326 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do | 336 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do |
| 337 if not Amr.db.profile.Logging.Auto[instanceId] then | |
| 338 Amr.db.profile.Logging.Auto[instanceId] = {} | |
| 339 end | |
| 327 for k, difficultyId in pairs(Amr.Difficulties) do | 340 for k, difficultyId in pairs(Amr.Difficulties) do |
| 328 _autoChecks[instanceId][difficultyId]:SetChecked(Amr.db.profile.Logging.Auto[instanceId][difficultyId]) | 341 _autoChecks[instanceId][difficultyId]:SetChecked(Amr.db.profile.Logging.Auto[instanceId][difficultyId]) |
| 329 end | 342 end |
| 330 end | 343 end |
| 331 end | 344 end |
| 342 end | 355 end |
| 343 end | 356 end |
| 344 | 357 |
| 345 function Amr:StartLogging() | 358 function Amr:StartLogging() |
| 346 | 359 |
| 360 --[[ | |
| 347 local now = time() | 361 local now = time() |
| 348 local oldDuration = 60 * 60 * 24 * 10 | 362 local oldDuration = 60 * 60 * 24 * 10 |
| 349 | 363 |
| 350 -- prune out entries in log data that are more than 10 days old | 364 -- prune out entries in log data that are more than 10 days old |
| 351 | 365 |
| 397 | 411 |
| 398 -- delete the last wipe date if it is more than 10 days old | 412 -- delete the last wipe date if it is more than 10 days old |
| 399 if Amr.db.char.Logging.LastWipe and difftime(now, Amr.db.char.Logging.LastWipe) > oldDuration then | 413 if Amr.db.char.Logging.LastWipe and difftime(now, Amr.db.char.Logging.LastWipe) > oldDuration then |
| 400 Amr.db.char.Logging.LastWipe = nil | 414 Amr.db.char.Logging.LastWipe = nil |
| 401 end | 415 end |
| 402 | 416 ]] |
| 417 | |
| 403 -- enable game log file | 418 -- enable game log file |
| 404 updateGameLogging(true) | 419 updateGameLogging(true) |
| 405 Amr.db.char.Logging.Enabled = true | 420 Amr.db.char.Logging.Enabled = true |
| 406 | 421 |
| 407 self:Print(L.LogChatStart) | 422 self:Print(L.LogChatStart) |
| 420 self:UpdateMinimap() | 435 self:UpdateMinimap() |
| 421 self:RefreshLogUi() | 436 self:RefreshLogUi() |
| 422 end | 437 end |
| 423 | 438 |
| 424 function Amr:Wipe() | 439 function Amr:Wipe() |
| 440 | |
| 441 --[[ | |
| 425 local t = time() | 442 local t = time() |
| 426 table.insert(Amr.db.global.Logging.Wipes, t) | 443 table.insert(Amr.db.global.Logging.Wipes, t) |
| 427 Amr.db.char.Logging.LastWipe = t | 444 Amr.db.char.Logging.LastWipe = t |
| 428 | 445 |
| 429 self:Print(L.LogChatWipe(date('%I:%M %p', t))) | 446 self:Print(L.LogChatWipe(date('%I:%M %p', t))) |
| 430 | 447 |
| 431 self:RefreshLogUi() | 448 self:RefreshLogUi() |
| 449 ]] | |
| 432 end | 450 end |
| 433 | 451 |
| 434 function Amr:UndoWipe() | 452 function Amr:UndoWipe() |
| 435 | 453 |
| 454 --[[ | |
| 436 local t = Amr.db.char.Logging.LastWipe | 455 local t = Amr.db.char.Logging.LastWipe |
| 437 local wipes = Amr.db.global.Logging.Wipes | 456 local wipes = Amr.db.global.Logging.Wipes |
| 438 | 457 |
| 439 if not t then | 458 if not t then |
| 440 self:Print(L.LogChatNoWipes) | 459 self:Print(L.LogChatNoWipes) |
| 450 Amr.db.char.Logging.LastWipe = nil | 469 Amr.db.char.Logging.LastWipe = nil |
| 451 self:Print(L.LogChatUndoWipe(date('%I:%M %p', t))) | 470 self:Print(L.LogChatUndoWipe(date('%I:%M %p', t))) |
| 452 end | 471 end |
| 453 | 472 |
| 454 self:RefreshLogUi() | 473 self:RefreshLogUi() |
| 474 ]] | |
| 455 end | 475 end |
| 456 | 476 |
| 457 function Amr:ToggleAutoLog(instanceId, difficultyId) | 477 function Amr:ToggleAutoLog(instanceId, difficultyId) |
| 458 | 478 |
| 459 local byDiff = Amr.db.profile.Logging.Auto[instanceId] | 479 local byDiff = Amr.db.profile.Logging.Auto[instanceId] |
| 480 -- see if we should turn logging on right now | 500 -- see if we should turn logging on right now |
| 481 updateAutoLogging(true) | 501 updateAutoLogging(true) |
| 482 end | 502 end |
| 483 | 503 |
| 484 function Amr:ProcessPlayerSnapshot(msg) | 504 function Amr:ProcessPlayerSnapshot(msg) |
| 505 --[[ | |
| 485 if not self:IsLogging() then return end | 506 if not self:IsLogging() then return end |
| 486 | 507 |
| 487 -- message will be of format: timestamp\nregion\nrealm\nname\n[stuff] | 508 -- message will be of format: timestamp\nregion\nrealm\nname\n[stuff] |
| 488 local parts = {} | 509 local parts = {} |
| 489 for part in string.gmatch(msg, "([^\n]+)") do | 510 for part in string.gmatch(msg, "([^\n]+)") do |
| 518 | 539 |
| 519 -- we only need to keep this setup if it is different than the previous | 540 -- we only need to keep this setup if it is different than the previous |
| 520 if setup ~= previousSetup then | 541 if setup ~= previousSetup then |
| 521 playerList[timestamp] = setup | 542 playerList[timestamp] = setup |
| 522 end | 543 end |
| 523 | 544 ]] |
| 524 end | 545 end |
| 525 | 546 |
| 526 -- read auras and pet mapping info (pet may not be necessary anymore... but doesn't hurt) | 547 -- read auras and pet mapping info (pet may not be necessary anymore... but doesn't hurt) |
| 527 local function getPlayerExtraData(data, unitId, petId) | 548 local function getPlayerExtraData(data, unitId, petId) |
| 528 | 549 --[[ |
| 529 local guid = UnitGUID(unitId) | 550 local guid = UnitGUID(unitId) |
| 530 if guid == nil then return end | 551 if guid == nil then return end |
| 531 | 552 |
| 532 local fields = {} | 553 local fields = {} |
| 533 | 554 |
| 557 realm = string.sub(name, splitPos + 1) | 578 realm = string.sub(name, splitPos + 1) |
| 558 name = string.sub(name, 1, splitPos - 1) | 579 name = string.sub(name, 1, splitPos - 1) |
| 559 end | 580 end |
| 560 | 581 |
| 561 data[region .. ":" .. realm .. ":" .. name] = table.concat(fields, ";") | 582 data[region .. ":" .. realm .. ":" .. name] = table.concat(fields, ";") |
| 583 ]] | |
| 562 end | 584 end |
| 563 | 585 |
| 564 local function logPlayerExtraData() | 586 local function logPlayerExtraData() |
| 587 --[[ | |
| 565 if not Amr:IsLogging() or not Amr:IsSupportedInstance() then return end | 588 if not Amr:IsLogging() or not Amr:IsSupportedInstance() then return end |
| 566 | 589 |
| 567 local timestamp = time() | 590 local timestamp = time() |
| 568 local units = {} | 591 local units = {} |
| 569 local petUnits = {} | 592 local petUnits = {} |
| 594 if Amr.db.global.Logging.PlayerExtras[name] == nil then | 617 if Amr.db.global.Logging.PlayerExtras[name] == nil then |
| 595 Amr.db.global.Logging.PlayerExtras[name] = {} | 618 Amr.db.global.Logging.PlayerExtras[name] = {} |
| 596 end | 619 end |
| 597 Amr.db.global.Logging.PlayerExtras[name][timestamp] = val | 620 Amr.db.global.Logging.PlayerExtras[name][timestamp] = val |
| 598 end | 621 end |
| 622 ]] | |
| 599 end | 623 end |
| 600 | 624 |
| 601 function Amr:InitializeCombatLog() | 625 function Amr:InitializeCombatLog() |
| 602 --updateAutoLogging() | 626 --updateAutoLogging() |
| 603 end | 627 end |
| 604 | 628 |
| 605 --[[ | 629 --[[ |
| 606 Amr:AddEventHandler("UPDATE_INSTANCE_INFO", updateAutoLogging) | 630 Amr:AddEventHandler("UPDATE_INSTANCE_INFO", updateAutoLogging) |
| 607 Amr:AddEventHandler("PLAYER_DIFFICULTY_CHANGED", updateAutoLogging) | 631 Amr:AddEventHandler("PLAYER_DIFFICULTY_CHANGED", updateAutoLogging) |
| 608 Amr:AddEventHandler("ENCOUNTER_START", updateAutoLogging) | 632 Amr:AddEventHandler("ENCOUNTER_START", updateAutoLogging) |
| 609 Amr:AddEventHandler("PLAYER_REGEN_DISABLED", logPlayerExtraData) | 633 --Amr:AddEventHandler("PLAYER_REGEN_DISABLED", logPlayerExtraData) |
| 610 ]] | 634 ]] |
