Mercurial > wow > hansgar_and_franzok_assist
comparison Libs/DF/auras.lua @ 58:0682d738499b v8.0.1.058
- 8.0.1 Update.
| author | Tercio |
|---|---|
| date | Fri, 20 Jul 2018 19:04:12 -0300 |
| parents | b740f601e824 |
| children |
comparison
equal
deleted
inserted
replaced
| 57:b1c62eed8999 | 58:0682d738499b |
|---|---|
| 7 local _ | 7 local _ |
| 8 local tinsert = tinsert | 8 local tinsert = tinsert |
| 9 local GetSpellInfo = GetSpellInfo | 9 local GetSpellInfo = GetSpellInfo |
| 10 local lower = string.lower | 10 local lower = string.lower |
| 11 local GetSpellBookItemInfo = GetSpellBookItemInfo | 11 local GetSpellBookItemInfo = GetSpellBookItemInfo |
| 12 | |
| 13 local CONST_MAX_SPELLS = 300000 | |
| 14 | |
| 15 function DF:GetAuraByName (unit, spellName, isDebuff) | |
| 16 isDebuff = isDebuff and "HARMFUL|PLAYER" | |
| 17 | |
| 18 for i = 1, 40 do | |
| 19 local name, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll = UnitAura (unit, i, isDebuff) | |
| 20 if (not name) then | |
| 21 return | |
| 22 end | |
| 23 | |
| 24 if (name == spellName) then | |
| 25 return name, texture, count, debuffType, duration, expirationTime, caster, canStealOrPurge, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, isCastByPlayer, nameplateShowAll | |
| 26 end | |
| 27 end | |
| 28 end | |
| 29 | |
| 30 local default_text_for_aura_frame = { | |
| 31 AUTOMATIC = "Automatic", | |
| 32 MANUAL = "Manual", | |
| 33 METHOD = "Aura Tracking Method:", | |
| 34 BUFFS_IGNORED = "Buffs Ignored", | |
| 35 DEBUFFS_IGNORED = "Debuffs Ignored", | |
| 36 BUFFS_TRACKED = "Buffs Tracked", | |
| 37 DEBUFFS_TRACKED = "Debuffs Tracked", | |
| 38 | |
| 39 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.", | |
| 40 MANUAL_DESC = "Auras are being tracked manually, the addon only check for auras you entered below.", | |
| 41 | |
| 42 MANUAL_ADD_BLACKLIST_BUFF = "Add Buff to Blacklist", | |
| 43 MANUAL_ADD_BLACKLIST_DEBUFF = "Add Debuff to Blacklist", | |
| 44 MANUAL_ADD_TRACKLIST_BUFF = "Add Buff to Tracklist", | |
| 45 MANUAL_ADD_TRACKLIST_DEBUFF = "Add Debuff to Tracklist", | |
| 46 } | |
| 47 | |
| 48 function DF:LoadAllSpells (hashMap, indexTable) | |
| 49 | |
| 50 --pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance | |
| 51 | |
| 52 if (not DF.LoadingAuraAlertFrame) then | |
| 53 DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent) | |
| 54 DF.LoadingAuraAlertFrame:SetSize (340, 75) | |
| 55 DF.LoadingAuraAlertFrame:SetPoint ("center") | |
| 56 DF.LoadingAuraAlertFrame:SetFrameStrata ("TOOLTIP") | |
| 57 DF:ApplyStandardBackdrop (DF.LoadingAuraAlertFrame) | |
| 58 DF.LoadingAuraAlertFrame:SetBackdropBorderColor (1, 0.8, 0.1) | |
| 59 | |
| 60 DF.LoadingAuraAlertFrame.IsLoadingLabel1 = DF:CreateLabel (DF.LoadingAuraAlertFrame, "We are currently loading spell names and spell IDs") | |
| 61 DF.LoadingAuraAlertFrame.IsLoadingLabel2 = DF:CreateLabel (DF.LoadingAuraAlertFrame, "This may take only a few seconds") | |
| 62 DF.LoadingAuraAlertFrame.IsLoadingImage1 = DF:CreateImage (DF.LoadingAuraAlertFrame, [[Interface\DialogFrame\UI-Dialog-Icon-AlertOther]], 32, 32) | |
| 63 DF.LoadingAuraAlertFrame.IsLoadingLabel1.align = "center" | |
| 64 DF.LoadingAuraAlertFrame.IsLoadingLabel2.align = "center" | |
| 65 | |
| 66 DF.LoadingAuraAlertFrame.IsLoadingLabel1:SetPoint ("center", 16, 10) | |
| 67 DF.LoadingAuraAlertFrame.IsLoadingLabel2:SetPoint ("center", 16, -5) | |
| 68 DF.LoadingAuraAlertFrame.IsLoadingImage1:SetPoint ("left", 10, 0) | |
| 69 end | |
| 70 | |
| 71 DF.LoadingAuraAlertFrame:Show() | |
| 72 | |
| 73 C_Timer.After (0.1, function() | |
| 74 if (hashMap and not indexTable) then | |
| 75 for i = 1, CONST_MAX_SPELLS do | |
| 76 local spellName = GetSpellInfo (i) | |
| 77 if (spellName) then | |
| 78 hashMap [lower (spellName)] = i | |
| 79 end | |
| 80 end | |
| 81 | |
| 82 elseif (not hashMap and indexTable) then | |
| 83 for i = 1, CONST_MAX_SPELLS do | |
| 84 local spellName = GetSpellInfo (i) | |
| 85 if (spellName) then | |
| 86 indexTable [#indexTable+1] = lower (spellName) | |
| 87 end | |
| 88 end | |
| 89 | |
| 90 elseif (hashMap and indexTable) then | |
| 91 for i = 1, CONST_MAX_SPELLS do | |
| 92 local spellName = GetSpellInfo (i) | |
| 93 if (spellName) then | |
| 94 indexTable [#indexTable+1] = lower (spellName) | |
| 95 hashMap [indexTable [#indexTable]] = i | |
| 96 end | |
| 97 end | |
| 98 end | |
| 99 | |
| 100 DF.LoadingAuraAlertFrame:Hide() | |
| 101 end) | |
| 102 | |
| 103 end | |
| 12 | 104 |
| 13 local cleanfunction = function() end | 105 local cleanfunction = function() end |
| 14 | 106 |
| 15 do | 107 do |
| 16 local metaPrototype = { | 108 local metaPrototype = { |
| 30 self.tracking_method:Select (newdb.aura_tracker.track_method) | 122 self.tracking_method:Select (newdb.aura_tracker.track_method) |
| 31 | 123 |
| 32 --automatic | 124 --automatic |
| 33 self.buff_ignored:SetData (newdb.aura_tracker.buff_banned) | 125 self.buff_ignored:SetData (newdb.aura_tracker.buff_banned) |
| 34 self.debuff_ignored:SetData (newdb.aura_tracker.debuff_banned) | 126 self.debuff_ignored:SetData (newdb.aura_tracker.debuff_banned) |
| 35 self.buff_available:Refresh() | 127 self.buff_tracked:SetData (newdb.aura_tracker.buff_tracked) |
| 128 self.debuff_tracked:SetData (newdb.aura_tracker.debuff_tracked) | |
| 129 | |
| 36 self.buff_ignored:Refresh() | 130 self.buff_ignored:Refresh() |
| 37 self.debuff_available:Refresh() | |
| 38 self.debuff_ignored:Refresh() | 131 self.debuff_ignored:Refresh() |
| 132 self.buff_tracked:Refresh() | |
| 133 self.debuff_tracked:Refresh() | |
| 39 | 134 |
| 40 --manual | 135 --manual |
| 41 self.buffs_added:SetData (newdb.aura_tracker.buff) | 136 self.buffs_added:SetData (newdb.aura_tracker.buff) |
| 42 self.debuffs_added:SetData (newdb.aura_tracker.debuff) | 137 self.debuffs_added:SetData (newdb.aura_tracker.debuff) |
| 43 self.buffs_added:Refresh() | 138 self.buffs_added:Refresh() |
| 45 | 140 |
| 46 --method | 141 --method |
| 47 if (newdb.aura_tracker.track_method == 0x1) then | 142 if (newdb.aura_tracker.track_method == 0x1) then |
| 48 self.f_auto:Show() | 143 self.f_auto:Show() |
| 49 self.f_manual:Hide() | 144 self.f_manual:Hide() |
| 145 | |
| 146 self.AutomaticTrackingCheckbox:SetValue (true) | |
| 147 self.ManualTrackingCheckbox:SetValue (false) | |
| 148 self.desc_label.text = texts.AUTOMATIC_DESC | |
| 149 | |
| 50 elseif (newdb.aura_tracker.track_method == 0x2) then | 150 elseif (newdb.aura_tracker.track_method == 0x2) then |
| 51 self.f_auto:Hide() | 151 self.f_auto:Hide() |
| 52 self.f_manual:Show() | 152 self.f_manual:Show() |
| 153 | |
| 154 self.AutomaticTrackingCheckbox:SetValue (false) | |
| 155 self.ManualTrackingCheckbox:SetValue (true) | |
| 156 self.desc_label.text = texts.MANUAL_DESC | |
| 53 end | 157 end |
| 54 end | 158 end |
| 55 | 159 |
| 56 local aura_panel_defaultoptions = { | 160 local aura_panel_defaultoptions = { |
| 57 height = 400, | 161 height = 400, |
| 58 row_height = 16, | 162 row_height = 18, |
| 59 width = 230, | 163 width = 230, |
| 164 button_text_template = "OPTIONS_FONT_TEMPLATE" | |
| 60 } | 165 } |
| 61 function DF:CreateAuraConfigPanel (parent, name, db, method_change_callback, options) | 166 |
| 167 function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, texts) | |
| 62 | 168 |
| 63 local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") | 169 local options_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") |
| 64 local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") | 170 local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") |
| 65 local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") | 171 local options_switch_template = DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE") |
| 66 local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") | 172 local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") |
| 79 f_auto:SetSize (600, 600) | 185 f_auto:SetSize (600, 600) |
| 80 f_manual:SetSize (600, 600) | 186 f_manual:SetSize (600, 600) |
| 81 f.f_auto = f_auto | 187 f.f_auto = f_auto |
| 82 f.f_manual = f_manual | 188 f.f_manual = f_manual |
| 83 | 189 |
| 84 local on_select_tracking_option = function (_, _, method) | 190 --check if the texts table is valid and also deploy default values into the table in case some value is nil |
| 191 texts = (type (texts == "table") and texts) or default_text_for_aura_frame | |
| 192 DF.table.deploy (texts, default_text_for_aura_frame) | |
| 193 | |
| 194 ------------- | |
| 195 | |
| 196 local on_switch_tracking_method = function (self) | |
| 197 local method = self.Method | |
| 198 | |
| 85 f.db.aura_tracker.track_method = method | 199 f.db.aura_tracker.track_method = method |
| 86 if (method_change_callback) then | 200 if (change_callback) then |
| 87 method_change_callback (self, method) | 201 DF:QuickDispatch (change_callback) |
| 88 end | 202 end |
| 89 | 203 |
| 90 if (method == 0x1) then | 204 if (method == 0x1) then |
| 91 f_auto:Show() | 205 f_auto:Show() |
| 92 f_manual:Hide() | 206 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." | 207 f.AutomaticTrackingCheckbox:SetValue (true) |
| 94 f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 8) | 208 f.ManualTrackingCheckbox:SetValue (false) |
| 209 f.desc_label.text = texts.AUTOMATIC_DESC | |
| 210 | |
| 95 elseif (method == 0x2) then | 211 elseif (method == 0x2) then |
| 96 f_auto:Hide() | 212 f_auto:Hide() |
| 97 f_manual:Show() | 213 f_manual:Show() |
| 98 f.desc_label.text = "Auras are being tracked manually, the addon only check for auras you entered below." | 214 f.AutomaticTrackingCheckbox:SetValue (false) |
| 99 f.desc_label:SetPoint ("topleft", f.tracking_method, "topright", 10, 1) | 215 f.ManualTrackingCheckbox:SetValue (true) |
| 100 end | 216 f.desc_label.text = texts.MANUAL_DESC |
| 101 end | 217 end |
| 102 | 218 end |
| 103 local tracking_options = function() | 219 |
| 104 return { | 220 local background_method_selection = CreateFrame ("frame", nil, f) |
| 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."}, | 221 background_method_selection:SetHeight (82) |
| 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."}, | 222 background_method_selection:SetPoint ("topleft", f, "topleft", 0, 0) |
| 107 } | 223 background_method_selection:SetPoint ("topright", f, "topright", 0, 0) |
| 108 end | 224 DF:ApplyStandardBackdrop (background_method_selection) |
| 109 | 225 |
| 110 local tracking_method_label = self:CreateLabel (f, "Tracking Aura Method:", 12, "orange") | 226 local tracking_method_label = self:CreateLabel (background_method_selection, texts.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")) | 227 tracking_method_label:SetPoint ("topleft", background_method_selection, "topleft", 6, -4) |
| 112 | 228 |
| 113 tracking_method_label:SetPoint ("topleft", f, "topleft", 10, -10) | 229 f.desc_label = self:CreateLabel (background_method_selection, "", 10, "silver") |
| 114 tracking_method:SetPoint ("left", tracking_method_label, "right", 2, 0) | 230 f.desc_label:SetPoint ("left", background_method_selection, "left", 130, 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") | 231 f.desc_label:SetJustifyV ("top") |
| 123 | 232 |
| 124 --------automatic | 233 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")) |
| 234 automatic_tracking_checkbox.Method = 0x1 | |
| 235 automatic_tracking_checkbox:SetAsCheckBox() | |
| 236 automatic_tracking_checkbox:SetSize (24, 24) | |
| 237 f.AutomaticTrackingCheckbox = automatic_tracking_checkbox | |
| 238 | |
| 239 local automatic_tracking_label = DF:CreateLabel (background_method_selection, "Automatic") | |
| 240 automatic_tracking_label:SetPoint ("left", automatic_tracking_checkbox, "right", 2, 0) | |
| 241 | |
| 242 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")) | |
| 243 manual_tracking_checkbox.Method = 0x2 | |
| 244 manual_tracking_checkbox:SetAsCheckBox() | |
| 245 manual_tracking_checkbox:SetSize (24, 24) | |
| 246 f.ManualTrackingCheckbox = manual_tracking_checkbox | |
| 247 | |
| 248 local manual_tracking_label = DF:CreateLabel (background_method_selection, "Manual") | |
| 249 manual_tracking_label:SetPoint ("left", manual_tracking_checkbox, "right", 2, 0) | |
| 250 | |
| 251 automatic_tracking_checkbox:SetPoint ("topleft", tracking_method_label, "bottomleft", 0, -6) | |
| 252 manual_tracking_checkbox:SetPoint ("topleft", automatic_tracking_checkbox, "bottomleft", 0, -6) | |
| 253 | |
| 254 | |
| 255 -------- anchors points | |
| 256 | |
| 257 local y = -110 | |
| 258 local xLocation = 230 | |
| 259 | |
| 260 | |
| 261 -------- automatic | |
| 262 | |
| 263 --manual add the buff and ebuff names | |
| 264 local AllSpellsMap = {} | |
| 265 local AllSpellNames = {} | |
| 266 | |
| 267 local load_all_spells = function (self, capsule) | |
| 268 if (not next (AllSpellsMap)) then | |
| 269 DF:LoadAllSpells (AllSpellsMap, AllSpellNames) | |
| 270 | |
| 271 f_auto.AddBuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames | |
| 272 f_auto.AddDebuffBlacklistTextBox.SpellAutoCompleteList = AllSpellNames | |
| 273 f_auto.AddBuffTracklistTextBox.SpellAutoCompleteList = AllSpellNames | |
| 274 f_auto.AddDebuffTracklistTextBox.SpellAutoCompleteList = AllSpellNames | |
| 275 | |
| 276 f_manual.NewBuffTextBox.SpellAutoCompleteList = AllSpellNames | |
| 277 f_manual.NewDebuffTextBox.SpellAutoCompleteList = AllSpellNames | |
| 278 | |
| 279 -- | |
| 280 | |
| 281 f_auto.AddBuffBlacklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 282 f_auto.AddDebuffBlacklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 283 f_auto.AddBuffTracklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 284 f_auto.AddDebuffTracklistTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 285 | |
| 286 f_manual.NewBuffTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 287 f_manual.NewDebuffTextBox:SetAsAutoComplete ("SpellAutoCompleteList") | |
| 288 | |
| 289 -- | |
| 290 | |
| 291 f_auto.AddBuffBlacklistTextBox.ShouldOptimizeAutoComplete = true | |
| 292 f_auto.AddDebuffBlacklistTextBox.ShouldOptimizeAutoComplete = true | |
| 293 f_auto.AddBuffTracklistTextBox.ShouldOptimizeAutoComplete = true | |
| 294 f_auto.AddDebuffTracklistTextBox.ShouldOptimizeAutoComplete = true | |
| 295 | |
| 296 f_manual.NewBuffTextBox.ShouldOptimizeAutoComplete = true | |
| 297 f_manual.NewDebuffTextBox.ShouldOptimizeAutoComplete = true | |
| 298 end | |
| 299 end | |
| 300 | |
| 301 local background_add_blacklist = CreateFrame ("frame", nil, f_auto) | |
| 302 background_add_blacklist:SetSize (220, 135) | |
| 303 DF:ApplyStandardBackdrop (background_add_blacklist) | |
| 304 | |
| 305 local background_add_tracklist = CreateFrame ("frame", nil, f_auto) | |
| 306 background_add_tracklist:SetSize (220, 135) | |
| 307 DF:ApplyStandardBackdrop (background_add_tracklist) | |
| 308 | |
| 309 --black list | |
| 310 local buff_blacklist_label = self:CreateLabel (background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_BUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | |
| 311 local debuff_blacklist_label = self:CreateLabel (background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_DEBUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | |
| 312 | |
| 313 local buff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, 200, 20, "AddBuffBlacklistTextBox", _, _, options_dropdown_template) | |
| 314 buff_name_blacklist_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 315 buff_name_blacklist_entry:SetJustifyH ("left") | |
| 316 buff_name_blacklist_entry.tooltip = "Enter the buff name using lower case letters." | |
| 317 f_auto.AddBuffBlacklistTextBox = buff_name_blacklist_entry | |
| 318 | |
| 319 local debuff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, 200, 20, "AddDebuffBlacklistTextBox", _, _, options_dropdown_template) | |
| 320 debuff_name_blacklist_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 321 debuff_name_blacklist_entry:SetJustifyH ("left") | |
| 322 debuff_name_blacklist_entry.tooltip = "Enter the debuff name using lower case letters." | |
| 323 f_auto.AddDebuffBlacklistTextBox = debuff_name_blacklist_entry | |
| 324 | |
| 325 local add_blacklist_buff_button = self:CreateButton (background_add_blacklist, function() | |
| 326 local text = buff_name_blacklist_entry.text | |
| 327 buff_name_blacklist_entry:SetText ("") | |
| 328 buff_name_blacklist_entry:ClearFocus() | |
| 329 | |
| 330 if (text ~= "") then | |
| 331 text = lower (text) | |
| 332 | |
| 333 --get the spellId | |
| 334 local spellId = AllSpellsMap [text] | |
| 335 if (not spellId) then | |
| 336 print ("spell not found") | |
| 337 return | |
| 338 end | |
| 339 | |
| 340 --add the spellId to the blacklist | |
| 341 f.db.aura_tracker.buff_banned [spellId] = true | |
| 342 | |
| 343 --refresh the buff blacklist frame | |
| 344 _G [f_auto:GetName() .. "BuffIgnored"]:Refresh() | |
| 345 | |
| 346 DF:QuickDispatch (change_callback) | |
| 347 end | |
| 348 | |
| 349 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)) | |
| 350 | |
| 351 local add_blacklist_debuff_button = self:CreateButton (background_add_blacklist, function() | |
| 352 local text = debuff_name_blacklist_entry.text | |
| 353 debuff_name_blacklist_entry:SetText ("") | |
| 354 debuff_name_blacklist_entry:ClearFocus() | |
| 355 | |
| 356 if (text ~= "") then | |
| 357 text = lower (text) | |
| 358 | |
| 359 --get the spellId | |
| 360 local spellId = AllSpellsMap [text] | |
| 361 if (not spellId) then | |
| 362 print ("spell not found") | |
| 363 return | |
| 364 end | |
| 365 | |
| 366 --add the spellId to the blacklist | |
| 367 f.db.aura_tracker.debuff_banned [spellId] = true | |
| 368 | |
| 369 --refresh the buff blacklist frame | |
| 370 _G [f_auto:GetName() .. "DebuffIgnored"]:Refresh() | |
| 371 | |
| 372 DF:QuickDispatch (change_callback) | |
| 373 end | |
| 374 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)) | |
| 375 | |
| 376 | |
| 377 --track list | |
| 378 local buff_tracklist_label = self:CreateLabel (background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_BUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | |
| 379 local debuff_tracklist_label = self:CreateLabel (background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_DEBUFF, DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | |
| 380 | |
| 381 local buff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, 200, 20, "AddBuffTracklistTextBox", _, _, options_dropdown_template) | |
| 382 buff_name_tracklist_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 383 buff_name_tracklist_entry:SetJustifyH ("left") | |
| 384 buff_name_tracklist_entry.tooltip = "Enter the buff name using lower case letters." | |
| 385 f_auto.AddBuffTracklistTextBox = buff_name_tracklist_entry | |
| 386 | |
| 387 local debuff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, 200, 20, "AddDebuffTracklistTextBox", _, _, options_dropdown_template) | |
| 388 debuff_name_tracklist_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 389 debuff_name_tracklist_entry:SetJustifyH ("left") | |
| 390 debuff_name_tracklist_entry.tooltip = "Enter the debuff name using lower case letters." | |
| 391 f_auto.AddDebuffTracklistTextBox = debuff_name_tracklist_entry | |
| 392 | |
| 393 local add_tracklist_buff_button = self:CreateButton (background_add_tracklist, function() | |
| 394 local text = buff_name_tracklist_entry.text | |
| 395 buff_name_tracklist_entry:SetText ("") | |
| 396 buff_name_tracklist_entry:ClearFocus() | |
| 397 | |
| 398 if (text ~= "") then | |
| 399 text = lower (text) | |
| 400 | |
| 401 --get the spellId | |
| 402 local spellId = AllSpellsMap [text] | |
| 403 if (not spellId) then | |
| 404 print ("spell not found") | |
| 405 return | |
| 406 end | |
| 407 | |
| 408 --add the spellId to the blacklist | |
| 409 f.db.aura_tracker.buff_tracked [spellId] = true | |
| 410 | |
| 411 --refresh the buff blacklist frame | |
| 412 _G [f_auto:GetName() .. "BuffTracked"]:Refresh() | |
| 413 | |
| 414 DF:QuickDispatch (change_callback) | |
| 415 end | |
| 416 | |
| 417 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)) | |
| 418 | |
| 419 local add_tracklist_debuff_button = self:CreateButton (background_add_tracklist, function() | |
| 420 local text = debuff_name_tracklist_entry.text | |
| 421 debuff_name_tracklist_entry:SetText ("") | |
| 422 debuff_name_tracklist_entry:ClearFocus() | |
| 423 | |
| 424 if (text ~= "") then | |
| 425 text = lower (text) | |
| 426 | |
| 427 --get the spellId | |
| 428 local spellId = AllSpellsMap [text] | |
| 429 if (not spellId) then | |
| 430 print ("spell not found") | |
| 431 return | |
| 432 end | |
| 433 | |
| 434 --add the spellId to the blacklist | |
| 435 f.db.aura_tracker.debuff_tracked [spellId] = true | |
| 436 | |
| 437 --refresh the buff blacklist frame | |
| 438 _G [f_auto:GetName() .. "DebuffTracked"]:Refresh() | |
| 439 | |
| 440 DF:QuickDispatch (change_callback) | |
| 441 end | |
| 442 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)) | |
| 443 | |
| 444 --anchors: | |
| 445 background_add_blacklist:SetPoint ("topleft", f_auto, "topleft", 0, y) | |
| 446 background_add_tracklist:SetPoint ("topleft", background_add_blacklist, "bottomleft", 0, -10) | |
| 447 | |
| 448 --debuff blacklist | |
| 449 debuff_name_blacklist_entry:SetPoint ("topleft", background_add_blacklist, "topleft", 4, -20) | |
| 450 debuff_blacklist_label:SetPoint ("bottomleft", debuff_name_blacklist_entry, "topleft", 0, 2) | |
| 451 add_blacklist_debuff_button:SetPoint ("topleft", debuff_name_blacklist_entry, "bottomleft", 0, -2) | |
| 452 | |
| 453 --buff blacklist | |
| 454 buff_blacklist_label:SetPoint ("topleft", add_blacklist_debuff_button.widget, "bottomleft", 0, -10) | |
| 455 buff_name_blacklist_entry:SetPoint ("topleft", buff_blacklist_label, "bottomleft", 0, -2) | |
| 456 add_blacklist_buff_button:SetPoint ("topleft", buff_name_blacklist_entry, "bottomleft", 0, -2) | |
| 457 | |
| 458 | |
| 459 --debuff tracklist | |
| 460 debuff_name_tracklist_entry:SetPoint ("topleft", background_add_tracklist, "topleft", 4, -20) | |
| 461 debuff_tracklist_label:SetPoint ("bottomleft", debuff_name_tracklist_entry, "topleft", 0, 2) | |
| 462 add_tracklist_debuff_button:SetPoint ("topleft", debuff_name_tracklist_entry, "bottomleft", 0, -2) | |
| 463 | |
| 464 --buff tracklist | |
| 465 buff_tracklist_label:SetPoint ("topleft", add_tracklist_debuff_button.widget, "bottomleft", 0, -10) | |
| 466 buff_name_tracklist_entry:SetPoint ("topleft", buff_tracklist_label, "bottomleft", 0, -2) | |
| 467 add_tracklist_buff_button:SetPoint ("topleft", buff_name_tracklist_entry, "bottomleft", 0, -2) | |
| 125 | 468 |
| 126 local ALL_BUFFS = {} | 469 local ALL_BUFFS = {} |
| 127 local ALL_DEBUFFS = {} | 470 local ALL_DEBUFFS = {} |
| 128 | 471 |
| 472 --options passed to the create aura panel | |
| 129 local width, height, row_height = options.width, options.height, options.row_height | 473 local width, height, row_height = options.width, options.height, options.row_height |
| 130 | 474 |
| 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, | 475 |
| 132 function (spellid) | 476 --Debuffs on the black list |
| 133 f.db.aura_tracker.buff_banned [spellid] = nil; | 477 local debuff_ignored = self:CreateSimpleListBox (f_auto, "$parentDebuffIgnored", texts.DEBUFFS_IGNORED, "the list is empty", f.db.aura_tracker.debuff_banned, function (spellid) |
| 134 end, | 478 --f.db.aura_tracker.debuff_banned [spellid] = nil; DF:QuickDispatch (change_callback); |
| 135 { | 479 end, |
| 136 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, | 480 { |
| 137 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, | 481 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, |
| 138 height = height, | 482 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, |
| 139 row_height = row_height, | 483 height = height, |
| 140 width = width, | 484 row_height = row_height, |
| 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, | 485 width = width, |
| 142 }) | 486 backdrop_color = {.8, .8, .8, 0.2}, |
| 143 | 487 panel_border_color = {.01, 0, 0, 1}, |
| 144 local buff_available = self:CreateSimpleListBox (f_auto, "$parentBuffAvailable", "Buffs Available", "The list is empty, cast spells to fill it", ALL_BUFFS, function (spellid) | 488 iconcoords = {.1, .9, .1, .9}, |
| 145 f.db.aura_tracker.buff_banned [spellid] = true; buff_ignored:Refresh() | 489 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, |
| 146 end, | 490 show_x_button = true, |
| 147 { | 491 x_button_func = function (spellId) |
| 148 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, | 492 f.db.aura_tracker.debuff_banned [spellId] = nil; DF:QuickDispatch (change_callback); |
| 149 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, | 493 end, |
| 150 height = height, | 494 }) |
| 151 row_height = row_height, | 495 |
| 152 width = width, | 496 --Buffs on the black list |
| 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, | 497 local buff_ignored = self:CreateSimpleListBox (f_auto, "$parentBuffIgnored", texts.BUFFS_IGNORED, "the list is empty", f.db.aura_tracker.buff_banned, |
| 154 }) | 498 function (spellid) |
| 155 | 499 --f.db.aura_tracker.buff_banned [spellid] = nil; DF:QuickDispatch (change_callback); |
| 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) | 500 end, |
| 157 f.db.aura_tracker.debuff_banned [spellid] = nil; | 501 { |
| 158 end, | 502 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, |
| 159 { | 503 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, |
| 160 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, | 504 height = height, |
| 161 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, | 505 row_height = row_height, |
| 162 height = height, | 506 width = width, |
| 163 row_height = row_height, | 507 backdrop_color = {.8, .8, .8, 0.2}, |
| 164 width = width, | 508 panel_border_color = {.02, 0, 0, 1}, |
| 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, | 509 iconcoords = {.1, .9, .1, .9}, |
| 166 }) | 510 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, |
| 167 | 511 show_x_button = true, |
| 168 local debuff_available = self:CreateSimpleListBox (f_auto, "$parentDebuffAvailable", "Debuffs Available", "The list is empty, cast spells to fill it", ALL_DEBUFFS, function (spellid) | 512 x_button_func = function (spellId) |
| 169 f.db.aura_tracker.debuff_banned [spellid] = true; debuff_ignored:Refresh() | 513 f.db.aura_tracker.buff_banned [spellId] = nil; DF:QuickDispatch (change_callback); |
| 170 end, { | 514 end, |
| 171 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, | 515 }) |
| 172 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, | 516 |
| 173 height = height, | 517 --Debuffs on the track list |
| 174 row_height = row_height, | 518 local debuff_tracked = self:CreateSimpleListBox (f_auto, "$parentDebuffTracked", texts.DEBUFFS_TRACKED, "the list is empty", f.db.aura_tracker.debuff_tracked, function (spellid) |
| 175 width = width, | 519 --f.db.aura_tracker.debuff_tracked [spellid] = nil; DF:QuickDispatch (change_callback); |
| 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, | 520 end, |
| 177 }) | 521 { |
| 178 | 522 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, |
| 179 --como ira preencher ela no inicio e como ficara o lance dos profiles | 523 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, |
| 180 | 524 height = height, |
| 181 local y = -40 | 525 row_height = row_height, |
| 182 buff_available:SetPoint ("topleft", f_auto, "topleft", 0, y) | 526 width = width, |
| 183 buff_ignored:SetPoint ("topleft", f_auto, "topleft", 6 + width, y) | 527 backdrop_color = {.8, .8, .8, 0.2}, |
| 184 debuff_available:SetPoint ("topleft", f_auto, "topleft", 12 + (width*2), y) | 528 panel_border_color = {0, .02, 0, 1}, |
| 185 debuff_ignored:SetPoint ("topleft", f_auto, "topleft", 18 + (width*3), y) | 529 iconcoords = {.1, .9, .1, .9}, |
| 186 | 530 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, |
| 187 f.buff_available = buff_available | 531 show_x_button = true, |
| 532 x_button_func = function (spellId) | |
| 533 f.db.aura_tracker.debuff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); | |
| 534 end, | |
| 535 }) | |
| 536 | |
| 537 --Buffs on the track list | |
| 538 local buff_tracked = self:CreateSimpleListBox (f_auto, "$parentBuffTracked", texts.BUFFS_TRACKED, "the list is empty", f.db.aura_tracker.buff_tracked, function (spellid) | |
| 539 --f.db.aura_tracker.buff_tracked [spellid] = nil; DF:QuickDispatch (change_callback); | |
| 540 end, | |
| 541 { | |
| 542 icon = function(spellid) return select (3, GetSpellInfo (spellid)) end, | |
| 543 text = function(spellid) return select (1, GetSpellInfo (spellid)) end, | |
| 544 height = height, | |
| 545 row_height = row_height, | |
| 546 width = width, | |
| 547 backdrop_color = {.8, .8, .8, 0.2}, | |
| 548 panel_border_color = {0, .01, 0, 1}, | |
| 549 iconcoords = {.1, .9, .1, .9}, | |
| 550 onenter = function(self, capsule, value) GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); GameTooltip:SetSpellByID(value); GameTooltip:AddLine (" "); GameTooltip:Show() end, | |
| 551 show_x_button = true, | |
| 552 x_button_func = function (spellId) | |
| 553 f.db.aura_tracker.buff_tracked [spellId] = nil; DF:QuickDispatch (change_callback); | |
| 554 end, | |
| 555 }) | |
| 556 | |
| 557 debuff_ignored:SetPoint ("topleft", f_auto, "topleft", 0 + xLocation, y) | |
| 558 buff_ignored:SetPoint ("topleft", f_auto, "topleft", 8 + width + xLocation, y) | |
| 559 debuff_tracked:SetPoint ("topleft", f_auto, "topleft", 16 + (width*2) + xLocation, y) | |
| 560 buff_tracked:SetPoint ("topleft", f_auto, "topleft", 24 + (width*3) + xLocation, y) | |
| 561 | |
| 188 f.buff_ignored = buff_ignored | 562 f.buff_ignored = buff_ignored |
| 189 f.debuff_available = debuff_available | |
| 190 f.debuff_ignored = debuff_ignored | 563 f.debuff_ignored = debuff_ignored |
| 191 | 564 f.buff_tracked = buff_tracked |
| 192 local readCombatLog = CreateFrame ("frame", nil, f_auto) | 565 f.debuff_tracked = debuff_tracked |
| 193 readCombatLog:SetScript ("OnEvent", function (self, event, time, token, hidding, sourceGUID, sourceName, sourceFlag, sourceFlag2, targetGUID, targetName, targetFlag, targetFlag2, spellid, spellname, spellschool, auraType, amount) | 566 |
| 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() | 567 f_auto:SetScript ("OnShow", function() |
| 208 for i = 1, BUFF_MAX_DISPLAY do | 568 for i = 1, BUFF_MAX_DISPLAY do |
| 209 local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HELPFUL") | 569 local name, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HELPFUL") |
| 210 if (name) then | 570 if (name) then |
| 211 ALL_BUFFS [spellId] = true | 571 ALL_BUFFS [spellId] = true |
| 212 end | 572 end |
| 213 local name, rank, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HARMFUL") | 573 local name, texture, count, debuffType, duration, expirationTime, caster, _, nameplateShowPersonal, spellId, _, _, _, nameplateShowAll = UnitAura ("player", i, "HARMFUL") |
| 214 if (name) then | 574 if (name) then |
| 215 ALL_DEBUFFS [spellId] = true | 575 ALL_DEBUFFS [spellId] = true |
| 216 end | 576 end |
| 217 end | 577 end |
| 218 | 578 |
| 219 buff_available:Refresh() | 579 buff_tracked:Refresh() |
| 220 buff_ignored:Refresh() | 580 debuff_tracked:Refresh() |
| 221 debuff_available:Refresh() | 581 buff_ignored:Refresh() |
| 222 debuff_ignored:Refresh() | 582 debuff_ignored:Refresh() |
| 223 | 583 |
| 224 readCombatLog.playerGUID = UnitGUID ("player") | |
| 225 readCombatLog:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | |
| 226 end) | 584 end) |
| 227 f_auto:SetScript ("OnHide", function() | 585 f_auto:SetScript ("OnHide", function() |
| 228 readCombatLog:UnregisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") | 586 -- |
| 229 end) | 587 end) |
| 230 | 588 |
| 231 --show the frame selecton on the f.db | 589 --show the frame selecton on the f.db |
| 232 on_select_tracking_option (_, _, f.db.aura_tracker.track_method) | 590 |
| 591 if (f.db.aura_tracker.track_method == 0x1) then | |
| 592 on_switch_tracking_method (automatic_tracking_checkbox) | |
| 593 elseif (f.db.aura_tracker.track_method == 0x2) then | |
| 594 on_switch_tracking_method (manual_tracking_checkbox) | |
| 595 end | |
| 233 | 596 |
| 234 -------manual | 597 -------manual |
| 235 | 598 |
| 236 --> build the two aura scrolls for buff and debuff | 599 --> build the two aura scrolls for buff and debuff |
| 237 | 600 |
| 248 local spellid = select (7, GetSpellInfo (self.value)) | 611 local spellid = select (7, GetSpellInfo (self.value)) |
| 249 if (spellid) then | 612 if (spellid) then |
| 250 GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); | 613 GameTooltip:SetOwner (self, "ANCHOR_RIGHT"); |
| 251 GameTooltip:SetSpellByID (spellid) | 614 GameTooltip:SetSpellByID (spellid) |
| 252 GameTooltip:AddLine (" ") | 615 GameTooltip:AddLine (" ") |
| 253 GameTooltip:AddLine ("Click to untrack this aura", .2, 1, .2) | |
| 254 GameTooltip:Show() | 616 GameTooltip:Show() |
| 255 end | 617 end |
| 256 end | 618 end |
| 257 | 619 |
| 258 local line_onleave = function (self) | 620 local line_onleave = function (self) |
| 259 self:SetBackdropColor (unpack (backdrop_color)) | 621 self:SetBackdropColor (unpack (backdrop_color)) |
| 260 GameTooltip:Hide() | 622 GameTooltip:Hide() |
| 261 end | 623 end |
| 262 local line_onclick = function (self) | 624 |
| 263 local spell = self.value | 625 local onclick_remove_button = function (self) |
| 264 local data = self:GetParent():GetData() | 626 local spell = self:GetParent().value |
| 627 local data = self:GetParent():GetParent():GetData() | |
| 265 | 628 |
| 266 for i = 1, #data do | 629 for i = 1, #data do |
| 267 if (data[i] == spell) then | 630 if (data[i] == spell) then |
| 268 tremove (data, i) | 631 tremove (data, i) |
| 269 break | 632 break |
| 270 end | 633 end |
| 271 end | 634 end |
| 272 | 635 |
| 273 self:GetParent():Refresh() | 636 self:GetParent():GetParent():Refresh() |
| 274 end | 637 end |
| 275 | 638 |
| 276 local scroll_createline = function (self, index) | 639 local scroll_createline = function (self, index) |
| 277 local line = CreateFrame ("button", "$parentLine" .. index, self) | 640 local line = CreateFrame ("button", "$parentLine" .. index, self) |
| 278 line:SetPoint ("topleft", self, "topleft", 0, -((index-1)*(scroll_line_height+1))) | 641 line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1) |
| 279 line:SetSize (scroll_width, scroll_line_height) | 642 line:SetSize (scroll_width - 2, scroll_line_height) |
| 280 line:SetScript ("OnEnter", line_onenter) | 643 line:SetScript ("OnEnter", line_onenter) |
| 281 line:SetScript ("OnLeave", line_onleave) | 644 line:SetScript ("OnLeave", line_onleave) |
| 282 line:SetScript ("OnClick", line_onclick) | |
| 283 | 645 |
| 284 line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) | 646 line:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) |
| 285 line:SetBackdropColor (unpack (backdrop_color)) | 647 line:SetBackdropColor (unpack (backdrop_color)) |
| 286 | 648 |
| 287 local icon = line:CreateTexture ("$parentIcon", "overlay") | 649 local icon = line:CreateTexture ("$parentIcon", "overlay") |
| 288 icon:SetSize (scroll_line_height, scroll_line_height) | 650 icon:SetSize (scroll_line_height - 2, scroll_line_height - 2) |
| 651 | |
| 289 local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal") | 652 local name = line:CreateFontString ("$parentName", "overlay", "GameFontNormal") |
| 653 | |
| 654 local remove_button = CreateFrame ("button", "$parentRemoveButton", line, "UIPanelCloseButton") | |
| 655 remove_button:SetSize (16, 16) | |
| 656 remove_button:SetScript ("OnClick", onclick_remove_button) | |
| 657 remove_button:SetPoint ("topright", line, "topright") | |
| 658 remove_button:GetNormalTexture():SetDesaturated (true) | |
| 659 | |
| 290 icon:SetPoint ("left", line, "left", 2, 0) | 660 icon:SetPoint ("left", line, "left", 2, 0) |
| 291 name:SetPoint ("left", icon, "right", 2, 0) | 661 name:SetPoint ("left", icon, "right", 2, 0) |
| 662 | |
| 292 line.icon = icon | 663 line.icon = icon |
| 293 line.name = name | 664 line.name = name |
| 665 line.removebutton = remove_button | |
| 294 | 666 |
| 295 return line | 667 return line |
| 296 end | 668 end |
| 297 | 669 |
| 298 local scroll_refresh = function (self, data, offset, total_lines) | 670 local scroll_refresh = function (self, data, offset, total_lines) |
| 304 local name, _, icon = GetSpellInfo (aura) | 676 local name, _, icon = GetSpellInfo (aura) |
| 305 line.value = aura | 677 line.value = aura |
| 306 if (name) then | 678 if (name) then |
| 307 line.name:SetText (name) | 679 line.name:SetText (name) |
| 308 line.icon:SetTexture (icon) | 680 line.icon:SetTexture (icon) |
| 681 line.icon:SetTexCoord (.1, .9, .1, .9) | |
| 309 else | 682 else |
| 310 line.name:SetText (aura) | 683 line.name:SetText (aura) |
| 311 line.icon:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]]) | 684 line.icon:SetTexture ([[Interface\InventoryItems\WoWUnknownItem01]]) |
| 312 end | 685 end |
| 313 end | 686 end |
| 314 end | 687 end |
| 315 end | 688 end |
| 316 | 689 |
| 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) | 690 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) | 691 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}) | 692 DF:ReskinSlider (buffs_added) |
| 320 buffs_added:SetBackdropColor (0, 0, 0, 0.2) | 693 |
| 321 buffs_added:SetBackdropBorderColor (0, 0, 0, 1) | |
| 322 for i = 1, scroll_lines do | 694 for i = 1, scroll_lines do |
| 323 buffs_added:CreateLine (scroll_createline) | 695 buffs_added:CreateLine (scroll_createline) |
| 324 end | 696 end |
| 325 | 697 |
| 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) | 698 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) | 699 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}) | 700 DF:ReskinSlider (debuffs_added) |
| 329 debuffs_added:SetBackdropColor (0, 0, 0, 0.2) | 701 |
| 330 debuffs_added:SetBackdropBorderColor (0, 0, 0, 1) | |
| 331 for i = 1, scroll_lines do | 702 for i = 1, scroll_lines do |
| 332 debuffs_added:CreateLine (scroll_createline) | 703 debuffs_added:CreateLine (scroll_createline) |
| 333 end | 704 end |
| 334 | 705 |
| 335 f.buffs_added = buffs_added | 706 f.buffs_added = buffs_added |
| 337 | 708 |
| 338 local buffs_added_name = DF:CreateLabel (buffs_added, "Buffs", 12, "silver") | 709 local buffs_added_name = DF:CreateLabel (buffs_added, "Buffs", 12, "silver") |
| 339 buffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | 710 buffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) |
| 340 buffs_added_name:SetPoint ("bottomleft", buffs_added, "topleft", 0, 2) | 711 buffs_added_name:SetPoint ("bottomleft", buffs_added, "topleft", 0, 2) |
| 341 buffs_added.Title = buffs_added_name | 712 buffs_added.Title = buffs_added_name |
| 713 | |
| 342 local debuffs_added_name = DF:CreateLabel (debuffs_added, "Debuffs", 12, "silver") | 714 local debuffs_added_name = DF:CreateLabel (debuffs_added, "Debuffs", 12, "silver") |
| 343 debuffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) | 715 debuffs_added_name:SetTemplate (DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE")) |
| 344 debuffs_added_name:SetPoint ("bottomleft", debuffs_added, "topleft", 0, 2) | 716 debuffs_added_name:SetPoint ("bottomleft", debuffs_added, "topleft", 0, 2) |
| 345 debuffs_added.Title = debuffs_added_name | 717 debuffs_added.Title = debuffs_added_name |
| 346 | 718 |
| 347 --> build the text entry to type the spellname | 719 --> build the text entry to type the spellname |
| 348 local new_buff_string = self:CreateLabel (f_manual, "Add Buff") | 720 local new_buff_string = self:CreateLabel (f_manual, "Add Buff") |
| 349 local new_debuff_string = self:CreateLabel (f_manual, "Add Debuff") | 721 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) | 722 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) | 723 local new_debuff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewDebuffTextBox", _, _, options_dropdown_template) |
| 353 | 724 |
| 725 new_buff_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 726 new_debuff_entry:SetHook ("OnEditFocusGained", load_all_spells) | |
| 727 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." | |
| 728 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." | |
| 729 | |
| 354 new_buff_entry:SetJustifyH ("left") | 730 new_buff_entry:SetJustifyH ("left") |
| 355 new_debuff_entry:SetJustifyH ("left") | 731 new_debuff_entry:SetJustifyH ("left") |
| 356 | 732 |
| 357 DF:SetAutoCompleteWithSpells (new_buff_entry) | |
| 358 DF:SetAutoCompleteWithSpells (new_debuff_entry) | |
| 359 | |
| 360 local add_buff_button = self:CreateButton (f_manual, function() | 733 local add_buff_button = self:CreateButton (f_manual, function() |
| 734 | |
| 361 local text = new_buff_entry.text | 735 local text = new_buff_entry.text |
| 362 new_buff_entry:SetText ("") | 736 new_buff_entry:SetText ("") |
| 363 new_buff_entry:ClearFocus() | 737 new_buff_entry:ClearFocus() |
| 738 | |
| 364 if (text ~= "") then | 739 if (text ~= "") then |
| 365 --> check for more than one spellname | 740 --> check for more than one spellname |
| 366 if (text:find (";")) then | 741 if (text:find (";")) then |
| 367 for _, spellname in ipairs ({strsplit (";", text)}) do | 742 for _, spellName in ipairs ({strsplit (";", text)}) do |
| 368 spellname = self:trim (spellname) | 743 spellName = self:trim (spellName) |
| 369 if (string.len (spellname) > 0) then | 744 spellName = lower (spellName) |
| 370 tinsert (f.db.aura_tracker.buff, spellname) | 745 if (string.len (spellName) > 0) then |
| 746 local spellId = AllSpellsMap [spellName] | |
| 747 if (spellId) then | |
| 748 tinsert (f.db.aura_tracker.buff, spellId) | |
| 749 else | |
| 750 print ("spellId not found for spell:", spellName) | |
| 751 end | |
| 371 end | 752 end |
| 372 end | 753 end |
| 373 else | 754 else |
| 374 tinsert (f.db.aura_tracker.buff, text) | 755 --get the spellId |
| 756 local spellName = lower (text) | |
| 757 local spellId = AllSpellsMap [spellName] | |
| 758 if (not spellId) then | |
| 759 print ("spellIs for spell ", spellName, "not found") | |
| 760 return | |
| 761 end | |
| 762 | |
| 763 tinsert (f.db.aura_tracker.buff, spellId) | |
| 375 end | 764 end |
| 376 | 765 |
| 377 buffs_added:Refresh() | 766 buffs_added:Refresh() |
| 378 end | 767 end |
| 768 | |
| 379 end, 100, 20, "Add Buff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) | 769 end, 100, 20, "Add Buff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) |
| 770 | |
| 380 local add_debuff_button = self:CreateButton (f_manual, function() | 771 local add_debuff_button = self:CreateButton (f_manual, function() |
| 381 local text = new_debuff_entry.text | 772 local text = new_debuff_entry.text |
| 382 new_debuff_entry:SetText ("") | 773 new_debuff_entry:SetText ("") |
| 383 new_debuff_entry:ClearFocus() | 774 new_debuff_entry:ClearFocus() |
| 384 if (text ~= "") then | 775 if (text ~= "") then |
| 385 --> check for more than one spellname | 776 --> check for more than one spellname |
| 386 if (text:find (";")) then | 777 if (text:find (";")) then |
| 387 for _, spellname in ipairs ({strsplit (";", text)}) do | 778 for _, spellName in ipairs ({strsplit (";", text)}) do |
| 388 spellname = self:trim (spellname) | 779 spellName = self:trim (spellName) |
| 389 if (string.len (spellname) > 0) then | 780 spellName = lower (spellName) |
| 390 tinsert (f.db.aura_tracker.debuff, spellname) | 781 if (string.len (spellName) > 0) then |
| 782 local spellId = AllSpellsMap [spellName] | |
| 783 if (spellId) then | |
| 784 tinsert (f.db.aura_tracker.debuff, spellId) | |
| 785 else | |
| 786 print ("spellId not found for spell:", spellName) | |
| 787 end | |
| 391 end | 788 end |
| 392 end | 789 end |
| 393 else | 790 else |
| 394 tinsert (f.db.aura_tracker.debuff, text) | 791 --get the spellId |
| 395 end | 792 local spellName = lower (text) |
| 793 local spellId = AllSpellsMap [spellName] | |
| 794 if (not spellId) then | |
| 795 print ("spellIs for spell ", spellName, "not found") | |
| 796 return | |
| 797 end | |
| 798 | |
| 799 tinsert (f.db.aura_tracker.debuff, spellId) | |
| 800 end | |
| 801 | |
| 396 debuffs_added:Refresh() | 802 debuffs_added:Refresh() |
| 397 end | 803 end |
| 398 end, 100, 20, "Add Debuff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) | 804 end, 100, 20, "Add Debuff", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) |
| 399 | 805 |
| 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") | 806 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) | 807 multiple_spells_label:SetSize (350, 24) |
| 402 multiple_spells_label:SetJustifyV ("top") | 808 multiple_spells_label:SetJustifyV ("top") |
| 403 | 809 |
| 404 local export_box = self:CreateTextEntry (f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template) | 810 local export_box = self:CreateTextEntry (f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template) |
| 405 | 811 |
| 406 local export_buff_button = self:CreateButton (f_manual, function() | 812 local export_buff_button = self:CreateButton (f_manual, function() |
| 407 local str = "" | 813 local str = "" |
| 408 for _, spellname in ipairs (f.db.aura_tracker.buff) do | 814 for _, spellId in ipairs (f.db.aura_tracker.buff) do |
| 409 str = str .. spellname .. "; " | 815 local spellName = GetSpellInfo (spellId) |
| 816 if (spellName) then | |
| 817 str = str .. spellName .. "; " | |
| 818 end | |
| 410 end | 819 end |
| 411 export_box.text = str | 820 export_box.text = str |
| 412 export_box:SetFocus (true) | 821 export_box:SetFocus (true) |
| 413 export_box:HighlightText() | 822 export_box:HighlightText() |
| 414 | 823 |
| 415 end, 120, 20, "Export Buffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) | 824 end, 120, 20, "Export Buffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) |
| 416 | 825 |
| 417 local export_debuff_button = self:CreateButton (f_manual, function() | 826 local export_debuff_button = self:CreateButton (f_manual, function() |
| 418 local str = "" | 827 local str = "" |
| 419 for _, spellname in ipairs (f.db.aura_tracker.debuff) do | 828 for _, spellId in ipairs (f.db.aura_tracker.debuff) do |
| 420 str = str .. spellname .. "; " | 829 local spellName = GetSpellInfo (spellId) |
| 421 end | 830 if (spellName) then |
| 831 str = str .. spellName .. "; " | |
| 832 end | |
| 833 end | |
| 834 | |
| 422 export_box.text = str | 835 export_box.text = str |
| 423 export_box:SetFocus (true) | 836 export_box:SetFocus (true) |
| 424 export_box:HighlightText() | 837 export_box:HighlightText() |
| 425 | 838 |
| 426 end, 120, 20, "Export Debuffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) | 839 end, 120, 20, "Export Debuffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")) |
| 427 | 840 |
| 428 multiple_spells_label:SetPoint ("topleft", f_manual, "topleft", 480, -120) | 841 new_buff_entry:SetPoint ("topleft", f_manual, "topleft", 480, y) |
| 429 | 842 new_buff_string:SetPoint ("bottomleft", new_buff_entry, "topleft", 0, 2) |
| 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) | 843 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." | 844 add_buff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it." |
| 438 | 845 |
| 439 new_debuff_string:SetPoint ("topleft", f_manual, "topleft", 480, -80) | 846 new_debuff_string:SetPoint ("topleft", new_buff_entry, "bottomleft", 0, -6) |
| 440 new_debuff_entry:SetPoint ("topleft", new_debuff_string, "bottomleft", 0, -2) | 847 new_debuff_entry:SetPoint ("topleft", new_debuff_string, "bottomleft", 0, -2) |
| 441 add_debuff_button:SetPoint ("left", new_debuff_entry, "right", 2, 0) | 848 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." | 849 add_debuff_button.tooltip = "Add the aura to be tracked.\n\nClick an aura on the list to remove it." |
| 850 | |
| 851 multiple_spells_label:SetPoint ("topleft", new_debuff_entry, "bottomleft", 0, -6) | |
| 852 | |
| 853 export_buff_button:SetPoint ("topleft", multiple_spells_label, "bottomleft", 0, -12) | |
| 854 export_debuff_button:SetPoint ("left",export_buff_button, "right", 2, 0) | |
| 855 export_box:SetPoint ("topleft", export_buff_button, "bottomleft", 0, -6) | |
| 443 | 856 |
| 444 buffs_added:Refresh() | 857 buffs_added:Refresh() |
| 445 debuffs_added:Refresh() | 858 debuffs_added:Refresh() |
| 446 | 859 |
| 447 return f | 860 return f |
