Elkano's BuffBars

26 - Vehicle Buffs with Stacks Incorrect

What steps will reproduce the problem?
1. Reset ElkBuffBars to default settings
2. Get on an Argent Tournament mount
3. Stack "Defend" to TWO stacks
4. Attack the beginner "Melee Target" one time. Note the ElkBuffBars still shows two stacks of "Defend" though the visual effect around your character correctly shows one.
5. Stack "Defend" one more time. Note that ElkBuffBars shows three stacks of "Defend" though the visual effect around your character correctly shows two.

What is the expected output? What do you see instead?
When in a vehicle, EBB shows buffs for the "player" unit when it should be showing buffs only for the "pet" unit. See "additional information".

What version of the product are you using?
2.2.4-149

Do you have an error log of what happened?
There are no errors, just incorrect display.

Please provide any additional information below.
I debugged the addon enough to determine the problem. After line 794 in ElkBuffBars.lua (shown here)...

local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(unit, i, filter)
if not icon then break end

... I added the following code:

if (name == "Defend") then
  ElkBuffBars:Print(string.format("Unit = %s", unit))
  ElkBuffBars:Print(string.format("i = %i", i))
  ElkBuffBars:Print(string.format("filter = %s", filter))
  ElkBuffBars:Print(string.format("count = %i", count))
end

What I discovered while performing the steps listed above is that when 'unit' = 'player', UnitAura returns an incorrect count for the "Defend" buff. It never decreases. However, the correct count IS returned for 'unit' = 'pet' (i.e. the buff is on the vehicle, not the player).

It also looks to me like EBB is first detecting the pet's buffs and then immediately checking the player's buffs and overriding the correct count display with the incorrect count display.

I believe the correct behavior should be that when the player is in a vehicle, the addon should replace 'player' with 'pet' everywhere that 'player' is checked. However, I'm not sure that this is the correct behavior when riding as an exposed passenger (i.e. Demolisher).

Elkano, I certainly don't envy you trying to fix this one!

Here's a couple other things I found while reading the way Blizzard handles it in the default UI. In BuffFrame.lua, they get 'unit' to pass to UnitAura() by checking PlayerFrame.unit. PlayerFrame.unit is set in PlayerFrame.lua in the functions PlayerFrame_ToVehicleArt() and PlayerFrame_ToPlayerArt(). What they do is swap the player and pet frames. Perhaps that's a better way of handling it... when the player is in a vehicle, swap 'player' for 'pet' and 'pet' for 'player'.

Hope this helps!

P.S. If you're running Pitbull, you can't depend on PlayerFrame.unit because Pitbull replaces PlayerFrame with its own frame. This messes up even the default BuffFrame. I think you're going to have to catch and handle the four vehicle events yourself as shown in PlayerFrame.lua.

self:RegisterEvent("UNIT_ENTERED_VEHICLE");
self:RegisterEvent("UNIT_ENTERING_VEHICLE");
self:RegisterEvent("UNIT_EXITING_VEHICLE");
self:RegisterEvent("UNIT_EXITED_VEHICLE");


User When Change
bheatwole Jun 13, 2009 at 13:58 UTC Create

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

Facts

Last updated
Jun 13, 2009
Reported
Jun 13, 2009
Status
New - Issue has not had initial review yet.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees