Something like this:
lua Code:
-- Make a list of the buffs you want to check for:
local buffs = {
["Battle Shout"] = true,
["Blessing of Kings"] = true,
["Horn of Winter"] = true,
["Mark of the Wild"] = true,
["Well Fed"] = true,
}
------------------------------------------------------------------------
-- Create a frame.
-- Frames are the basic UI objects in WoW.
-- You need them in order to respond to events (things happening in the
-- game) or to show visible elements on the screen (graphics, text,
-- buttons, etc.).
------------------------------------------------------------------------
local frame = CreateFrame("Frame")
------------------------------------------------------------------------
-- Register for the UNIT_AURA event.
-- Events are how WoW tells addons that something has happened.
-- The UNIT_AURA event fires whenever any buff or debuff changes on any
-- unit that currently has a unit token (such as player, target, boss1,
-- focustarget, arena3, party2, or raid18pet).
------------------------------------------------------------------------
frame:RegisterEvent("UNIT_AURA")
------------------------------------------------------------------------
-- Set an OnEvent handler for the frame.
-- This is a function that will be run each time the frame receives
-- an event for which it has registered.
-- The function recieves a reference to the frame as its first
-- argument (conventionally named "self"), the name of the event
-- as the second argument (conventionally named "event"), and then
-- event-specific data from the third argument onward.
------------------------------------------------------------------------
frame:SetScript("OnEvent", function(self, event, ...)
--------------------------------------------------------------------
-- ... is called a vararg, and is a construct that contains any
-- number of variables. It is used mainly when receiving variables
-- without knowing how many of them there are. Since different
-- events pass different numbers of arguments, a vararg is very
-- common in event handling functions.
-- Technically you don't need it here, since your frame is only
-- registered for one event, but if you expand your addon later,
-- it may become useful.
--------------------------------------------------------------------
-- Unpack the vararg into the variable(s) it contains:
local unit = ...
-- If the unit is not "player" you don't care about it, so
-- you can quit out of the function early to save time:
if unit ~= "player" then
return
end
-- Loop through all of the buffs you want to check for:
for buff in pairs(buffs) do
-- Check to see if you have the buff:
if UnitBuff("player", buff) then
-- You have the buff.
-- Do something here.
else
-- You don't have the buff.
-- Do something here.
end
end
end)