-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConfettiConfig.lua
45 lines (35 loc) · 1 KB
/
ConfettiConfig.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
local _, _, classIndex = UnitClass("player")
if not (classIndex == 1) then
return;
end
local AddonString = "|cff33ff99Confetti Suite: |r";
local DefaultThreshold = 10^6
if not ConfettiConfigFrame then
local ConfettiConfigFrame = CreateFrame("Frame", "ConfettiConfigFrame", UIParent)
end
SLASH_CONF1 = "/confetti";
SLASH_CONF2 = "/cft";
local function ConfHandler(threshold, _)
local t = tonumber(threshold)
if t >= 0 then
ConfettiVariables.threshold = t;
print(AddonString, "Threshold set to", t)
else
print(AddonString, threshold, "is not a number")
end
end
SlashCmdList["CONF"] = ConfHandler;
local function ConfigInit()
if (not ConfettiVariables) then
ConfettiVariables = {
["threshold"] = DefaultThreshold
};
end
end
local function OnEvent(self, event)
if event == "VARIABLES_LOADED" then
ConfigInit();
end
end
ConfettiConfigFrame:RegisterEvent("VARIABLES_LOADED");
ConfettiConfigFrame:SetScript("OnEvent", OnEvent);