Who Buffed Me in Classic - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-18-20, 11:52 PM   #1
A Firelord
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 460
Who Buffed Me in Classic

In classic, drive by buffs are common. I had an idea to create an addon that grabs the name of the player who buffed you and do a /ty. The later part is theoretical, but here is my hacked together code.

local JWB = CreateFrame("Frame")

local function(WhoBuff)
	local buffnum=0
	for i=1, 40 do
		local name, __, count,_,_,_,caster = UnitBuff("player", i, "HELPFUL");    -- buffs only
		if (not name) then
			casterName = caster==nil and "unknown" or caster=="player" and "you" or caster=="pet" and "your pet" or UnitName(caster)
			print("Caster: "..casterName)
			break;    --end the loop

JWB:SetScript("OnEvent", WhoBuff)
JWB:RegisterUnitEvent("UNIT_AURA", "player")
What I thought would happen is when my toon is buffed, the code would loop through the buffs and pick the last one and print the caster name. Maybe I am misreading the API documentation or I should not try coding until I adjust to a new shift.
Author of JWExpBar and JWRepBar.
  Reply With Quote

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Help/Support » Who Buffed Me in Classic

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