-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathConfig.lua
100 lines (89 loc) · 2.08 KB
/
Config.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
local _, FS = ...
local Config = FS:RegisterModule("Config")
local AceConfig = LibStub("AceConfig-3.0")
local options = {
type = "group",
args = {
About = {
name = "About",
order = 1,
type = "group",
args = {
title = {
type = "description",
name = "|cff64b4ffFS Core",
fontSize = "large",
order = 0
},
desc = {
type = "description",
name = "FS Core provides a framework to build powerful addons, WeakAuras and enhancing boss mods for high-end raiding.",
fontSize = "medium",
order = 1
},
author = {
type = "description",
name = "\n|cffffd100Author: |r Blash @ EU-Sargeras",
order = 2
},
version = {
type = "description",
name = "|cffffd100Version: |r" .. FS.version,
order = 3
},
player_key = {
type = "description",
name = function()
return "|cffffd100\nPlayer key:\n|r" .. FS:Wrap(FS:PlayerKey(), 40)
end,
hidden = true,
order = 4
}
}
}
}
}
function Config:OnInitialize()
AceConfig:RegisterOptionsTable("FS Core", options)
end
function Config:OnEnable()
options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(FS.db)
end
function Config:Register(title, config, order)
if order == nil then order = 10 end
options.args[title] = {
name = title,
order = order,
type = "group",
args = config
}
end
function Config:MakeDoc(title, order, fields, prefix)
local output = {
type = "group",
name = "|cff64b4ff" .. title,
inline = true,
order = order,
args = {}
}
local order = 1
for _, field in ipairs(fields) do
local title_order = order
local desc_order = order + 1
order = order + 2
local title = prefix and "|cffff7d0a" .. prefix or ""
title = title .. "|cfffff569" .. field[1]:gsub("[()<>%-%[%],%.]+", "|cffaaaaaa%0|cfffff569")
output.args["item_" .. title_order] = {
type = "description",
name = title,
fontSize = "medium",
order = title_order
}
output.args["item_" .. desc_order] = {
type = "description",
name = field[2] .. "\n",
order = desc_order
}
end
return output
end