-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.lua
More file actions
184 lines (171 loc) · 6.76 KB
/
Copy pathconfig.lua
File metadata and controls
184 lines (171 loc) · 6.76 KB
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
-- // Uber UI
-- // Uberlicious - 2018
-----------------------------
-- INIT
-----------------------------
--get the addon namespace
local addon, ns = ...
UberUI = {}
uuidb = {}
local _, class = UnitClass("player")
local classcolor = class and ((C_ClassColor and C_ClassColor.GetClassColor(class)) or (GetClassColorObj and GetClassColorObj(class)) or RAID_CLASS_COLORS[class])
-----------------------------
-- DEFAULTS
-----------------------------
--generate a holder for the config data
UberUI = CreateFrame("Frame")
UberUI:RegisterEvent("VARIABLES_LOADED")
UberUI:RegisterEvent("ADDON_LOADED")
UberUI:RegisterEvent("PLAYER_LOGIN")
UberUI:RegisterEvent("PLAYER_LOGOUT")
UberUI:SetScript("OnEvent", function(self, event)
if (event == "ADDON_LOADED" or event == "VARIABLES_LOADED") then
self:Init();
end
if (event == "PLAYER_LOGOUT") then
self:Save();
end
end)
local defaults = {
statusbars = {
Blizzard = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\nameplate",
Blizzard_Flat = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\nameplate",
Blizzard_Old = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\blizzard",
Minimalist = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\Minimalist",
Ace = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\Ace",
Aluminum = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\Aluminum",
Banto = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\banto",
Charcoal = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\Charcoal",
Glaze = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\glaze",
Litestep = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\LiteStep",
Otravi = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\otravi",
Perl = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\perl",
Smooth = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\smooth",
Striped = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\striped",
Swag = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\swag",
Flat = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\flat",
},
masks = {
cdm_mask = "Interface\\AddOns\\Uber UI\\textures\\statusbars\\cdm_bar_mask.tga",
},
general = {
classcolorhealth = true,
darkencolor = { r = .4, g = .4, b = .4, a = 1 },
texture = "Blizzard",
secondarybartexture = "Blizzard",
raidbartexture = "Blizzard",
playerbartexture = "Blizzard",
targetbartexture = "Blizzard",
focusbartexture = "Blizzard",
nameplatebartexture = "Blizzard",
personalresourcebartexture = "Blizzard",
damagemetertexture = "Blizzard",
arenanumbers = true,
hidearenaframes = false,
border = "Interface\\AddOns\\Uber UI\\textures\\border",
hidehotkeys = false,
hidemacros = false,
hiderepcolor = true,
hostilitycolor = true,
darkenpersonalresourceborder = true,
allbartextures = true,
secondarybartextures = false,
raidbartextures = false,
playerbartextures = false,
targetbartextures = false,
focusbartextures = false,
nameplatebartextures = false,
personalresourcebartextures = false,
damagemeterbartextures = false,
zoomiconbuffs = false,
zoomicontarget = false,
zoomiconparty = false,
zoomiconcompact = false,
showExtendedBarTextures = false,
nameplateraidtargetscale = 1,
nameplateraidtargettopanchor = false,
},
damagemeters = {
background = false,
alpha = .5,
hideoverlay = false,
hidebarbackground = false,
},
cooldown = {
bartexture = "Blizzard",
bartextures = false,
borders = true,
},
playerframes = {
classcolor = true,
},
targetframes = {
classcolorenemy = true,
classcolorfriendly = true,
},
focusframes = {
classcolorenemy = true,
classcolorfriendly = true,
},
arenaframes = {
classcolor = true,
},
partyframes = {
classcolor = true,
},
cuf = {
hideRaidTitle = false,
},
}
function UberUI:GetDefaults()
return defaults;
end
function UberUI:Init()
local function initDB(def, tbl, saved)
if type(def) ~= "table" then return {} end
if type(tbl) ~= "table" then tbl = {} end
if type(saved) ~= "table" then saved = {} end
for k, v in pairs(def) do
if type(v) == "table" then
tbl[k] = initDB(v, tbl[k], saved[k])
elseif type(tbl[k]) ~= "table" and saved[k] ~= nil then -- If saved value exists use it
tbl[k] = saved[k]
elseif type(tbl[k]) ~= "table" and saved[k] == nil then -- If saved value does not exist use default
tbl[k] = v
end
end
return tbl
end
uuidb = initDB(defaults, uuidb, UberuiDB)
end
function UberUI:Save()
local function updateSave(def, tbl, saved)
if type(def) ~= "table" then return {} end
if type(tbl) ~= "table" then tbl = {} end
if type(saved) ~= "table" then saved = {} end
for k, v in pairs(tbl) do
if type(v) == "table" then
saved[k] = updateSave(def[k], v, saved[k])
elseif type(saved[k]) ~= "table" and v ~= def[k] then -- If temp value does not equal the default, save it
saved[k] = v
elseif type(saved[k]) ~= "table" and v == def[k] and saved[k] ~= def[k] then -- Unset saved value if temp == default and saved value exists
saved[k] = nil
elseif type(saved[k]) ~= "table" and saved[k] == def[k] then -- Cleanup if save value happens to == default
saved[k] = nil
end
end
return saved
end
UberuiDB = updateSave(defaults, uuidb, UberuiDB)
local function cleanupSave(saved)
for k, v in pairs(saved) do
if type(v) == "table" and next(v) then
cleanupSave(v)
elseif type(v) == "table" and not next(v) then
saved[k] = nil
end
end
return saved
end
UberuiDB = cleanupSave(UberuiDB)
end