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