|
Tercio@41
|
1
|
|
Tercio@41
|
2 local DF = _G ["DetailsFramework"]
|
|
Tercio@41
|
3 if (not DF or not DetailsFrameworkCanLoad) then
|
|
Tercio@41
|
4 return
|
|
Tercio@41
|
5 end
|
|
Tercio@41
|
6
|
|
Tercio@41
|
7 local _
|
|
Tercio@41
|
8 local tinsert = tinsert
|
|
Tercio@41
|
9 local GetSpellInfo = GetSpellInfo
|
|
Tercio@41
|
10 local lower = string.lower
|
|
Tercio@41
|
11 local GetSpellBookItemInfo = GetSpellBookItemInfo
|
|
Tercio@41
|
12
|
|
Tercio@41
|
13 local cleanfunction = function() end
|
|
Tercio@41
|
14
|
|
Tercio@41
|
15 do
|
|
Tercio@41
|
16 local metaPrototype = {
|
|
Tercio@41
|
17 WidgetType = "aura_tracker",
|
|
Tercio@41
|
18 SetHook = DF.SetHook,
|
|
Tercio@41
|
19 RunHooksForWidget = DF.RunHooksForWidget,
|
|
Tercio@41
|
20 }
|
|
Tercio@41
|
21
|
|
Tercio@41
|
22 _G [DF.GlobalWidgetControlNames ["aura_tracker"]] = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] or metaPrototype
|
|
Tercio@41
|
23 end
|
|
Tercio@41
|
24
|
|
Tercio@41
|
25 local AuraTrackerMetaFunctions = _G [DF.GlobalWidgetControlNames ["aura_tracker"]]
|
|
Tercio@41
|
26
|
|
Tercio@41
|
27 --create panels
|
|
Tercio@41
|
28 local on_profile_changed = function (self, newdb)
|
|
Tercio@41
|
29 self.db = newdb
|
|
Tercio@41
|
30 self.tracking_method:Select (newdb.aura_tracker.track_method)
|
|
Tercio@41
|
31
|
|
Tercio@41
|
32 --automatic
|
|
Tercio@41
|
33 self.buff_ignored:SetData (newdb.aura_tracker.buff_banned)
|
|
Tercio@41
|
34 self.debuff_ignored:SetData (newdb.aura_tracker.debuff_banned)
|
|
Tercio@41
|
35 self.buff_available:Refresh()
|
|
Tercio@41
|
36 self.buff_ignored:Refresh()
|
|
Tercio@41
|
37 self.debuff_available:Refresh()
|
|
Tercio@41
|
38 self.debuff_ignored:Refresh()
|
|
Tercio@41
|
39
|
|
Tercio@41
|
40 --manual
|
|
Tercio@41
|
41 self.buffs_added:SetData (newdb.aura_tracker.buff)
|
|
Tercio@41
|
42 self.debuffs_added:SetData (newdb.aura_tracker.debuff)
|
|
Tercio@41
|
43 self.buffs_added:Refresh()
|
|
Tercio@41
|
44 self.debuffs_added:Refresh()
|
|
Tercio@41
|
45
|
|
Tercio@41
|
46 --method
|
|
Tercio@41
|
47 if (newdb.aura_tracker.track_method == 0x1) then
|
|
Tercio@41
|
48 self.f_auto:Show()
|
|
Tercio@41
|
49 self.f_manual:Hide()
|
|
Tercio@41
|
50 elseif (newdb.aura_tracker.track_method == 0x2) then
|
|
Tercio@41
|
51 self.f_auto:Hide()
|
|
Tercio@41
|
52 self.f_manual:Show()
|
|
Tercio@41
|
53 end
|
|
Tercio@41
|
54 end
|
|
Tercio@41
|
55
|
|
Tercio@41
|
56 local aura_panel_defaultoptions = {
|
|
Tercio@41
|
57 height = 400,
|
|
Tercio@41
|
58 row_height = 16,
|
|
Tercio@41
|
59 width = 230,
|
|
Tercio@41
|
60 }
|
|
Tercio@41
|
61 function DF:CreateAuraConfigPanel (parent, name, db, method_change_callback, options)
|
|
Tercio@41
|
62
|
|
Tercio@41
|
63 local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")
|
|
Tercio@41
|
64 local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
|
|
Tercio@41
|
65 local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")
|
|
Tercio@41
|
66 local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE")
|
|
Tercio@41
|
67 local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
|
|
Tercio@41
|
68
|
|
Tercio@41
|
69 local f = CreateFrame ("frame", name, parent)
|
|
Tercio@41
|
70 f.db = db
|
|
Tercio@41
|
71 f.OnProfileChanged = on_profile_changed
|
|
Tercio@41
|
72 options = options or {}
|
|
Tercio@41
|
73 self.table.deploy (options, aura_panel_defaultoptions)
|
|
Tercio@41
|
74
|
|
Tercio@41
|
75 local f_auto = CreateFrame ("frame", "$parent_Automatic", f)
|
|
Tercio@41
|
76 local f_manual = CreateFrame ("frame", "$parent_Manual", f)
|
|
Tercio@41
|
77 f_auto:SetPoint ("topleft", f, "topleft", 0, -24)
|
|
Tercio@41
|
78 f_manual:SetPoint ("topleft", f, "topleft", 0, -24)
|
|
Tercio@41
|
79 f_auto:SetSize (600, 600)
|
|
Tercio@41
|
80 f_manual:SetSize (600, 600)
|
|
Tercio@41
|
81 f.f_auto = f_auto
|
|
Tercio@41
|
82 f.f_manual = f_manual
|
|
Tercio@41
|
83
|
|
Tercio@41
|
84 local on_select_tracking_option = function (_, _, method)
|
|
Tercio@41
|
85 f.db.aura_tracker.track_method = method
|
|
Tercio@41
|
86 if (method_change_callback) then
|
|
Tercio@41
|
87 method_change_callback (self, method)
|
|
Tercio@41
|
88 end
|
|
Tercio@41
|
89
|
|
Tercio@41
|
90 if (method == 0x1) then
|
|
Tercio@41
|
91 f_auto:Show()
|
|
Tercio@41
|
92 f_manual:Hide()
|
|
Tercio@41
|
93 f.desc_label.text = "Auras are being tracked automatically, the addon controls what to show. You may entry an aura to ignore.\nCast spells to fill the Buff and Buff available boxes."
|
|
Tercio@41
|
94 f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 8)
|
|
Tercio@41
|
95 elseif (method == 0x2) then
|
|
Tercio@41
|
96 f_auto:Hide()
|
|
Tercio@41
|
97 f_manual:Show()
|
|
Tercio@41
|
98 f.desc_label.text = "Auras are being tracked manually, the addon only check for auras you entered below."
|
|
Tercio@41
|
99 f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 1)
|
|
Tercio@41
|
100 end
|
|
Tercio@41
|
101 end
|
|
Tercio@41
|
102
|
|
Tercio@41
|
103 local tracking_options = function()
|
|
Tercio@41
|
104 return {
|
|
Tercio@41
|
105 {label = "Automatic", value = 0x1, onclick = on_select_tracking_option, desc = "Show all your auras by default, you can exclude those you don't want to show."},
|
|
Tercio@41
|
106 {label = "Manual", value = 0x2, onclick = on_select_tracking_option, desc = "Do not show any aura by default, you need to manually add each aura you want to track."},
|
|
Tercio@41
|
107 }
|
|
Tercio@41
|
108 end
|
|
Tercio@41
|
109
|
|
Tercio@41
|
110 local tracking_method_label = self:CreateLabel (f, "Tracking Aura Method:", 12, "orange")
|
|
Tercio@41
|
111 local tracking_method = self:CreateDropDown (f, tracking_options, f.db.aura_tracker.track_method, 120, 20, "dropdown_tracking_method", _, self:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
|
|
Tercio@41
|
112
|
|
Tercio@41
|
113 tracking_method_label:SetPoint ("topleft", f, "topleft", 10, -10)
|
|
Tercio@41
|
114 tracking_method:SetPoint ("left", tracking_method_label, "right", 2, 0)
|
|
Tercio@41
|
115 tracking_method:SetFrameStrata ("tooltip")
|
|
Tercio@41
|
116 tracking_method.tooltip = "Choose which aura tracking method you want to use."
|
|
Tercio@41
|
117 f.tracking_method = tracking_method
|
|
Tercio@41
|
118
|
|
Tercio@41
|
119 f.desc_label = self:CreateLabel (f, "", 10, "silver")
|
|
Tercio@41
|
120 f.desc_label:SetSize (400, 40)
|
|
Tercio@41
|
121 f.desc_label:SetPoint ("topleft", tracking_method, "topright", 10, 8)
|
|
Tercio@41
|
122 f.desc_label:SetJustifyV ("top")
|
|
Tercio@41
|
123
|
|
Tercio@41
|
124 --------automatic
|
|
Tercio@41
|
125
|
|
Tercio@41
|
126 local ALL_BUFFS = {}
|
|
Tercio@41
|
127 local ALL_DEBUFFS = {}
|
|
Tercio@41
|
128
|
|
Tercio@41
|
129 local width, height, row_height = options.width, options.height, options.row_height
|
|
Tercio@41
|
130
|
|
Tercio@41
|
131 local buff_ignored = self:CreateSimpleListBox (f_auto, "$parentBuffIgnored", "Buffs Ignored", "The list is empty, select a spell from the buff list to ignore it.", f.db.aura_tracker.buff_banned,
|
|
Tercio@41
|
132 function (spellid)
|
|
Tercio@41
|
133 f.db.aura_tracker.buff_banned [spellid] = nil;
|
|
Tercio@41
|
134 end,
|
|
Tercio@41
|
135 {
|
|
Tercio@41
|
136 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
137 text = function(spellid) return select (1, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
138 height = height,
|
|
Tercio@41
|
139 row_height = row_height,
|
|
Tercio@41
|
140 width = width,
|
|
Tercio@41
|
141 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:AddLine ("Click to un-ignore this aura", .2, 1, .2); GameTooltip:Show() end,
|
|
Tercio@41
|
142 })
|
|
Tercio@41
|
143
|
|
Tercio@41
|
144 local buff_available = self:CreateSimpleListBox (f_auto, "$parentBuffAvailable", "Buffs Available", "The list is empty, cast spells to fill it", ALL_BUFFS, function (spellid)
|
|
Tercio@41
|
145 f.db.aura_tracker.buff_banned [spellid] = true; buff_ignored:Refresh()
|
|
Tercio@41
|
146 end,
|
|
Tercio@41
|
147 {
|
|
Tercio@41
|
148 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
149 text = function(spellid) return select (1, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
150 height = height,
|
|
Tercio@41
|
151 row_height = row_height,
|
|
Tercio@41
|
152 width = width,
|
|
Tercio@41
|
153 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:AddLine ("Click to ignore this aura", .2, 1, .2); GameTooltip:Show() end,
|
|
Tercio@41
|
154 })
|
|
Tercio@41
|
155
|
|
Tercio@41
|
156 local debuff_ignored = self:CreateSimpleListBox (f_auto, "$parentDebuffIgnored", "Debuffs Ignored", "The list is empty, select a spell from the debuff list to ignore it.", f.db.aura_tracker.debuff_banned, function (spellid)
|
|
Tercio@41
|
157 f.db.aura_tracker.debuff_banned [spellid] = nil;
|
|
Tercio@41
|
158 end,
|
|
Tercio@41
|
159 {
|
|
Tercio@41
|
160 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
161 text = function(spellid) return select (1, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
162 height = height,
|
|
Tercio@41
|
163 row_height = row_height,
|
|
Tercio@41
|
164 width = width,
|
|
Tercio@41
|
165 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:AddLine ("Click to un-ignore this aura", .2, 1, .2); GameTooltip:Show() end,
|
|
Tercio@41
|
166 })
|
|
Tercio@41
|
167
|
|
Tercio@41
|
168 local debuff_available = self:CreateSimpleListBox (f_auto, "$parentDebuffAvailable", "Debuffs Available", "The list is empty, cast spells to fill it", ALL_DEBUFFS, function (spellid)
|
|
Tercio@41
|
169 f.db.aura_tracker.debuff_banned [spellid] = true; debuff_ignored:Refresh()
|
|
Tercio@41
|
170 end, {
|
|
Tercio@41
|
171 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
172 text = function(spellid) return select (1, GetSpellInfo (spellid)) end,
|
|
Tercio@41
|
173 height = height,
|
|
Tercio@41
|
174 row_height = row_height,
|
|
Tercio@41
|
175 width = width,
|
|
Tercio@41
|
176 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:AddLine ("Click to ignore this aura", .2, 1, .2); GameTooltip:Show() end,
|
|
Tercio@41
|
177 })
|
|
Tercio@41
|
178
|
|
Tercio@41
|
179 --como ira preencher ela no inicio e como ficara o lance dos profiles
|
|
Tercio@41
|
180
|
|
Tercio@41
|
181 local y = -40
|
|
Tercio@41
|
182 buff_available:SetPoint ("topleft", f_auto, "topleft", 0, y)
|
|
Tercio@41
|
183 buff_ignored:SetPoint ("topleft", f_auto, "topleft", 6 + width, y)
|
|
Tercio@41
|
184 debuff_available:SetPoint ("topleft", f_auto, "topleft", 12 + (width*2), y)
|
|
Tercio@41
|
185 debuff_ignored:SetPoint ("topleft", f_auto, "topleft", 18 + (width*3), y)
|
|
Tercio@41
|
186
|
|
Tercio@41
|
187 f.buff_available = buff_available
|
|
Tercio@41
|
188 f.buff_ignored = buff_ignored
|
|
Tercio@41
|
189 f.debuff_available = debuff_available
|
|
Tercio@41
|
190 f.debuff_ignored = debuff_ignored
|
|
Tercio@41
|
191
|
|
Tercio@41
|
192 local readCombatLog = CreateFrame ("frame", nil, f_auto)
|
|
Tercio@41
|
193 readCombatLog:SetScript ("OnEvent", function (self, event, time, token, hidding, sourceGUID, sourceName, sourceFlag, sourceFlag2, targetGUID, targetName, targetFlag, targetFlag2, spellid, spellname, spellschool, auraType, amount)
|
|
Tercio@41
|
194 if (auraType == "BUFF" and sourceGUID == readCombatLog.playerGUID) then
|
|
Tercio@41
|
195 if (not ALL_BUFFS [spellid]) then
|
|
Tercio@41
|
196 ALL_BUFFS [spellid] = true
|
|
Tercio@41
|
197 buff_available:Refresh()
|
|
Tercio@41
|
198 end
|
|
Tercio@41
|
199 elseif (auraType == "DEBUFF" and sourceGUID == readCombatLog.playerGUID) then
|
|
Tercio@41
|
200 if (not ALL_DEBUFFS [spellid]) then
|
|
Tercio@41
|
201 ALL_DEBUFFS [spellid] = true
|
|
Tercio@41
|
202 debuff_available:Refresh()
|
|
Tercio@41
|
203 end
|
|
Tercio@41
|
204 end
|
|
Tercio@41
|
205 end)
|
|
Tercio@41
|
206
|
|
Tercio@41
|
207 f_auto:SetScript ("OnShow", function()
|
|
Tercio@41
|
208 for i = 1, BUFF_MAX_DISPLAY do
|
|
Tercio@41
|
209 local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HELPFUL")
|
|
Tercio@41
|
210 if (name) then
|
|
Tercio@41
|
211 ALL_BUFFS [spellId] = true
|
|
Tercio@41
|
212 end
|
|
Tercio@41
|
213 local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HARMFUL")
|
|
Tercio@41
|
214 if (name) then
|
|
Tercio@41
|
215 ALL_DEBUFFS [spellId] = true
|
|
Tercio@41
|
216 end
|
|
Tercio@41
|
217 end
|
|
Tercio@41
|
218
|
|
Tercio@41
|
219 buff_available:Refresh()
|
|
Tercio@41
|
220 buff_ignored:Refresh()
|
|
Tercio@41
|
221 debuff_available:Refresh()
|
|
Tercio@41
|
222 debuff_ignored:Refresh()
|
|
Tercio@41
|
223
|
|
Tercio@41
|
224 readCombatLog.playerGUID = UnitGUID ("player")
|
|
Tercio@41
|
225 readCombatLog:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
|
Tercio@41
|
226 end)
|
|
Tercio@41
|
227 f_auto:SetScript ("OnHide", function()
|
|
Tercio@41
|
228 readCombatLog:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED")
|
|
Tercio@41
|
229 end)
|
|
Tercio@41
|
230
|
|
Tercio@41
|
231 --show the frame selecton on the f.db
|
|
Tercio@41
|
232 on_select_tracking_option (_, _, f.db.aura_tracker.track_method)
|
|
Tercio@41
|
233
|
|
Tercio@41
|
234 -------manual
|
|
Tercio@41
|
235
|
|
Tercio@41
|
236 --> build the two aura scrolls for buff and debuff
|
|
Tercio@41
|
237
|
|
Tercio@41
|
238 local scroll_width = width
|
|
Tercio@41
|
239 local scroll_height = height
|
|
Tercio@41
|
240 local scroll_lines = 15
|
|
Tercio@41
|
241 local scroll_line_height = 20
|
|
Tercio@41
|
242
|
|
Tercio@41
|
243 local backdrop_color = {.8, .8, .8, 0.2}
|
|
Tercio@41
|
244 local backdrop_color_on_enter = {.8, .8, .8, 0.4}
|
|
Tercio@41
|
245
|
|
Tercio@41
|
246 local line_onenter = function (self)
|
|
Tercio@41
|
247 self:SetBackdropColor (unpack (backdrop_color_on_enter))
|
|
Tercio@41
|
248 local spellid = select (7, GetSpellInfo (self.value))
|
|
Tercio@41
|
249 if (spellid) then
|
|
Tercio@41
|
250 GameTooltip:SetOwner (self, "ANCHOR_RIGHT");
|
|
Tercio@41
|
251 GameTooltip:SetSpellByID (spellid)
|
|
Tercio@41
|
252 GameTooltip:AddLine (" ")
|
|
Tercio@41
|
253 GameTooltip:AddLine ("Click to untrack this aura", .2, 1, .2)
|
|
Tercio@41
|
254 GameTooltip:Show()
|
|
Tercio@41
|
255 end
|
|
Tercio@41
|
256 end
|
|
Tercio@41
|
257
|
|
Tercio@41
|
258 local line_onleave = function (self)
|
|
Tercio@41
|
259 self:SetBackdropColor (unpack (backdrop_color))
|
|
Tercio@41
|
260 GameTooltip:Hide()
|
|
Tercio@41
|
261 end
|
|
Tercio@41
|
262 local line_onclick = function (self)
|
|
Tercio@41
|
263 local spell = self.value
|
|
Tercio@41
|
264 local data = self:GetParent():GetData()
|
|
Tercio@41
|
265
|
|
Tercio@41
|
266 for i = 1, #data do
|
|
Tercio@41
|
267 if (data[i] == spell) then
|
|
Tercio@41
|
268 tremove (data, i)
|
|
Tercio@41
|
269 break
|
|
Tercio@41
|
270 end
|
|
Tercio@41
|
271 end
|
|
Tercio@41
|
272
|
|
Tercio@41
|
273 self:GetParent():Refresh()
|
|
Tercio@41
|
274 end
|
|
Tercio@41
|
275
|
|
Tercio@41
|
276 local scroll_createline = function (self, index)
|
|
Tercio@41
|
277 local line = CreateFrame ("button", "$parentLine" .. index, self)
|
|
Tercio@41
|
278 line:SetPoint ("topleft", self, "topleft", 0, -((index-1)*(scroll_line_height+1)))
|
|
Tercio@41
|
279 line:SetSize (scroll_width, scroll_line_height)
|
|
Tercio@41
|
280 line:SetScript ("OnEnter", line_onenter)
|
|
Tercio@41
|
281 line:SetScript ("OnLeave", line_onleave)
|
|
Tercio@41
|
282 line:SetScript ("OnClick", line_onclick)
|
|
Tercio@41
|
283
|
|
Tercio@41
|
284 line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
|
Tercio@41
|
285 line:SetBackdropColor (unpack (backdrop_color))
|
|
Tercio@41
|
286
|
|
Tercio@41
|
287 local icon = line:CreateTexture ("$parentIcon", "overlay")
|
|
Tercio@41
|
288 icon:SetSize (scroll_line_height, scroll_line_height)
|
|
Tercio@41
|
289 local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal")
|
|
Tercio@41
|
290 icon:SetPoint ("left", line, "left", 2, 0)
|
|
Tercio@41
|
291 name:SetPoint ("left", icon, "right", 2, 0)
|
|
Tercio@41
|
292 line.icon = icon
|
|
Tercio@41
|
293 line.name = name
|
|
Tercio@41
|
294
|
|
Tercio@41
|
295 return line
|
|
Tercio@41
|
296 end
|
|
Tercio@41
|
297
|
|
Tercio@41
|
298 local scroll_refresh = function (self, data, offset, total_lines)
|
|
Tercio@41
|
299 for i = 1, total_lines do
|
|
Tercio@41
|
300 local index = i + offset
|
|
Tercio@41
|
301 local aura = data [index]
|
|
Tercio@41
|
302 if (aura) then
|
|
Tercio@41
|
303 local line = self:GetLine (i)
|
|
Tercio@41
|
304 local name, _, icon = GetSpellInfo (aura)
|
|
Tercio@41
|
305 line.value = aura
|
|
Tercio@41
|
306 if (name) then
|
|
Tercio@41
|
307 line.name:SetText (name)
|
|
Tercio@41
|
308 line.icon:SetTexture (icon)
|
|
Tercio@41
|
309 else
|
|
Tercio@41
|
310 line.name:SetText (aura)
|
|
Tercio@41
|
311 line.icon:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]])
|
|
Tercio@41
|
312 end
|
|
Tercio@41
|
313 end
|
|
Tercio@41
|
314 end
|
|
Tercio@41
|
315 end
|
|
Tercio@41
|
316
|
|
Tercio@41
|
317 local buffs_added = self:CreateScrollBox (f_manual, "$parentBuffsAdded", scroll_refresh, f.db.aura_tracker.buff, scroll_width, scroll_height, scroll_lines, scroll_line_height)
|
|
Tercio@41
|
318 buffs_added:SetPoint ("topleft", f_manual, "topleft", 0, y)
|
|
Tercio@41
|
319 buffs_added:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
|
Tercio@41
|
320 buffs_added:SetBackdropColor (0, 0, 0, 0.2)
|
|
Tercio@41
|
321 buffs_added:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@41
|
322 for i = 1, scroll_lines do
|
|
Tercio@41
|
323 buffs_added:CreateLine (scroll_createline)
|
|
Tercio@41
|
324 end
|
|
Tercio@41
|
325
|
|
Tercio@41
|
326 local debuffs_added = self:CreateScrollBox (f_manual, "$parentDebuffsAdded", scroll_refresh, f.db.aura_tracker.debuff, scroll_width, scroll_height, scroll_lines, scroll_line_height)
|
|
Tercio@41
|
327 debuffs_added:SetPoint ("topleft", f_manual, "topleft", width+30, y)
|
|
Tercio@41
|
328 debuffs_added:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
|
Tercio@41
|
329 debuffs_added:SetBackdropColor (0, 0, 0, 0.2)
|
|
Tercio@41
|
330 debuffs_added:SetBackdropBorderColor (0, 0, 0, 1)
|
|
Tercio@41
|
331 for i = 1, scroll_lines do
|
|
Tercio@41
|
332 debuffs_added:CreateLine (scroll_createline)
|
|
Tercio@41
|
333 end
|
|
Tercio@41
|
334
|
|
Tercio@41
|
335 f.buffs_added = buffs_added
|
|
Tercio@41
|
336 f.debuffs_added = debuffs_added
|
|
Tercio@41
|
337
|
|
Tercio@41
|
338 local buffs_added_name = DF:CreateLabel (buffs_added, "Buffs", 12, "silver")
|
|
Tercio@41
|
339 buffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE"))
|
|
Tercio@41
|
340 buffs_added_name:SetPoint ("bottomleft", buffs_added, "topleft", 0, 2)
|
|
Tercio@41
|
341 buffs_added.Title = buffs_added_name
|
|
Tercio@41
|
342 local debuffs_added_name = DF:CreateLabel (debuffs_added, "Debuffs", 12, "silver")
|
|
Tercio@41
|
343 debuffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE"))
|
|
Tercio@41
|
344 debuffs_added_name:SetPoint ("bottomleft", debuffs_added, "topleft", 0, 2)
|
|
Tercio@41
|
345 debuffs_added.Title = debuffs_added_name
|
|
Tercio@41
|
346
|
|
Tercio@41
|
347 --> build the text entry to type the spellname
|
|
Tercio@41
|
348 local new_buff_string = self:CreateLabel (f_manual, "Add Buff")
|
|
Tercio@41
|
349 local new_debuff_string = self:CreateLabel (f_manual, "Add Debuff")
|
|
Tercio@41
|
350
|
|
Tercio@41
|
351 local new_buff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewBuffTextBox", _, _, options_dropdown_template)
|
|
Tercio@41
|
352 local new_debuff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewDebuffTextBox", _, _, options_dropdown_template)
|
|
Tercio@41
|
353
|
|
Tercio@41
|
354 new_buff_entry:SetJustifyH ("left")
|
|
Tercio@41
|
355 new_debuff_entry:SetJustifyH ("left")
|
|
Tercio@41
|
356
|
|
Tercio@41
|
357 DF:SetAutoCompleteWithSpells (new_buff_entry)
|
|
Tercio@41
|
358 DF:SetAutoCompleteWithSpells (new_debuff_entry)
|
|
Tercio@41
|
359
|
|
Tercio@41
|
360 local add_buff_button = self:CreateButton (f_manual, function()
|
|
Tercio@41
|
361 local text = new_buff_entry.text
|
|
Tercio@41
|
362 new_buff_entry:SetText ("")
|
|
Tercio@41
|
363 new_buff_entry:ClearFocus()
|
|
Tercio@41
|
364 if (text ~= "") then
|
|
Tercio@41
|
365 --> check for more than one spellname
|
|
Tercio@41
|
366 if (text:find (";")) then
|
|
Tercio@41
|
367 for _, spellname in ipairs ({strsplit (";", text)}) do
|
|
Tercio@41
|
368 spellname = self:trim (spellname)
|
|
Tercio@41
|
369 if (string.len (spellname) > 0) then
|
|
Tercio@41
|
370 tinsert (f.db.aura_tracker.buff, spellname)
|
|
Tercio@41
|
371 end
|
|
Tercio@41
|
372 end
|
|
Tercio@41
|
373 else
|
|
Tercio@41
|
374 tinsert (f.db.aura_tracker.buff, text)
|
|
Tercio@41
|
375 end
|
|
Tercio@41
|
376
|
|
Tercio@41
|
377 buffs_added:Refresh()
|
|
Tercio@41
|
378 end
|
|
Tercio@41
|
379 end, 100, 20, "Add Buff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
|
|
Tercio@41
|
380 local add_debuff_button = self:CreateButton (f_manual, function()
|
|
Tercio@41
|
381 local text = new_debuff_entry.text
|
|
Tercio@41
|
382 new_debuff_entry:SetText ("")
|
|
Tercio@41
|
383 new_debuff_entry:ClearFocus()
|
|
Tercio@41
|
384 if (text ~= "") then
|
|
Tercio@41
|
385 --> check for more than one spellname
|
|
Tercio@41
|
386 if (text:find (";")) then
|
|
Tercio@41
|
387 for _, spellname in ipairs ({strsplit (";", text)}) do
|
|
Tercio@41
|
388 spellname = self:trim (spellname)
|
|
Tercio@41
|
389 if (string.len (spellname) > 0) then
|
|
Tercio@41
|
390 tinsert (f.db.aura_tracker.debuff, spellname)
|
|
Tercio@41
|
391 end
|
|
Tercio@41
|
392 end
|
|
Tercio@41
|
393 else
|
|
Tercio@41
|
394 tinsert (f.db.aura_tracker.debuff, text)
|
|
Tercio@41
|
395 end
|
|
Tercio@41
|
396 debuffs_added:Refresh()
|
|
Tercio@41
|
397 end
|
|
Tercio@41
|
398 end, 100, 20, "Add Debuff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
|
|
Tercio@41
|
399
|
|
Tercio@41
|
400 local multiple_spells_label = DF:CreateLabel (buffs_added, "You can add multiple auras at once by separating them with ';'.\nExample: Fireball; Frostbolt; Flamestrike", 10, "gray")
|
|
Tercio@41
|
401 multiple_spells_label:SetSize (350, 60)
|
|
Tercio@41
|
402 multiple_spells_label:SetJustifyV ("top")
|
|
Tercio@41
|
403
|
|
Tercio@41
|
404 local export_box = self:CreateTextEntry (f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template)
|
|
Tercio@41
|
405
|
|
Tercio@41
|
406 local export_buff_button = self:CreateButton (f_manual, function()
|
|
Tercio@41
|
407 local str = ""
|
|
Tercio@41
|
408 for _, spellname in ipairs (f.db.aura_tracker.buff) do
|
|
Tercio@41
|
409 str = str .. spellname .. "; "
|
|
Tercio@41
|
410 end
|
|
Tercio@41
|
411 export_box.text = str
|
|
Tercio@41
|
412 export_box:SetFocus (true)
|
|
Tercio@41
|
413 export_box:HighlightText()
|
|
Tercio@41
|
414
|
|
Tercio@41
|
415 end, 120, 20, "Export Buffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
|
|
Tercio@41
|
416
|
|
Tercio@41
|
417 local export_debuff_button = self:CreateButton (f_manual, function()
|
|
Tercio@41
|
418 local str = ""
|
|
Tercio@41
|
419 for _, spellname in ipairs (f.db.aura_tracker.debuff) do
|
|
Tercio@41
|
420 str = str .. spellname .. "; "
|
|
Tercio@41
|
421 end
|
|
Tercio@41
|
422 export_box.text = str
|
|
Tercio@41
|
423 export_box:SetFocus (true)
|
|
Tercio@41
|
424 export_box:HighlightText()
|
|
Tercio@41
|
425
|
|
Tercio@41
|
426 end, 120, 20, "Export Debuffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"))
|
|
Tercio@41
|
427
|
|
Tercio@41
|
428 multiple_spells_label:SetPoint ("topleft", f_manual, "topleft", 480, -120)
|
|
Tercio@41
|
429
|
|
Tercio@41
|
430 export_buff_button:SetPoint ("topleft", f_manual, "topleft", 480, -160)
|
|
Tercio@41
|
431 export_debuff_button:SetPoint ("left",export_buff_button, "right", 2, 0)
|
|
Tercio@41
|
432 export_box:SetPoint ("topleft", f_manual, "topleft", 480, -185)
|
|
Tercio@41
|
433
|
|
Tercio@41
|
434 new_buff_string:SetPoint ("topleft", f_manual, "topleft", 480, -40)
|
|
Tercio@41
|
435 new_buff_entry:SetPoint ("topleft", new_buff_string, "bottomleft", 0, -2)
|
|
Tercio@41
|
436 add_buff_button:SetPoint ("left", new_buff_entry, "right", 2, 0)
|
|
Tercio@41
|
437 add_buff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it."
|
|
Tercio@41
|
438
|
|
Tercio@41
|
439 new_debuff_string:SetPoint ("topleft", f_manual, "topleft", 480, -80)
|
|
Tercio@41
|
440 new_debuff_entry:SetPoint ("topleft", new_debuff_string, "bottomleft", 0, -2)
|
|
Tercio@41
|
441 add_debuff_button:SetPoint ("left", new_debuff_entry, "right", 2, 0)
|
|
Tercio@41
|
442 add_debuff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it."
|
|
Tercio@41
|
443
|
|
Tercio@41
|
444 buffs_added:Refresh()
|
|
Tercio@41
|
445 debuffs_added:Refresh()
|
|
Tercio@41
|
446
|
|
Tercio@41
|
447 return f
|
|
Tercio@41
|
448 end
|
|
Tercio@41
|
449
|
|
Tercio@41
|
450
|
|
Tercio@41
|
451 function DF:GetAllPlayerSpells (include_lower_case)
|
|
Tercio@41
|
452 local playerSpells = {}
|
|
Tercio@41
|
453 local tab, tabTex, offset, numSpells = GetSpellTabInfo (2)
|
|
Tercio@41
|
454 for i = 1, numSpells do
|
|
Tercio@41
|
455 local index = offset + i
|
|
Tercio@41
|
456 local spellType, spellId = GetSpellBookItemInfo (index, "player")
|
|
Tercio@41
|
457 if (spellType == "SPELL") then
|
|
Tercio@41
|
458 local spellName = GetSpellInfo (spellId)
|
|
Tercio@41
|
459 tinsert (playerSpells, spellName)
|
|
Tercio@41
|
460 if (include_lower_case) then
|
|
Tercio@41
|
461 tinsert (playerSpells, lower (spellName))
|
|
Tercio@41
|
462 end
|
|
Tercio@41
|
463 end
|
|
Tercio@41
|
464 end
|
|
Tercio@41
|
465 return playerSpells
|
|
Tercio@41
|
466 end
|
|
Tercio@41
|
467
|
|
Tercio@41
|
468 function DF:SetAutoCompleteWithSpells (textentry)
|
|
Tercio@41
|
469 textentry:SetHook ("OnEditFocusGained", function()
|
|
Tercio@41
|
470 local playerSpells = DF:GetAllPlayerSpells (true)
|
|
Tercio@41
|
471 textentry.WordList = playerSpells
|
|
Tercio@41
|
472 end)
|
|
Tercio@41
|
473 textentry:SetAsAutoComplete ("WordList")
|
|
Tercio@41
|
474 end
|
|
Tercio@41
|
475
|
|
Tercio@41
|
476 --check for aura
|
|
Tercio@41
|
477
|
|
Tercio@41
|
478
|
|
Tercio@41
|
479 -- add aura
|
|
Tercio@41
|
480
|
|
Tercio@41
|
481
|
|
Tercio@41
|
482 --handle savedvariables
|
|
Tercio@41
|
483
|
|
Tercio@41
|
484
|
|
Tercio@41
|
485 --remove a aura
|
|
Tercio@41
|
486
|
|
Tercio@41
|
487
|
|
Tercio@41
|
488
|
|
Tercio@41
|
489
|
|
Tercio@41
|
490
|
|
Tercio@41
|
491 --handle UNIT_AURA event
|
|
Tercio@41
|
492
|
|
Tercio@41
|
493
|