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@58: local CONST_MAX_SPELLS = 300000 Tercio@58: Tercio@58: function DF:GetAuraByName (unit, spellName, isDebuff) Tercio@58: isDebuff = isDebuff and "HARMFUL|PLAYER" Tercio@58: Tercio@58: for i = 1, 40 do Tercio@58: local name, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll = UnitAura (unit, i, isDebuff) Tercio@58: if (not name) then Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: if (name == spellName) then Tercio@58: return name, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll Tercio@58: end Tercio@58: end Tercio@58: end Tercio@58: Tercio@58: local default_text_for_aura_frame = { Tercio@58: AUTOMATIC = "Automatic", Tercio@58: MANUAL = "Manual", Tercio@58: METHOD = "Aura Tracking Method:", Tercio@58: BUFFS_IGNORED = "Buffs Ignored", Tercio@58: DEBUFFS_IGNORED = "Debuffs Ignored", Tercio@58: BUFFS_TRACKED = "Buffs Tracked", Tercio@58: DEBUFFS_TRACKED = "Debuffs Tracked", Tercio@58: Tercio@58: AUTOMATIC_DESC = "Auras are being tracked automatically, the addon controls what to show.\nYou may add auras to the blacklist or add extra auras to track.", Tercio@58: MANUAL_DESC = "Auras are being tracked manually, the addon only check for auras you entered below.", Tercio@58: Tercio@58: MANUAL_ADD_BLACKLIST_BUFF = "Add Buff to Blacklist", Tercio@58: MANUAL_ADD_BLACKLIST_DEBUFF = "Add Debuff to Blacklist", Tercio@58: MANUAL_ADD_TRACKLIST_BUFF = "Add Buff to Tracklist", Tercio@58: MANUAL_ADD_TRACKLIST_DEBUFF = "Add Debuff to Tracklist", Tercio@58: } Tercio@58: Tercio@58: function DF:LoadAllSpells (hashMap, indexTable) Tercio@58: Tercio@58: --pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance Tercio@58: Tercio@58: if (not DF.LoadingAuraAlertFrame) then Tercio@58: DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent) Tercio@58: DF.LoadingAuraAlertFrame:SetSize (340, 75) Tercio@58: DF.LoadingAuraAlertFrame:SetPoint ("center") Tercio@58: DF.LoadingAuraAlertFrame:SetFrameStrata ("TOOLTIP") Tercio@58: DF:ApplyStandardBackdrop (DF.LoadingAuraAlertFrame) Tercio@58: DF.LoadingAuraAlertFrame:SetBackdropBorderColor (1, 0.8, 0.1) Tercio@58: Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel1 = DF:CreateLabel (DF.LoadingAuraAlertFrame, "We are currently loading spell names and spell IDs") Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel2 = DF:CreateLabel (DF.LoadingAuraAlertFrame, "This may take only a few seconds") Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingImage1 = DF:CreateImage (DF.LoadingAuraAlertFrame, [[Interface\DialogFrame\UI-Dialog-Icon-AlertOther]], 32, 32) Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel1.align = "center" Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel2.align = "center" Tercio@58: Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel1:SetPoint ("center", 16, 10) Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingLabel2:SetPoint ("center", 16, -5) Tercio@58: DF.LoadingAuraAlertFrame.IsLoadingImage1:SetPoint ("left", 10, 0) Tercio@58: end Tercio@58: Tercio@58: DF.LoadingAuraAlertFrame:Show() Tercio@58: Tercio@58: C_Timer.After (0.1, function() Tercio@58: if (hashMap and not indexTable) then Tercio@58: for i = 1, CONST_MAX_SPELLS do Tercio@58: local spellName = GetSpellInfo (i) Tercio@58: if (spellName) then Tercio@58: hashMap [lower (spellName)] = i Tercio@58: end Tercio@58: end Tercio@58: Tercio@58: elseif (not hashMap and indexTable) then Tercio@58: for i = 1, CONST_MAX_SPELLS do Tercio@58: local spellName = GetSpellInfo (i) Tercio@58: if (spellName) then Tercio@58: indexTable [#indexTable+1] = lower (spellName) Tercio@58: end Tercio@58: end Tercio@58: Tercio@58: elseif (hashMap and indexTable) then Tercio@58: for i = 1, CONST_MAX_SPELLS do Tercio@58: local spellName = GetSpellInfo (i) Tercio@58: if (spellName) then Tercio@58: indexTable [#indexTable+1] = lower (spellName) Tercio@58: hashMap [indexTable [#indexTable]] = i Tercio@58: end Tercio@58: end Tercio@58: end Tercio@58: Tercio@58: DF.LoadingAuraAlertFrame:Hide() Tercio@58: end) Tercio@58: Tercio@58: end Tercio@58: 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@58: self.buff_tracked:SetData (newdb.aura_tracker.buff_tracked) Tercio@58: self.debuff_tracked:SetData (newdb.aura_tracker.debuff_tracked) Tercio@58: Tercio@41: self.buff_ignored:Refresh() Tercio@41: self.debuff_ignored:Refresh() Tercio@58: self.buff_tracked:Refresh() Tercio@58: self.debuff_tracked: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@58: Tercio@58: self.AutomaticTrackingCheckbox:SetValue (true) Tercio@58: self.ManualTrackingCheckbox:SetValue (false) Tercio@58: self.desc_label.text = texts.AUTOMATIC_DESC Tercio@58: Tercio@41: elseif (newdb.aura_tracker.track_method == 0x2) then Tercio@41: self.f_auto:Hide() Tercio@41: self.f_manual:Show() Tercio@58: Tercio@58: self.AutomaticTrackingCheckbox:SetValue (false) Tercio@58: self.ManualTrackingCheckbox:SetValue (true) Tercio@58: self.desc_label.text = texts.MANUAL_DESC Tercio@41: end Tercio@41: end Tercio@41: Tercio@41: local aura_panel_defaultoptions = { Tercio@41: height = 400, Tercio@58: row_height = 18, Tercio@41: width = 230, Tercio@58: button_text_template = "OPTIONS_FONT_TEMPLATE" Tercio@41: } Tercio@58: Tercio@58: function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, texts) 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@58: --check if the texts table is valid and also deploy default values into the table in case some value is nil Tercio@58: texts = (type (texts == "table") and texts) or default_text_for_aura_frame Tercio@58: DF.table.deploy (texts, default_text_for_aura_frame) Tercio@58: Tercio@58: ------------- Tercio@58: Tercio@58: local on_switch_tracking_method = function (self) Tercio@58: local method = self.Method Tercio@58: Tercio@41: f.db.aura_tracker.track_method = method Tercio@58: if (change_callback) then Tercio@58: DF:QuickDispatch (change_callback) Tercio@41: end Tercio@41: Tercio@41: if (method == 0x1) then Tercio@41: f_auto:Show() Tercio@41: f_manual:Hide() Tercio@58: f.AutomaticTrackingCheckbox:SetValue (true) Tercio@58: f.ManualTrackingCheckbox:SetValue (false) Tercio@58: f.desc_label.text = texts.AUTOMATIC_DESC Tercio@58: Tercio@41: elseif (method == 0x2) then Tercio@41: f_auto:Hide() Tercio@41: f_manual:Show() Tercio@58: f.AutomaticTrackingCheckbox:SetValue (false) Tercio@58: f.ManualTrackingCheckbox:SetValue (true) Tercio@58: f.desc_label.text = texts.MANUAL_DESC Tercio@41: end Tercio@41: end Tercio@41: Tercio@58: local background_method_selection = CreateFrame ("frame", nil, f) Tercio@58: background_method_selection:SetHeight (82) Tercio@58: background_method_selection:SetPoint ("topleft", f, "topleft", 0, 0) Tercio@58: background_method_selection:SetPoint ("topright", f, "topright", 0, 0) Tercio@58: DF:ApplyStandardBackdrop (background_method_selection) Tercio@58: Tercio@58: local tracking_method_label = self:CreateLabel (background_method_selection, texts.METHOD, 12, "orange") Tercio@58: tracking_method_label:SetPoint ("topleft", background_method_selection, "topleft", 6, -4) Tercio@58: Tercio@58: f.desc_label = self:CreateLabel (background_method_selection, "", 10, "silver") Tercio@58: f.desc_label:SetPoint ("left", background_method_selection, "left", 130, 0) Tercio@58: f.desc_label:SetJustifyV ("top") Tercio@58: Tercio@58: local automatic_tracking_checkbox = DF:CreateSwitch (background_method_selection, on_switch_tracking_method, f.db.aura_tracker.track_method == 0x1, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) Tercio@58: automatic_tracking_checkbox.Method = 0x1 Tercio@58: automatic_tracking_checkbox:SetAsCheckBox() Tercio@58: automatic_tracking_checkbox:SetSize (24, 24) Tercio@58: f.AutomaticTrackingCheckbox = automatic_tracking_checkbox Tercio@58: Tercio@58: local automatic_tracking_label = DF:CreateLabel (background_method_selection, "Automatic") Tercio@58: automatic_tracking_label:SetPoint ("left", automatic_tracking_checkbox, "right", 2, 0) Tercio@58: Tercio@58: local manual_tracking_checkbox = DF:CreateSwitch (background_method_selection, on_switch_tracking_method, f.db.aura_tracker.track_method == 0x2, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) Tercio@58: manual_tracking_checkbox.Method = 0x2 Tercio@58: manual_tracking_checkbox:SetAsCheckBox() Tercio@58: manual_tracking_checkbox:SetSize (24, 24) Tercio@58: f.ManualTrackingCheckbox = manual_tracking_checkbox Tercio@58: Tercio@58: local manual_tracking_label = DF:CreateLabel (background_method_selection, "Manual") Tercio@58: manual_tracking_label:SetPoint ("left", manual_tracking_checkbox, "right", 2, 0) Tercio@58: Tercio@58: automatic_tracking_checkbox:SetPoint ("topleft", tracking_method_label, "bottomleft", 0, -6) Tercio@58: manual_tracking_checkbox:SetPoint ("topleft", automatic_tracking_checkbox, "bottomleft", 0, -6) Tercio@58: Tercio@58: Tercio@58: -------- anchors points Tercio@58: Tercio@58: local y = -110 Tercio@58: local xLocation = 230 Tercio@58: Tercio@58: Tercio@58: -------- automatic Tercio@58: Tercio@58: --manual add the buff and ebuff names Tercio@58: local AllSpellsMap = {} Tercio@58: local AllSpellNames = {} Tercio@58: Tercio@58: local load_all_spells = function (self, capsule) Tercio@58: if (not next (AllSpellsMap)) then Tercio@58: DF:LoadAllSpells (AllSpellsMap, AllSpellNames) Tercio@58: Tercio@58: f_auto.AddBuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: f_auto.AddDebuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: f_auto.AddBuffTracklistTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: f_auto.AddDebuffTracklistTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: Tercio@58: f_manual.NewBuffTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: f_manual.NewDebuffTextBox.SpellAutoCompleteList = AllSpellNames Tercio@58: Tercio@58: -- Tercio@58: Tercio@58: f_auto.AddBuffBlacklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: f_auto.AddDebuffBlacklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: f_auto.AddBuffTracklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: f_auto.AddDebuffTracklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: Tercio@58: f_manual.NewBuffTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: f_manual.NewDebuffTextBox:SetAsAutoComplete ("SpellAutoCompleteList") Tercio@58: Tercio@58: -- Tercio@58: Tercio@58: f_auto.AddBuffBlacklistTextBox.ShouldOptimizeAutoComplete = true Tercio@58: f_auto.AddDebuffBlacklistTextBox.ShouldOptimizeAutoComplete = true Tercio@58: f_auto.AddBuffTracklistTextBox.ShouldOptimizeAutoComplete = true Tercio@58: f_auto.AddDebuffTracklistTextBox.ShouldOptimizeAutoComplete = true Tercio@58: Tercio@58: f_manual.NewBuffTextBox.ShouldOptimizeAutoComplete = true Tercio@58: f_manual.NewDebuffTextBox.ShouldOptimizeAutoComplete = true Tercio@58: end Tercio@41: end Tercio@58: Tercio@58: local background_add_blacklist = CreateFrame ("frame", nil, f_auto) Tercio@58: background_add_blacklist:SetSize (220, 135) Tercio@58: DF:ApplyStandardBackdrop (background_add_blacklist) Tercio@41: Tercio@58: local background_add_tracklist = CreateFrame ("frame", nil, f_auto) Tercio@58: background_add_tracklist:SetSize (220, 135) Tercio@58: DF:ApplyStandardBackdrop (background_add_tracklist) Tercio@41: Tercio@58: --black list Tercio@58: local buff_blacklist_label = self:CreateLabel (background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_BUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@58: local debuff_blacklist_label = self:CreateLabel (background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_DEBUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@58: Tercio@58: local buff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, 200, 20, "AddBuffBlacklistTextBox", _, _, options_dropdown_template) Tercio@58: buff_name_blacklist_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: buff_name_blacklist_entry:SetJustifyH ("left") Tercio@58: buff_name_blacklist_entry.tooltip = "Enter the buff name using lower case letters." Tercio@58: f_auto.AddBuffBlacklistTextBox = buff_name_blacklist_entry Tercio@58: Tercio@58: local debuff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, 200, 20, "AddDebuffBlacklistTextBox", _, _, options_dropdown_template) Tercio@58: debuff_name_blacklist_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: debuff_name_blacklist_entry:SetJustifyH ("left") Tercio@58: debuff_name_blacklist_entry.tooltip = "Enter the debuff name using lower case letters." Tercio@58: f_auto.AddDebuffBlacklistTextBox = debuff_name_blacklist_entry Tercio@41: Tercio@58: local add_blacklist_buff_button = self:CreateButton (background_add_blacklist, function() Tercio@58: local text = buff_name_blacklist_entry.text Tercio@58: buff_name_blacklist_entry:SetText ("") Tercio@58: buff_name_blacklist_entry:ClearFocus() Tercio@58: Tercio@58: if (text ~= "") then Tercio@58: text = lower (text) Tercio@58: Tercio@58: --get the spellId Tercio@58: local spellId = AllSpellsMap [text] Tercio@58: if (not spellId) then Tercio@58: print ("spell not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: --add the spellId to the blacklist Tercio@58: f.db.aura_tracker.buff_banned [spellId] = true Tercio@58: Tercio@58: --refresh the buff blacklist frame Tercio@58: _G [f_auto:GetName() .. "BuffIgnored"]:Refresh() Tercio@58: Tercio@58: DF:QuickDispatch (change_callback) Tercio@58: end Tercio@58: Tercio@58: end, 100, 20, "Add to Blacklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) Tercio@58: Tercio@58: local add_blacklist_debuff_button = self:CreateButton (background_add_blacklist, function() Tercio@58: local text = debuff_name_blacklist_entry.text Tercio@58: debuff_name_blacklist_entry:SetText ("") Tercio@58: debuff_name_blacklist_entry:ClearFocus() Tercio@58: Tercio@58: if (text ~= "") then Tercio@58: text = lower (text) Tercio@58: Tercio@58: --get the spellId Tercio@58: local spellId = AllSpellsMap [text] Tercio@58: if (not spellId) then Tercio@58: print ("spell not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: --add the spellId to the blacklist Tercio@58: f.db.aura_tracker.debuff_banned [spellId] = true Tercio@58: Tercio@58: --refresh the buff blacklist frame Tercio@58: _G [f_auto:GetName() .. "DebuffIgnored"]:Refresh() Tercio@58: Tercio@58: DF:QuickDispatch (change_callback) Tercio@58: end Tercio@58: end, 100, 20, "Add to Blacklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) Tercio@58: Tercio@58: Tercio@58: --track list Tercio@58: local buff_tracklist_label = self:CreateLabel (background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_BUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@58: local debuff_tracklist_label = self:CreateLabel (background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_DEBUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) Tercio@58: Tercio@58: local buff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, 200, 20, "AddBuffTracklistTextBox", _, _, options_dropdown_template) Tercio@58: buff_name_tracklist_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: buff_name_tracklist_entry:SetJustifyH ("left") Tercio@58: buff_name_tracklist_entry.tooltip = "Enter the buff name using lower case letters." Tercio@58: f_auto.AddBuffTracklistTextBox = buff_name_tracklist_entry Tercio@58: Tercio@58: local debuff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, 200, 20, "AddDebuffTracklistTextBox", _, _, options_dropdown_template) Tercio@58: debuff_name_tracklist_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: debuff_name_tracklist_entry:SetJustifyH ("left") Tercio@58: debuff_name_tracklist_entry.tooltip = "Enter the debuff name using lower case letters." Tercio@58: f_auto.AddDebuffTracklistTextBox = debuff_name_tracklist_entry Tercio@58: Tercio@58: local add_tracklist_buff_button = self:CreateButton (background_add_tracklist, function() Tercio@58: local text = buff_name_tracklist_entry.text Tercio@58: buff_name_tracklist_entry:SetText ("") Tercio@58: buff_name_tracklist_entry:ClearFocus() Tercio@58: Tercio@58: if (text ~= "") then Tercio@58: text = lower (text) Tercio@58: Tercio@58: --get the spellId Tercio@58: local spellId = AllSpellsMap [text] Tercio@58: if (not spellId) then Tercio@58: print ("spell not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: --add the spellId to the blacklist Tercio@58: f.db.aura_tracker.buff_tracked [spellId] = true Tercio@58: Tercio@58: --refresh the buff blacklist frame Tercio@58: _G [f_auto:GetName() .. "BuffTracked"]:Refresh() Tercio@58: Tercio@58: DF:QuickDispatch (change_callback) Tercio@58: end Tercio@58: Tercio@58: end, 100, 20, "Add to Tracklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) Tercio@58: Tercio@58: local add_tracklist_debuff_button = self:CreateButton (background_add_tracklist, function() Tercio@58: local text = debuff_name_tracklist_entry.text Tercio@58: debuff_name_tracklist_entry:SetText ("") Tercio@58: debuff_name_tracklist_entry:ClearFocus() Tercio@58: Tercio@58: if (text ~= "") then Tercio@58: text = lower (text) Tercio@58: Tercio@58: --get the spellId Tercio@58: local spellId = AllSpellsMap [text] Tercio@58: if (not spellId) then Tercio@58: print ("spell not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: --add the spellId to the blacklist Tercio@58: f.db.aura_tracker.debuff_tracked [spellId] = true Tercio@58: Tercio@58: --refresh the buff blacklist frame Tercio@58: _G [f_auto:GetName() .. "DebuffTracked"]:Refresh() Tercio@58: Tercio@58: DF:QuickDispatch (change_callback) Tercio@58: end Tercio@58: end, 100, 20, "Add to Tracklist", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE"), DF:GetTemplate ("font", options.button_text_template)) Tercio@58: Tercio@58: --anchors: Tercio@58: background_add_blacklist:SetPoint ("topleft", f_auto, "topleft", 0, y) Tercio@58: background_add_tracklist:SetPoint ("topleft", background_add_blacklist, "bottomleft", 0, -10) Tercio@58: Tercio@58: --debuff blacklist Tercio@58: debuff_name_blacklist_entry:SetPoint ("topleft", background_add_blacklist, "topleft", 4, -20) Tercio@58: debuff_blacklist_label:SetPoint ("bottomleft", debuff_name_blacklist_entry, "topleft", 0, 2) Tercio@58: add_blacklist_debuff_button:SetPoint ("topleft", debuff_name_blacklist_entry, "bottomleft", 0, -2) Tercio@58: Tercio@58: --buff blacklist Tercio@58: buff_blacklist_label:SetPoint ("topleft", add_blacklist_debuff_button.widget, "bottomleft", 0, -10) Tercio@58: buff_name_blacklist_entry:SetPoint ("topleft", buff_blacklist_label, "bottomleft", 0, -2) Tercio@58: add_blacklist_buff_button:SetPoint ("topleft", buff_name_blacklist_entry, "bottomleft", 0, -2) Tercio@41: Tercio@58: Tercio@58: --debuff tracklist Tercio@58: debuff_name_tracklist_entry:SetPoint ("topleft", background_add_tracklist, "topleft", 4, -20) Tercio@58: debuff_tracklist_label:SetPoint ("bottomleft", debuff_name_tracklist_entry, "topleft", 0, 2) Tercio@58: add_tracklist_debuff_button:SetPoint ("topleft", debuff_name_tracklist_entry, "bottomleft", 0, -2) Tercio@58: Tercio@58: --buff tracklist Tercio@58: buff_tracklist_label:SetPoint ("topleft", add_tracklist_debuff_button.widget, "bottomleft", 0, -10) Tercio@58: buff_name_tracklist_entry:SetPoint ("topleft", buff_tracklist_label, "bottomleft", 0, -2) Tercio@58: add_tracklist_buff_button:SetPoint ("topleft", buff_name_tracklist_entry, "bottomleft", 0, -2) Tercio@41: Tercio@41: local ALL_BUFFS = {} Tercio@41: local ALL_DEBUFFS = {} Tercio@41: Tercio@58: --options passed to the create aura panel Tercio@41: local width, height, row_height = options.width, options.height, options.row_height Tercio@58: Tercio@41: Tercio@58: --Debuffs on the black list Tercio@58: local debuff_ignored = self:CreateSimpleListBox (f_auto, "$parentDebuffIgnored", texts.DEBUFFS_IGNORED, "the list is empty", f.db.aura_tracker.debuff_banned, function (spellid) Tercio@58: --f.db.aura_tracker.debuff_banned [spellid] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: { Tercio@58: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@58: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@58: height = height, Tercio@58: row_height = row_height, Tercio@58: width = width, Tercio@58: backdrop_color = {.8, .8, .8, 0.2}, Tercio@58: panel_border_color = {.01, 0, 0, 1}, Tercio@58: iconcoords = {.1, .9, .1, .9}, Tercio@58: onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, Tercio@58: show_x_button = true, Tercio@58: x_button_func = function (spellId) Tercio@58: f.db.aura_tracker.debuff_banned [spellId] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: }) Tercio@41: Tercio@58: --Buffs on the black list Tercio@58: local buff_ignored = self:CreateSimpleListBox (f_auto, "$parentBuffIgnored", texts.BUFFS_IGNORED, "the list is empty", f.db.aura_tracker.buff_banned, Tercio@58: function (spellid) Tercio@58: --f.db.aura_tracker.buff_banned [spellid] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: { Tercio@58: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@58: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@58: height = height, Tercio@58: row_height = row_height, Tercio@58: width = width, Tercio@58: backdrop_color = {.8, .8, .8, 0.2}, Tercio@58: panel_border_color = {.02, 0, 0, 1}, Tercio@58: iconcoords = {.1, .9, .1, .9}, Tercio@58: onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, Tercio@58: show_x_button = true, Tercio@58: x_button_func = function (spellId) Tercio@58: f.db.aura_tracker.buff_banned [spellId] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: }) Tercio@41: Tercio@58: --Debuffs on the track list Tercio@58: local debuff_tracked = self:CreateSimpleListBox (f_auto, "$parentDebuffTracked", texts.DEBUFFS_TRACKED, "the list is empty", f.db.aura_tracker.debuff_tracked, function (spellid) Tercio@58: --f.db.aura_tracker.debuff_tracked [spellid] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: { Tercio@58: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@58: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@58: height = height, Tercio@58: row_height = row_height, Tercio@58: width = width, Tercio@58: backdrop_color = {.8, .8, .8, 0.2}, Tercio@58: panel_border_color = {0, .02, 0, 1}, Tercio@58: iconcoords = {.1, .9, .1, .9}, Tercio@58: onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, Tercio@58: show_x_button = true, Tercio@58: x_button_func = function (spellId) Tercio@58: f.db.aura_tracker.debuff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: }) Tercio@58: Tercio@58: --Buffs on the track list Tercio@58: local buff_tracked = self:CreateSimpleListBox (f_auto, "$parentBuffTracked", texts.BUFFS_TRACKED, "the list is empty", f.db.aura_tracker.buff_tracked, function (spellid) Tercio@58: --f.db.aura_tracker.buff_tracked [spellid] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: { Tercio@58: icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, Tercio@58: text = function(spellid) return select (1, GetSpellInfo (spellid)) end, Tercio@58: height = height, Tercio@58: row_height = row_height, Tercio@58: width = width, Tercio@58: backdrop_color = {.8, .8, .8, 0.2}, Tercio@58: panel_border_color = {0, .01, 0, 1}, Tercio@58: iconcoords = {.1, .9, .1, .9}, Tercio@58: onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, Tercio@58: show_x_button = true, Tercio@58: x_button_func = function (spellId) Tercio@58: f.db.aura_tracker.buff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); Tercio@58: end, Tercio@58: }) Tercio@58: Tercio@58: debuff_ignored:SetPoint ("topleft", f_auto, "topleft", 0 + xLocation, y) Tercio@58: buff_ignored:SetPoint ("topleft", f_auto, "topleft", 8 + width + xLocation, y) Tercio@58: debuff_tracked:SetPoint ("topleft", f_auto, "topleft", 16 + (width*2) + xLocation, y) Tercio@58: buff_tracked:SetPoint ("topleft", f_auto, "topleft", 24 + (width*3) + xLocation, y) Tercio@58: Tercio@41: f.buff_ignored = buff_ignored Tercio@41: f.debuff_ignored = debuff_ignored Tercio@58: f.buff_tracked = buff_tracked Tercio@58: f.debuff_tracked = debuff_tracked Tercio@41: Tercio@41: f_auto:SetScript ("OnShow", function() Tercio@41: for i = 1, BUFF_MAX_DISPLAY do Tercio@58: local name, 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@58: local name, 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@58: buff_tracked:Refresh() Tercio@58: debuff_tracked:Refresh() Tercio@58: buff_ignored:Refresh() Tercio@41: debuff_ignored:Refresh() Tercio@41: Tercio@41: end) Tercio@41: f_auto:SetScript ("OnHide", function() Tercio@58: -- Tercio@41: end) Tercio@58: Tercio@41: --show the frame selecton on the f.db Tercio@58: Tercio@58: if (f.db.aura_tracker.track_method == 0x1) then Tercio@58: on_switch_tracking_method (automatic_tracking_checkbox) Tercio@58: elseif (f.db.aura_tracker.track_method == 0x2) then Tercio@58: on_switch_tracking_method (manual_tracking_checkbox) Tercio@58: end 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: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@58: Tercio@58: local onclick_remove_button = function (self) Tercio@58: local spell = self:GetParent().value Tercio@58: local data = self:GetParent():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@58: self:GetParent():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@58: line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1) Tercio@58: line:SetSize (scroll_width - 2, scroll_line_height) Tercio@41: line:SetScript ("OnEnter", line_onenter) Tercio@41: line:SetScript ("OnLeave", line_onleave) 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@58: icon:SetSize (scroll_line_height - 2, scroll_line_height - 2) Tercio@58: Tercio@41: local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal") Tercio@58: Tercio@58: local remove_button = CreateFrame ("button", "$parentRemoveButton", line, "UIPanelCloseButton") Tercio@58: remove_button:SetSize (16, 16) Tercio@58: remove_button:SetScript ("OnClick", onclick_remove_button) Tercio@58: remove_button:SetPoint ("topright", line, "topright") Tercio@58: remove_button:GetNormalTexture():SetDesaturated (true) Tercio@58: Tercio@41: icon:SetPoint ("left", line, "left", 2, 0) Tercio@41: name:SetPoint ("left", icon, "right", 2, 0) Tercio@58: Tercio@41: line.icon = icon Tercio@41: line.name = name Tercio@58: line.removebutton = remove_button 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@58: line.icon:SetTexCoord (.1, .9, .1, .9) 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@58: DF:ReskinSlider (buffs_added) Tercio@58: 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@58: DF:ReskinSlider (debuffs_added) Tercio@58: 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@58: 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: 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@58: new_buff_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: new_debuff_entry:SetHook ("OnEditFocusGained", load_all_spells) Tercio@58: new_buff_entry.tooltip = "Enter the buff name using lower case letters.\n\nYou can add several spells at once using |cFFFFFF00;|r to separate each spell name." Tercio@58: new_debuff_entry.tooltip = "Enter the debuff name using lower case letters.\n\nYou can add several spells at once using |cFFFFFF00;|r to separate each spell name." Tercio@58: Tercio@41: new_buff_entry:SetJustifyH ("left") Tercio@41: new_debuff_entry:SetJustifyH ("left") Tercio@41: Tercio@58: local add_buff_button = self:CreateButton (f_manual, function() Tercio@41: Tercio@41: local text = new_buff_entry.text Tercio@41: new_buff_entry:SetText ("") Tercio@41: new_buff_entry:ClearFocus() Tercio@58: Tercio@41: if (text ~= "") then Tercio@41: --> check for more than one spellname Tercio@41: if (text:find (";")) then Tercio@58: for _, spellName in ipairs ({strsplit (";", text)}) do Tercio@58: spellName = self:trim (spellName) Tercio@58: spellName = lower (spellName) Tercio@58: if (string.len (spellName) > 0) then Tercio@58: local spellId = AllSpellsMap [spellName] Tercio@58: if (spellId) then Tercio@58: tinsert (f.db.aura_tracker.buff, spellId) Tercio@58: else Tercio@58: print ("spellId not found for spell:", spellName) Tercio@58: end Tercio@41: end Tercio@41: end Tercio@41: else Tercio@58: --get the spellId Tercio@58: local spellName = lower (text) Tercio@58: local spellId = AllSpellsMap [spellName] Tercio@58: if (not spellId) then Tercio@58: print ("spellIs for spell ", spellName, "not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: tinsert (f.db.aura_tracker.buff, spellId) Tercio@41: end Tercio@41: Tercio@41: buffs_added:Refresh() Tercio@41: end Tercio@58: Tercio@41: end, 100, 20, "Add Buff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) Tercio@58: 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@58: for _, spellName in ipairs ({strsplit (";", text)}) do Tercio@58: spellName = self:trim (spellName) Tercio@58: spellName = lower (spellName) Tercio@58: if (string.len (spellName) > 0) then Tercio@58: local spellId = AllSpellsMap [spellName] Tercio@58: if (spellId) then Tercio@58: tinsert (f.db.aura_tracker.debuff, spellId) Tercio@58: else Tercio@58: print ("spellId not found for spell:", spellName) Tercio@58: end Tercio@41: end Tercio@41: end Tercio@41: else Tercio@58: --get the spellId Tercio@58: local spellName = lower (text) Tercio@58: local spellId = AllSpellsMap [spellName] Tercio@58: if (not spellId) then Tercio@58: print ("spellIs for spell ", spellName, "not found") Tercio@58: return Tercio@58: end Tercio@58: Tercio@58: tinsert (f.db.aura_tracker.debuff, spellId) Tercio@41: end Tercio@58: 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@58: multiple_spells_label:SetSize (350, 24) 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@58: for _, spellId in ipairs (f.db.aura_tracker.buff) do Tercio@58: local spellName = GetSpellInfo (spellId) Tercio@58: if (spellName) then Tercio@58: str = str .. spellName .. "; " Tercio@58: end 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@58: for _, spellId in ipairs (f.db.aura_tracker.debuff) do Tercio@58: local spellName = GetSpellInfo (spellId) Tercio@58: if (spellName) then Tercio@58: str = str .. spellName .. "; " Tercio@58: end Tercio@41: end Tercio@58: 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@58: new_buff_entry:SetPoint ("topleft", f_manual, "topleft", 480, y) Tercio@58: new_buff_string:SetPoint ("bottomleft", new_buff_entry, "topleft", 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@58: new_debuff_string:SetPoint ("topleft", new_buff_entry, "bottomleft", 0, -6) 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@58: Tercio@58: multiple_spells_label:SetPoint ("topleft", new_debuff_entry, "bottomleft", 0, -6) Tercio@58: Tercio@58: export_buff_button:SetPoint ("topleft", multiple_spells_label, "bottomleft", 0, -12) Tercio@58: export_debuff_button:SetPoint ("left",export_buff_button, "right", 2, 0) Tercio@58: export_box:SetPoint ("topleft", export_buff_button, "bottomleft", 0, -6) 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: