Thread Tools Display Modes
09-20-18, 09:14 PM   #1
EKE
An Aku'mai Servant
 
EKE's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2011
Posts: 37
To check how many auras a unit have

thinking about show bolstering buff as stack on nameplate.

for example, is there any way to count how many auras i got?

should cache it by myself ?_?
  Reply With Quote
09-21-18, 01:33 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
You can try working with default filters. You can use multiple filter options at once like "HELPFUL|PLAYER"

Filter list:

NONE
HELPFUL - buffs.
HARMFUL - debuffs.
PLAYER - auras that were applied by the player.
RAID - auras that can be applied (if HELPFUL) or dispelled (if HARMFUL) by the player.
CANCELABLE - buffs that can be removed (such as by right-clicking or using the /cancelaura command)
NOT_CANCELABLE - buffs that cannot be removed
INCLUDE_NAME_PLATE_ONLY - includes some specific auras which Blizzard decides that they should appear on nameplates

Here is the Blizzard nameplate filter function:
https://www.townlong-yak.com/framexm...Plates.lua#140

If the default filters get you nowhere you need a custom filter. The max number of debuffs available is 40. You will probably need two loops one for buffs and one for debuffs and you need to check each one against a certain spellid or spellname and on top you can match other stuff like who casted the aura etc.

Here is how oUF provides custom filters:
https://github.com/oUF-wow/oUF/blob/...auras.lua#L186

oUF supports nameplates and thus allows you to work with a custom filter on nameplate units.
https://github.com/zorker/rothui/blo...eplate.lua#L50

If you are using any other nameplate addon you need it to support aura white/blacklisting of some sort.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-21-18 at 01:43 AM.
  Reply With Quote
09-21-18, 04:16 PM   #3
EKE
An Aku'mai Servant
 
EKE's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2011
Posts: 37
ty for reply!

here's the filter, fallow blizzard's nameplate
https://github.com/EKE00372/EKPlates...lates.lua#L233

as 40 max available, i'm thinking about show bolstering buff as 1 icon only, and show how many bolstering that unit got as buff stack, and......show "6+" if over 6 bolstering buff.

so now:

1. need a custom filter (looks like already have)
2. only show 1 buff. and need to count how many bolstering buff the unit have
> thinking how to do
3. show numbers as stack
  Reply With Quote
11-25-18, 07:06 PM   #4
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 17
I use this code, i try rewrite to your koncept. Maybe help you. Sry for eng.

Save dname in function UpdateAuraIcon

lua Code:
  1. button.name = name

lua Code:
  1. if dname and matchdebuff then
  2.     --if dspellid == 209859 or dspellid == 113746 or dspellid == 228287 then return end -- 激勵?
  3.     local exist = false
  4.     if dname == "Bolstering" then
  5.         for index = 1, i do
  6.             if unitFrame.icons[index].name == dname then
  7.                 unitFrame.icons[index].count = unitFrame.icons[index].count + 1
  8.                 exist = true
  9.             end
  10.         end
  11.     elseif not exist then
  12.         if not unitFrame.icons[i] then
  13.             unitFrame.icons[i] = CreateAuraIcon(unitFrame.icons)
  14.         end
  15.             UpdateAuraIcon(unitFrame.icons[i], unit, index, "HARMFUL")
  16.             if i ~= 1 then
  17.                 unitFrame.icons[i]:SetPoint("LEFT", unitFrame.icons[i-1], "RIGHT", 4, 0)
  18.             end
  19.             i = i + 1
  20.     end
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » To check how many auras a unit have

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