Thread Tools Display Modes
10-10-14, 06:46 AM   #1
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Here's a dry-coded example, so I have no idea if it works.
Lua Code:
  1. -- todo: Track that someone in the raid is actually capable of battle rezzing and alive
  2. local WhoDead, SecondsPerRez, ElapsedTime, NumRezzed = {}, 1, 0, 0
  3. local f = CreateFrame('frame') f:Hide()
  4. f:SetScript('OnEvent', function(self, event, ...) return self[event] and self[event](self, ...) end)
  5.  
  6. function f:ENCOUNTER_START(encounterID, encounterName, difficultyID, raidSize)
  7.     if difficultyID < 3 then return end
  8.     wipe(WhoDead)
  9.     SecondsPerRez, ElapsedTime, NumRezzed = 5400 / raidSize, 0, 0
  10.     self:RegisterEvent('INCOMING_RESURRECT_CHANGED')
  11.     self:Show()
  12. end
  13. f:RegisterEvent('ENCOUNTER_START')
  14.  
  15. function f:ENCOUNTER_END()
  16.     self:Hide()
  17.     self:UnregisterEvent('INCOMING_RESURRECT_CHANGED')
  18. end
  19. f:RegisterEvent('ENCOUNTER_END')
  20.  
  21. function f:INCOMING_RESURRECT_CHANGED(unit) -- Track who has received a rez within range
  22.     local name = UnitName(unit)
  23.     if name and not WhoDead[name] and UnitHasIncomingResurrection(unit) then
  24.         WhoDead[name] = true
  25.     end
  26. end
  27.  
  28. f:SetScript('OnUpdate', function(self, elapsed)
  29.     ElapsedTime = ElapsedTime + elapsed
  30.    
  31.     for name in pairs(WhoDead) do
  32.         if not UnitIsDeadOrGhost(name) and UnitIsConnected(name) then -- Dead unit is no longer dead
  33.             WhoDead[name] = nil
  34.             NumRezzed = NumRezzed + 1
  35.         end
  36.     end
  37.    
  38.     local availableRezzes = 1 + floor(ElapsedTime / SecondsPerRez) - NumRezzed
  39.     -- Do something to display this number somewhere..
  40. end)
It doesn't actually do anything with the "availableRezzes" number, so if you want this for an LDB display or something you'll need to add the appropriate code for that.

I have no idea how reincarnation is factored into the new rules, and I don't know if reincarnation or soulstones trigger an incoming rez event, so it might just be simpler to check UNIT_HEALTH to track when they've died or rezzed.

Last edited by semlar : 10-10-14 at 07:55 AM.
 
10-10-14, 11:01 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by semlar View Post
I don't know if reincarnation or soulstones trigger an incoming rez event, ...
They don't. The event only indicates that a res spell started or stopped being cast on someone; there's no event that specifically notifies you when (or if) they actually ressurect, so you have to watch UNIT_HEALTH or just poll OnUpdate as in your example. The event also doesn't fire for Mass Res, though I suppose that's not relevant if you're only tracking in combat.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
 
10-10-14, 06:55 PM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I'm trying to decide how best to determine that the people in the raid are also in the current boss fight and not outside the instance.

You could loop over the raid on ENCOUNTER_START and put everyone who's in the same zone as you into a table to reference throughout the fight, or you could compare their zone (from GetRaidRosterInfo) to yours when they're resurrected.. but I'm not sure if phasing could potentially cause problems with that.

I was thinking something like this..
Lua Code:
  1. for i = 1, GetNumGroupMembers() do
  2.     local name, _, _, _, _, class, zone, online, isDead, _, _, role = GetRaidRosterInfo(i)
  3.     if zone == OurZone and online then
  4.         if not isDead and WhoDead[name] then -- unit no longer dead, presumed rezzed
  5.             WhoDead[name] = nil
  6.             NumRezzed = NumRezzed + 1
  7.         elseif isDead and not WhoDead[name] then -- someone died
  8.             WhoDead[name] = true
  9.         end
  10.     end
  11. end

