-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlizzardOptions.lua
112 lines (94 loc) · 2.19 KB
/
BlizzardOptions.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
local TrinketAlerter = BannZay.TrinketAlerter;
local AceConfig = LibStub("AceConfig-3.0");
local AceConfigDialog = LibStub("AceConfigDialog-3.0");
if TrinketAlerter == nil or AceConfig == nil or AceConfigDialog == nil then print("TrinketAlerter blizzard options will not be created as there dependencies to be satisfied"); return; end
local BlizzOptions = {};
local WotlkClassIds = {
"WARRIOR",
"PALADIN",
"HUNTER",
"ROGUE",
"PRIEST",
"DEATHKNIGHT",
"SHAMAN",
"MAGE",
};
local function AddHooks()
hooksecurefunc(TrinketAlerter, "OnInitialize", BlizzOptions.OnInitialize);
end
function BlizzOptions:OnInitialize()
AceConfig:RegisterOptionsTable("TrinketAlerter", BlizzOptions:BuildBlizzardOptions())
AceConfigDialog:AddToBlizOptions("TrinketAlerter", "TrinketAlerter")
end
local function SetOption(info, value)
local key = info.arg or info[#info]
if key == nil then
return;
end
TrinketAlerter.db[key] = value;
TrinketAlerter:ApplyDbSettings();
end
local function GetOption(info)
local key = info.arg or info[#info]
return TrinketAlerter.db[key];
end
function BlizzOptions:BuildBlizzardOptions()
local s = TrinketAlerter.Settings;
local options =
{
type = "group",
name = "TrinketAlerter (/ta or /trinketAlerter)",
plugins = {},
get = GetOption,
set = SetOption,
args = {}
}
options.args["lock"] =
{
type = "execute",
name = "Lock",
desc = "lock frames (/trinketAlerter lock)",
order = 1,
func = function(info, value) TrinketAlerter:Lock(); end,
}
options.args[s.AnimationTime] =
{
type = "range",
name = "Animation time",
desc = "The time frame flashes after trinket was used",
min =.4,
max = 6,
step =.2,
order = 2,
}
options.args[s.Scale] =
{
type = "range",
name = "Scale",
desc = "",
min =.3,
max = 6,
step =.1,
order = 3,
}
options.args[s.AnimationSpeed] =
{
type = "range",
name = "AnimationSpeed",
desc = "",
min =.05,
max = 1,
step =.05,
order = 4,
}
options.args["test"] =
{
type = "execute",
name = "Test",
desc = "",
order = 99,
func = function(info, value) TrinketAlerter:Lock(false); TrinketAlerter:FlashFreeFrame(WotlkClassIds[math.random(1, 8)]); end,
}
return options;
end
AddHooks();