-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.lua
More file actions
184 lines (168 loc) · 6.07 KB
/
core.lua
File metadata and controls
184 lines (168 loc) · 6.07 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
--Don't worry about this
local addon, ns = ...
local Version = GetAddOnMetadata(addon, "Version")
--Cache Lua / WoW API
local format = string.format
local GetCVarBool = GetCVarBool
local ReloadUI = ReloadUI
local StopMusic = StopMusic
-- These are things we do not cache
-- GLOBALS: PluginInstallStepComplete, PluginInstallFrame
--Change this line and use a unique name for your plugin.
local HTUI = "HealTree UI"
--Create references to ElvUI internals
local E, L, V, P, G = unpack(ElvUI)
--Create reference to LibElvUIPlugin
local EP = LibStub("LibElvUIPlugin-1.0")
--Create a new ElvUI module so ElvUI can handle initialization when ready
local mod = E:NewModule(HTUI, "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
--This function is executed when you press "Skip Process" or "Finished" in the installer.
local function InstallComplete()
if GetCVarBool("Sound_EnableMusic") then
StopMusic()
end
--Set a variable tracking the version of the addon when layout was installed
E.db[HTUI].install_version = Version
ReloadUI()
end
--This is the data we pass on to the ElvUI Plugin Installer.
--The Plugin Installer is reponsible for displaying the install guide for this layout.
local InstallerData = {
Title = format("|cff4beb2c%s %s|r", HTUI, "Installation"),
Name = HTUI,
tutorialImage = "Interface\\AddOns\\ElvUI_HTUI\\assets\\htui_logo.tga", --If you have a logo you want to use, otherwise it uses the one from ElvUI
Pages = {
[1] = function()
PluginInstallFrame.SubTitle:SetFormattedText("Welcome to the installation for %s.", HTUI)
PluginInstallFrame.Desc1:SetText("This installation process will guide you through a few steps and apply settings to your current ElvUI profile. If you want to be able to go back to your original settings then create a new profile before going through this installation process.")
PluginInstallFrame.Desc2:SetText("Please press the continue button if you wish to go through the installation process, otherwise click the 'Skip Process' button.")
PluginInstallFrame.Option1:Show()
PluginInstallFrame.Option1:SetScript("OnClick", InstallComplete)
PluginInstallFrame.Option1:SetText("Skip Process")
end,
[2] = function()
PluginInstallFrame.SubTitle:SetText("Layouts")
PluginInstallFrame.Desc1:SetText("These are the layouts that are available. Please click a button below to apply the layout of your choosing.")
PluginInstallFrame.Desc2:SetText("Importance: |cff07D400High|r")
PluginInstallFrame.Option2:Show()
PluginInstallFrame.Option2:SetScript("OnClick", function() ns.SetupLayout("healer") end)
PluginInstallFrame.Option2:SetText("Set me UP!")
end,
[3] = function()
PluginInstallFrame.SubTitle:SetText("Installation Complete")
PluginInstallFrame.Desc1:SetText("You have completed the installation process.")
PluginInstallFrame.Desc2:SetText("Please click the button below in order to finalize the process and automatically reload your UI.")
PluginInstallFrame.Option1:Show()
PluginInstallFrame.Option1:SetScript("OnClick", InstallComplete)
PluginInstallFrame.Option1:SetText("Finished")
end,
},
StepTitles = {
[1] = "Welcome",
[2] = "Layouts",
[3] = "Installation Complete",
},
StepTitlesColor = {1, 1, 1},
StepTitlesColorSelected = {0, 179/255, 1},
StepTitleWidth = 200,
StepTitleButtonWidth = 180,
StepTitleTextJustification = "RIGHT",
}
--This function holds the options table which will be inserted into the ElvUI config
local function InsertOptions()
E.Options.args.HTUI = {
order = 100,
type = "group",
name = format("|cffFFF05E%s|r", HTUI),
args = {
header1 = {
order = 1,
type = "header",
name = HTUI,
},
description1 = {
order = 2,
type = "description",
name = format("%s is a layout for ElvUI.", HTUI),
},
spacer1 = {
order = 3,
type = "description",
name = "\n\n\n",
},
header2 = {
order = 4,
type = "header",
name = "Installation",
},
description2 = {
order = 5,
type = "description",
name = "The installation guide should pop up automatically after you have completed the ElvUI installation. If you wish to re-run the installation process for this layout then please click the button below.",
},
spacer2 = {
order = 6,
type = "description",
name = "",
},
install = {
order = 7,
type = "execute",
name = "Install",
desc = "Run the installation process.",
func = function() E:GetModule("PluginInstaller"):Queue(InstallerData); E:ToggleConfig(); end,
},
spacer3 = {
order = 8,
type = "description",
name = "\n\n",
},
--Coming soon to an AddOn near you
--[[
header3 = {
order = 9,
type = "header",
name = "Features",
},
toggle1 = {
order = 10,
desc = 'enables / disables custom health/powerbars on Units Player/Target',
descStyle = 'inline',
type = 'toggle',
name = "Custom Statusbars",
},
toggle2 = {
order = 11,
desc = 'enable / disable vignette',
descStyle = 'inline',
type = 'toggle',
name = 'Vignette or Border',
},
toggle3 = {
order = 12,
desc = 'adds leveltext and sets font/color',
descStyle = 'inline',
type = 'toggle',
name = 'QuestTracker Frame'
}
]]
},
}
end
--Create a unique table for our plugin
P[HTUI] = {}
--This function will handle initialization of the addon
function mod:Initialize()
--Initiate installation process if ElvUI install is complete and our plugin install has not yet been run
if E.private.install_complete and E.db[HTUI].install_version == nil then
E:GetModule("PluginInstaller"):Queue(InstallerData)
end
--Insert our options table when ElvUI config is loaded
EP:RegisterPlugin(addon, InsertOptions)
end
--This function will get called by ElvUI automatically when it is ready to initialize modules
local function CallbackInitialize()
mod:Initialize()
end
--Register module with callback so it gets initialized when ready
E:RegisterModule(HTUI, CallbackInitialize)