Last edited by semlar : 10-10-14 at 06:59 PM.
 
10-11-14, 01:58 AM   #4
cremor
A Murloc Raider
Join Date: Jun 2008
Posts: 9
Isn't the raidSize parameter of the ENCOUNTER_START event that value? I assumed so because you used it in your first example instead of GetNumGroupMembers().
 
10-11-14, 03:56 AM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by cremor View Post
Isn't the raidSize parameter of the ENCOUNTER_START event that value? I assumed so because you used it in your first example instead of GetNumGroupMembers().
Presumably the raid size argument from ENCOUNTER_START tells us how many people are engaged with the boss, but it doesn't tell us who they are.

Since there isn't an event specifically for detecting when someone comes back to life, we have to infer that someone has been resurrected based on the fact that the encounter is still in progress and someone has gone from "dead" to "alive".

The combat log can tell us when someone has died, and if someone has cast a resurrection spell on them, but not whether they've taken it. It also is the least reliable method for tracking that someone has been rezzed, because it can occasionally malfunction, and it would completely fail if you're in a different phase than the person who died.

In the worst-case-scenario we can't detect whether a player has been rezzed, but we can detect that they've come back to life. This is a tricky distinction because there have been fights where players are killed and resurrected as part of the fight itself (eg. the final phase of the lich king), but it's not something we should really worry too much about.

So, ultimately I think the best solution is to make a table of who's in the same zone at the start of the encounter, and either OnUpdate or on UNIT_HEALTH scan for dead and potentially resurrected raid members.

I think it's a toss-up whether UNIT_HEALTH or OnUpdate is more efficient in a raid; either way you're going to be calling a lot of functions. UNIT_HEALTH is probably slightly better, but you have to use OnUpdate anyway because the available number of charges is based on elapsed time, assuming you want to update a display as soon as the number changes.

There is one other aspect that I picked up from the blizzard post on the subject, and it's that dead players with pending resurrections have a debuff. I don't know what that debuff is called, but it could be used to distinguish between people who have died in the boss fight and people who died outside of it, unless it doesn't show for people with self-resurrections, in which case it isn't terribly helpful.

Last edited by semlar : 10-11-14 at 04:03 AM.
 
10-11-14, 08:32 AM   #6
ykiigor
A Murloc Raider
Join Date: Jun 2014
Posts: 9
CLEU event: SPELL_RESURRECT for start watching
And UNIT_FLAGS event with func UnitIsDead for tracking successful resurrection
Don't know how fast this, but it works
 
10-11-14, 04:11 PM   #7
InKahootz
A Murloc Raider
Join Date: Aug 2014
Posts: 7
Originally Posted by semlar View Post

There is one other aspect that I picked up from the blizzard post on the subject, and it's that dead players with pending resurrections have a debuff. I don't know what that debuff is called, but it could be used to distinguish between people who have died in the boss fight and people who died outside of it, unless it doesn't show for people with self-resurrections, in which case it isn't terribly helpful.
This is where I come in as I've been trying to solve the battle rez for my addon.
The debuff is called "Resurrecting". Seen here: http://wod.wowhead.com/spell=160029
There is a pretty big bug though, it applies in the CLEU but when raid testing was going on, there was no spell_aura_removed for it. One more big caveat, it doesn't work for warlocks who use soulstone.
Blizz has some big oversights here and we just have to figure out a way to work around them.
 
10-14-14, 01:36 AM   #8
InKahootz
A Murloc Raider
Join Date: Aug 2014
Posts: 7
I logged a dungeon and the time that a battle rez was used, the resurrecting debuff had a CLEU for removal. So there might be hope yet.
 
 

WoWInterface » Site Forums » Archived Beta Forums » WoD Beta archived threads » API/Addon for new combat resurrection mechanic available?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off