wow-addons/BigBrother/BigBrother.lua

42 lines
1.2 KiB
Lua
Raw Normal View History

2020-07-10 03:56:08 +02:00
BigBrother = {}
BigBrother.title = GetAddOnMetadata("BigBrother", "Title")
BigBrother.version = GetAddOnMetadata("BigBrother", "Version")
BigBrother.author = GetAddOnMetadata("BigBrother", "Author")
BigBrother.Items = {}
print(("Loaded %s v%s by %s."):format(BigBrother.title, BigBrother.version, BigBrother.author))
BigBrotherDB = {} -- default value, will be overwritten by the game if persistent data exists
local frame = CreateFrame("FRAME")
frame:RegisterEvent("ENCOUNTER_START")
frame:SetScript("OnEvent", function(self, event, encounterID, encounterName, difficultyID, groupSize)
if not IsInRaid() then
return
end
local classBuffs = {}
for className, _ in pairs(RAID_CLASS_COLORS) do
classBuffs[className] = {}
end
for m = 1, GetNumGroupMembers() do
local unit = "raid" .. m
local unitBuffs = {}
for b = 1, 40 do
_, _, _, _, _, _, _, _, _, spellId = UnitBuff(unit, b)
if not spellId then
break
end
unitBuffs[b] = spellId
end
local _, className = UnitClass(unit)
classBuffs[className][UnitName(unit)] = unitBuffs
end
table.insert(BigBrotherDB, {
date = date("%F %T"),
zone = GetRealZoneText(),
encounterID = encounterID,
encounterName = encounterName,
buffs = classBuffs,
})
end)