Repository navigation
Expand file tree
/
Copy pathMuffinStuff.lua
More file actions
84 lines (75 loc) · 2.46 KB
/
Copy pathMuffinStuff.lua
File metadata and controls
84 lines (75 loc) · 2.46 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
MuffinStuff = LibStub("AceAddon-3.0"):NewAddon("MuffinStuff", "AceConsole-3.0")
-- Define local default values
local defaults = {
profile = {
stanceHiddenValue = true,
combatTextSizeValue = 2.0,
},
}
-- Define the options table
local options = {
name = "MuffinStuff Options",
handler = MuffinStuff,
type = "group",
order = 1,
args = {
hide_stance_group = {
type = "group",
order = 2,
inline = true,
name = "Hide Stance Bar",
args = {
hideStanceToggle = {
name = "Hide Stance Bar",
desc = "Toggle hiding the stance/stealth/form bar. Changing this will reload your UI.",
type = "toggle",
set = function(info,val) MuffinStuff.db.profile.stanceHiddenValue = val; ReloadUI(); end,
get = function(info) return MuffinStuff.db.profile.stanceHiddenValue end
}
}
},
combat_text_size_group = {
type = "group",
order = 3,
inline = true,
name = "Combat Text Size",
args = {
combatTextSizeSlider = {
name = "Combat Text Size",
desc = "1 is the default Blizzard setting. Set this to 2 like Papa Simon intended.",
type = "range",
min = 1,
max = 5,
step = 0.1,
set = function(info,val) MuffinStuff:SetCombatTextValue(val) end,
get = function(info) return MuffinStuff.GetCombatTextValue() end
}
}
}
}
}
-- Called when the addon is loaded
function MuffinStuff:OnInitialize()
-- Initialize profile DB
self.db = LibStub("AceDB-3.0"):New("MuffinStuffDB", defaults)
-- Initialize options panel
LibStub("AceConfig-3.0"):RegisterOptionsTable("MuffinStuff_options", options)
self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("MuffinStuff_options", "MuffinStuff")
-- Set the state of the stance bar based on user selection
if self.db.profile.stanceHiddenValue == true then
RegisterStateDriver(StanceBarFrame, "visibility", "hide")
else
RegisterStateDriver(StanceBarFrame, "visibility", "show")
end
-- Set combat text to the user selected size
C_CVar.SetCVar("WorldTextScale", self.db.profile.combatTextSizeValue)
end
-- Setter for Combat Text Value
function MuffinStuff:SetCombatTextValue(val)
self.db.profile.combatTextSizeValue = val
C_CVar.SetCVar("WorldTextScale", val)
end
-- Getter for Combat Text Value
function MuffinStuff.GetCombatTextValue()
return MuffinStuff.db.profile.combatTextSizeValue
end