View Single Post
01-07-14, 06:24 PM   #15
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
If you have a custom button that handles your buffs, I bet you can set a macro on it to target the person that cast the spell on you. Then you can specially click that buff button to invoke the macro. I do not think this would work in combat, so raid buffs may not be usable a lot, but it could work out of combat. Once you target the caster of the original buff you can do as you will.

Edit:
In fact, I imagine you might be able to monitor when you get a buff cast on you, and instead of having the actual buff need to be specially clicked, you would have a different button that you could set the macrotext on to target the caster of the buff. Then you click that button to target the benefactor so you can cast MotW on them.

Edit 2:
Something like this should work. It is a bit rough, but you get the idea:

local previousBuffs = {}
local targetButton = CreateFrame("Button", nil, WorldFrame, "SecureActionButtonTemplate,UIPanelButtonTemplate")
targetButton:SetWidth(16)
targetButton:SetHeight(16)
targetButton:SetPoint("LEFT",WorldFrame,"BOTTOMLEFT",50,320)
targetButton:SetAttribute("type1", "macro")
targetButton:SetScript("OnEvent", function(ignored, event, arg1)
if arg1 == "player" then
local i = 1
local currentBuffs = {}
local chosenCaster = nil
while (true) do
local name,_,_,_,_,_,_,caster,_,_,spellId = UnitAura(arg1, i)
if name then
spellId = tonumber(spellId)
if nil ~= spellId then
currentBuffs[spellId] = caster
if nil == previousBuffs[spellId] then chosenCaster = caster end
end
i = i + 1
else
break
end
end
local benefactorName = chosenCaster and UnitName(chosenCaster)
if benefactorName and not InCombatLockdown() then targetButton:SetAttribute("macrotext", SLASH_TARGET1 .. ' ' .. benefactorName) end
previousBuffs = currentBuffs
end
end)
targetButton:RegisterUnitEvent("UNIT_AURA", "player")

Last edited by Nimhfree : 01-07-14 at 07:25 PM.
  Reply With Quote