WeakAuras

Tracking multiple nontarget/focus auras/spellcasts (pvp)

  • 9 posts
    #1 Oct 14, 2011 at 22:29 UTC - 0 likes

    hi, i've spent the whole evening trying to set up my weak auras in a way similar to spellalerter and couldn't quite get it done. i wanted to have 2 dynamic groups of icons to track important enemy casts (hex, poly...) and aura gains (shadow dance, reck, master's call...) regardless of having the caster focused/targeted. but i couldn't figure out how to add a second trigger to my auragains and SPELL_CAST_START events which ultimately eliminates friendly target's spells matching my spell ids from showing. settting unit reaction to hostile in a 2nd trigger isn't working, as it only provides checks for target, focus, pet and so on. selecting "multiple targets" as dest for my tracked buffs also still showed friendly units. so i figured i'd try a custom trigger solution like:

    function(event,source,sourcereaction,spellname,rank,lineid,spellid)
        if spellname == "Aimed Shot"  and
         sourcereaction == REACTION_HOSTILE then
            return true
        end
        return false
    end
    

    maybe someone can help me out, my lua skills aren't that good. another thing i'd like to have in my wa setup is for the hostile buffgains to print the destinations name in classcolors next to the icon. and one final question: how is it possible for a deadly poison icon to set different locations/sizes for stacktext and durationtext, like having the duration shown centered in an omnicc like way while stacks remain in the lower right corner of the icon? i'd really apprecciate some help, love the addon so far, thanks in advance.

    Last edited Oct 14, 2011 by yeahno
    #2 Oct 15, 2011 at 09:42 UTC - 0 likes

    Use a custom COMBAT_LOG_EVENT_UNFILTERED trigger:

    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
      -- One table to make changes easier [Note: Rename to WA_SPELL_ALERTS_AURAS to prevent collision when doing aura watching]
      if not WA_SPELL_ALERTS_CASTS then
        WA_SPELL_ALERTS_CASTS = {
          [SPELL-ID] = true,         -- Replace SPELL-ID/SPELL-NAME with spells id or name
          [SPELL-NAME] = true,   -- Replace SPELL-ID/SPELL-NAME with spells id or name
          ...
          [SPELL-ID] = true,         -- Replace SPELL-ID/SPELL-NAME with spells id or name
          [SPELL-NAME] = true    -- Replace SPELL-ID/SPELL-NAME with spells id or name
        };
      end
    
      -- Spell cast (starting) [NOTE: Use SPELL_AURA_APPLIED for aura scans]
      if message == "SPELL_CAST_START" then
        -- Additional arguments
        local spellID, spellName, spellSchool = ...;
    
        -- Unit is hostile and spell is watched [Note: Remember to rename here to!]
        if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) > 0 and (spellId and WA_SPELL_ALERTS_CASTS[spellID] or spellName and WA_SPELL_ALERTS_CASTS[spellName]) then
          return true;
        end
      end
    end
    

    If the above code does not work, use this one instead, although it only works in arenas or with target/focus:

    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
      -- One table to make changes easier [Note: Rename to WA_SPELL_ALERTS_AURAS to prevent collision when doing aura watching]
      if not WA_SPELL_ALERTS_CASTS then
        WA_SPELL_ALERTS_CASTS = {
          [SPELL-ID] = true,         -- Replace SPELL-ID/SPELL-NAME with spells id or name
          [SPELL-NAME] = true,   -- Replace SPELL-ID/SPELL-NAME with spells id or name
          ...
          [SPELL-ID] = true,         -- Replace SPELL-ID/SPELL-NAME with spells id or name
          [SPELL-NAME] = true    -- Replace SPELL-ID/SPELL-NAME with spells id or name
        };
      end
    
      -- Spell cast (starting) [NOTE: Use SPELL_AURA_APPLIED for aura scans]
      if message == "SPELL_CAST_START" then
        -- Additional arguments
        local spellID, spellName, spellSchool = ...;
    
        -- Spell is watched? [Note: Remember to rename here to!]
        if spellId and WA_SPELL_ALERTS_CASTS[spellID] or spellName and WA_SPELL_ALERTS_CASTS[spellName] then
          -- Compare to target, focus, arenaX
          if  UnitGUID("target") == sourceGUID and UnitCanAttack("player", "target")
          or UnitGUID("focus") == sourceGUID and UnitCanAttack("player", "focus")
          or UnitGUID("arena1") == sourceGUID and UnitCanAttack("player", "arena1")
          or UnitGUID("arena2") == sourceGUID and UnitCanAttack("player", "arena2")
          or UnitGUID("arena3") == sourceGUID and UnitCanAttack("player", "arena3")
          or UnitGUID("arena4") == sourceGUID and UnitCanAttack("player", "arena4")
          or UnitGUID("arena5") == sourceGUID and UnitCanAttack("player", "arena5")
          then
            return true;
          end
        end
      end
    end
    

    EDIT: Regarding using destUnit, as far as I remember it is only available when using SPELL_CAST_SUCCESS (instead of SPELL_CAST_START) for enemy sources to prevent enemy cast detection addons. (I'm not sure if destUnit is available for enemy SPELL_AURA_APPLIED events though)

    Independent text alignment is currently not available, one could maybe fake it by using a custom text function that inserts \n (new lines) between stacks and duration.

    Last edited Oct 15, 2011 by CommanderSirow
    #3 Oct 15, 2011 at 09:55 UTC - 0 likes

    thanks a lot, i'll be trying it when i get home from work. thinking about the arena/target/focus solution one thing came to my mind: wouldn't it be possible for battlegrounds to achieve the desired filter by inverse checking for group auras/casts?

    edit: doesn't seem to work :(

    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
    
        if not WA_SPELL_ALERTS_CASTS then
            WA_SPELL_ALERTS_CASTS = {
                [spellName] = "Healing Surge"    
            };
        end
        
        if message == "SPELL_CAST_START" then
            -- Additional arguments
            local spellID, spellName, spellSchool = ...;
            
            if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) > 0 and (spellId and WA_SPELL_ALERTS_CASTS[spellID] or spellName and WA_SPELL_ALERTS_CASTS[spellName]) then
                return true;
            end
        end
    end
    

    this is what i used against a shaman, the only thing i changed was macthing the table's SPELL-CAST to what is called later in the WA_SPELL_ALERTS_CASTS[spellName]. it produces a lot of lua errors, just on every clog event:

    Message: [string "return function(event, timestamp, message, ..."]:5: table index is nil Time: 10/15/11 12:55:36 Count: 575 Stack: [string "return function(event, timestamp, message, ..."]:5: in function `trigger' Interface\AddOns\WeakAuras\WeakAuras.lua:1693: in function `ScanEvents' Interface\AddOns\WeakAuras\WeakAuras.lua:1670: in function <Interface\AddOns\WeakAuras\WeakAuras.lua:1628>

    Locals: event = "COMBAT_LOG_EVENT_UNFILTERED" timestamp = 1318676153.107 message = "SPELL_AURA_APPLIED_DOSE" hideCaster = false sourceGUID = "0x02800000032898B2" sourceName = "Ershin" sourceFlags = 1304 sourceRaidFlags = 0 destGUID = "0x02800000032898B2" destName = "Ershin" destFlags = 1304 destRaidFlags = 0 (*temporary) = <table> { } (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = nil (*temporary) = "table index is nil"

    Last edited Oct 15, 2011 by yeahno
    #4 Oct 15, 2011 at 14:33 UTC - 0 likes

    It has to be ["Healing Surge" ] = true. ;)

    EDIT:

    Btw the whole purpose of using this custom trigger is to have a simple trigger that holds all casts (hex, sheep, ect.), and not one trigger per cast (otherwise using an Event->Combat Log trigger would be far easier :) ), thus you can add them all inside the WA_SPELL_ALERTS_CASTS table (make sure to separate each entry with a ','). ;)

    Or I guess you where just trying to find the error. :)

    Last edited Oct 15, 2011 by CommanderSirow
    #5 Oct 15, 2011 at 19:13 UTC - 0 likes

    thank you so much! works perfectly :D

    one further question, could you provide the right syntax to put into the custom-icon box in order for it to get the corresponding spell icon to show for the different spells in my table?

    edit:

    and one other thing: i'd like to define a custom hide function for the auras which fires as soon as the buff expires or is removed ( SPELL_AURA_REMOVED ? ) and a duration display if that is possible with a custom trigger. does the dest unit of a received buff like "Master's Call" turn into the source unit for the remove event?

    Last edited Oct 15, 2011 by yeahno
    #6 Oct 16, 2011 at 17:24 UTC - 0 likes

    Spell icon:

    Add this right before the "return true":

    WA_SPELL_ALERTS_CASTS_SPELL = spellID;
    

    Inside the icon code function use:

    function()
      local icon = select(3, GetSpellInfo(WA_SPELL_ALERTS_CASTS_SPELL or 0));
      return icon;
    end
    

    SPELL_AURA_REMOVED:

    The problem with untriggering via SPELL_AURA_REMOVED with this custom trigger is that its able to track activation of mulitple spells, but not their duration individually. Eg. suppose enemy player casts heroism and hex, display gets shown. now hex fades first while the heroism is still active, BUT the display would get hidden due to one SPELL_AURA_REMOVED fired (The one from hex). If you really want to track the duration of some spells, you should instead use one trigger per spell, eg.:

    • Custom show code:
    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
       local theSpell = <SPELL-ID> or <SPELL-NAME>
    
        if message == "SPELL_AURA_APPLIED" then
            -- Additional arguments
            local spellID, spellName, spellSchool = ...;
            
            if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) > 0 and (spellId and spellID == theSpell or spellName and spellName == theSpell) then
                return true;
            end
        end
    end
    
    • Custom hide code:
    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
       local theSpell = <SPELL-ID> or <SPELL-NAME>
    
        if message == "SPELL_AURA_REMOVED" then
            -- Additional arguments
            local spellID, spellName, spellSchool = ...;
            
            if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) > 0 and (spellId and spellID == theSpell or spellName and spellName == theSpell) then
                return true;
            end
        end
    end
    

    About duration:

    Well this isn't impossible but really difficult to do (and it would only work in arena or if you focus/target the person the moment he gets the aura), because finding out the duration of an aura is only possible if you know its unitID (target, focus, raidN, raidNtarget, pet, pettarget, arenaN, ect.).

    You could try using an aura -> unit=multi-target trigger, but I don't know if it works for arenaN ids (I don't think so).

    Last edited Oct 16, 2011 by CommanderSirow
    #7 Oct 16, 2011 at 22:24 UTC - 0 likes

    thanks again commander. actually works perfectly right now, i'm going to handle non dispellable auras with timed hide set to their durations and do the rest with your SEPLL_AURA_REMOVED code, lovin it.

    #9 May 24, 2013 at 00:05 UTC - 0 likes

    Tell me what's wrong? Addon swears that was not written correctly.
    Thank you!

    function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
        -- One table to make changes easier [Note: Rename to WA_SPELL_ALERTS_AURAS to prevent collision when doing aura watching]
        WA_SPELL_ALERTS_CASTS = {
            [Огненный шар] = true   -- Replace SPELL-ID/SPELL-NAME with spells id or name
        };    
     end
    -- Spell cast (starting) [NOTE: Use SPELL_AURA_APPLIED for aura scans]
     if message == "SPELL_CAST_START" then
        -- Additional arguments
        local spellID, spellName, spellSchool = ...;
            -- Unit is hostile and spell is watched [Note: Remember to rename here to!]
        if bit.band(sourceFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) > 0 and (spellId and WA_SPELL_ALERTS_CASTS[120112] or spellName and WA_SPELL_ALERTS_CASTS[Огненный шар]) then
            return true;
        end
     end
     end
    
    #10 Jul 06, 2013 at 01:37 UTC - 0 likes

    Hi there, could somebody link an import on this thread? I've been looking for something like this, it would be much appreciated.

  • 9 posts

You must login to post a comment. Don't have an account? Register to get one!