Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
local SetUnitAura, SetUnitBuff, SetUnitDebuff = _G.GameTooltip.SetUnitAura, _G.GameTooltip.SetUnitBuff, _G.GameTooltip.SetUnitDebuff local tconcat = _G.table.concat local tinsert = _G.tinsert local wipe = _G.wipe local UnitName = _G.UnitName local UnitClass = _G.UnitClass local UnitVehicleSeatInfo = _G.UnitVehicleSeatInfo local UnitAura = _G.UnitAura local names = {} local colors = setmetatable({}, {__index = function(t, class) local c = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class] if c then t[class] = ("ff%02x%02x%02x"):format(c.r * 255, c.g * 255, c.b * 255) else t[class] = "ffffffff" end return t[class] end }) local function hook(original, ...) original(...) wipe(names) local _, unitid, id, filter = ... if original == SetUnitBuff then filter = "HELPFUL" elseif original == SetUnitDebuff then filter = "HARMFUL" end local _, _, _, _, _, _, _, caster = UnitAura(unitid, id, filter) if caster then local name, class _, name = UnitVehicleSeatInfo(caster, 1) if name then _, class = UnitClass(name) tinsert(names, ("|c%s%s|r"):format(colors[class], name)) _, name = UnitVehicleSeatInfo(caster, 2) if name then _, class = UnitClass(name) tinsert(names, ("|c%s%s|r"):format(colors[class], name)) end else _, class = UnitClass(caster) tinsert(names, ("|c%s%s|r"):format(colors[class], UnitName(caster))) end GameTooltip:AddLine(tconcat(names, ", ")) GameTooltip:Show() end end -- Install the hooks GameTooltip.SetUnitAura = function( ... ) hook( SetUnitAura, ... ) end GameTooltip.SetUnitBuff = function( ... ) hook( SetUnitBuff, ... ) end GameTooltip.SetUnitDebuff = function( ... ) hook( SetUnitDebuff, ... ) end
This paste will be private.
From the Design Piracy series on my blog: