Tercio@41: Tercio@41: local DF = _G ["DetailsFramework"] Tercio@41: if (not DF or not DetailsFrameworkCanLoad) then Tercio@41: return Tercio@41: end Tercio@41: Tercio@41: local _ Tercio@41: local tinsert = tinsert Tercio@41: local GetSpellInfo = GetSpellInfo Tercio@41: local lower = string.lower Tercio@41: local GetSpellBookItemInfo = GetSpellBookItemInfo Tercio@41: Tercio@41: local cleanfunction = function() end Tercio@41: Tercio@41: do Tercio@41: local metaPrototype = { Tercio@41: WidgetType = "aura_tracker", Tercio@41: SetHook = DF.SetHook, Tercio@41: RunHooksForWidget = DF.RunHooksForWidget, Tercio@41: } Tercio@41: Tercio@41: _G [DF.GlobalWidgetControlNames ["aura_tracker"]] = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] or metaPrototype Tercio@41: end Tercio@41: Tercio@41: local AuraTrackerMetaFunctions = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] Tercio@41: Tercio@41: --create panels Tercio@41: local on_profile_changed = function (self, newdb) Tercio@41: self.db = newdb Tercio@41: self.tracking_method:Select (newdb.aura_tracker.track_method) Tercio@41: Tercio@41: --automatic Tercio@41: self.buff_ignored:SetData (newdb.aura_tracker.buff_banned) Tercio@41: self.debuff_ignored:SetData (newdb.aura_tracker.debuff_banned) Tercio@41: self.buff_available:Refresh() Tercio@41: self.buff_ignored:Refresh() Tercio@41: self.debuff_available:Refresh() Tercio@41: self.debuff_ignored:Refresh() Tercio@41: Tercio@41: --manual Tercio@41: self.buffs_added:SetData (newdb.aura_tracker.buff) Tercio@41: self.debuffs_added:SetData (newdb.aura_tracker.debuff) Tercio@41: self.buffs_added:Refresh() Tercio@41: self.debuffs_added:Refresh() Tercio@41: Tercio@41: --method Tercio@41: if (newdb.aura_tracker.track_method == 0x1) then Tercio@41: self.f_auto:Show() Tercio@41: self.f_manual:Hide() Tercio@41: elseif (newdb.aura_tracker.track_method == 0x2) then Tercio@41: self.f_auto:Hide() Tercio@41: self.f_manual:Show() Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: local aura_panel_defaultoptions = { Tercio@41: height = 400, Tercio@41: row_height = 16, Tercio@41: width = 230, Tercio@41: } Tercio@41: function DF:CreateAuraConfigPanel (parent, name, db, method_change_callback, options) Tercio@41: Tercio@41: local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") Tercio@41: local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") Tercio@41: local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") Tercio@41: local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") Tercio@41: local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") Tercio@41: Tercio@41: local f = CreateFrame ("frame", name, parent) Tercio@41: f.db = db Tercio@41: f.OnProfileChanged = on_profile_changed Tercio@41: options = options or {} Tercio@41: self.table.deploy (options, aura_panel_defaultoptions) Tercio@41: Tercio@41: local f_auto = CreateFrame ("frame", "$parent_Automatic", f) Tercio@41: local f_manual = CreateFrame ("frame", "$parent_Manual", f) Tercio@41: f_auto:SetPoint ("topleft", f, "topleft", 0, -24) Tercio@41: f_manual:SetPoint ("topleft", f, "topleft", 0, -24) Tercio@41: f_auto:SetSize (600, 600) Tercio@41: f_manual:SetSize (600, 600) Tercio@41: f.f_auto = f_auto Tercio@41: f.f_manual = f_manual Tercio@41: Tercio@41: local on_select_tracking_option = function (_, _, method) Tercio@41: f.db.aura_tracker.track_method = method Tercio@41: if (method_change_callback) then Tercio@41: method_change_callback (self, method) Tercio@41: end Tercio@41: Tercio@41: if (method == 0x1) then Tercio@41: f_auto:Show() Tercio@41: f_manual:Hide() Tercio@41: 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: f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 8) Tercio@41: elseif (method == 0x2) then Tercio@41: f_auto:Hide() Tercio@41: f_manual:Show() Tercio@41: f.desc_label.text = "Auras are being tracked manually, the addon only check for auras you entered below." Tercio@41: f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 1) Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: local tracking_options = function() Tercio@41: return { Tercio@41: {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: {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: } Tercio@41: end Tercio@41: Tercio@41: local tracking_method_label = self:CreateLabel (f, "Tracking Aura Method:", 12, "orange") Tercio@41: 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: Tercio@41: tracking_method_label:SetPoint ("topleft", f, "topleft", 10, -10) Tercio@41: tracking_method:SetPoint ("left", tracking_method_label, "right", 2, 0) Tercio@41: tracking_method:SetFrameStrata ("tooltip") Tercio@41: tracking_method.tooltip = "Choose which aura tracking method you want to use." Tercio@41: f.tracking_method = tracking_method Tercio@41: Tercio@41: f.desc_label = self:CreateLabel (f, "", 10, "silver") Tercio@41: f.desc_label:SetSize (400, 40) Tercio@41: f.desc_label:SetPoint ("topleft", tracking_method, "topright", 10, 8) Tercio@41: f.desc_label:SetJustifyV ("top") Tercio@41: Tercio@41: --------automatic Tercio@41: Tercio@41: local ALL_BUFFS = {} Tercio@41: local ALL_DEBUFFS = {} Tercio@41: Tercio@41: local width, height, row_height = options.width, options.height, options.row_height Tercio@41: Tercio@41: 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: function (spellid) Tercio@41: f.db.aura_tracker.buff_banned [spellid] = nil; Tercio@41: end, Tercio@41: { Tercio@41: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@41: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@41: height = height, Tercio@41: row_height = row_height, Tercio@41: width = width, Tercio@41: 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: }) Tercio@41: Tercio@41: 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: f.db.aura_tracker.buff_banned [spellid] = true; buff_ignored:Refresh() Tercio@41: end, Tercio@41: { Tercio@41: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@41: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@41: height = height, Tercio@41: row_height = row_height, Tercio@41: width = width, Tercio@41: 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: }) Tercio@41: Tercio@41: 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: f.db.aura_tracker.debuff_banned [spellid] = nil; Tercio@41: end, Tercio@41: { Tercio@41: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@41: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@41: height = height, Tercio@41: row_height = row_height, Tercio@41: width = width, Tercio@41: 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: }) Tercio@41: Tercio@41: 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: f.db.aura_tracker.debuff_banned [spellid] = true; debuff_ignored:Refresh() Tercio@41: end, { Tercio@41: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@41: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@41: height = height, Tercio@41: row_height = row_height, Tercio@41: width = width, Tercio@41: 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: }) Tercio@41: Tercio@41: --como ira preencher ela no inicio e como ficara o lance dos profiles Tercio@41: Tercio@41: local y = -40 Tercio@41: buff_available:SetPoint ("topleft", f_auto, "topleft", 0, y) Tercio@41: buff_ignored:SetPoint ("topleft", f_auto, "topleft", 6 + width, y) Tercio@41: debuff_available:SetPoint ("topleft", f_auto, "topleft", 12 + (width*2), y) Tercio@41: debuff_ignored:SetPoint ("topleft", f_auto, "topleft", 18 + (width*3), y) Tercio@41: Tercio@41: f.buff_available = buff_available Tercio@41: f.buff_ignored = buff_ignored Tercio@41: f.debuff_available = debuff_available Tercio@41: f.debuff_ignored = debuff_ignored Tercio@41: Tercio@41: local readCombatLog = CreateFrame ("frame", nil, f_auto) Tercio@41: readCombatLog:SetScript ("OnEvent", function (self, event, time, token, hidding, sourceGUID, sourceName, sourceFlag, sourceFlag2, targetGUID, targetName, targetFlag, targetFlag2, spellid, spellname, spellschool, auraType, amount) Tercio@41: if (auraType == "BUFF" and sourceGUID == readCombatLog.playerGUID) then Tercio@41: if (not ALL_BUFFS [spellid]) then Tercio@41: ALL_BUFFS [spellid] = true Tercio@41: buff_available:Refresh() Tercio@41: end Tercio@41: elseif (auraType == "DEBUFF" and sourceGUID == readCombatLog.playerGUID) then Tercio@41: if (not ALL_DEBUFFS [spellid]) then Tercio@41: ALL_DEBUFFS [spellid] = true Tercio@41: debuff_available:Refresh() Tercio@41: end Tercio@41: end Tercio@41: end) Tercio@41: Tercio@41: f_auto:SetScript ("OnShow", function() Tercio@41: for i = 1, BUFF_MAX_DISPLAY do Tercio@41: local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HELPFUL") Tercio@41: if (name) then Tercio@41: ALL_BUFFS [spellId] = true Tercio@41: end Tercio@41: local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HARMFUL") Tercio@41: if (name) then Tercio@41: ALL_DEBUFFS [spellId] = true Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: buff_available:Refresh() Tercio@41: buff_ignored:Refresh() Tercio@41: debuff_available:Refresh() Tercio@41: debuff_ignored:Refresh() Tercio@41: Tercio@41: readCombatLog.playerGUID = UnitGUID ("player") Tercio@41: readCombatLog:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") Tercio@41: end) Tercio@41: f_auto:SetScript ("OnHide", function() Tercio@41: readCombatLog:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") Tercio@41: end) Tercio@41: Tercio@41: --show the frame selecton on the f.db Tercio@41: on_select_tracking_option (_, _, f.db.aura_tracker.track_method) Tercio@41: Tercio@41: -------manual Tercio@41: Tercio@41: --> build the two aura scrolls for buff and debuff Tercio@41: Tercio@41: local scroll_width = width Tercio@41: local scroll_height = height Tercio@41: local scroll_lines = 15 Tercio@41: local scroll_line_height = 20 Tercio@41: Tercio@41: local backdrop_color = {.8, .8, .8, 0.2} Tercio@41: local backdrop_color_on_enter = {.8, .8, .8, 0.4} Tercio@41: Tercio@41: local line_onenter = function (self) Tercio@41: self:SetBackdropColor (unpack (backdrop_color_on_enter)) Tercio@41: local spellid = select (7, GetSpellInfo (self.value)) Tercio@41: if (spellid) then Tercio@41: GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); Tercio@41: GameTooltip:SetSpellByID (spellid) Tercio@41: GameTooltip:AddLine (" ") Tercio@41: GameTooltip:AddLine ("Click to untrack this aura", .2, 1, .2) Tercio@41: GameTooltip:Show() Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: local line_onleave = function (self) Tercio@41: self:SetBackdropColor (unpack (backdrop_color)) Tercio@41: GameTooltip:Hide() Tercio@41: end Tercio@41: local line_onclick = function (self) Tercio@41: local spell = self.value Tercio@41: local data = self:GetParent():GetData() Tercio@41: Tercio@41: for i = 1, #data do Tercio@41: if (data[i] == spell) then Tercio@41: tremove (data, i) Tercio@41: break Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: self:GetParent():Refresh() Tercio@41: end Tercio@41: Tercio@41: local scroll_createline = function (self, index) Tercio@41: local line = CreateFrame ("button", "$parentLine" .. index, self) Tercio@41: line:SetPoint ("topleft", self, "topleft", 0, -((index-1)*(scroll_line_height+1))) Tercio@41: line:SetSize (scroll_width, scroll_line_height) Tercio@41: line:SetScript ("OnEnter", line_onenter) Tercio@41: line:SetScript ("OnLeave", line_onleave) Tercio@41: line:SetScript ("OnClick", line_onclick) Tercio@41: Tercio@41: line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) Tercio@41: line:SetBackdropColor (unpack (backdrop_color)) Tercio@41: Tercio@41: local icon = line:CreateTexture ("$parentIcon", "overlay") Tercio@41: icon:SetSize (scroll_line_height, scroll_line_height) Tercio@41: local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal") Tercio@41: icon:SetPoint ("left", line, "left", 2, 0) Tercio@41: name:SetPoint ("left", icon, "right", 2, 0) Tercio@41: line.icon = icon Tercio@41: line.name = name Tercio@41: Tercio@41: return line Tercio@41: end Tercio@41: Tercio@41: local scroll_refresh = function (self, data, offset, total_lines) Tercio@41: for i = 1, total_lines do Tercio@41: local index = i + offset Tercio@41: local aura = data [index] Tercio@41: if (aura) then Tercio@41: local line = self:GetLine (i) Tercio@41: local name, _, icon = GetSpellInfo (aura) Tercio@41: line.value = aura Tercio@41: if (name) then Tercio@41: line.name:SetText (name) Tercio@41: line.icon:SetTexture (icon) Tercio@41: else Tercio@41: line.name:SetText (aura) Tercio@41: line.icon:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]]) Tercio@41: end Tercio@41: end Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: 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: buffs_added:SetPoint ("topleft", f_manual, "topleft", 0, y) Tercio@41: buffs_added:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) Tercio@41: buffs_added:SetBackdropColor (0, 0, 0, 0.2) Tercio@41: buffs_added:SetBackdropBorderColor (0, 0, 0, 1) Tercio@41: for i = 1, scroll_lines do Tercio@41: buffs_added:CreateLine (scroll_createline) Tercio@41: end Tercio@41: Tercio@41: 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: debuffs_added:SetPoint ("topleft", f_manual, "topleft", width+30, y) Tercio@41: debuffs_added:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) Tercio@41: debuffs_added:SetBackdropColor (0, 0, 0, 0.2) Tercio@41: debuffs_added:SetBackdropBorderColor (0, 0, 0, 1) Tercio@41: for i = 1, scroll_lines do Tercio@41: debuffs_added:CreateLine (scroll_createline) Tercio@41: end Tercio@41: Tercio@41: f.buffs_added = buffs_added Tercio@41: f.debuffs_added = debuffs_added Tercio@41: Tercio@41: local buffs_added_name = DF:CreateLabel (buffs_added, "Buffs", 12, "silver") Tercio@41: buffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@41: buffs_added_name:SetPoint ("bottomleft", buffs_added, "topleft", 0, 2) Tercio@41: buffs_added.Title = buffs_added_name Tercio@41: local debuffs_added_name = DF:CreateLabel (debuffs_added, "Debuffs", 12, "silver") Tercio@41: debuffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@41: debuffs_added_name:SetPoint ("bottomleft", debuffs_added, "topleft", 0, 2) Tercio@41: debuffs_added.Title = debuffs_added_name Tercio@41: Tercio@41: --> build the text entry to type the spellname Tercio@41: local new_buff_string = self:CreateLabel (f_manual, "Add Buff") Tercio@41: local new_debuff_string = self:CreateLabel (f_manual, "Add Debuff") Tercio@41: Tercio@41: local new_buff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewBuffTextBox", _, _, options_dropdown_template) Tercio@41: local new_debuff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewDebuffTextBox", _, _, options_dropdown_template) Tercio@41: Tercio@41: new_buff_entry:SetJustifyH ("left") Tercio@41: new_debuff_entry:SetJustifyH ("left") Tercio@41: Tercio@41: DF:SetAutoCompleteWithSpells (new_buff_entry) Tercio@41: DF:SetAutoCompleteWithSpells (new_debuff_entry) Tercio@41: Tercio@41: local add_buff_button = self:CreateButton (f_manual, function() Tercio@41: local text = new_buff_entry.text Tercio@41: new_buff_entry:SetText ("") Tercio@41: new_buff_entry:ClearFocus() Tercio@41: if (text ~= "") then Tercio@41: --> check for more than one spellname Tercio@41: if (text:find (";")) then Tercio@41: for _, spellname in ipairs ({strsplit (";", text)}) do Tercio@41: spellname = self:trim (spellname) Tercio@41: if (string.len (spellname) > 0) then Tercio@41: tinsert (f.db.aura_tracker.buff, spellname) Tercio@41: end Tercio@41: end Tercio@41: else Tercio@41: tinsert (f.db.aura_tracker.buff, text) Tercio@41: end Tercio@41: Tercio@41: buffs_added:Refresh() Tercio@41: end Tercio@41: end, 100, 20, "Add Buff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) Tercio@41: local add_debuff_button = self:CreateButton (f_manual, function() Tercio@41: local text = new_debuff_entry.text Tercio@41: new_debuff_entry:SetText ("") Tercio@41: new_debuff_entry:ClearFocus() Tercio@41: if (text ~= "") then Tercio@41: --> check for more than one spellname Tercio@41: if (text:find (";")) then Tercio@41: for _, spellname in ipairs ({strsplit (";", text)}) do Tercio@41: spellname = self:trim (spellname) Tercio@41: if (string.len (spellname) > 0) then Tercio@41: tinsert (f.db.aura_tracker.debuff, spellname) Tercio@41: end Tercio@41: end Tercio@41: else Tercio@41: tinsert (f.db.aura_tracker.debuff, text) Tercio@41: end Tercio@41: debuffs_added:Refresh() Tercio@41: end Tercio@41: end, 100, 20, "Add Debuff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) Tercio@41: Tercio@41: 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: multiple_spells_label:SetSize (350, 60) Tercio@41: multiple_spells_label:SetJustifyV ("top") Tercio@41: Tercio@41: local export_box = self:CreateTextEntry (f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template) Tercio@41: Tercio@41: local export_buff_button = self:CreateButton (f_manual, function() Tercio@41: local str = "" Tercio@41: for _, spellname in ipairs (f.db.aura_tracker.buff) do Tercio@41: str = str .. spellname .. "; " Tercio@41: end Tercio@41: export_box.text = str Tercio@41: export_box:SetFocus (true) Tercio@41: export_box:HighlightText() Tercio@41: Tercio@41: end, 120, 20, "Export Buffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) Tercio@41: Tercio@41: local export_debuff_button = self:CreateButton (f_manual, function() Tercio@41: local str = "" Tercio@41: for _, spellname in ipairs (f.db.aura_tracker.debuff) do Tercio@41: str = str .. spellname .. "; " Tercio@41: end Tercio@41: export_box.text = str Tercio@41: export_box:SetFocus (true) Tercio@41: export_box:HighlightText() Tercio@41: Tercio@41: end, 120, 20, "Export Debuffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) Tercio@41: Tercio@41: multiple_spells_label:SetPoint ("topleft", f_manual, "topleft", 480, -120) Tercio@41: Tercio@41: export_buff_button:SetPoint ("topleft", f_manual, "topleft", 480, -160) Tercio@41: export_debuff_button:SetPoint ("left",export_buff_button, "right", 2, 0) Tercio@41: export_box:SetPoint ("topleft", f_manual, "topleft", 480, -185) Tercio@41: Tercio@41: new_buff_string:SetPoint ("topleft", f_manual, "topleft", 480, -40) Tercio@41: new_buff_entry:SetPoint ("topleft", new_buff_string, "bottomleft", 0, -2) Tercio@41: add_buff_button:SetPoint ("left", new_buff_entry, "right", 2, 0) Tercio@41: add_buff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it." Tercio@41: Tercio@41: new_debuff_string:SetPoint ("topleft", f_manual, "topleft", 480, -80) Tercio@41: new_debuff_entry:SetPoint ("topleft", new_debuff_string, "bottomleft", 0, -2) Tercio@41: add_debuff_button:SetPoint ("left", new_debuff_entry, "right", 2, 0) Tercio@41: add_debuff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it." Tercio@41: Tercio@41: buffs_added:Refresh() Tercio@41: debuffs_added:Refresh() Tercio@41: Tercio@41: return f Tercio@41: end Tercio@41: Tercio@41: Tercio@41: function DF:GetAllPlayerSpells (include_lower_case) Tercio@41: local playerSpells = {} Tercio@41: local tab, tabTex, offset, numSpells = GetSpellTabInfo (2) Tercio@41: for i = 1, numSpells do Tercio@41: local index = offset + i Tercio@41: local spellType, spellId = GetSpellBookItemInfo (index, "player") Tercio@41: if (spellType == "SPELL") then Tercio@41: local spellName = GetSpellInfo (spellId) Tercio@41: tinsert (playerSpells, spellName) Tercio@41: if (include_lower_case) then Tercio@41: tinsert (playerSpells, lower (spellName)) Tercio@41: end Tercio@41: end Tercio@41: end Tercio@41: return playerSpells Tercio@41: end Tercio@41: Tercio@41: function DF:SetAutoCompleteWithSpells (textentry) Tercio@41: textentry:SetHook ("OnEditFocusGained", function() Tercio@41: local playerSpells = DF:GetAllPlayerSpells (true) Tercio@41: textentry.WordList = playerSpells Tercio@41: end) Tercio@41: textentry:SetAsAutoComplete ("WordList") Tercio@41: end Tercio@41: Tercio@41: --check for aura Tercio@41: Tercio@41: Tercio@41: -- add aura Tercio@41: Tercio@41: Tercio@41: --handle savedvariables Tercio@41: Tercio@41: Tercio@41: --remove a aura Tercio@41: Tercio@41: Tercio@41: Tercio@41: Tercio@41: Tercio@41: --handle UNIT_AURA event Tercio@41: Tercio@41: