Browse Source

unavailable buffs

more comments for the last (and first!) Pull Request
Sergio Álvarez 5 years ago
parent
commit
1811d2efd2
3 changed files with 46 additions and 24 deletions
  1. 37 22
      Broker_ConsolidatedBuffs.lua
  2. 4 1
      Broker_ConsolidatedBuffs.toc
  3. 5 1
      README.md

+ 37 - 22
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())
-
-		BrokerConsolidatedBuffs.text  = c.."/"..max(c, buffcount)
-		BrokerConsolidatedBuffs.value = c.."/"..max(c, buffcount) -- for ElvUI datatexts
+		-- 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
+
+		-- 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
 

+ 4 - 1
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)

+ 5 - 1
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)