WeakAuras

Tracking Pet Stances?

  • 7 posts
    #1 Feb 15, 2011 at 20:10 UTC - 0 likes

    Is it possible to check for the status of pet stances?

    i.e. Defensive, Aggressive, Passive?

    For that matter, can it check for:

    Follow, Move to, Stay?

    Keep up the great work! Loving things so far!

    #2 Feb 15, 2011 at 21:53 UTC - 0 likes

    @YajinHB: Go

    This is not supported by default. It could probably be accomplished using a Custom Trigger (although with a cursory glance through the WoW API, I don't see any function that specifically returns what mode your pet is in).

    #3 Feb 15, 2011 at 22:12 UTC - 0 likes

    Trigger Type: "Custom" Event Type: "Status" Check On...: "Event(s)" Event(s): "PET_BAR_UPDATE" Custom Trigger:

    function()
      local name,_,_,_,active,_,_,exists
      local aggressive
      local index = 1
      repeat
        name,_,_,_,active,_,_,exists = GetPetActionInfo(index)
        index = index + 1
        if(name == "PET_MODE_AGGRESSIVE" and active == 1) then
          aggressive = true
        end
      until not exists
      return aggressive
    end
    

    Custom Untrigger:

    function()
      local name,_,_,_,active,_,_,exists
      local aggressive
      local index = 1
      repeat
        name,_,_,_,active,_,_,exists = GetPetActionInfo(index)
        index = index + 1
        if(name == "PET_MODE_AGGRESSIVE" and active == 1) then
          aggressive = true
        end
      until not exists
      return not aggressive
    end
    

    I haven't tested this yet but theoretically it should work.

    You can change "PET_MODE_AGGRESSIVE" to "PET_MODE_PASSIVE", "PET_MODE_DEFENSIVE", etc. for different functionality. I'll consider making this an integrated trigger in a future version.

    Last edited Feb 15, 2011 by Mirrormn
    #4 Feb 16, 2011 at 13:29 UTC - 0 likes

    Mirrormn, that works perfectly!

    Thanks for taking the time to help me out.

    Definitely add it to the core addon, imo.

    I'm sure all perma-pet classes would appreciate it!

    Also, a note for anyone wanting to use the custom trigger, above:

    You NEED to have Passive, Aggressive and Defensive on your pet bar!

    Last edited Feb 16, 2011 by YajinHB: typo
    #5 May 29, 2013 at 19:28 UTC - 0 likes

    How would one accomplish this now? It seems this doesn't work anymore.

    #6 Sep 19, 2013 at 22:28 UTC - 0 likes

    @ayreal: Go

    The "Agressive" mode for pets was changed to "Assist", so:

    Trigger Type: "Custom"

    Event Type: "Status"

    Check On...: "Event(s)"

    Event(s): "PET_BAR_UPDATE"

    Custom Trigger:

    function()
      local name,_,_,_,active,_,_,exists
      local aggressive
      local index = 1
      repeat
        name,_,_,_,active,_,_,exists = GetPetActionInfo(index)
        index = index + 1
        if(name == "PET_MODE_ASSIST" and active == 1) then
          aggressive = true
        end
      until not exists
      return aggressive
    end
    

    Custom Untrigger:

    function()
      local name,_,_,_,active,_,_,exists
      local aggressive
      local index = 1
      repeat
        name,_,_,_,active,_,_,exists = GetPetActionInfo(index)
        index = index + 1
        if(name == "PET_MODE_ASSIST" and active == 1) then
          aggressive = true
        end
      until not exists
      return not aggressive
    end
    

    Basically, just change "PET_MODE_AGRESSIVE" from the original code to "PET_MODE_ASSIST". Using "PET_MODE_DEFENSIVE" and "PET_MODE_PASSIVE" for the other modes still works as before.

    Last edited Sep 19, 2013 by Mirrormn
    #7 Jan 15, 2014 at 19:21 UTC - 0 likes

    Just a quick note for anyone else who may have had the same issues with this as I did (namely the code firing for some pets but not others):

    It seems to choke if there are any gaps in the pets action bar, so to solve this you can either drop a spell from the pets spellbook to fill the gap,

    OR

    Change index to start checking actions in the pet bar a bit further along (i.e. index = 7)

    So the final code would look like this:

    function()
        local name,_,_,_,active,_,_,exists
        local passive
        local index = 7
        repeat
            name,_,_,_,active,_,_,exists = GetPetActionInfo(index)
            index = index + 1
            if(name == "PET_MODE_PASSIVE" and active == 1) then
                passive = true
            end
        until not exists
        return passive
    end
    

    ..and the same change needs to be applied to the Untrigger code as well.

    FYI I use this to check if my pet is set to Passive stance, rather than the Aggressive stance in the examples above.. other than those small changes it's functionally the same.

    I've included the WeakAuras string for it below, it places the Sleep_State_Head.m2 model over the pet bar Passive button (which is a set of sleep Zzz's rising up from the button). I use a custom Bartender set up, so it may not be in the exact position of the default pet bar, but easy enough to reposition..

    dmKngaGiGkJssQtjj5vasnlqDlkvzxuQQFPcKHPc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W43Y6dGXli2)QI(ji9F7RYDHsjwoqOFC(YsoF2z76(bRFQyrMS9dOqPelVFgC6oV63moNzjtE1vjmffffJjtXqHxUC4b8aEaxywILdpGhWoAcDPctrrrXyYumuauOuILlmffffJjtXqHWrC0kqvQuykkkkSoaVSctrrrrrrrHxUC4b8aEaxywILdpGhWoAcDPkqvSRV3(IcZsMCu5MNvt4io6QeMIIIIIIIcHJ4OvGQq4ioAfGwXMWuuuuuuuuiMRMxUCfOqva3TP6HDo6qtJBu(hvq0e4ukCeLcZsSCfOqvSvLYEY5ctrrrrrrrrrrrbqHsjwUcuLLf3fMIIIIIIIIZreMIIIcoFjgk85Q4Oj0LkmffffwFXz5k85QaOqPelxyohP3E7N2plyoq)wn4TbPTd0B3a
    
    Last edited Jan 15, 2014 by cheeseycom
  • 7 posts

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