vscode-wow-api
vscode-wow-api copied to clipboard
Combat log event enum
I would like to have an Enum for the combat log sub-events, the list of events is available in Blizzard_CombatLog.lua. I tried to add it myself but I couldn't quite figure out the intended way to pull in a dependency on additional default UI files. You seem to pull Blizzard files from your own repository, but how do I get in there in a future-proof way to keep it updated?
Anyhow, if the problem of acquiring the file is solved, then you can use this to extract COMBATLOG_EVENT_LIST from Blizzard_CombatLog.lua (or in fact probably global variables from most arbitrary scripts in general), it's a bit ugly but hopefully pretty future-proof.
An alternative to this mess would be to use lua-language-server with a custom script to extract the content of the variable statically. But given that the rest of the code relies on dynamic evaluation of Blizzard's code I guessed this is fine.
local maxSteps = 10000
local function avoidInfiniteLoop()
maxSteps = maxSteps - 1
if maxSteps <= 0 then
error("loop counter exceeded")
end
end
local mockEnv
mockEnv = setmetatable({}, {
__index = function(self, k)
avoidInfiniteLoop()
return _G[k] or mockEnv
end,
__call = function()
avoidInfiniteLoop()
return mockEnv
end
})
local f = loadfile("Blizzard_CombatLog.lua", nil, mockEnv)
local ok, err = pcall(f)
if not ok then
print("Warning: unexpected error when loading Blizzard_CombatLog (but that may be fine)", err)
end
local combatLogEvents = rawget(mockEnv, "COMBATLOG_EVENT_LIST")
if not combatLogEvents then
error("failed to get combatLogEvents")
end
for k in pairs(combatLogEvents) do print(k) end
I uhh copy everything over manually, so no, not future-proof at all 😅
Thanks for your Lua script for getting the CLEU events. Are you maybe interested in communicating via Discord? (ketho) Otherwise here is fine too. I just have a very busy schedule at the moment so there has not been much progress.
No urgency here; my discord username is tandanu