-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZeroUI.lua
109 lines (89 loc) · 2.91 KB
/
ZeroUI.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
ZeroUI = {}
ZeroUI.name = "ZeroUI"
ZeroUI.version = 1.0
ZeroUI.defaults = {
showAttributes = true,
showCombat = true,
}
function ZeroUI:Initialize()
--if is in combat function
self.inCombat = IsUnitInCombat("player")
if ZeroUI.ZUIConfig.showCombat == true then
EVENT_MANAGER:RegisterForEvent(self.name, EVENT_PLAYER_COMBAT_STATE, self.OnPlayerCombatState)
end
--Always show attribute bars
if ZeroUI.ZUIConfig.showAttributes == true then
PLAYER_ATTRIBUTE_BARS:ForceShow(yes)
end
--buff event
--EVENT_MANAGER:RegisterForEvent(1, EVENT_EFFECT_CHANGED, self.BuffEffectChanged)
end
function ZeroUI.OnAddOnLoaded(event, addonName)
if addonName == ZeroUI.name then
--use settings
ZeroUI.ZUIConfig = ZO_SavedVars:New("ZeroUIConfig", ZeroUI.version, nil, ZeroUI.defaults)
local LAM2 = LibStub("LibAddonMenu-2.0")
--Menu settings starts here
local panelData = {
type = "panel",
name = "ZeroUI",
displayName = "ZeroUI",
author = "jlahtela",
version = ZeroUI.version,
slashCommand = "/ZeroUI", --(optional) will register a keybind to open to this panel
registerForRefresh = true, --boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown)
registerForDefaults = true, --boolean (optional) (will set all options controls back to default values)
}
LAM2:RegisterAddonPanel("ZeroUI_OptionsPanel", panelData)
local optionsTable = {
[1] = {
type = "header",
name = "User Interface",
},
[2] = {
type = "checkbox",
name = "Show attributes",
getFunc = function() return ZeroUI.ZUIConfig.showAttributes end,
setFunc = function(newValue) ZeroUI.ZUIConfig.showAttributes = newValue; end,
default = ZeroUI.defaults.showAttributes,
warning = "To apply settings reloadui is required!",
},
[3] = {
type = "header",
name = "Combat events",
},
[4] = {
type = "checkbox",
name = "Show combat status messages",
getFunc = function() return ZeroUI.ZUIConfig.showCombat end,
setFunc = function(newValue) ZeroUI.ZUIConfig.showCombat = newValue; end,
default = ZeroUI.defaults.showCombat,
warning = "To apply settings reloadui is required!",
},
}
LAM2:RegisterOptionControls("ZeroUI_OptionsPanel", optionsTable)
ZeroUI:Initialize()
end
end
EVENT_MANAGER:RegisterForEvent(ZeroUI.name, EVENT_ADD_ON_LOADED, ZeroUI.OnAddOnLoaded)
function ZeroUI.OnPlayerCombatState(event, inCombat)
--Check if is in combat
if inCombat ~= ZeroUI.inCombat then
ZeroUI.inCombat = inCombat
if inCombat then
--If in combat make actions here
--Add message to chat that entering to combat
d("Entering combat.")
else
--when exits combat
d("Exiting combat.")
end
end
end
--if buff comes on set ability bars force visible
--function ZeroUI.BuffEffectChanged(event)
--for debugging that event work:
--d("Buff enabled!")
--PLAYER_ATTRIBUTE_BARS:
--PLAYER_ATTRIBUTE_BARS:ForceShow(yes)
--end