Originally Posted by semlar
Paste this into addon.bool.no to create an addon:
Lua Code:
local button, REVIVE_BATTLE_PETS = CreateFrame('button', 'SmartRez', nil, 'SecureActionButtonTemplate'), GetSpellInfo(125439) button:SetAttribute('type', 'macro') button:SetScript('PreClick', function(self) if InCombatLockdown() then return end local injured = false for i = 1, 3 do -- Determine whether any pet in our loadout is actually injured local guid = C_PetJournal.GetPetLoadOutInfo(i) if guid then local health, maxHealth = C_PetJournal.GetPetStats(guid) if health < maxHealth then injured = true break end end end if not injured then DEFAULT_CHAT_FRAME:AddMessage('Pets are already at full health!', 1, 1, 0) self:SetAttribute('macrotext', nil) return end if GetSpellCooldown(125439) == 0 then -- "Revive Battle Pets" is off cooldown, cast that self:SetAttribute('macrotext', '/cast ' .. REVIVE_BATTLE_PETS) else self:SetAttribute('macrotext', '/use item:86143') end end)
Once you've loaded that, make a macro like this to use it:
Lua Code:
#showtooltip Revive Battle Pets /click [nocombat] SmartRez /cast [combat] Revive Battle Pets
It will use the spell if it's off cooldown or if you're in combat, otherwise it will use a bandage. I'm not going to bother including code to update the icon based on what it's going to cast since it's largely unnecessary and probably more useful to see the remaining cooldown of Revive Battle Pets instead.
|
@semlar This worked for me until Dragon Flight Phase 1 Release. Can anyone provided the required fixes to make it function again ?