View Single Post
02/27/23, 10:13 AM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Did you check on your player that this debuf is actually shown at the player as a buff?
if the buff is not there you cannot listen for it at the events.
If you click C to show the player buffs it shows you all the buffs you currently got, as names. The abilityIds of them are not shown.

You either need an addon like Srendar and enable the debug to show the current player buffs ids behind the name.
Or you can list them to chat via some code like this (by e.g. using a slash command /playerbuffs that runs this function "ShowPlayerBuffs"):

Lua Code:
  1. function ShowPlayerBuffs(unitTag)
  2.     unitTag = unitTag or "player"
  3.     local entries = {}
  4.     table.insert(entries, "================ START OF PLAYER BUFFs ===============")
  5.     table.insert(entries, zo_strformat("\"<<1>>\" Buffs:", unitTag))
  6.     local buffName, abilityId, _
  7.     local numBuffs = GetNumBuffs(unitTag)
  8.     if numBuffs > 0 then
  9.         for i = 1, numBuffs do
  10.             buffName, _, _, _, _, _, _, _, _, _, abilityId = GetUnitBuffInfo(unitTag, i)
  11.             table.insert(entries, zo_strformat("<<1>>. [<<2>>] <<C:3>>", i, abilityId, ZO_SELECTED_TEXT:Colorize(buffName)))
  12.         end
  13.     else
  14.         table.insert(entries, "<NO buffs active!")
  15.     end
  16.     table.insert(entries, "================ END OF PLAYER BUFFs ===============")
  17.  
  18.     if #entries > 0 then
  19.         for _, entryText in ipairs(entries) do
  20.             d(entryText)
  21.         end
  22.     end
  23. end
  24.  
  25. SLASH_COMMANDS["/playerbuffs"] = function() ShowPlayerBuffs("player") end


If you have found the correct abilityId or buffId that is shown as the playerbuff you can then simply do a test via an event
EVENT_EFFECT_CHANGED using a filter like this, to react on it:

Lua Code:
  1. local function OnCinderShotEffectChanged(eventId, changeType, effectSlot, effectName, unitTag, beginTime, endTime, stackCount, iconName, buffType, effectType, abilityType, statusEffectType, unitName, unitId, abilityId, sourceType)
  2.  if changeType == EFFECT_RESULT_GAINED or changeType == EFFECT_RESULT_UPDATED then --buff was gained or it updated
  3.    d(">CinderShot effect GAINED as player buff!")
  4.  elseif changeType == EFFECT_RESULT_FADED then
  5.    d("<CinderShot effect LOST AGAIN as player buff!")
  6.  end
  7. end
  8.  
  9. local abilityIdOfTheCinderShotBuff =  ????? --enter the number of the abilityId here which is shown as player buff as you got it
  10.  
  11. EVENT_MANAGER:RegisterForEvent("MyAddonTest1", EVENT_EFFECT_CHANGED, OnCinderShotEffectChanged)
  12. EVENT_MANAGER:AddFilterForEvent("MyAddonTest1", EVENT_EFFECT_CHANGED, REGISTER_FILTER_ABILITY_ID, abilityIdOfTheCinderShotBuff) --will only filter for the cinderShot buffId and ignre others!
  13. EVENT_MANAGER:AddFilterForEvent("MyAddonTest1", EVENT_EFFECT_CHANGED, REGISTER_FILTER_UNIT_TAG, "player") --will only find it on yourself, the player and ignore buffs on ther units (in group e.g.)!

-> See https://wiki.esoui.com/AddFilterForEvent




Edit:
I'm not sure where you got that
ACTION_RESULT_EFFECT_GAINED
constant from
but in the current API documentation the 2nd parameter of the EVET_EFFECT_CHANGED event is using the type EffectResult which can be one of these:
Code:
h5. EffectResult
* EFFECT_RESULT_FADED
* EFFECT_RESULT_FULL_REFRESH
* EFFECT_RESULT_GAINED
* EFFECT_RESULT_TRANSFER
* EFFECT_RESULT_UPDATED

Last edited by Baertram : 02/27/23 at 10:32 AM.
  Reply With Quote