Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Combat log event enum #130

Open
emmericp opened this issue Feb 6, 2024 · 2 comments
Open

Combat log event enum #130

emmericp opened this issue Feb 6, 2024 · 2 comments

Comments

@emmericp
Copy link
Contributor

emmericp commented Feb 6, 2024

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
@Ketho
Copy link
Owner

Ketho commented Feb 6, 2024

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.

@emmericp
Copy link
Contributor Author

emmericp commented Feb 7, 2024

No urgency here; my discord username is tandanu

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants