WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How do I use UnitBuff now in 8.0? (https://www.wowinterface.com/forums/showthread.php?t=56370)

Drudatz 07-18-18 06:18 AM

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

siweia 07-18-18 07:06 AM

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.

Ammako 07-18-18 07:11 AM

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.

d87 07-18-18 07:13 AM

You can use AuraUtil.FindAuraByName("Ban-Lu, Grandmaster's Companion", "player")

Ammako 07-18-18 07:24 AM

Quote:

Originally Posted by d87 (Post 328678)
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!

zork 07-18-18 07:36 AM

Posting here to save that.

Drudatz 07-18-18 05:45 PM

Quote:

Originally Posted by d87 (Post 328678)
You can use AuraUtil.FindAuraByName("Ban-Lu, Grandmaster's Companion", "player")

Dam, thanks a lot :banana: ! 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]

Torhal 07-18-18 08:23 PM

It was actually updated a few hours before your post here (though not on this site yet)

Drudatz 07-19-18 09:49 PM

Quote:

Originally Posted by Torhal (Post 328729)
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.


All times are GMT -6. The time now is 03:52 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI