Check Hunter Aspect
More actions
Sample Code: Check Hunter Aspect by Pholus 03:48, 1 Jan 2005 (EST)
Hunter Aspects are character buffs. The following code uses UnitBuff to determine if a hunter is carrying a specific buff by name.
see Sample Code Check Hunter's Mark Aspect for sample code on finding deBuffs by name.
--Loops through active buffs looking for a string match
--Origin Zorlen's hunter functions
function isUnitBuffUp(sUnitname, sBuffname)
local iIterator = 1
while (UnitBuff(sUnitname, iIterator)) do
if (string.find(UnitBuff(sUnitname, iIterator), sBuffname)) then
return true
end
iIterator = iIterator + 1
end
return false
end
function isPlayerBuffUp(sBuffname)
return isUnitBuffUp("player", sBuffname)
end;
The actual names are quite different than the display texts eg: "Aspect of the Cheetah" has the queriable name "JungleTiger". Edit: The names are the names of the Icons.
local spellHawk = "Aspect of the Hawk(Rank 3)" local spellMonkey = "Aspect of the Monkey" local spellCheetah = "Aspect of the Cheetah" local qryHawk = "Raven" local qryMonkey = "Monkey" local qryCheeta = "JungleTiger" function isAOMUp() return isPlayerBuffUp(qryMonkey) end; function isAOHUp() return isPlayerBuffUp(qryHawk) end; function isAOCUp() return isPlayerBuffUp(qryCheeta); end;
You can determine the query name of a buff by casting it and using showAllUnitBuffs("player")
function showAllUnitBuffs(sUnitname)
local iIterator = 1
DEFAULT_CHAT_FRAME:AddMessage(format("[%s] Buffs", sUnitname))
while (UnitBuff(sUnitname, iIterator)) do
DEFAULT_CHAT_FRAME:AddMessage(UnitBuff(sUnitname, iIterator), 1, 1, 0)
iIterator = iIterator + 1
end
DEFAULT_CHAT_FRAME:AddMessage("---", 1, 1, 0)
end
From here is it simple to create functions that check to see if aspects are already up before casting them.
function setAOM() if isAOMUp() then return false else CastSpellByName(spellMonkey) return true end end; function setAOH() if isAOHUp() then return false else CastSpellByName(spellHawk) return true end end; function setAOC() if isAOCUp() then return false else CastSpellByName(spellCheetah) return true end end;
I use a boolean to indicate whether a cast was necessary, that way in my macros I can chain a followup cast.
eg: /script if not setAOH() then CastSpellByName("Auto Shot") end;
If aspect of the hawk was already up it takes just one keypress to start the music, if it wasn't it takes 1 to get it up and go through the cooldown and a second to start the mustic.
See List of known buff and debuff effects that can be queried