From 0093c02ccb2ae06270306fa3e09076a740526e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Fri, 9 Jan 2015 01:13:03 +0100 Subject: [PATCH] added a column to show who cast each buff again, credits for @Dairyman for the inpsiration. --- Broker_ConsolidatedBuffs.lua | 28 ++++++++++++++++++++++++---- Broker_ConsolidatedBuffs.toc | 4 ++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Broker_ConsolidatedBuffs.lua b/Broker_ConsolidatedBuffs.lua index 41ddab5..0b7188f 100644 --- a/Broker_ConsolidatedBuffs.lua +++ b/Broker_ConsolidatedBuffs.lua @@ -106,11 +106,28 @@ local defaults = { -- http://www.wowhead.com/guide=1100/buffs-and-debuffs } } + local function classColorLocalized(color, spec) return "\124c".. color..spec.."\124r" end +local function getCasterName(buffName) + local unitCaster = select(8, _G.UnitBuff("player", buffName) ) + if unitCaster then + -- Do we want translate the name of the player to "you"? + + -- Will add FOREIGN_SERVER_LABEL to the name if the player is from a other server. Connected Realms do not get the label + -- if this is a problem change false to true, then all player not on your server will return as "Name-Realm" + return _G.GetUnitName(unitCaster, true) + else + -- We can improve this *else* with this code from Dairyman: https://github.com/Dairyman/Broker_ConsolidatedBuffs/blob/who_cast_it_extra_column/Broker_ConsolidatedBuffs.lua#L113 + -- For now, I prefer to show something different indicating the unknown source of the buff. + return _G.NOT_APPLICABLE + end +end + + local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { type = "data source", text = "0/".._G.NUM_LE_RAID_BUFF_TYPES, @@ -119,12 +136,13 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { label = "ConsolidatedBuffs", OnEnter = function(self) - local tooltip = LQT:Acquire("Broker_ConsolidatedBuffsTooltip", 3, "LEFT", "LEFT", "LEFT") + local tooltip = LQT:Acquire("Broker_ConsolidatedBuffsTooltip", 4, "LEFT", "LEFT", "LEFT", "LEFT") self.tooltip = tooltip - tooltip:AddHeader(_G.CONSOLIDATE_BUFFS_TEXT) + local line = tooltip:AddHeader() -- Create an empty line + tooltip:SetCell(line, 1, _G.CONSOLIDATE_BUFFS_TEXT, tooltip.headerFont, "LEFT", #tooltip.columns) -- Set value and change the col-span to the full tooltip width tooltip:AddLine(" ") - tooltip:AddHeader(_G.STATISTICS, _G.ALL_CLASSES, _G.PETS)--CONSOLIDATE_BUFFS_TEXT) + tooltip:AddHeader(_G.STATISTICS, " ", _G.ALL_CLASSES, _G.PETS) tooltip:AddSeparator() --tooltip:AddLine(" ") @@ -134,10 +152,11 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do local name, rank, texture, duration, expiration, spellId, slot = _G.GetRaidBuffTrayAuraInfo(i) - local c + local c, who if name then c = "00FF00" + who = getCasterName(name) else if bit.band(buffmask, mask) > 0 then c = "FF0000" @@ -156,6 +175,7 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { end tooltip:AddLine( "\124T"..defaults[i][1]..":0\124t \124cFF"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r", + who or "", strsub(classes, 2), strsub(pets, 2) ) diff --git a/Broker_ConsolidatedBuffs.toc b/Broker_ConsolidatedBuffs.toc index ebba2be..d75567e 100644 --- a/Broker_ConsolidatedBuffs.toc +++ b/Broker_ConsolidatedBuffs.toc @@ -2,7 +2,7 @@ ## Title: Broker_ConsolidatedBuffs ## Notes: Track consolidated buffs ## Author: Gio -## Version: 0.9 +## Version: 1.0 ## SavedVariables: libs\LibStub\LibStub.lua @@ -22,4 +22,4 @@ Broker_ConsolidatedBuffs.lua # http://www.curse.com/addons/wow/libbabble-creaturetype-3-0 # Thanks to: -# Dairyman (https://github.com/Dairyman) \ No newline at end of file +# Dairyman (https://github.com/Dairyman) x2! \ No newline at end of file