2014-11-01 00:25:03 +00:00
|
|
|
|
2014-12-12 14:17:55 +00:00
|
|
|
-- Upvalues
|
|
|
|
local _G = _G
|
|
|
|
local bit, strsub, strlen, select, max = bit, strsub, strlen, select, max
|
|
|
|
|
2014-11-01 00:25:03 +00:00
|
|
|
local addonName, addonNS = ...
|
2014-11-08 23:25:26 +00:00
|
|
|
local LQT = LibStub('LibQTip-1.0')
|
2014-11-07 07:21:43 +00:00
|
|
|
local LDB = LibStub("LibDataBroker-1.1")
|
|
|
|
local LTT = LibStub("LibBabble-TalentTree-3.0"):GetLookupTable()
|
|
|
|
local LCT = LibStub("LibBabble-CreatureType-3.0"):GetLookupTable()
|
|
|
|
local LC = {} -- LOCALE CLASSES
|
|
|
|
local CC = {} -- CLASS COLOR
|
|
|
|
|
|
|
|
local classes_raw = {} -- conversion only
|
|
|
|
FillLocalizedClassList(classes_raw)
|
|
|
|
for token, localizedName in pairs(classes_raw) do
|
|
|
|
local color = RAID_CLASS_COLORS[token];
|
|
|
|
LC[token] = localizedName
|
|
|
|
CC[token] = color.colorStr
|
|
|
|
end
|
2014-11-01 00:25:03 +00:00
|
|
|
|
2014-11-06 18:19:55 +00:00
|
|
|
local defaults = { -- http://www.wowhead.com/guide=1100/buffs-and-debuffs
|
|
|
|
[1] = { -- Stats
|
|
|
|
[1] = "Interface\\Icons\\spell_nature_regeneration",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DRUID"], CC["DRUID"]},
|
|
|
|
{LC["MONK"], CC["MONK"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["PALADIN"], CC["PALADIN"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Dog"], LCT["Gorilla"], LCT["Shale Spider"], LCT["Worm"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[2] = { -- Stamina
|
|
|
|
[1] = "Interface\\Icons\\spell_holy_wordfortitude",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["WARRIOR"], CC["WARRIOR"]},
|
|
|
|
{LC["PRIEST"], CC["PRIEST"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["WARLOCK"], CC["WARLOCK"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Bear"], LCT["Goat"], LCT["Rylak"], LCT["Silithid"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[3] = { --Attack Power
|
|
|
|
[1] = "Interface\\Icons\\ability_warrior_battleshout",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DEATHKNIGHT"], CC["DEATHKNIGHT"]},
|
|
|
|
{LC["WARRIOR"], CC["WARRIOR"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["HUNTER"], CC["HUNTER"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[4] = { --Haste
|
|
|
|
[1] = "Interface\\Icons\\spell_nature_bloodlust",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DEATHKNIGHT"].." "..STAT_DPS_SHORT, CC["DEATHKNIGHT"]},
|
|
|
|
{LC["ROGUE"], CC["ROGUE"]},
|
|
|
|
{LC["PRIEST"].." "..LTT["Shadow"], CC["PRIEST"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["SHAMAN"], CC["SHAMAN"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Hyena"], LCT["Rylak"], LCT["Sporebat"], LCT["Wasp"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[5] = { --Spell Power
|
|
|
|
[1] = "Interface\\Icons\\spell_holy_magicalsentry",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["MAGE"], CC["MAGE"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["WARLOCK"], CC["WARLOCK"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Serpent"], LCT["Silithid"], LCT["Water Strider"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[6] = { -- Critical Strike
|
|
|
|
[1] = "Interface\\Icons\\spell_nature_unyeildingstamina",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["MAGE"], CC["MAGE"]},
|
|
|
|
{LC["DRUID"].." "..LTT["Feral"], CC["DRUID"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["MONK"].." "..STAT_CATEGORY_MELEE, CC["MONK"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Devilsaur"], LCT["Quilen"], LCT["Raptor"], LCT["Shale Spider"], LCT["Water Strider"], LCT["Wolf"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[7] = { --Mastery
|
|
|
|
[1] = "Interface\\Icons\\spell_holy_greaterblessingofkings",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DEATHKNIGHT"].." "..LTT["Blood"], CC["DEATHKNIGHT"]},
|
|
|
|
{LC["SHAMAN"], CC["SHAMAN"]},
|
|
|
|
{LC["DRUID"].." "..LTT["Balance"], CC["DRUID"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["PALADIN"], CC["PALADIN"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Cat"], LCT["Hydra"], LCT["Spirit Beast"], LCT["Tallstrider"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[8] = { --Multistrike
|
|
|
|
[1] = "Interface\\Icons\\inv_elemental_mote_air01",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["ROGUE"], CC["ROGUE"]},
|
|
|
|
{LC["PRIEST"].." "..LTT["Shadow"], CC["PRIEST"]},
|
|
|
|
{LC["WARLOCK"], CC["WARLOCK"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["MONK"].." "..STAT_DPS_SHORT, CC["MONK"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Bat"], LCT["Clefthoof"], LCT["Core Hound"], LCT["Dragonhawk"], LCT["Wind Serpent"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
},
|
|
|
|
[9] = { --Versatility
|
|
|
|
[1] = "Interface\\Icons\\spell_holy_mindvision",
|
2014-11-07 07:21:43 +00:00
|
|
|
[2] = {
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DEATHKNIGHT"].." "..STAT_DPS_SHORT, CC["DEATHKNIGHT"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["WARRIOR"].." "..STAT_DPS_SHORT, CC["WARRIOR"]},
|
2014-12-12 14:04:48 +00:00
|
|
|
{LC["DRUID"], CC["DRUID"]},
|
2014-11-07 07:21:43 +00:00
|
|
|
{LC["PALADIN"].." "..STAT_DPS_SHORT, CC["PALADIN"]}
|
2014-11-08 12:31:11 +00:00
|
|
|
},
|
|
|
|
[3] = {LCT["Bird of Prey"], LCT["Boar"], LCT["Clefthoof"], LCT["Porcupine"], LCT["Ravager"], LCT["Stag"], LCT["Worm"]}
|
2014-11-06 18:19:55 +00:00
|
|
|
}
|
2014-11-05 06:31:29 +00:00
|
|
|
}
|
2014-11-06 18:19:55 +00:00
|
|
|
|
2014-11-07 07:21:43 +00:00
|
|
|
local function classColorLocalized(color, spec)
|
|
|
|
return "\124c".. color..spec.."\124r"
|
2014-11-06 18:19:55 +00:00
|
|
|
end
|
2014-11-05 06:31:29 +00:00
|
|
|
|
2014-11-01 00:25:03 +00:00
|
|
|
|
2014-11-07 07:21:43 +00:00
|
|
|
local BrokerConsolidatedBuffs = LDB:NewDataObject("Broker_ConsolidatedBuffs", {
|
2014-11-05 17:26:08 +00:00
|
|
|
type = "data source",
|
2014-12-12 14:17:55 +00:00
|
|
|
text = "0/".._G.NUM_LE_RAID_BUFF_TYPES,
|
|
|
|
value = "0/".._G.NUM_LE_RAID_BUFF_TYPES,
|
2014-11-05 17:26:08 +00:00
|
|
|
icon = "Interface\\AddOns\\Broker_ConsolidatedBuffs\\BuffConsolidation", -- I can't use the default because is a combination texture :(
|
2014-11-01 00:25:03 +00:00
|
|
|
label = "ConsolidatedBuffs",
|
|
|
|
|
2014-11-08 23:25:26 +00:00
|
|
|
OnEnter = function(self)
|
|
|
|
local tooltip = LQT:Acquire("Broker_ConsolidatedBuffsTooltip", 3, "LEFT", "LEFT", "LEFT")
|
|
|
|
self.tooltip = tooltip
|
|
|
|
|
2014-12-12 14:17:55 +00:00
|
|
|
tooltip:AddHeader(_G.CONSOLIDATE_BUFFS_TEXT)
|
2014-11-01 00:25:03 +00:00
|
|
|
tooltip:AddLine(" ")
|
2014-12-12 14:17:55 +00:00
|
|
|
tooltip:AddHeader(_G.STATISTICS, _G.ALL_CLASSES, _G.PETS)--CONSOLIDATE_BUFFS_TEXT)
|
2014-11-08 23:25:26 +00:00
|
|
|
tooltip:AddSeparator()
|
|
|
|
--tooltip:AddLine(" ")
|
2014-11-01 00:25:03 +00:00
|
|
|
|
2014-12-12 14:17:55 +00:00
|
|
|
local buffmask = _G.GetRaidBuffInfo() or 0
|
2014-12-12 14:04:48 +00:00
|
|
|
local mask = 1
|
2014-12-12 14:17:55 +00:00
|
|
|
for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do
|
|
|
|
local name, rank, texture, duration, expiration, spellId, slot = _G.GetRaidBuffTrayAuraInfo(i)
|
2014-11-06 18:19:55 +00:00
|
|
|
local c
|
2014-11-01 00:25:03 +00:00
|
|
|
|
|
|
|
if name then
|
2014-11-06 18:19:55 +00:00
|
|
|
c = "FF00FF00"
|
2014-11-01 00:25:03 +00:00
|
|
|
else
|
2014-12-12 14:04:48 +00:00
|
|
|
if bit.band(buffmask, mask) > 0 then
|
|
|
|
c = "FFFF0000"
|
|
|
|
else
|
|
|
|
c = "FF888888"
|
|
|
|
end
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
|
|
|
|
2014-11-07 07:21:43 +00:00
|
|
|
local classes = ""
|
|
|
|
for ii = 1, #defaults[i][2] do
|
|
|
|
classes = classes ..", ".. classColorLocalized(defaults[i][2][ii][2], defaults[i][2][ii][1])
|
2014-11-06 18:19:55 +00:00
|
|
|
end
|
2014-11-08 12:31:11 +00:00
|
|
|
local pets = ""
|
|
|
|
for ii = 1, #defaults[i][3] do
|
|
|
|
pets = pets ..", ".. defaults[i][3][ii]
|
|
|
|
end
|
2014-11-08 23:25:26 +00:00
|
|
|
tooltip:AddLine(
|
2014-12-12 14:11:58 +00:00
|
|
|
"\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r",
|
2014-11-08 23:25:26 +00:00
|
|
|
strsub(classes, 2),
|
|
|
|
strsub(pets, 2)
|
|
|
|
)
|
2014-11-08 12:31:11 +00:00
|
|
|
--tooltip:AddLine(" ")
|
|
|
|
|
2014-12-12 14:11:58 +00:00
|
|
|
--tooltip:AddLine("\124T"..defaults[i][1]..":0\124t \124c"..c.._G["RAID_BUFF_"..i]:gsub("-\n", "").."\124r "..list)
|
2014-11-06 18:19:55 +00:00
|
|
|
--tooltip:AddLine(" "..list)
|
2014-12-12 14:04:48 +00:00
|
|
|
|
|
|
|
mask = bit.lshift(mask, 1)
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
2014-11-08 23:25:26 +00:00
|
|
|
|
|
|
|
tooltip:SmartAnchorTo(self)
|
|
|
|
tooltip:Show()
|
|
|
|
end,
|
|
|
|
|
|
|
|
OnLeave = function(self)
|
|
|
|
LQT:Release(self.tooltip)
|
|
|
|
self.tooltip = nil
|
2014-11-01 00:25:03 +00:00
|
|
|
end,
|
|
|
|
|
|
|
|
OnClick = function(button)
|
|
|
|
local missing = ""
|
2014-12-12 14:17:55 +00:00
|
|
|
local buffmask = _G.GetRaidBuffInfo() or 0
|
2014-12-12 14:04:48 +00:00
|
|
|
local mask = 1
|
2014-11-01 00:25:03 +00:00
|
|
|
|
2014-12-12 14:17:55 +00:00
|
|
|
for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do
|
|
|
|
if not _G.GetRaidBuffTrayAuraInfo(i) and bit.band(buffmask, mask) > 0 then
|
2014-12-12 14:11:58 +00:00
|
|
|
missing = missing .. _G["RAID_BUFF_"..i]:gsub("-\n", "") ..", "
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
2014-12-12 14:04:48 +00:00
|
|
|
mask = bit.lshift(mask, 1)
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
if missing ~= "" then
|
2014-11-01 12:19:44 +00:00
|
|
|
local channel = "SAY"
|
2014-12-12 14:17:55 +00:00
|
|
|
if _G.IsInGroup(_G.LE_PARTY_CATEGORY_INSTANCE) then
|
2014-11-01 12:19:44 +00:00
|
|
|
channel = "INSTANCE_CHAT"
|
2014-12-12 14:17:55 +00:00
|
|
|
elseif _G.IsInRaid() then
|
2014-11-01 12:19:44 +00:00
|
|
|
channel = "RAID"
|
2014-12-12 14:17:55 +00:00
|
|
|
elseif _G.IsInGroup() then
|
2014-11-01 12:19:44 +00:00
|
|
|
channel = "PARTY"
|
|
|
|
end
|
2014-12-12 14:17:55 +00:00
|
|
|
_G.SendChatMessage(_G.ADDON_MISSING..": "..strsub(missing, 0, strlen(missing)-2), channel)
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
local function updateBuffs(self, event, unitID)
|
|
|
|
if (unitID == "player" or event == "PLAYER_ENTERING_WORLD") then
|
|
|
|
local c = 0
|
2014-12-12 14:17:55 +00:00
|
|
|
for i = 1, _G.NUM_LE_RAID_BUFF_TYPES do
|
|
|
|
if _G.GetRaidBuffTrayAuraInfo(i) then
|
2014-11-01 00:25:03 +00:00
|
|
|
c = c + 1
|
|
|
|
end
|
|
|
|
end
|
2014-12-12 14:04:48 +00:00
|
|
|
|
2014-12-12 14:17:55 +00:00
|
|
|
local buffcount = select(2, _G.GetRaidBuffInfo())
|
2014-12-12 14:04:48 +00:00
|
|
|
|
|
|
|
BrokerConsolidatedBuffs.text = c.."/"..max(c, buffcount)
|
|
|
|
BrokerConsolidatedBuffs.value = c.."/"..max(c, buffcount) -- for ElvUI datatexts
|
2014-11-01 00:25:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local frame = CreateFrame("Frame")
|
|
|
|
frame:RegisterEvent("UNIT_AURA")
|
|
|
|
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
|
|
frame:SetScript("OnEvent", updateBuffs)
|