forked from isalcedo/VanillaGuide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
VGuideFu.lua
215 lines (193 loc) · 5.59 KB
/
VGuideFu.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
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
--[[--------------------------------------------------
----- VanillaGuide -----
------------------
VGuideFu.lua
Authors: mrmr
Version: 1.04.2
------------------------------------------------------
Description:
Fubar plugin for VGuide
1.00
-- Initial Ace2 release
1.99a
-- Ally addition starter version
1.03
-- No Changes. Just adjusting "version".
1.99x for a beta release was a weird choise.
1.04.1
-- Just minor adjustments to reflect changes in the
rest of addon
1.04.2
-- no changes in here for this revision
------------------------------------------------------
Connection:
--]]--------------------------------------------------
if not VGuide then
return
end
if not IsAddOnLoaded("Fubar") then
return
end
local tablet = AceLibrary("Tablet-2.0")
VGuideFu = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0")
VGuideFu.hasIcon = "Interface\\AddOns\\VanillaGuide\\Textures\\FuBar_Icon"
-- using an AceOptions data table
VGuideFu.OnMenuRequest = {
type = 'group',
args = {
titletoggle = {
order = 1,
type = "toggle",
name = "Show Title",
desc = "Click to Toggle Title Visibility",
get = "IsTitle",
set = "ToggleTitle",
},
guidenametoggle = {
order = 2,
type = "toggle",
name = "Show Guide Name",
desc = "Click to Toggle Guide Name Visibility",
get = "IsGuideName",
set = "ToggleGuideName",
},
guidesteptoggle = {
order = 3,
type = "toggle",
name = "Show Guide Step",
desc = "Click to Toggle Guide Step Visibility",
get = "IsGuideStep",
set = "ToggleGuideStep",
},
lablestoggle = {
order = 4,
type = "toggle",
name = "Show Labels",
desc = "Click to Toggle Labels Visibility",
get = "IsLabels",
set = "ToggleLabels",
},
}
}
function VGuideFu:OnInitialize()
self.title = "VanillaGuide"
self.hasIcon = "Interface\\AddOns\\VanillaGuide\\Textures\\FuBar_Icon.tga"
self.cannotHideText = true
self.overrideMenu = false
self.hideMenuTitle = true
self.defaultPosition = "RIGHT"
self.defaultMinimapPosition = 180
self.independentProfile = false
end
function VGuideFu:OnEnable()
self.GuideID = nil
self.GuideName = nil
self.GuideStep = nil
self.GuideStepLabel = nil
self:ShowIcon()
self:SetIcon(true)
end
function VGuideFu:IsTitle()
return VGuide.Settings.db.char.VGuideFu.ShowTitle
end
function VGuideFu:ToggleTitle()
VGuide.Settings.db.char.VGuideFu.ShowTitle = not VGuide.Settings.db.char.VGuideFu.ShowTitle
self:UpdateText()
end
function VGuideFu:IsGuideName()
return VGuide.Settings.db.char.VGuideFu.ShowGuideName
end
function VGuideFu:ToggleGuideName()
VGuide.Settings.db.char.VGuideFu.ShowGuideName = not VGuide.Settings.db.char.VGuideFu.ShowGuideName
self:UpdateText()
end
function VGuideFu:IsGuideStep()
return VGuide.Settings.db.char.VGuideFu.ShowGuideStep
end
function VGuideFu:ToggleGuideStep()
VGuide.Settings.db.char.VGuideFu.ShowGuideStep = not VGuide.Settings.db.char.VGuideFu.ShowGuideStep
self:UpdateText()
end
function VGuideFu:IsLabels()
return VGuide.Settings.db.char.VGuideFu.ShowLabels
end
function VGuideFu:ToggleLabels()
VGuide.Settings.db.char.VGuideFu.ShowLabels = not VGuide.Settings.db.char.VGuideFu.ShowLabels
self:UpdateText()
end
function VGuideFu:OnDataUpdate()
self.GuideID = VGuide.Settings.db.char.GuideValues.GuideID
self.GuideName = VGuide.Display:GetGuideTitle()
self.GuideStep = VGuide.Settings.db.char.GuideValues.Step
self.GuideStepLabel = VGuide.Display:GetStepLabel()
end
function VGuideFu:OnTextUpdate()
local guideLabel = self.GuideName or ""
local step = self.GuideStep or ""
local textTitle = "|c00FFFF00VGuide"
local textGuideNameLabel = "|c0000FF00Guide:"
local textGuideStepLabel = "|c0000FF00Step:"
local whiteTextColor = "|c00FFFFFF"
local text = ""
if not self:IsLabels() then
textGuideNameLabel = ""
textGuideStepLabel = ""
end
if self:IsTitle() then
text = text .. textTitle
end
if self:IsGuideName() then
if self:IsTitle() then
text = text .. " - "
end
text = text .. textGuideNameLabel .. whiteTextColor .. guideLabel
end
if self:IsGuideStep() then
if self:IsGuideName() or self:IsTitle() then
text = text .. " - "
end
text = text .. textGuideStepLabel .. whiteTextColor .. step
end
self:SetText(text)
end
function VGuideFu:OnTooltipUpdate()
tablet:SetHint("Click to Toggle VGuide's Frame")
-- as a rule, if you have an OnClick or OnDoubleClick or OnMouseUp or
-- OnMouseDown, you should set a hint.
local cat = tablet:AddCategory(
"text", "Guide",
"columns", 1,
"child_textR", 1,
"child_textG", 1,
"child_textB", 0
)
cat:AddLine(
"text", "|c00FFFF00" .. tostring(self.GuideName) .. "|r"
)
cat = tablet:AddCategory(
"text", "Step Label",
"columns", 1,
"child_textR", 1,
"child_textG", 1,
"child_textB", 1
)
cat:AddLine(
"text", tostring(self.GuideStepLabel)
)
end
function VGuideFu:OnClick()
local frame = getglobal("VG_MainFrame")
local fSettings = getglobal("VG_SettingsFrame")
if frame:IsVisible() then
frame:Hide()
if fSettings:IsVisible() then
fSettings.showthis = true
fSettings:Hide()
end
else
frame:Show()
if fSettings.showthis then
fSettings:Show()
end
end
end