-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
75 lines (66 loc) · 1.91 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
-- Main Lua code for Intellect4Dummies
-- Author: MStewGT
-- Version: 1.3
-- Returns a list of members in the player's party or raid and assigns to a variable
local raidMembers = {};
local partyMembers = {};
do
for i=1,40 do
raidMembers[i] = "raid"..i
end
for i=1,4 do
partyMembers[i] = "party"..i
end
end
-- Loop through raidMembers and check Arcane Intellect buff/aura
function CheckBuffsGroup()
-- Define local variables
local aura = false
local buff = "Arcane Intellect"
local warnText = "Someone is Dumb!!"
local soundFile = "12867"
-- Check if in a raid first
if IsInRaid() then
-- Loop through raid members
for i=1, GetNumGroupMembers() do
-- Check for buff
aura = AuraUtil.FindAuraByName(buff, raidMembers[i])
-- If buff is not present then warn
if not aura then
message(warnText)
PlaySound(soundFile)
return aura
end
end
-- If not in a raid check if in a party
elseif IsInGroup() then
-- Loop through party members
for i=1, GetNumSubgroupMembers() do
-- Check for buff
aura = AuraUtil.FindAuraByName(buff, partyMembers[i])
-- If buff is not present then warn
if not aura then
message(warnText)
PlaySound(soundFile)
return aura
end
end
-- If all else fails you must be solo, only usable via debugger
else
-- Check for buff
aura = AuraUtil.FindAuraByName(buff, "player")
-- If buff is not present then warn
if not aura then
message(warnText)
PlaySound(soundFile)
return aura
end
end
end
-- Event handler
local frame = CreateFrame("FRAME", "I4DFrame")
frame:RegisterEvent("READY_CHECK") -- Listens for a Ready Check
local function eventHandler(self, event, ...)
CheckBuffsGroup() -- Runs buff check on event
end
frame:SetScript("OnEvent", eventHandler)