Skip to content

Commit

Permalink
ENCOUNTER_START will now always be included if another addon used ENC…
Browse files Browse the repository at this point in the history
…OUNTER_START to start logging. Add player info (name/class/spec/etc) of each player to the top of each log similar to the WoW combat log.
  • Loading branch information
funkydude committed Aug 4, 2024
1 parent e5fa75e commit c530692
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 33 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ read_globals = {
"UnitCanAttack",
"UnitCastingInfo",
"UnitChannelInfo",
"UnitClass",
"UnitClassification",
"UnitCreatureType",
"UnitExists",
Expand Down
126 changes: 93 additions & 33 deletions Transcriptor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ local hiddenAuraPermList = {
[5384] = true, -- Feign Death
[209997] = true, -- Play Dead (Hunter Pet)
}
local playerSpecList = {}
local previousSpecialEvent = nil
local hiddenAuraEngageList = nil
local prevEncounterStart = nil
local shouldLogFlags = false
local inEncounter, blockingRelease, limitingRes = false, false, false
local mineOrPartyOrRaid = 7 -- COMBATLOG_OBJECT_AFFILIATION_MINE + COMBATLOG_OBJECT_AFFILIATION_PARTY + COMBATLOG_OBJECT_AFFILIATION_RAID
Expand Down Expand Up @@ -70,8 +72,14 @@ do
end

local origUnitName = UnitName
function UnitName(name)
return origUnitName(name) or "??"
function UnitName(unit)
local name, server = origUnitName(unit)
if not name then
return "??"
elseif server and server ~= "" then
name = name .."-".. server
end
return name
end
end

Expand Down Expand Up @@ -1624,6 +1632,35 @@ eventFrame:SetScript("OnUpdate", function()
end
end)

--------------------------------------------------------------------------------
-- Backup events
--

do
local f = CreateFrame("Frame")
f:RegisterEvent("ENCOUNTER_START")
f:SetScript("OnEvent", function(_, event, ...)
if not logging then
local line = sh[event](...)
logStartTime = compareStartTime / 1000
prevEncounterStart = line
end
end)
end

--------------------------------------------------------------------------------
-- LibSpec
--

do
local LibSpec = LibStub and LibStub("LibSpecialization", true)
if LibSpec then
LibSpec:Register(Transcriptor, function(specId, role, position, playerName, talents)
playerSpecList[playerName] = {specId, role, position, talents}
end)
end
end

--------------------------------------------------------------------------------
-- Addon
--
Expand Down Expand Up @@ -1790,43 +1827,19 @@ do
shouldLogFlags = TranscriptIgnore.logFlags and true or false
twipe(TIMERS_SPECIAL_EVENTS_DATA)

hiddenAuraEngageList = {}
do
local UnitAura = C_UnitAuras and C_UnitAuras.GetAuraDataByIndex or UnitAura
local UnitPosition = UnitPosition
local _, _, _, myInstance = UnitPosition("player")
for unit in Transcriptor:IterateGroup() do
local _, _, _, tarInstanceId = UnitPosition(unit)
if tarInstanceId == myInstance then
for i = 1, 100 do
local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HELPFUL")
if not spellId then
break
elseif not hiddenAuraEngageList[spellId] then
hiddenAuraEngageList[spellId] = true
end
end
for i = 1, 100 do
local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL")
if not spellId then
break
elseif not hiddenAuraEngageList[spellId] then
hiddenAuraEngageList[spellId] = true
end
end
end
end
end

collectNameplates = {}
hiddenUnitAuraCollector = {}
playerSpellCollector = {}
previousSpecialEvent = nil
compareStartTime = debugprofilestop()
logStartTime = compareStartTime / 1000
if not compareStartTime or debugprofilestop()-compareStartTime > 5 then
compareStartTime = debugprofilestop()
logStartTime = compareStartTime / 1000
prevEncounterStart = nil
end
local _, instanceType, diff, _, _, _, _, instanceId = GetInstanceInfo()
local diffText = difficultyTbl[diff] or "None"
logName = format(logNameFormat, date("%Y-%m-%d"), date("%H:%M:%S"), instanceId or 0, diff, diffText, instanceType)
local time = date("%H:%M:%S")
logName = format(logNameFormat, date("%Y-%m-%d"), time, instanceId or 0, diff, diffText, instanceType)

if type(TranscriptDB[logName]) ~= "table" then TranscriptDB[logName] = {} end
if type(TranscriptIgnore) ~= "table" then TranscriptIgnore = {} end
Expand Down Expand Up @@ -1863,6 +1876,52 @@ do
end
logging = 1

if prevEncounterStart then
local stop = debugprofilestop() / 1000
local t = stop - logStartTime
local text = format("<%.2f %s> [ENCOUNTER_START] %s", t, time, prevEncounterStart)
currentLog.total[#currentLog.total+1] = text
end

hiddenAuraEngageList = {}
do
local UnitAura = C_UnitAuras and C_UnitAuras.GetAuraDataByIndex or UnitAura
local UnitPosition, UnitClass = UnitPosition, UnitClass
local _, _, _, myInstance = UnitPosition("player")
local stop = debugprofilestop() / 1000
local t = stop - logStartTime
for unit in Transcriptor:IterateGroup() do
local _, _, _, tarInstanceId = UnitPosition(unit)
if tarInstanceId == myInstance then
local _, class = UnitClass(unit)
local name = UnitName(unit)
local specId, role, position, talents = nil, nil, nil, nil
if playerSpecList[name] then
specId, role, position, talents = playerSpecList[name][1], playerSpecList[name][2], playerSpecList[name][3], playerSpecList[name][4]
end
local line = strjoin("#", tostringall(name, class, UnitGUID(unit), specId, role, position, talents))
local text = format("<%.2f %s> [%s] %s", t, time, "PLAYER_INFO", line)
currentLog.total[#currentLog.total+1] = text
for i = 1, 100 do
local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HELPFUL")
if not spellId then
break
elseif not hiddenAuraEngageList[spellId] then
hiddenAuraEngageList[spellId] = true
end
end
for i = 1, 100 do
local _, _, _, _, _, _, _, _, _, spellId = UnitAura(unit, i, "HARMFUL")
if not spellId then
break
elseif not hiddenAuraEngageList[spellId] then
hiddenAuraEngageList[spellId] = true
end
end
end
end
end

--Notify Log Start
if not silent then
print(L["Beginning Transcript: "]..logName)
Expand Down Expand Up @@ -2357,6 +2416,7 @@ function Transcriptor:StopLog(silent)
collectNameplates = nil
hiddenUnitAuraCollector = nil
playerSpellCollector = nil
prevEncounterStart = nil

return logName
end
Expand Down
1 change: 1 addition & 0 deletions Transcriptor.toc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## IconTexture: Interface\AddOns\Transcriptor\icon_on
## Author: Funkydude
## Version: @project-version@
## OptionalDeps: LibSpecialization
## X-Credits: Kyahx, Rabbit, MysticalOS, nebula169
## X-Category: Development Tools
## X-License: All Rights Reserved: You are free to fork and modify on GitHub, please ask us about anything else.
Expand Down
1 change: 1 addition & 0 deletions Transcriptor_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## IconTexture: Interface\AddOns\Transcriptor\icon_on
## Author: Funkydude
## Version: @project-version@
## OptionalDeps: LibSpecialization
## X-Credits: Kyahx, Rabbit, MysticalOS, nebula169
## X-Category: Development Tools
## X-License: All Rights Reserved: You are free to fork and modify on GitHub, please ask us about anything else.
Expand Down
1 change: 1 addition & 0 deletions Transcriptor_TBC.toc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## IconTexture: Interface\AddOns\Transcriptor\icon_on
## Author: Funkydude
## Version: @project-version@
## OptionalDeps: LibSpecialization
## X-Credits: Kyahx, Rabbit, MysticalOS, nebula169
## X-Category: Development Tools
## X-License: All Rights Reserved: You are free to fork and modify on GitHub, please ask us about anything else.
Expand Down
1 change: 1 addition & 0 deletions Transcriptor_Vanilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## IconTexture: Interface\AddOns\Transcriptor\icon_on
## Author: Funkydude
## Version: @project-version@
## OptionalDeps: LibSpecialization
## X-Credits: Kyahx, Rabbit, MysticalOS, nebula169
## X-Category: Development Tools
## X-License: All Rights Reserved: You are free to fork and modify on GitHub, please ask us about anything else.
Expand Down
1 change: 1 addition & 0 deletions Transcriptor_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
## IconTexture: Interface\AddOns\Transcriptor\icon_on
## Author: Funkydude
## Version: @project-version@
## OptionalDeps: LibSpecialization
## X-Credits: Kyahx, Rabbit, MysticalOS, nebula169
## X-Category: Development Tools
## X-License: All Rights Reserved: You are free to fork and modify on GitHub, please ask us about anything else.
Expand Down

0 comments on commit c530692

Please sign in to comment.