WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Is there a way to get a count of the number of pets/minions assisting me in combat? (https://www.wowinterface.com/forums/showthread.php?t=53887)

Aznamir 07-14-16 08:29 PM

Is there a way to get a count of the number of pets/minions assisting me in combat?
 
I'm talking about warlock pets/minions.
Don't want to count the combat ally assigned from the order hall.
Don't want to count quest NPCs assisting me in combat.

Is there any way count them and get their current heal as well?

SDPhantom 07-15-16 10:11 AM

I doubt it. The only direct UnitID we have is for your main demon. None of the ones that spawn from your other abilities.

Aznamir 07-15-16 10:30 AM

Okay, what about these unit frames:


Anyone know the name / events that trigger them?

SDPhantom 07-15-16 11:13 AM

What does /fstack say about them?

semlar 07-15-16 11:36 AM

You can track your pets through combat log events (probably SPELL_SUMMON), and mask their flags for ownership to see if they belong to the player.

Insert their GUID into a table when they spawn and remove them when they despawn; if they're on a timer just keep track of the timestamp and remove them after a set amount of time.

Aznamir 07-15-16 02:43 PM

Quote:

Originally Posted by SDPhantom (Post 316429)
What does /fstack say about them?

Looks like it is a totem frame


kokomala 07-17-16 02:33 AM

Anything that is is displayed to the totem frame can be obtained with the totem API and events.

Pseudo code.
Code:

OnEvent(self, event, ...)
  if ( event == "PLAYER_TOTEM_UPDATE" ) then
      local slot = ...;
      local haveTotem, name, startTime, duration, icon = GetTotemInfo(slot)
 
      -- do stuff

  end
end

This API is also used for Death Knights and Druids.

http://wowprogramming.com/docs/api/GetTotemInfo

Kith 07-17-16 07:38 PM

Quote:

Originally Posted by kokomala (Post 316504)
Anything that is is displayed to the totem frame can be obtained with the totem API and events.

Pseudo code.
Code:

OnEvent(self, event, ...)
  if ( event == "PLAYER_TOTEM_UPDATE" ) then
      local slot = ...;
      local haveTotem, name, startTime, duration, icon = GetTotemInfo(slot)
 
      -- do stuff

  end
end

This API is also used for Death Knights and Druids.

http://wowprogramming.com/docs/api/GetTotemInfo

I'm not sure whether its a bug in beta right now (or how its always been), but while working on the 'special cases' for my aura tracking mod, I found that the Serpent Statue (Mistweaver) triggers TOTEM_UPDATE but the info given by GetTotemInfo refers to the totem itself which doesn't return a valid spellID via GetSpellInfo(<namegiven>). May want to just check whether this is a one off (i'm intending to trial a few) or something that would need to be handled case-by-case.

Edit: Just to follow up, the TOTEM event now fires on several classes for different things that i've played with

Warlock (Demonology): The Wild Imps and the Dreadstalkers both trigger the event but return nothing for GetTotemInfo (i'm faking it by watching the SPELL_SUMMON event in the combat log)

Monk (Mistweaver): The Jade Serpent Statue works the same as Warlocks

Druid (Restoration): Efflorescence is the same

Shaman (Restoration): While they give the proper GetTotemInfo returns, if you take Echo which allows 2 charges of Healing Stream Totem, both have the same spellID and thus need to be handled specially (if using spellID as an indentifier)

kokomala 07-20-16 06:14 AM

You should always be tracking via the slot when using the totem events, and not via the spellID.

I highly doubt classes other than shaman will have a valid spellID, and the tooltips use tooltip:GetTotem(slot) to fill the tooltip information.

With COMBAT_LOG_EVENT_UNFILTERED and SPELL_SUMMON, you should be able to use something like this (untested):

Code:

local summons = {}

function frame:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event,  hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)
  if event == 'SPELL_SUMMON' and sourceName == UnitName('player') then
      local spellId, spellName, spellSchool = ...

      -- increment counter
      if not summons[destName] then
        summons[destName] = {}
      end
       
      summons[destName] = summons[destName][destGUID] = timestamp

      -- demons last 12 seconds, remove from table
    C.Timer.After(12, function() summons[destName][destGUID] = nil end)

  end
end

It's then up to you to have a function that returns the current summons[destName] count, and another function to get the health from the GUID.

Be aware that the above code is untested. I'm also assuming destName/destGUID is used for the summoned demon. You could also store the table as a saved variable, which means you can still get an accurate count after a loading screen.

You could also probably combine them or use some other method to determine how many were summoned.


All times are GMT -6. The time now is 02:17 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI