Code:
local buffNames = {
["Earthen Armor"]=true,
["Golem's Strength"]=true,
["Volcanic Power"]=true,
["Tol'vir Agility"]=true,
}
local spellNames = { -- unsure which one shows in the combat log, so I'm adding both buff name and spell name for the time being
["Earthen Armor"]=true,
["Earthen Potion"]=true,
["Golem's Strength"]=true,
["Golemblood Potion"]=true,
["Mysterious Potion"]=true,
["Potion of Concentration"]=true,
["Concentration"]=true,
["Potion of the Tol'vir"]=true,
["Tol'vir Agility"]=true,
["Volcanic Potion"]=true,
["Volcanic Power"]=true,
["Mighty Rejuvenation Potion"]=true,
}
local select, table, pairs, tinsert, print =
select, table, pairs, tinsert, print
local GetUnitName, GetInstanceInfo, UnitBuff, GetNumGroupMembers, UnitInRaid =
GetUnitName, GetInstanceInfo, UnitBuff, GetNumGroupMembers, UnitInRaid
local a = CreateFrame("Frame")
a:SetScript("OnEvent", function(self, event, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
local subEvent, srcName, spellName = (select(2,...)), (select(5,...)), (select(13,...))
local raidIndex = UnitInRaid(srcName)
if subEvent == "SPELL_CAST_SUCCESS" and spellNames[spellName] and raidIndex then
self.pots = self.pots or {}
self.pots[GetUnitName(("raid%d"):format(raidIndex),true)] = spellName
end
elseif event == "PLAYER_REGEN_DISABLED" then
local n = GetNumGroupMembers()
local nP=(select(5, GetInstanceInfo()))
if nP and (nP >= 10) and (n>0) then
self.pots = self.pots and table.wipe(self.pots) or {}
self.prepots = self.prepots and table.wipe(self.prepots) or {}
for id=1, n do
local uID = ("raid%d"):format(id)
for buffName in pairs(buffNames) do
if UnitBuff(uID, buffName) then
self.prepots[GetUnitName(uID,true)] = true
break
end
end
end
end
elseif event == "PLAYER_REGEN_ENABLED" then
local n = GetNumGroupMembers()
local nP=(select(5, GetInstanceInfo()))
if nP and (nP >= 10) and (n>0) then
local noprepot, noinpot = {}, {}
for id=1, n do
local name = GetUnitName(("raid%d"):format(id),true)
if not self.prepots[name] then tinsert(noprepot, name) end
if not self.pots[name] then tinsert(noinpot, name) end
end
if (#noprepot>0) then
print("Players that did not have a potion buff when combat started: "..table.concat(noprepot, ", "))
else
print("Everyone had a potion buff when combat started!")
end
if (#noinpot>0) then
print("Players that did not use a potion in combat: "..table.concat(noinpot, ", "))
else
print("Everyone used a potion during combat!")
end
end
end
end)
a:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
a:RegisterEvent("PLAYER_REGEN_ENABLED")
a:RegisterEvent("PLAYER_REGEN_DISABLED")
You'll still have to replace all the spell/buff names for the individual potions you want to be allowed at the top as I don't have an active account to check these right now.