Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

rework buff scanning #341

Open
Alessandro-Barbieri opened this issue Feb 13, 2025 · 1 comment · May be fixed by #342
Open

rework buff scanning #341

Alessandro-Barbieri opened this issue Feb 13, 2025 · 1 comment · May be fixed by #342

Comments

@Alessandro-Barbieri
Copy link
Contributor

Alessandro-Barbieri commented Feb 13, 2025

We should avoid using the old method of scanning the buffs with

 for i = 1, 40 do
         local _, _, _, _, _, _, _, _, _, spellId, _ = UnitAura("player", i, "HELPFUL")
 end

because in SoD and fresh the limit is removed.
A better approach is this

local i = 1
repeat
    local aura = C_UnitAuras.GetBuffDataByIndex ("player", i)
    i = i + 1
until (not aura)

and an even better approach is to just check the buff directly (only for player)

local aura = C_UnitAuras.GetPlayerAuraBySpellID(26481)
@BreakBB
Copy link
Owner

BreakBB commented Feb 15, 2025

Hey @Alessandro-Barbieri this is a great hint, thank you!

I actually don't think using C_UnitAuras.GetPlayerAuraBySpellID is a better aproach as it scales badly with the amount of IDs ECS checks.

But I do like the idea of using C_UnitAuras.GetBuffDataByIndex istead of UnitAura - Are you up for a PR on this change?

@BreakBB BreakBB linked a pull request Feb 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants