Thread Tools Display Modes
07-18-18, 06:18 AM   #1
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
How do I use UnitBuff now in 8.0?

Before 8.0 I used to use UnitBuff("player", "Summon Chauffeur") and
UnitBuff("player", "Ban-Lu, Grandmaster's Companion") to check if my toon
is on a mount on which you cant enter a pet battle and have my toons
dismounted when the pb dialog pops up.

Since 8.0 I now get the error: "Usage: UnitBuff("unit", [index][, "filter"])"
And as I am a noob I have no idea what to and how to check now
if my toon sits on "Summon Chauffeur" or "Ban-Lu, Grandmaster's Companion".

Any help to fix this would be greatly appreciated!


ps: any infos on what happend to the events
BN_FRIEND_TOON_ONLINE, BN_FRIEND_TOON_OFFLINE, BN_FRIEND_INFO_CHANGED, BN_FRIEND_ACCOUNT_OFFLINE, BN_FRIEND_ACCOUNT_ONLINE (deleted, renamed?)
would also be very helpful. tia

Last edited by Drudatz : 07-18-18 at 06:20 AM.
  Reply With Quote
07-18-18, 07:06 AM   #2
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
1. You can now only get info via buff index.
for index = 1, 32 do
local buffName = UnitBuff(unit, index)
...
end

2. They are removed.
  Reply With Quote
07-18-18, 07:11 AM   #3
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
You just can't query by name anymore. You'll have to iterate through all your buffs in a loop and check each of their names until it finds the one you're looking for, by checking their names one by one.

Example from wowpedia:
lua Code:
  1. for i=1,40 do
  2.     local name, icon, _, _, _, etime = UnitBuff("player",i)
  3.     if name == "Summon Chauffeur" or name == "Ban-Lu, Grandmaster's Companion" then
  4.         --do things
  5.     end
  6. end

btw: https://wow.gamepedia.com/Patch_8.0.1/API_changes
Not a complete list, but it has a bunch of stuff.

Last edited by Ammako : 07-18-18 at 07:13 AM.
  Reply With Quote
07-18-18, 07:13 AM   #4
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
You can use AuraUtil.FindAuraByName("Ban-Lu, Grandmaster's Companion", "player")
  Reply With Quote
07-18-18, 07:24 AM   #5
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by d87 View Post
You can use AuraUtil.FindAuraByName("Ban-Lu, Grandmaster's Companion", "player")
Ding ding ding we have a winner! I didn't know that existed. Should be super handy.

Turns out someone's already brought it up a couple weeks ago on here too, oops.
http://www.wowinterface.com/forums/s...ad.php?t=56332

There's more stuff to play with!
  Reply With Quote
07-18-18, 07:36 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Posting here to save that.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-18-18, 05:45 PM   #7
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Originally Posted by d87 View Post
You can use AuraUtil.FindAuraByName("Ban-Lu, Grandmaster's Companion", "player")
Dam, thanks a lot ! for finding that!
YOu guys are awsome!

One last thing (before I go back to be silent reader for the next 9 years ):

An Addon I still use ut seeems to not be updated anymore
uses GetMapContinents and GetCurrentMapAreaID.

I have replaced GetCurrentMapAreaID with C_Map.GetBestMapForUnit("player")
but which would be the best option to replace GetMapContinents?

[its PetJournalEnhanced which uses them to make it possible to sort pets by continents/zones]
  Reply With Quote
07-18-18, 08:23 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
It was actually updated a few hours before your post here (though not on this site yet)
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
07-19-18, 09:49 PM   #9
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Originally Posted by Torhal View Post
It was actually updated a few hours before your post here (though not on this site yet)
You got me, the time I checked it wasnt updated.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How do I use UnitBuff now in 8.0?

Thread Tools
Display Modes

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