From 1811d2efd2858b95f634982f85cd8a2af82510c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Mon, 29 Dec 2014 16:42:26 +0100 Subject: [PATCH] unavailable buffs more comments for the last (and first!) Pull Request --- Broker_ConsolidatedBuffs.lua | 57 +++++++++++++++++++++++------------- Broker_ConsolidatedBuffs.toc | 5 +++- README.md | 6 +++- 3 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Broker_ConsolidatedBuffs.lua b/Broker_ConsolidatedBuffs.lua index d35b029..41ddab5 100644 --- a/Broker_ConsolidatedBuffs.lua +++ b/Broker_ConsolidatedBuffs.lua @@ -128,19 +128,21 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { tooltip:AddSeparator() --tooltip:AddLine(" ") + -- http://wowprogramming.com/utils/xmlbrowser/live/FrameXML/BuffFrame.lua local buffmask = _G.GetRaidBuffInfo() or 0 local mask = 1 + for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do local name, rank, texture, duration, expiration, spellId, slot = _G.GetRaidBuffTrayAuraInfo(i) local c if name then - c = "FF00FF00" + c = "00FF00" else if bit.band(buffmask, mask) > 0 then - c = "FFFF0000" + c = "FF0000" else - c = "FF888888" + c = "888888" end end @@ -153,14 +155,10 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { pets = pets ..", ".. defaults[i][3][ii] end tooltip:AddLine( - "\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r", + "\124T"..defaults[i][1]..":0\124t \124cFF"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r", strsub(classes, 2), strsub(pets, 2) ) - --tooltip:AddLine(" ") - - --tooltip:AddLine("\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r "..list) - --tooltip:AddLine(" "..list) mask = bit.lshift(mask, 1) end @@ -176,27 +174,37 @@ local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", { OnClick = function(button) local missing = "" + local unavailable = "" local buffmask = _G.GetRaidBuffInfo() or 0 local mask = 1 for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do - if not _G.GetRaidBuffTrayAuraInfo(i) and bit.band(buffmask, mask) > 0 then - missing = missing .. _G["RAID_BUFF_"..i]:gsub("-\n", "") ..", " + if not _G.GetRaidBuffTrayAuraInfo(i) then + if bit.band(buffmask, mask) > 0 then + missing = missing .. _G["RAID_BUFF_"..i]:gsub("-\n", "") ..", " + else + unavailable = unavailable .. _G["RAID_BUFF_"..i]:gsub("-\n", "") ..", " + end end mask = bit.lshift(mask, 1) end + local channel = "SAY" + if _G.IsInGroup(_G.LE_PARTY_CATEGORY_INSTANCE) then + channel = "INSTANCE_CHAT" + elseif _G.IsInRaid() then + channel = "RAID" + elseif _G.IsInGroup() then + channel = "PARTY" + end + if missing ~= "" then - local channel = "SAY" - if _G.IsInGroup(_G.LE_PARTY_CATEGORY_INSTANCE) then - channel = "INSTANCE_CHAT" - elseif _G.IsInRaid() then - channel = "RAID" - elseif _G.IsInGroup() then - channel = "PARTY" - end _G.SendChatMessage(_G.ADDON_MISSING..": "..strsub(missing, 0, strlen(missing)-2), channel) end + + if unavailable ~= "" then + _G.SendChatMessage(_G.UNAVAILABLE..": "..strsub(unavailable, 0, strlen(unavailable)-2), channel) + end end }) @@ -210,10 +218,17 @@ local function updateBuffs(self, event, unitID) end end - local buffcount = select(2, _G.GetRaidBuffInfo()) + -- I'm gona keep the old code here. Becouse there is an issue with GetRaidBuffInfo()+versatility + --and sometimes can appear 2/2 with 1 buff missing + -- For example a party of Hunter+Druid. Hunter > AP, Druid > Stats+Vers. GRBI() report only Stats and AP. + -- IMO is better to show 2/9 than 2/2 in this cases. + --local buffcount = select(2, _G.GetRaidBuffInfo()) + --BrokerConsolidatedBuffs.text = c.."/"..max(c, buffcount) + --BrokerConsolidatedBuffs.value = c.."/"..max(c, buffcount) -- for ElvUI datatexts - BrokerConsolidatedBuffs.text = c.."/"..max(c, buffcount) - BrokerConsolidatedBuffs.value = c.."/"..max(c, buffcount) -- for ElvUI datatexts + -- old code, to be replaced by ^^^^^ + BrokerConsolidatedBuffs.text = c.."/"..NUM_LE_RAID_BUFF_TYPES + BrokerConsolidatedBuffs.value = c.."/"..NUM_LE_RAID_BUFF_TYPES -- for ElvUI datatexts end end diff --git a/Broker_ConsolidatedBuffs.toc b/Broker_ConsolidatedBuffs.toc index 236d0df..ebba2be 100644 --- a/Broker_ConsolidatedBuffs.toc +++ b/Broker_ConsolidatedBuffs.toc @@ -2,7 +2,7 @@ ## Title: Broker_ConsolidatedBuffs ## Notes: Track consolidated buffs ## Author: Gio -## Version: 0.8 +## Version: 0.9 ## SavedVariables: libs\LibStub\LibStub.lua @@ -20,3 +20,6 @@ Broker_ConsolidatedBuffs.lua # http://sethcoder.com/reference/wow/INTERFACE/BUTTONS/ # http://www.curse.com/addons/wow/libbabble-talenttree-3-0 # http://www.curse.com/addons/wow/libbabble-creaturetype-3-0 + +# Thanks to: +# Dairyman (https://github.com/Dairyman) \ No newline at end of file diff --git a/README.md b/README.md index bf0953e..f2d04c3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Track your consolidated buffs and show it in a Broker Display like Chocolate Bar Simple :) -![Image](http://i.imgur.com/aeJy3zl.png) +![Image](http://i.imgur.com/dPIDsTQ.png) ## Links - [Curse](http://www.curse.com/addons/wow/broker_consolidatedbuffs) @@ -12,6 +12,10 @@ Simple :) - [WoWInterface](http://www.wowinterface.com/downloads/info23247-Broker_ConsolidatedBuffs.html) ## TODO +- Who cast each buff - (DONE) Change tooltip lib to LibQTip. - (DONE) To show more info about missing buffs. - (DONE) Workaround for ElvUI datatexts :/ + +## Thanks! +- [Dairyman](https://github.com/Dairyman) \ No newline at end of file