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

[REQ] Another aggro warning type option #131

Open
anzz1 opened this issue Nov 8, 2022 · 1 comment
Open

[REQ] Another aggro warning type option #131

anzz1 opened this issue Nov 8, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@anzz1
Copy link

anzz1 commented Nov 8, 2022

Please add another type of aggro warning as an option, one which follows the blizzard convention as detailed here : https://wowpedia.fandom.com/wiki/API_UnitThreatSituation

UNIT_THREAT_LIST_UPDATE event is fired by source and thus requires the unit token to be available (target, nameplateX, etc.).
UNIT_THREAT_SITUATION_UPDATE event is fired by target (player, partyX, etc.) and thus does not need the source unit token to be available.

And by omitting the source from UnitThreatSituation, you can get the moment of aggro irregardless whether the source unit token is available so it's always consistent. You can't get the detailed data this way but for the aggro warning is more intuitive this way in my opinion. It is also very simple to implement.

Example code:

AggroWarningSound = {
  ["enabled"] = true,
  ["ingrouponly"] = true
}
local last_status = 0

local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, ...)
  if (not AggroWarningSound.enabled or (AggroWarningSound.ingrouponly and not IsInGroup())) then
    return
  end
  local status = UnitThreatSituation("player") or 0
  if (status > last_status) then
    PlaySoundFile("sound/spells/seepinggaseous_fel_nova.ogg")
  end
  last_status = status
end)
f:RegisterUnitEvent("UNIT_THREAT_SITUATION_UPDATE", "player")
@anzz1 anzz1 added the enhancement New feature or request label Nov 8, 2022
@dfherr
Copy link
Owner

dfherr commented Jan 10, 2023

Sounds good. I'll see if I can implement this with the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants