From 6243a32740d002de384577337f8ebc5c2d26d84d Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 12 Oct 2022 18:37:00 -0300 Subject: [PATCH] More bug fixes --- API.lua | 10 +- Libs/AceSerializer-3.0/AceSerializer-3.0.lua | 4 +- Libs/DF/auras.lua | 37 +- Libs/DF/button.lua | 213 +- Libs/DF/cooltip.lua | 13 +- Libs/DF/dropdown.lua | 129 +- Libs/DF/fw.lua | 330 +- Libs/DF/help.lua | 2 +- Libs/DF/label.lua | 7 +- Libs/DF/languages.lua | 595 ++- Libs/DF/math.lua | 2 +- Libs/DF/mixins.lua | 122 +- Libs/DF/normal_bar.lua | 54 +- Libs/DF/panel.lua | 3844 ++++++++--------- Libs/DF/picture.lua | 3 +- Libs/DF/pictureedit.lua | 32 +- Libs/DF/slider.lua | 572 ++- Libs/DF/split_bar.lua | 50 +- Libs/DF/textentry.lua | 493 +-- Libs/DF/timebar.lua | 26 +- Libs/LibGraph-2.0/LibGraph-2.0.lua | 12 +- Libs/NickTag-1.0/NickTag-1.0.lua | 110 +- boot.lua | 216 +- classes/class_combat.lua | 6 +- classes/class_custom.lua | 949 ++-- classes/class_damage.lua | 341 +- classes/class_error.lua | 2 +- classes/class_heal.lua | 86 +- classes/class_instance.lua | 36 +- classes/class_resources.lua | 32 +- classes/class_utility.lua | 58 +- classes/container_actors.lua | 24 +- classes/container_pets.lua | 6 +- classes/container_segments.lua | 2 +- core/control.lua | 18 +- core/gears.lua | 40 +- core/meta.lua | 8 +- core/parser.lua | 40 +- core/plugins.lua | 38 +- core/plugins_raid.lua | 16 +- core/plugins_statusbar.lua | 22 +- core/plugins_toolbar.lua | 2 +- core/timemachine.lua | 6 +- core/util.lua | 26 +- core/windows.lua | 12 +- frames/anime.lua | 26 +- frames/fw_mods.lua | 30 +- frames/window_api.lua | 8 +- frames/window_benchmark.lua | 10 +- frames/window_brokertexteditor.lua | 2 +- frames/window_copy.lua | 2 +- frames/window_currentdps.lua | 8 +- frames/window_custom.lua | 96 +- frames/window_dump.lua | 6 +- frames/window_eventtracker.lua | 20 +- frames/window_forge.lua | 78 +- frames/window_macros.lua | 6 +- frames/window_main.lua | 26 +- frames/window_options2_sections.lua | 100 +- frames/window_playerbreakdown.lua | 312 +- frames/window_playerbreakdown_list.lua | 2 +- frames/window_report.lua | 4 +- frames/window_rowtexteditor.lua | 2 +- frames/window_runcode.lua | 10 +- frames/window_statistics.lua | 18 +- frames/window_switch.lua | 18 +- frames/window_wa.lua | 156 +- frames/window_welcome.lua | 108 +- functions/boss.lua | 2 +- functions/bossmods.lua | 4 +- functions/classes.lua | 8 +- functions/deathrecap.lua | 38 +- functions/dungeon.lua | 20 +- functions/events.lua | 4 +- functions/mythicdungeon.lua | 2 +- functions/pack.lua | 4 +- functions/playerclass.lua | 6 +- functions/profiles.lua | 22 +- functions/skins.lua | 2 +- functions/slash.lua | 68 +- functions/spells.lua | 35 +- functions/testbars.lua | 2 +- functions/timedata.lua | 22 +- .../Details_DataStorage.lua | 2 +- .../Details_EncounterDetails.lua | 74 +- plugins/Details_EncounterDetails/frames.lua | 106 +- plugins/Details_Streamer/Details_Streamer.lua | 32 +- .../Details_TinyThreat/Details_TinyThreat.lua | 30 +- plugins/Details_Vanguard/Details_Vanguard.lua | 16 +- startup.lua | 219 +- 90 files changed, 5200 insertions(+), 5212 deletions(-) diff --git a/API.lua b/API.lua index 35c83146..78af10fa 100644 --- a/API.lua +++ b/API.lua @@ -782,13 +782,13 @@ for i = 1, #Details.APIText do local text = Details.APIText [i] --add the color to the text - text = text:gsub ([[@TITLE]], "|c" .. titleColor) - text = text:gsub ([[@CODE]], "|c" .. codeColor) - text = text:gsub ([[@DESC]], "|c" .. descColor) - text = text:gsub ([[@COMMENT]], "|c" .. luacomentColor) + text = text:gsub([[@TITLE]], "|c" .. titleColor) + text = text:gsub([[@CODE]], "|c" .. codeColor) + text = text:gsub([[@DESC]], "|c" .. descColor) + text = text:gsub([[@COMMENT]], "|c" .. luacomentColor) --add the end color - text = text:gsub ([[@]], "|r") + text = text:gsub([[@]], "|r") Details.APIText [i] = text end diff --git a/Libs/AceSerializer-3.0/AceSerializer-3.0.lua b/Libs/AceSerializer-3.0/AceSerializer-3.0.lua index 8b294171..c5b88b8d 100644 --- a/Libs/AceSerializer-3.0/AceSerializer-3.0.lua +++ b/Libs/AceSerializer-3.0/AceSerializer-3.0.lua @@ -219,12 +219,12 @@ local function DeserializeValue(iter,single,ctl,data) if ctl=="^t" then break end -- ignore ^t's data k = DeserializeValue(iter,true,ctl,data) if k==nil then - error("Invalid AceSerializer table format (no table end marker)") + error("Invalid AceSerializer table format(no table end marker)") end ctl,data = iter() v = DeserializeValue(iter,true,ctl,data) if v==nil then - error("Invalid AceSerializer table format (no table end marker)") + error("Invalid AceSerializer table format(no table end marker)") end res[k]=v end diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index c5d6b17a..18699739 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -88,7 +88,6 @@ function DF:LoadAllSpells (hashMap, indexTable, allSpellsSameName) end elseif (hashMap and indexTable) then - --DF_CALC_PERFORMANCE() if (allSpellsSameName) then for i = 1, CONST_MAX_SPELLS do local spellName = GetSpellInfo(i) @@ -128,9 +127,6 @@ local cleanfunction = function() end do local metaPrototype = { WidgetType = "aura_tracker", - SetHook = DF.SetHook, - RunHooksForWidget = DF.RunHooksForWidget, - dversion = DF.dversion, } @@ -153,6 +149,7 @@ do end local AuraTrackerMetaFunctions = _G[DF.GlobalWidgetControlNames["aura_tracker"]] +DF:Mixin(AuraTrackerMetaFunctions, DF.ScriptHookMixin) --create panels local on_profile_changed = function(self, newdb) @@ -357,13 +354,13 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local buff_blacklist_label = self:CreateLabel(background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_BUFF, DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) local debuff_blacklist_label = self:CreateLabel(background_add_blacklist, texts.MANUAL_ADD_BLACKLIST_DEBUFF, DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - local buff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, textEntryWidth, 20, "AddBuffBlacklistTextBox", _, _, options_dropdown_template) + local buff_name_blacklist_entry = self:CreateTextEntry(background_add_blacklist, function()end, textEntryWidth, 20, "AddBuffBlacklistTextBox", _, _, options_dropdown_template) buff_name_blacklist_entry:SetHook("OnEditFocusGained", load_all_spells) buff_name_blacklist_entry:SetJustifyH("left") buff_name_blacklist_entry.tooltip = "Enter the buff name using lower case letters." f_auto.AddBuffBlacklistTextBox = buff_name_blacklist_entry - local debuff_name_blacklist_entry = self:CreateTextEntry (background_add_blacklist, function()end, textEntryWidth, 20, "AddDebuffBlacklistTextBox", _, _, options_dropdown_template) + local debuff_name_blacklist_entry = self:CreateTextEntry(background_add_blacklist, function()end, textEntryWidth, 20, "AddDebuffBlacklistTextBox", _, _, options_dropdown_template) debuff_name_blacklist_entry:SetHook("OnEditFocusGained", load_all_spells) debuff_name_blacklist_entry:SetJustifyH("left") debuff_name_blacklist_entry.tooltip = "Enter the debuff name using lower case letters." @@ -380,9 +377,9 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local spellWithSameName = AllSpellsSameName [spellName] if (spellWithSameName) then if (t) then - t [spellName] = DF.table.copy ({}, spellWithSameName) + t [spellName] = DF.table.copy({}, spellWithSameName) else - db.aura_cache_by_name [spellName] = DF.table.copy ({}, spellWithSameName) + db.aura_cache_by_name [spellName] = DF.table.copy({}, spellWithSameName) end end end @@ -391,7 +388,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local get_spellID_from_string = function(text) --check if the user entered a spell ID - local isSpellID = tonumber (text) + local isSpellID = tonumber(text) if (isSpellID and isSpellID > 1 and isSpellID < 10000000) then local isValidSpellID = GetSpellInfo(isSpellID) if (isValidSpellID) then @@ -530,13 +527,13 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local buff_tracklist_label = self:CreateLabel(background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_BUFF, DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) local debuff_tracklist_label = self:CreateLabel(background_add_tracklist, texts.MANUAL_ADD_TRACKLIST_DEBUFF, DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - local buff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, textEntryWidth, 20, "AddBuffTracklistTextBox", _, _, options_dropdown_template) + local buff_name_tracklist_entry = self:CreateTextEntry(background_add_tracklist, function()end, textEntryWidth, 20, "AddBuffTracklistTextBox", _, _, options_dropdown_template) buff_name_tracklist_entry:SetHook("OnEditFocusGained", load_all_spells) buff_name_tracklist_entry:SetJustifyH("left") buff_name_tracklist_entry.tooltip = "Enter the buff name using lower case letters." f_auto.AddBuffTracklistTextBox = buff_name_tracklist_entry - local debuff_name_tracklist_entry = self:CreateTextEntry (background_add_tracklist, function()end, textEntryWidth, 20, "AddDebuffTracklistTextBox", _, _, options_dropdown_template) + local debuff_name_tracklist_entry = self:CreateTextEntry(background_add_tracklist, function()end, textEntryWidth, 20, "AddDebuffTracklistTextBox", _, _, options_dropdown_template) debuff_name_tracklist_entry:SetHook("OnEditFocusGained", load_all_spells) debuff_name_tracklist_entry:SetJustifyH("left") debuff_name_tracklist_entry.tooltip = "Enter the debuff name using lower case letters." @@ -771,7 +768,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t line.name:SetText(spellName .. " (" .. spellID .. ")") end line.icon:SetTexture(spellIcon) - line.icon:SetTexCoord (.1, .9, .1, .9) + line.icon:SetTexCoord(.1, .9, .1, .9) end end end @@ -1024,7 +1021,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t if (name) then line.name:SetText(name) line.icon:SetTexture(icon) - line.icon:SetTexCoord (.1, .9, .1, .9) + line.icon:SetTexCoord(.1, .9, .1, .9) else line.name:SetText(aura) line.icon:SetTexture([[Interface\InventoryItems\WoWUnknownItem01]]) @@ -1065,8 +1062,8 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t -- build the text entry to type the spellname local new_buff_string = self:CreateLabel(f_manual, "Add Buff") local new_debuff_string = self:CreateLabel(f_manual, "Add Debuff") - local new_buff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewBuffTextBox", _, _, options_dropdown_template) - local new_debuff_entry = self:CreateTextEntry (f_manual, function()end, 200, 20, "NewDebuffTextBox", _, _, options_dropdown_template) + local new_buff_entry = self:CreateTextEntry(f_manual, function()end, 200, 20, "NewBuffTextBox", _, _, options_dropdown_template) + local new_debuff_entry = self:CreateTextEntry(f_manual, function()end, 200, 20, "NewDebuffTextBox", _, _, options_dropdown_template) new_buff_entry:SetHook("OnEditFocusGained", load_all_spells) new_debuff_entry:SetHook("OnEditFocusGained", load_all_spells) @@ -1084,7 +1081,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t if (text ~= "") then --check for more than one spellname - if (text:find (";")) then + if (text:find(";")) then for _, spellName in ipairs({strsplit(";", text)}) do spellName = self:trim (spellName) local spellID = get_spellID_from_string (spellName) @@ -1131,7 +1128,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t new_debuff_entry:ClearFocus() if (text ~= "") then --check for more than one spellname - if (text:find (";")) then + if (text:find(";")) then for _, spellName in ipairs({strsplit(";", text)}) do spellName = self:trim (spellName) local spellID = get_spellID_from_string (spellName) @@ -1177,7 +1174,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t multiple_spells_label:SetSize(350, 24) multiple_spells_label:SetJustifyV ("top") - local export_box = self:CreateTextEntry (f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template) + local export_box = self:CreateTextEntry(f_manual, function()end, 242, 20, "ExportAuraTextBox", _, _, options_dropdown_template) local export_buff_button = self:CreateButton(f_manual, function() local str = "" @@ -1188,7 +1185,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t end end export_box.text = str - export_box:SetFocus (true) + export_box:SetFocus(true) export_box:HighlightText() end, 120, 20, "Export Buffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -1203,7 +1200,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t end export_box.text = str - export_box:SetFocus (true) + export_box:SetFocus(true) export_box:HighlightText() end, 120, 20, "Export Debuffs", nil, nil, nil, nil, nil, nil, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index d80746b9..4197d634 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -6,16 +6,12 @@ if (not DF or not DetailsFrameworkCanLoad) then end local _ -local cleanfunction = function() end +local emptyFunction = function() end local APIButtonFunctions = false do local metaPrototype = { WidgetType = "button", - SetHook = DF.SetHook, - HasHook = DF.HasHook, - ClearHooks = DF.ClearHooks, - RunHooksForWidget = DF.RunHooksForWidget, dversion = DF.dversion } @@ -41,6 +37,8 @@ local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames["button"]] DF:Mixin(ButtonMetaFunctions, DF.SetPointMixin) DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) +DF:Mixin(ButtonMetaFunctions, DF.TooltipHandlerMixin) +DF:Mixin(ButtonMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables @@ -123,7 +121,7 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) ButtonMetaFunctions.GetMembers["fontsize"] = gmember_textsize ButtonMetaFunctions.GetMembers["textcolor"] = gmember_textcolor --alias ButtonMetaFunctions.GetMembers["textfont"] = gmember_textfont --alias - ButtonMetaFunctions.GetMembers["textsize"] = gmember_textsize --alias + ButtonMetaFunctions.GetMembers["textsize"] = gmember_textsize --alias ButtonMetaFunctions.__index = function(_table, _member_requested) @@ -131,15 +129,15 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) if (func) then return func (_table, _member_requested) end - - local fromMe = rawget (_table, _member_requested) + + local fromMe = rawget(_table, _member_requested) if (fromMe) then return fromMe end - + return ButtonMetaFunctions [_member_requested] end - + ------------------------------------------------------------------------------------------------------------------------------------------------------------------- --tooltip @@ -198,7 +196,7 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) --text color local smember_textcolor = function(_object, _value) local _value1, _value2, _value3, _value4 = DF:ParseColors(_value) - return _object.button.text:SetTextColor (_value1, _value2, _value3, _value4) + return _object.button.text:SetTextColor(_value1, _value2, _value3, _value4) end --text font @@ -261,7 +259,7 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) _object.capsule_textalign = "right" end end - + ButtonMetaFunctions.SetMembers = ButtonMetaFunctions.SetMembers or {} ButtonMetaFunctions.SetMembers ["tooltip"] = smember_tooltip ButtonMetaFunctions.SetMembers ["show"] = smember_show @@ -281,7 +279,7 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) ButtonMetaFunctions.SetMembers ["texture"] = smember_texture ButtonMetaFunctions.SetMembers ["locked"] = smember_locked ButtonMetaFunctions.SetMembers ["textalign"] = smember_textalign - + ButtonMetaFunctions.__newindex = function(_table, _key, _value) local func = ButtonMetaFunctions.SetMembers [_key] if (func) then @@ -294,26 +292,13 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) ------------------------------------------------------------------------------------------------------------ --methods ---tooltip - function ButtonMetaFunctions:SetTooltip(tooltip) - if (tooltip) then - return rawset(self, "have_tooltip", tooltip) - else - return rawset(self, "have_tooltip", nil) - end - end - - function ButtonMetaFunctions:GetTooltip() - return rawget(self, "have_tooltip") - end - --functions function ButtonMetaFunctions:SetClickFunction(func, param1, param2, clickType) if (not clickType or string.find(string.lower(clickType), "left")) then if (func) then rawset(self, "func", func) else - rawset(self, "func", cleanfunction) + rawset(self, "func", emptyFunction) end if (param1 ~= nil) then @@ -323,11 +308,11 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) rawset(self, "param2", param2) end - elseif (clickType or string.find (string.lower (clickType), "right")) then + elseif (clickType or string.find(string.lower(clickType), "right")) then if (func) then rawset(self, "funcright", func) else - rawset(self, "funcright", cleanfunction) + rawset(self, "funcright", emptyFunction) end end end @@ -521,7 +506,7 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) return end - button.MyObject.is_mouse_over = true + object.is_mouse_over = true if (button.texture) then if (button.texture.coords) then @@ -531,23 +516,15 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end end - if (button.MyObject.onenter_backdrop_border_color) then - button:SetBackdropBorderColor(unpack(button.MyObject.onenter_backdrop_border_color)) + if (object.onenter_backdrop_border_color) then + button:SetBackdropBorderColor(unpack(object.onenter_backdrop_border_color)) end - if (button.MyObject.onenter_backdrop) then - button:SetBackdropColor(unpack(button.MyObject.onenter_backdrop)) + if (object.onenter_backdrop) then + button:SetBackdropColor(unpack(object.onenter_backdrop)) end - if (button.MyObject.have_tooltip) then - GameCooltip2:Preset(2) - if (type(button.MyObject.have_tooltip) == "function") then - GameCooltip2:AddLine(button.MyObject.have_tooltip() or "") - else - GameCooltip2:AddLine(button.MyObject.have_tooltip) - end - GameCooltip2:ShowCooltip(button, "tooltip") - end + object:ShowTooltip() end local OnLeave = function(button) @@ -558,9 +535,9 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) return end - button.MyObject.is_mouse_over = false + object.is_mouse_over = false - if (button.texture and not button.MyObject.is_mouse_down) then + if (button.texture and not object.is_mouse_down) then if (button.texture.coords) then button.texture:SetTexCoord(unpack(button.texture.coords.Normal)) else @@ -568,19 +545,15 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end end - if (button.MyObject.onleave_backdrop_border_color) then - button:SetBackdropBorderColor(unpack(button.MyObject.onleave_backdrop_border_color)) + if (object.onleave_backdrop_border_color) then + button:SetBackdropBorderColor(unpack(object.onleave_backdrop_border_color)) end - if (button.MyObject.onleave_backdrop) then - button:SetBackdropColor(unpack(button.MyObject.onleave_backdrop)) + if (object.onleave_backdrop) then + button:SetBackdropColor(unpack(object.onleave_backdrop)) end - if (button.MyObject.have_tooltip) then - if (GameCooltip2:GetText(1) == button.MyObject.have_tooltip or type(button.MyObject.have_tooltip) == "function") then - GameCooltip2:Hide() - end - end + object:HideTooltip() end local OnHide = function(button) @@ -600,18 +573,18 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end local OnMouseDown = function(button, buttontype) - local object = button.MyObject - if (not button:IsEnabled()) then return end + local object = button.MyObject + local kill = object:RunHooksForWidget("OnMouseDown", button, object) if (kill) then return end - button.MyObject.is_mouse_down = true + object.is_mouse_down = true if (button.texture) then if (button.texture.coords) then @@ -621,22 +594,22 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end end - if (button.MyObject.capsule_textalign) then - if (button.MyObject.icon) then - button.MyObject.icon:SetPoint("left", button, "left", 5 + (button.MyObject.icon.leftpadding or 0), -1) + if (object.capsule_textalign) then + if (object.icon) then + object.icon:SetPoint("left", button, "left", 5 + (object.icon.leftpadding or 0), -1) - elseif (button.MyObject.capsule_textalign == "left") then + elseif (object.capsule_textalign == "left") then button.text:SetPoint("left", button, "left", 3, -1) - elseif (button.MyObject.capsule_textalign == "center") then + elseif (object.capsule_textalign == "center") then button.text:SetPoint("center", button, "center", 1, -1) - elseif (button.MyObject.capsule_textalign == "right") then + elseif (object.capsule_textalign == "right") then button.text:SetPoint("right", button, "right", -1, -1) end else - if (button.MyObject.icon) then - button.MyObject.icon:SetPoint("left", button, "left", 5 + (button.MyObject.icon.leftpadding or 0), -1) + if (object.icon) then + object.icon:SetPoint("left", button, "left", 5 + (object.icon.leftpadding or 0), -1) else button.text:SetPoint("center", button,"center", 1, -1) end @@ -647,19 +620,19 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) button.x = floor(x) button.y = floor(y) - if (not button.MyObject.container.isLocked and button.MyObject.container:IsMovable()) then + if (not object.container.isLocked and object.container:IsMovable()) then if (not button.isLocked and button:IsMovable()) then - button.MyObject.container.isMoving = true - button.MyObject.container:StartMoving() + object.container.isMoving = true + object.container:StartMoving() end end - if (button.MyObject.options.OnGrab) then - if (type(button.MyObject.options.OnGrab) == "string" and button.MyObject.options.OnGrab == "PassClick") then + if (object.options.OnGrab) then + if (type(object.options.OnGrab) == "string" and object.options.OnGrab == "PassClick") then if (buttontype == "LeftButton") then - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", button.MyObject.func, button, buttontype, button.MyObject.param1, button.MyObject.param2) + DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.func, button, buttontype, object.param1, object.param2) else - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", button.MyObject.funcright, button, buttontype, button.MyObject.param1, button.MyObject.param2) + DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseDown()", object.funcright, button, buttontype, object.param1, object.param2) end end end @@ -671,22 +644,23 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end local object = button.MyObject + local kill = object:RunHooksForWidget("OnMouseUp", button, object) if (kill) then return end - button.MyObject.is_mouse_down = false + object.is_mouse_down = false if (button.texture) then if (button.texture.coords) then - if (button.MyObject.is_mouse_over) then + if (object.is_mouse_over) then button.texture:SetTexCoord(unpack(button.texture.coords.Highlight)) else button.texture:SetTexCoord(unpack(coords.Normal)) end else - if (button.MyObject.is_mouse_over) then + if (object.is_mouse_over) then button.texture:SetTexCoord(0, 1, 0.24609375, 0.49609375) else button.texture:SetTexCoord(0, 1, 0, 0.24609375) @@ -694,30 +668,30 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) end end - if (button.MyObject.capsule_textalign) then - if (button.MyObject.icon) then - button.MyObject.icon:SetPoint("left", button, "left", 4 + (button.MyObject.icon.leftpadding or 0), 0) + if (object.capsule_textalign) then + if (object.icon) then + object.icon:SetPoint("left", button, "left", 4 + (object.icon.leftpadding or 0), 0) - elseif (button.MyObject.capsule_textalign == "left") then + elseif (object.capsule_textalign == "left") then button.text:SetPoint("left", button, "left", 2, 0) - elseif (button.MyObject.capsule_textalign == "center") then + elseif (object.capsule_textalign == "center") then button.text:SetPoint("center", button, "center", 0, 0) - elseif (button.MyObject.capsule_textalign == "right") then + elseif (object.capsule_textalign == "right") then button.text:SetPoint("right", button, "right", -2, 0) end else - if (button.MyObject.icon) then - button.MyObject.icon:SetPoint("left", button, "left", 4 + (button.MyObject.icon.leftpadding or 0), 0) + if (object.icon) then + object.icon:SetPoint("left", button, "left", 4 + (object.icon.leftpadding or 0), 0) else button.text:SetPoint("center", button,"center", 0, 0) end end - if (button.MyObject.container.isMoving) then - button.MyObject.container:StopMovingOrSizing() - button.MyObject.container.isMoving = false + if (object.container.isMoving) then + object.container:StopMovingOrSizing() + object.container.isMoving = false end local x, y = GetCursorPosition() @@ -728,9 +702,9 @@ DF:Mixin(ButtonMetaFunctions, DF.FrameMixin) if ((x == button.x and y == button.y) or (button.mouse_down + 0.5 > GetTime() and button:IsMouseOver())) then if (buttonType == "LeftButton") then - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", button.MyObject.func, button, buttonType, button.MyObject.param1, button.MyObject.param2) + DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.func, button, buttonType, object.param1, object.param2) else - DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", button.MyObject.funcright, button, buttonType, button.MyObject.param1, button.MyObject.param2) + DF:CoreDispatch((button:GetName() or "Button") .. ":OnMouseUp()", object.funcright, button, buttonType, object.param1, object.param2) end end end @@ -792,8 +766,8 @@ function ButtonMetaFunctions:SetTemplate(template) end if (template.icon) then - local i = template.icon - self:SetIcon(i.texture, i.width, i.height, i.layout, i.texcoord, i.color, i.textdistance, i.leftpadding) + local iconInfo = template.icon + self:SetIcon(iconInfo.texture, iconInfo.width, iconInfo.height, iconInfo.layout, iconInfo.texcoord, iconInfo.color, iconInfo.textdistance, iconInfo.leftpadding) end if (template.textsize) then @@ -815,7 +789,6 @@ end ------------------------------------------------------------------------------------------------------------ --object constructor - local onDisableFunc = function(self) self.texture_disabled:Show() self.texture_disabled:SetVertexColor(0, 0, 0) @@ -830,10 +803,10 @@ end self:SetSize(100, 20) self.text = self:CreateFontString("$parent_Text", "ARTWORK", "GameFontNormal") - self:SetFontString(self.text) self.text:SetJustifyH("CENTER") - DF:SetFontSize(self.text, 10) self.text:SetPoint("CENTER", self, "CENTER", 0, 0) + self:SetFontString(self.text) + DF:SetFontSize(self.text, 10) self.texture_disabled = self:CreateTexture("$parent_TextureDisabled", "OVERLAY") self.texture_disabled:SetAllPoints() @@ -883,10 +856,9 @@ end DF:Mixin(buttonObject.button, DF.WidgetFunctions) createButtonWidgets(buttonObject.button) - + buttonObject.button:SetSize(width or 100, height or 20) buttonObject.widget = buttonObject.button - buttonObject.button:SetBackdropColor(0, 0, 0, 0.4) - buttonObject.button:SetBackdropBorderColor(1, 1, 1, 1) + buttonObject.button.MyObject = buttonObject if (not APIButtonFunctions) then APIButtonFunctions = true @@ -901,10 +873,6 @@ end end end - buttonObject.button:SetWidth(width or 100) - buttonObject.button:SetHeight(height or 20) - buttonObject.button.MyObject = buttonObject - buttonObject.text_overlay = _G[name .. "_Text"] buttonObject.disabled_overlay = _G[name .. "_TextureDisabled"] @@ -914,7 +882,9 @@ end buttonObject.button:SetDisabledTexture(texture) buttonObject.button:SetHighlightTexture(texture, "ADD") - buttonObject.button.text:SetText(text or "") + local locTable = text + DF.Language.SetTextWithLocTableWithDefault(buttonObject.button.text, locTable, text) + buttonObject.button.text:SetPoint("center", buttonObject.button, "center") local textWidth = buttonObject.button.text:GetStringWidth() @@ -943,8 +913,8 @@ end end end - buttonObject.func = func or cleanfunction - buttonObject.funcright = cleanfunction + buttonObject.func = func or emptyFunction + buttonObject.funcright = emptyFunction buttonObject.param1 = param1 buttonObject.param2 = param2 buttonObject.short_method = shortMethod @@ -953,10 +923,12 @@ end if (textTemplate.size) then DF:SetFontSize(buttonObject.button.text, textTemplate.size) end + if (textTemplate.color) then local r, g, b, a = DF:ParseColors(textTemplate.color) buttonObject.button.text:SetTextColor(r, g, b, a) end + if (textTemplate.font) then local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local font = SharedMedia:Fetch("font", textTemplate.font) @@ -1027,31 +999,32 @@ end function DF:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) --button - local button = DF:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2", nil, nil, nil, buttonTemplate) - button.color_callback = callback - button.Cancel = colorpickCancel - button.SetColor = setColorPickColor - button.GetColor = getColorPickColor + local colorPickButton = DF:NewButton(parent, _, name, member, 16, 16, pickcolor, alpha, "param2", nil, nil, nil, buttonTemplate) + colorPickButton.color_callback = callback + colorPickButton.Cancel = colorpickCancel + colorPickButton.SetColor = setColorPickColor + colorPickButton.GetColor = getColorPickColor - button.HookList.OnColorChanged = {} + colorPickButton.HookList.OnColorChanged = {} if (not buttonTemplate) then - button:InstallCustomTexture() + colorPickButton:SetTemplate(DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) end - local background = button:CreateTexture(nil, "background", nil, 2) - background:SetPoint("topleft", button.widget, "topleft", 0, 0) - background:SetPoint("bottomright", button.widget, "bottomright", 0, 0) + --background showing a grid to indicate the transparency + local background = colorPickButton:CreateTexture(nil, "background", nil, 2) + background:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0) + background:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0) background:SetTexture([[Interface\ITEMSOCKETINGFRAME\UI-EMPTYSOCKET]]) background:SetTexCoord(3/16, 13/16, 3/16, 13/16) background:SetAlpha(0.3) - --color texture - local img = DF:NewImage(button, nil, 16, 16, nil, nil, "color_texture", "$parentTex") - img:SetColorTexture(1, 1, 1) - img:SetPoint("topleft", button.widget, "topleft", 0, 0) - img:SetPoint("bottomright", button.widget, "bottomright", 0, 0) - img:SetDrawLayer("background", 3) + --texture which shows the texture color + local colorTexture = DF:NewImage(colorPickButton, nil, 16, 16, nil, nil, "color_texture", "$parentTex") + colorTexture:SetColorTexture(1, 1, 1) + colorTexture:SetPoint("topleft", colorPickButton.widget, "topleft", 0, 0) + colorTexture:SetPoint("bottomright", colorPickButton.widget, "bottomright", 0, 0) + colorTexture:SetDrawLayer("background", 3) - return button + return colorPickButton end diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 78fdca6d..42d90972 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -15,7 +15,7 @@ local max = math.max --api locals local PixelUtil = PixelUtil or DFPixelUtil -local version = 4 +local version = 5 local CONST_MENU_TYPE_MAINMENU = "main" local CONST_MENU_TYPE_SUBMENU = "sub" @@ -1142,7 +1142,7 @@ function DF:CreateCoolTip() function gameCooltip:StatusBar(menuButton, statusBarSettings) if (statusBarSettings) then menuButton.statusbar:SetValue(statusBarSettings[1]) - menuButton.statusbar:SetStatusBarColor (statusBarSettings[2], statusBarSettings[3], statusBarSettings[4], statusBarSettings[5]) + menuButton.statusbar:SetStatusBarColor(statusBarSettings[2], statusBarSettings[3], statusBarSettings[4], statusBarSettings[5]) menuButton.statusbar:SetHeight(20 + (gameCooltip.OptionsTable.StatusBarHeightMod or 0)) menuButton.spark2:Hide() @@ -1160,9 +1160,9 @@ function DF:CreateCoolTip() end if (statusBarSettings[7].color) then local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(statusBarSettings[7].color) - menuButton.statusbar2:SetStatusBarColor (colorRed, colorGreen, colorBlue, colorAlpha) + menuButton.statusbar2:SetStatusBarColor(colorRed, colorGreen, colorBlue, colorAlpha) else - menuButton.statusbar2:SetStatusBarColor (1, 1, 1, 1) + menuButton.statusbar2:SetStatusBarColor(1, 1, 1, 1) end else menuButton.statusbar2:SetValue(0) @@ -1961,6 +1961,11 @@ function DF:CreateCoolTip() return gameCooltip.Host end + function gameCooltip:IsOwner(frame) + local currentOwner = gameCooltip:GetOwner() + return currentOwner == frame + end + --set the anchor of cooltip, parameters: frame [, cooltip anchor point, frame anchor point[, x mod, y mod]] function gameCooltip:SetOwner(frame, myPoint, hisPoint, x, y) return gameCooltip:SetHost(frame, myPoint, hisPoint, x, y) diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index f056fabd..bf47ce38 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -10,10 +10,6 @@ local loadedAPIDropDownFunctions = false do local metaPrototype = { WidgetType = "dropdown", - SetHook = DF.SetHook, - HasHook = DF.HasHook, - ClearHooks = DF.ClearHooks, - RunHooksForWidget = DF.RunHooksForWidget, dversion = DF.dversion, } @@ -39,49 +35,58 @@ local DropDownMetaFunctions = _G[DF.GlobalWidgetControlNames["dropdown"]] DF:Mixin(DropDownMetaFunctions, DF.SetPointMixin) DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) +DF:Mixin(DropDownMetaFunctions, DF.TooltipHandlerMixin) +DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables - DropDownMetaFunctions.__call = function(_table, value) + DropDownMetaFunctions.__call = function(object, value) --unknown end ------------------------------------------------------------------------------------------------------------ --members - --selected value local gmember_value = function(object) return object:GetValue() end + --tooltip local gmember_tooltip = function(object) return object:GetTooltip() end + --shown local gmember_shown = function(object) return object:IsShown() end + --frame width local gmember_width = function(object) return object.button:GetWidth() end + --frame height local gmember_height = function(object) return object.button:GetHeight() end + --current text local gmember_text = function(object) return object.label:GetText() end + --menu creation function local gmember_function = function(object) return object:GetFunction() end + --menu width local gmember_menuwidth = function(object) return rawget(object, "realsizeW") end + --menu height local gmember_menuheight = function(object) return rawget(object, "realsizeH") @@ -118,6 +123,7 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) local smember_tooltip = function(object, value) return object:SetTooltip(value) end + --show local smember_show = function(object, value) if (value) then @@ -126,6 +132,7 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) return object:Hide() end end + --hide local smember_hide = function(object, value) if (not value) then @@ -134,36 +141,41 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) return object:Hide() end end + --frame width local smember_width = function(object, value) return object.dropdown:SetWidth(value) end + --frame height local smember_height = function(object, value) return object.dropdown:SetHeight(value) - end + end + --menu creation function local smember_function = function(object, value) return object:SetFunction(value) end + --menu width local smember_menuwidth = function(object, value) object:SetMenuSize(value, nil) end + --menu height local smember_menuheight = function(object, value) object:SetMenuSize(nil, value) end DropDownMetaFunctions.SetMembers = DropDownMetaFunctions.SetMembers or {} - DropDownMetaFunctions.SetMembers ["tooltip"] = smember_tooltip - DropDownMetaFunctions.SetMembers ["show"] = smember_show - DropDownMetaFunctions.SetMembers ["hide"] = smember_hide - DropDownMetaFunctions.SetMembers ["width"] = smember_width - DropDownMetaFunctions.SetMembers ["menuwidth"] = smember_menuwidth - DropDownMetaFunctions.SetMembers ["height"] = smember_height - DropDownMetaFunctions.SetMembers ["menuheight"] = smember_menuheight - DropDownMetaFunctions.SetMembers ["func"] = smember_function + DropDownMetaFunctions.SetMembers["tooltip"] = smember_tooltip + DropDownMetaFunctions.SetMembers["show"] = smember_show + DropDownMetaFunctions.SetMembers["hide"] = smember_hide + DropDownMetaFunctions.SetMembers["width"] = smember_width + DropDownMetaFunctions.SetMembers["menuwidth"] = smember_menuwidth + DropDownMetaFunctions.SetMembers["height"] = smember_height + DropDownMetaFunctions.SetMembers["menuheight"] = smember_menuheight + DropDownMetaFunctions.SetMembers["func"] = smember_function DropDownMetaFunctions.__newindex = function(object, key, value) local func = DropDownMetaFunctions.SetMembers[key] @@ -185,6 +197,7 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) return rawset(self, "realsizeH", height) end end + function DropDownMetaFunctions:GetMenuSize() return rawget(self, "realsizeW"), rawget(self, "realsizeH") end @@ -193,6 +206,7 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) function DropDownMetaFunctions:SetFunction(func) return rawset(self, "func", func) end + function DropDownMetaFunctions:GetFunction() return rawget(self, "func") end @@ -201,22 +215,11 @@ DF:Mixin(DropDownMetaFunctions, DF.FrameMixin) function DropDownMetaFunctions:GetValue() return rawget(self, "myvalue") end + function DropDownMetaFunctions:SetValue(value) return rawset(self, "myvalue", value) end ---tooltip - function DropDownMetaFunctions:SetTooltip(tooltip) - if (tooltip) then - return rawset(self, "have_tooltip", tooltip) - else - return rawset(self, "have_tooltip", nil) - end - end - function DropDownMetaFunctions:GetTooltip() - return rawget(self, "have_tooltip") - end - --frame levels function DropDownMetaFunctions:SetFrameLevel(level, frame) if (not frame) then @@ -362,7 +365,7 @@ local runCallbackFunctionForButton = function(button) --need: the the callback func, the object of the dropdown (capsule), the object (capsule) of the button to get FixedValue and the last need the value of the optionTable local success, errorText = pcall(button.table.onclick, button:GetParent():GetParent():GetParent().MyObject, button.object.FixedValue, button.table.value) if (not success) then - error ("Details! Framework: dropdown " .. button:GetParent():GetParent():GetParent().MyObject:GetName() .. " error: " .. errorText) + error("Details! Framework: dropdown " .. button:GetParent():GetParent():GetParent().MyObject:GetName() .. " error: " .. errorText) end button:GetParent():GetParent():GetParent().MyObject:RunHooksForWidget("OnOptionSelected", button:GetParent():GetParent():GetParent().MyObject, button.object.FixedValue, button.table.value) end @@ -374,7 +377,7 @@ local canRunCallbackFunctionForOption = function(canRunCallback, optionTable, dr if (optionTable.onclick) then local success, errorText = pcall(optionTable.onclick, dropdownObject, fixedValue, optionTable.value) if (not success) then - error ("Details! Framework: dropdown " .. dropdownObject:GetName() .. " error: " .. errorText) + error("Details! Framework: dropdown " .. dropdownObject:GetName() .. " error: " .. errorText) end dropdownObject:RunHooksForWidget("OnOptionSelected", dropdownObject, fixedValue, optionTable.value) end @@ -433,6 +436,7 @@ function DropDownMetaFunctions:Select(optionName, byOptionNumber, onlyShown, run self:Selected(optionTableSelected) canRunCallbackFunctionForOption(runCallback, optionTableSelected, self) return true + else local optionTableSelected = optionsTable[optionIndex] @@ -823,90 +827,82 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) end function DetailsFrameworkDropDownOnEnter(self) - local capsule = self.MyObject - local kill = capsule:RunHooksForWidget("OnEnter", self, capsule) + local object = self.MyObject + local kill = object:RunHooksForWidget("OnEnter", self, object) if (kill) then return end - if (self.MyObject.onenter_backdrop) then - self:SetBackdropColor(unpack(self.MyObject.onenter_backdrop)) + if (object.onenter_backdrop) then + self:SetBackdropColor(unpack(object.onenter_backdrop)) else self:SetBackdropColor(.2, .2, .2, .2) end - if (self.MyObject.onenter_backdrop_border_color) then - self:SetBackdropBorderColor(unpack(self.MyObject.onenter_backdrop_border_color)) + if (object.onenter_backdrop_border_color) then + self:SetBackdropBorderColor(unpack(object.onenter_backdrop_border_color)) end self.arrowTexture2:Show() - if (self.MyObject.have_tooltip) then - GameCooltip2:Preset(2) - if (type(self.MyObject.have_tooltip) == "function") then - GameCooltip2:AddLine(self.MyObject.have_tooltip() or "") - else - GameCooltip2:AddLine(self.MyObject.have_tooltip) - end - - GameCooltip2:SetOwner(self) - GameCooltip2:ShowCooltip() - end + object:ShowTooltip() end function DetailsFrameworkDropDownOnLeave(self) - local capsule = self.MyObject - local kill = capsule:RunHooksForWidget("OnLeave", self, capsule) + local object = self.MyObject + local kill = object:RunHooksForWidget("OnLeave", self, object) if (kill) then return end - if (self.MyObject.onleave_backdrop) then - self:SetBackdropColor(unpack(self.MyObject.onleave_backdrop)) + if (object.onleave_backdrop) then + self:SetBackdropColor(unpack(object.onleave_backdrop)) else self:SetBackdropColor(1, 1, 1, .5) end - if (self.MyObject.onleave_backdrop_border_color) then - self:SetBackdropBorderColor(unpack(self.MyObject.onleave_backdrop_border_color)) + if (object.onleave_backdrop_border_color) then + self:SetBackdropBorderColor(unpack(object.onleave_backdrop_border_color)) end self.arrowTexture2:Hide() - if (self.MyObject.have_tooltip) then - GameCooltip2:ShowMe(false) - end + object:HideTooltip() end function DetailsFrameworkDropDownOnSizeChanged(self) - self.MyObject.label:SetSize(self:GetWidth()-40, 10) + local object = self.MyObject + object.label:SetSize(self:GetWidth() - 40, 10) end function DetailsFrameworkDropDownOnShow(self) - local capsule = self.MyObject - local kill = capsule:RunHooksForWidget("OnShow", self, capsule) + local object = self.MyObject + local kill = object:RunHooksForWidget("OnShow", self, object) if (kill) then return end end function DetailsFrameworkDropDownOnHide(self) - local capsule = self.MyObject - local kill = capsule:RunHooksForWidget("OnHide", self, capsule) + local object = self.MyObject + local kill = object:RunHooksForWidget("OnHide", self, object) if (kill) then return end - self.MyObject:Close() + object:Close() end function DF:BuildDropDownFontList(onClick, icon, iconTexcoord, iconSize) - local t = {} + local fontTable = {} + local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") for name, fontPath in pairs(SharedMedia:HashTable("font")) do - t[#t+1] = {value = name, label = name, onclick = onClick, icon = icon, iconsize = iconSize, texcoord = iconTexcoord, font = fontPath, descfont = "abcdefg ABCDEFG"} + fontTable[#fontTable+1] = {value = name, label = name, onclick = onClick, icon = icon, iconsize = iconSize, texcoord = iconTexcoord, font = fontPath, descfont = "abcdefg ABCDEFG"} end - table.sort(t, function(t1, t2) return t1.label < t2.label end) - return t + + table.sort(fontTable, function(t1, t2) return t1.label < t2.label end) + + return fontTable end ------------------------------------------------------------------------------------------------------------ @@ -1104,6 +1100,7 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de --initialize first menu selected if (type(default) == "string") then dropDownObject:Select(default) + elseif (type(default) == "number") then if (not dropDownObject:Select(default)) then dropDownObject:Select(default, true) @@ -1117,7 +1114,7 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de return dropDownObject end -local defaultBackdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], +local defaultBackdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 1, tile = true, tileSize = 16, insets = {left = 1, right = 1, top = 0, bottom = 1}} local borderBackdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, insets = {left = 0, right = 0, top = 0, bottom = 0}} local childBackdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 256, insets = {left = 0, right = 0, top = 0, bottom = 0}} diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 6c92c65f..59089c62 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 379 +local dversion = 380 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -179,7 +179,7 @@ function DF:GetRoleByClassicTalentTree() --get the spec with more points spent local spec = pointsPerSpec[1] - if (spec and spec [2] >= MIN_SPECS) then + if (spec and spec[2] >= MIN_SPECS) then local specName = spec[1] local spentPoints = spec[2] local specTexture = spec[3] @@ -337,7 +337,6 @@ local embedFunctions = { "BuildMenu", "ShowTutorialAlertFrame", "GetNpcIdFromGuid", - "ShowFeedbackPanel", "SetAsOptionsPanel", "GetPlayerRole", "GetCharacterTalents", @@ -361,7 +360,6 @@ local embedFunctions = { "CreateSplitBar", "CreateTextEntry", "Create1PxPanel", - "CreateFeedbackButton", "CreateOptionsFrame", "NewSpecialLuaEditorEntry", "ShowPromptPanel", @@ -676,7 +674,7 @@ function DF:CommaValue(value) --source http://richard.warburton.it local left, num, right = string_match (value, '^([^%d]*%d)(%d*)(.-)$') - return left .. (num:reverse():gsub ('(%d%d%d)','%1,'):reverse()) .. right + return left .. (num:reverse():gsub('(%d%d%d)','%1,'):reverse()) .. right end function DF:GroupIterator(callback, ...) @@ -724,7 +722,7 @@ function DF:SetFontFace(fontString, fontface) end function DF:SetFontColor(fontString, r, g, b, a) r, g, b, a = DF:ParseColors(r, g, b, a) - fontString:SetTextColor (r, g, b, a) + fontString:SetTextColor(r, g, b, a) end function DF:SetFontShadow (fontString, r, g, b, a, x, y) @@ -2388,11 +2386,11 @@ end function DF:CreateInCombatTexture(frame) if (DF.debug and not frame) then - error ("Details! Framework: CreateInCombatTexture invalid frame on parameter 1.") + error("Details! Framework: CreateInCombatTexture invalid frame on parameter 1.") end local in_combat_background = DF:CreateImage(frame) - in_combat_background:SetColorTexture (.6, 0, 0, .1) + in_combat_background:SetColorTexture(.6, 0, 0, .1) in_combat_background:Hide() local in_combat_label = Plater:CreateLabel(frame, "you are in combat", 24, "silver") @@ -2589,15 +2587,15 @@ end local texturetitle = options_frame:CreateTexture(nil, "artwork") texturetitle:SetTexture([[Interface\CURSOR\Interact]]) - texturetitle:SetTexCoord (0, 1, 0, 1) + texturetitle:SetTexCoord(0, 1, 0, 1) texturetitle:SetVertexColor(1, 1, 1, 1) texturetitle:SetPoint("topleft", options_frame, "topleft", 2, -3) texturetitle:SetWidth(36) texturetitle:SetHeight(36) - local title = DF:NewLabel(options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow") - title:SetPoint("left", texturetitle, "right", 2, -1) - DF:SetFontOutline (title, true) + local titleLabel = DF:NewLabel(options_frame, nil, "$parentTitle", nil, title, nil, 20, "yellow") + titleLabel:SetPoint("left", texturetitle, "right", 2, -1) + DF:SetFontOutline (titleLabel, true) local c = CreateFrame("Button", nil, options_frame, "UIPanelCloseButton") c:SetWidth(32) @@ -2612,6 +2610,12 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --~templates +local latinLanguageIds = {"enUS", "deDE", "esES", "esMX", "frFR", "itIT", "ptBR"} +local alphbets = { + [latinLanguageIds] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}, + ["zhCN"] = {}, +} + --fonts DF.font_templates = DF.font_templates or {} @@ -2634,8 +2638,37 @@ function DF:GetClientRegion() end end +DF.registeredFontPaths = DF.registeredFontPaths or {} + +function DF:GetBestFontPathForLanguage(locale) + local fontPath = DF.registeredFontPaths[locale] + if (fontPath) then + return fontPath + end + + --font paths gotten from creating a FontString with template "GameFontNormal" and getting the font returned from FontString:GetFont() + if (locale == "enUS" or locale == "deDE" or locale == "esES" or locale == "esMX" or locale == "frFR" or locale == "itIT" or locale == "ptBR") then + return [[Fonts\FRIZQT__.TTF]] + + elseif (locale == "ruRU") then + return [[Fonts\FRIZQT___CYR.TTF]] + + elseif (locale == "zhCN") then + return [[Fonts\ARKai_T.ttf]] + + elseif (locale == "zhTW") then + return [[Fonts\blei00d.TTF]] + + elseif (locale == "koKR") then + return [[Fonts\2002.TTF]] + end + + --the locale passed doesn't exists, so pass the enUS + return [[Fonts\FRIZQT__.TTF]] +end + --return the best font to use for the client language -function DF:GetBestFontForLanguage (language, western, cyrillic, china, korean, taiwan) +function DF:GetBestFontForLanguage(language, western, cyrillic, china, korean, taiwan) if (not language) then language = DF.ClientLanguage end @@ -2644,7 +2677,7 @@ function DF:GetBestFontForLanguage (language, western, cyrillic, china, korean, return western or "Friz Quadrata TT" elseif (language == "ruRU") then - return cyrillic or "Arial Narrow" + return cyrillic or "Friz Quadrata TT" elseif (language == "zhCN") then return china or "AR CrystalzcuheiGBK Demibold" @@ -2792,7 +2825,7 @@ function DF:InstallTemplate (widgetType, templateName, template, parentName) end function DF:GetTemplate(widget_type, template_name) - widget_type = string.lower (widget_type) + widget_type = string.lower(widget_type) local template_table if (widget_type == "font") then @@ -2809,80 +2842,14 @@ function DF:GetTemplate(widget_type, template_name) return template_table [template_name] end -function DF.GetParentName (frame) +function DF.GetParentName(frame) local parentName = frame:GetName() if (not parentName) then - error ("Details! FrameWork: called $parent but parent was no name.", 2) + error("Details! FrameWork: called $parent but parent was no name.", 2) end return parentName end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---widget scripts and hooks - -function DF:RunHooksForWidget (event, ...) - local hooks = self.HookList [event] - - if (not hooks) then - print(self.widget:GetName(), "no hooks for", event) - return - end - - for i, func in ipairs(hooks) do - local success, canInterrupt = pcall (func, ...) - if (not success) then - error ("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt) - elseif (canInterrupt) then - return true - end - end -end - -function DF:SetHook(hookType, func) - if (self.HookList [hookType]) then - if (type(func) == "function") then - local isRemoval = false - for i = #self.HookList [hookType], 1, -1 do - if (self.HookList [hookType] [i] == func) then - tremove(self.HookList [hookType], i) - isRemoval = true - break - end - end - if (not isRemoval) then - tinsert(self.HookList [hookType], func) - end - else - if (DF.debug) then - print(debugstack()) - error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".") - end - end - else - if (DF.debug) then - error ("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.") - end - end -end - -function DF:HasHook (hookType, func) - if (self.HookList [hookType]) then - if (type(func) == "function") then - for i = #self.HookList [hookType], 1, -1 do - if (self.HookList [hookType] [i] == func) then - return true - end - end - end - end -end - -function DF:ClearHooks() - for hookType, hookTable in pairs(self.HookList) do - table.wipe(hookTable) - end -end - function DF:Error (errortext) print("|cFFFF2222Details! Framework Error|r:", errortext, self.GetName and self:GetName(), self.WidgetType, debugstack (2, 3, 0)) end @@ -2918,17 +2885,17 @@ function DF:AddMemberForWidget (widgetName, memberType, memberName, func) end else if (DF.debug) then - error ("Details! Framework: AddMemberForWidget invalid function.") + error("Details! Framework: AddMemberForWidget invalid function.") end end else if (DF.debug) then - error ("Details! Framework: AddMemberForWidget unknown memberName or memberType.") + error("Details! Framework: AddMemberForWidget unknown memberName or memberType.") end end else if (DF.debug) then - error ("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".") + error("Details! Framework: AddMemberForWidget unknown widget type: " .. (widgetName or "") .. ".") end end end @@ -2975,11 +2942,11 @@ function DF:OpenInterfaceProfile() if (text == self.__name) then local toggle = _G ["InterfaceOptionsFrameAddOnsButton" .. i .. "Toggle"] if (toggle) then - if (toggle:GetNormalTexture():GetTexture():find ("PlusButton")) then + if (toggle:GetNormalTexture():GetTexture():find("PlusButton")) then --is minimized, need expand toggle:Click() _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click() - elseif (toggle:GetNormalTexture():GetTexture():find ("MinusButton")) then + elseif (toggle:GetNormalTexture():GetTexture():find("MinusButton")) then --isn't minimized _G ["InterfaceOptionsFrameAddOnsButton" .. i+1]:Click() end @@ -3512,13 +3479,13 @@ end local SetBorderColor = function(self, r, g, b) for _, texture in ipairs(self.Borders.Layer1) do - texture:SetColorTexture (r, g, b) + texture:SetColorTexture(r, g, b) end for _, texture in ipairs(self.Borders.Layer2) do - texture:SetColorTexture (r, g, b) + texture:SetColorTexture(r, g, b) end for _, texture in ipairs(self.Borders.Layer3) do - texture:SetColorTexture (r, g, b) + texture:SetColorTexture(r, g, b) end end @@ -3554,68 +3521,68 @@ function DF:CreateBorder (parent, alpha1, alpha2, alpha3) parent.SetLayerVisibility = SetLayerVisibility local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "topleft", parent, "topleft", -1, 1) - PixelUtil.SetPoint (border1, "bottomleft", parent, "bottomleft", -1, -1) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "topleft", parent, "topleft", -1, 1) + PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", -1, -1) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topleft", parent, "topleft", -2, 2) - PixelUtil.SetPoint (border2, "bottomleft", parent, "bottomleft", -2, -2) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -2, 2) + PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -2, -2) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topleft", parent, "topleft", -3, 3) - PixelUtil.SetPoint (border3, "bottomleft", parent, "bottomleft", -3, -3) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -3, 3) + PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -3, -3) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) tinsert(parent.Borders.Layer3, border3) local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "topleft", parent, "topleft", 0, 1) - PixelUtil.SetPoint (border1, "topright", parent, "topright", 1, 1) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "topleft", parent, "topleft", 0, 1) + PixelUtil.SetPoint(border1, "topright", parent, "topright", 1, 1) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topleft", parent, "topleft", -1, 2) - PixelUtil.SetPoint (border2, "topright", parent, "topright", 2, 2) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -1, 2) + PixelUtil.SetPoint(border2, "topright", parent, "topright", 2, 2) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topleft", parent, "topleft", -2, 3) - PixelUtil.SetPoint (border3, "topright", parent, "topright", 3, 3) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -2, 3) + PixelUtil.SetPoint(border3, "topright", parent, "topright", 3, 3) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) tinsert(parent.Borders.Layer3, border3) local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "topright", parent, "topright", 1, 0) - PixelUtil.SetPoint (border1, "bottomright", parent, "bottomright", 1, -1) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "topright", parent, "topright", 1, 0) + PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 1, -1) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topright", parent, "topright", 2, 1) - PixelUtil.SetPoint (border2, "bottomright", parent, "bottomright", 2, -2) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "topright", parent, "topright", 2, 1) + PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 2, -2) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topright", parent, "topright", 3, 2) - PixelUtil.SetPoint (border3, "bottomright", parent, "bottomright", 3, -3) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "topright", parent, "topright", 3, 2) + PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 3, -3) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) tinsert(parent.Borders.Layer3, border3) local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "bottomleft", parent, "bottomleft", 0, -1) - PixelUtil.SetPoint (border1, "bottomright", parent, "bottomright", 0, -1) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", 0, -1) + PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 0, -1) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "bottomleft", parent, "bottomleft", -1, -2) - PixelUtil.SetPoint (border2, "bottomright", parent, "bottomright", 1, -2) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -1, -2) + PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 1, -2) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "bottomleft", parent, "bottomleft", -2, -3) - PixelUtil.SetPoint (border3, "bottomright", parent, "bottomright", 2, -3) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -2, -3) + PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 2, -3) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) @@ -3743,21 +3710,21 @@ function DF:CreateBorderWithSpread (parent, alpha1, alpha2, alpha3, size, spread --left local border1 = parent:CreateTexture(nil, "background") - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) - PixelUtil.SetPoint (border1, "topleft", parent, "topleft", -1 + spread, 1 + (-spread), 0, 0) - PixelUtil.SetPoint (border1, "bottomleft", parent, "bottomleft", -1 + spread, -1 + spread, 0, 0) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "topleft", parent, "topleft", -1 + spread, 1 + (-spread), 0, 0) + PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", -1 + spread, -1 + spread, 0, 0) PixelUtil.SetWidth (border1, size, minPixels) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topleft", parent, "topleft", -2 + spread, 2 + (-spread)) - PixelUtil.SetPoint (border2, "bottomleft", parent, "bottomleft", -2 + spread, -2 + spread) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -2 + spread, 2 + (-spread)) + PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -2 + spread, -2 + spread) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) PixelUtil.SetWidth (border2, size, minPixels) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topleft", parent, "topleft", -3 + spread, 3 + (-spread)) - PixelUtil.SetPoint (border3, "bottomleft", parent, "bottomleft", -3 + spread, -3 + spread) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -3 + spread, 3 + (-spread)) + PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -3 + spread, -3 + spread) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetWidth (border3, size, minPixels) tinsert(parent.Borders.Layer1, border1) @@ -3766,22 +3733,22 @@ function DF:CreateBorderWithSpread (parent, alpha1, alpha2, alpha3, size, spread --top local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "topleft", parent, "topleft", 0 + spread, 1 + (-spread)) - PixelUtil.SetPoint (border1, "topright", parent, "topright", 1 + (-spread), 1 + (-spread)) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) - PixelUtil.SetHeight (border1, size, minPixels) + PixelUtil.SetPoint(border1, "topleft", parent, "topleft", 0 + spread, 1 + (-spread)) + PixelUtil.SetPoint(border1, "topright", parent, "topright", 1 + (-spread), 1 + (-spread)) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetHeight(border1, size, minPixels) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topleft", parent, "topleft", -1 + spread, 2 + (-spread)) - PixelUtil.SetPoint (border2, "topright", parent, "topright", 2 + (-spread), 2 + (-spread)) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) - PixelUtil.SetHeight (border2, size, minPixels) + PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -1 + spread, 2 + (-spread)) + PixelUtil.SetPoint(border2, "topright", parent, "topright", 2 + (-spread), 2 + (-spread)) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetHeight(border2, size, minPixels) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topleft", parent, "topleft", -2 + spread, 3 + (-spread)) - PixelUtil.SetPoint (border3, "topright", parent, "topright", 3 + (-spread), 3 + (-spread)) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) - PixelUtil.SetHeight (border3, size, minPixels) + PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -2 + spread, 3 + (-spread)) + PixelUtil.SetPoint(border3, "topright", parent, "topright", 3 + (-spread), 3 + (-spread)) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetHeight(border3, size, minPixels) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) @@ -3789,21 +3756,21 @@ function DF:CreateBorderWithSpread (parent, alpha1, alpha2, alpha3, size, spread --right local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "topright", parent, "topright", 1 + (-spread), 0 + (-spread)) - PixelUtil.SetPoint (border1, "bottomright", parent, "bottomright", 1 + (-spread), -1 + spread) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetPoint(border1, "topright", parent, "topright", 1 + (-spread), 0 + (-spread)) + PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 1 + (-spread), -1 + spread) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) PixelUtil.SetWidth (border1, size, minPixels) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "topright", parent, "topright", 2 + (-spread), 1 + (-spread)) - PixelUtil.SetPoint (border2, "bottomright", parent, "bottomright", 2 + (-spread), -2 + spread) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetPoint(border2, "topright", parent, "topright", 2 + (-spread), 1 + (-spread)) + PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 2 + (-spread), -2 + spread) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) PixelUtil.SetWidth (border2, size, minPixels) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "topright", parent, "topright", 3 + (-spread), 2 + (-spread)) - PixelUtil.SetPoint (border3, "bottomright", parent, "bottomright", 3 + (-spread), -3 + spread) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetPoint(border3, "topright", parent, "topright", 3 + (-spread), 2 + (-spread)) + PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 3 + (-spread), -3 + spread) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetWidth (border3, size, minPixels) tinsert(parent.Borders.Layer1, border1) @@ -3811,22 +3778,22 @@ function DF:CreateBorderWithSpread (parent, alpha1, alpha2, alpha3, size, spread tinsert(parent.Borders.Layer3, border3) local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border1, "bottomleft", parent, "bottomleft", 0 + spread, -1 + spread) - PixelUtil.SetPoint (border1, "bottomright", parent, "bottomright", 0 + (-spread), -1 + spread) - border1:SetColorTexture (0, 0, 0, alpha1 or default_border_color1) - PixelUtil.SetHeight (border1, size, minPixels) + PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", 0 + spread, -1 + spread) + PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 0 + (-spread), -1 + spread) + border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) + PixelUtil.SetHeight(border1, size, minPixels) local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border2, "bottomleft", parent, "bottomleft", -1 + spread, -2 + spread) - PixelUtil.SetPoint (border2, "bottomright", parent, "bottomright", 1 + (-spread), -2 + spread) - border2:SetColorTexture (0, 0, 0, alpha2 or default_border_color2) - PixelUtil.SetHeight (border2, size, minPixels) + PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -1 + spread, -2 + spread) + PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 1 + (-spread), -2 + spread) + border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) + PixelUtil.SetHeight(border2, size, minPixels) local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint (border3, "bottomleft", parent, "bottomleft", -2 + spread, -3 + spread) - PixelUtil.SetPoint (border3, "bottomright", parent, "bottomright", 2 + (-spread), -3 + spread) - border3:SetColorTexture (0, 0, 0, alpha3 or default_border_color3) - PixelUtil.SetHeight (border3, size, minPixels) + PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -2 + spread, -3 + spread) + PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 2 + (-spread), -3 + spread) + border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + PixelUtil.SetHeight(border3, size, minPixels) tinsert(parent.Borders.Layer1, border1) tinsert(parent.Borders.Layer2, border2) @@ -3940,7 +3907,7 @@ end function DF:GetCurrentSpec() local specIndex = DF.GetSpecialization() if (specIndex) then - local specID = DF.GetSpecializationInfo (specIndex) + local specID = DF.GetSpecializationInfo(specIndex) if (specID and specID ~= 0) then return specID end @@ -3981,7 +3948,7 @@ function DF:QuickDispatch (func, ...) return end - local okay, errortext = pcall (func, ...) + local okay, errortext = pcall(func, ...) if (not okay) then --trigger an error msg @@ -4021,7 +3988,7 @@ function DF:CoreDispatch (context, func, ...) if (type(func) ~= "function") then local stack = debugstack(2) local errortext = "D!Framework " .. context .. " error: invalid function to call\n====================\n" .. stack .. "\n====================\n" - error (errortext) + error(errortext) end local okay, result1, result2, result3, result4 = xpcall(func, geterrorhandler(), ...) @@ -4029,28 +3996,13 @@ function DF:CoreDispatch (context, func, ...) --if (not okay) then --when using pcall --local stack = debugstack(2) --local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n" - --error (errortext) + --error(errortext) --end return result1, result2, result3, result4 end ---/run local a, b =32,3; local f=function(c,d) return c+d, 2, 3;end; print(xpcall(f,geterrorhandler(),a,b)) -function DF_CALC_PERFORMANCE() - local F = CreateFrame("frame") - local T = GetTime() - local J = false - F:SetScript("OnUpdate", function(self, deltaTime) - if (not J) then - J = true - return - end - print("Elapsed Time:", deltaTime) - F:SetScript("OnUpdate", nil) - end) -end - DF.ClassIndexToFileName = { [6] = "DEATHKNIGHT", [1] = "WARRIOR", @@ -4722,7 +4674,7 @@ DF.DebugMixin = { --returns if the unit is tapped (gray health color when another player hit the unit first) function DF:IsUnitTapDenied (unitId) - return unitId and not UnitPlayerControlled (unitId) and UnitIsTapDenied (unitId) + return unitId and not UnitPlayerControlled(unitId) and UnitIsTapDenied(unitId) end diff --git a/Libs/DF/help.lua b/Libs/DF/help.lua index 0c688acc..2874dd96 100644 --- a/Libs/DF/help.lua +++ b/Libs/DF/help.lua @@ -80,7 +80,7 @@ function DF:NewHelp (parent, width, height, x, y, buttonWidth, buttonHeight, nam if (not APIHelpFunctions) then APIHelpFunctions = true - local idx = getmetatable (helpButton).__index + local idx = getmetatable(helpButton).__index for funcName, funcAddress in pairs(idx) do if (not HelpMetaFunctions [funcName]) then HelpMetaFunctions [funcName] = function(object, ...) diff --git a/Libs/DF/label.lua b/Libs/DF/label.lua index a0dd9de9..9ff0528e 100644 --- a/Libs/DF/label.lua +++ b/Libs/DF/label.lua @@ -10,8 +10,6 @@ local loadedAPILabelFunctions = false do local metaPrototype = { WidgetType = "label", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, dversion = detailsFramework.dversion, } @@ -36,6 +34,7 @@ end local LabelMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames ["label"]] detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.SetPointMixin) +detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables @@ -285,7 +284,9 @@ detailsFramework:Mixin(LabelMetaFunctions, detailsFramework.SetPointMixin) container = container.widget end - font = font == "" and "GameFontHighlightSmall" or font or "GameFontHighlightSmall" + if (not font or font == "") then + font = "GameFontNormal" + end labelObject.label = parent:CreateFontString(name, layer or "OVERLAY", font) labelObject.widget = labelObject.label diff --git a/Libs/DF/languages.lua b/Libs/DF/languages.lua index 1ae01e45..599bee7f 100644 --- a/Libs/DF/languages.lua +++ b/Libs/DF/languages.lua @@ -1,7 +1,10 @@ --todo: need to send a callback when setting a new language, this will be used by the volatile menu to refresh the menu +--todo: compress the language tables that aren't in use +--todo: check cooltip fonts --[=[ - namespace = DetailsFramework.Language = DetailsFramework.Language.Register() + namespace = DetailsFramework.Language + Register() = DetailsFramework.Language.Register() Register(addonId, languageId[, gameLanguageOnly]) create a language table within an addon namespace @@ -37,17 +40,39 @@ fontString:SetText(languageTable["STRING_MY_PHRASE"]) GetText(addonId, phraseId[, silent]) - get a text from a registered addonId and phraseId + get a text from a registered addonId and phraseId, return a localized string and the languageId where the string was found, otherwise return the phraseId @addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater @phraseId: any string to identify the a translated text, example: phraseId: "OPTIONS_FRAME_WIDTH" text: "Adjust the Width of the frame." @silent: if true won't error on invalid phrase text and instead use the phraseId as the text, it will still error on invalid addonId - + + ShowOptionsHelp() + print to chat the available options ids, use SetOption to set them + + SetOption(addonId, optionId, value) + set an option + SetCurrentLanguage(addonId, languageId) set the language used by default when retriving a languageTable with DF.Language.GetLanguageTable() and not passing the second argument (languageId) within the call use this in combination with a savedVariable to use a language of the user choice @addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater @languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other value if 'gameLanguageOnly' is false (default) + CreateLanguageSelector(addonId, parent, callback, selectedLanguage) + create and return a dropdown (using details framework dropdown widget) to select the laguage + @addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater + @parent: a frame to use as parent while creating the language selector dropdown + @callback: a function which will be called when the user select a new language function(languageId) print("new language:", languageId) end + @selectedLanguage: default selected language + + SetFontForLanguageId(addonId, languageId, fontPath) + SetFontByAlphabetOrRegion(addonId, latin_FontPath, cyrillic_FontPath, china_FontPath, korean_FontPath, taiwan_FontPath) + set the font to be used for different languages, if no font is registered for a language, the lib will guess if the font need to be changed and change to a compatible with the language + if a font name is passed the lib will attempt to retrive from LibSharedMedia + latin changes the font for "deDE", "enUS", "esES", "esMX", "frFR", "itIT" and "ptBR" + cyrillic for "ruRU", china for "zhCN", korean for "koKR" and taiwan for "zhTW" + @addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater + @languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other string value to represent a language already registered + RegisterObject(addonId, object, phraseId[, silent[, ...]]) to be registered, the Object need to have a SetText method when setting a languageId with DetailsFramework.Language.SetCurrentLanguage(), automatically change the text of all registered Objects @@ -80,14 +105,14 @@ @table: a lua table @key: any value except nil or boolean @vararg: arguments to pass for format(text, ...) - + RegisterObjectWithDefault(addonId, object, phraseId, defaultText[, ...]) (helper function) register an object if a phraseID is valid or object:SetText(defaultText) is called RegisterTableKeyWithDefault(addonId, table, key, phraseId, defaultText[, ...]) (helper function) register a tableKey if a phraseID is valid or table[key] = defaultText - CreateLocTable(addonId, phraseId, shouldRegister[, ...]) + CreateLocTable(addonId, phraseId[, shouldRegister = true[, ...]]) make a table to pass instead of the text while using DetailsFramework widgets this avoid to call the register object function right after creating the widget also make easy to register the same phraseID in many different widgets @@ -95,6 +120,18 @@ SetTextWithLocTable(object, locTable) set the text of an object using a locTable, the object need the method SetText + SetTextWithLocTableWithDefault(object, locTable, defaultText) + set the text from the locTable if passed or use the defaultText + + SetTextIfLocTableOrDefault(object, locTable) + set the text if locTable is a locTable or SetText(locTable) + + RegisterTableKeyWithLocTable(table, key, locTable[, silence]) + same as RegisterTableKey() but get addonId, phraseId and arguments from the locTable + + RegisterObjectWithLocTable(object, locTable[, silence]) + same as RegisterObject() but get addonId, phraseId and arguments from the locTable + --]=] local DF = _G["DetailsFramework"] @@ -106,28 +143,63 @@ local format = string.format local unpack = table.unpack or unpack local GetLocale = _G.GetLocale -local CONST_LANGAGEID_ENUS = "enUS" +local CONST_LANGUAGEID_ENUS = "enUS" +local gameLanguage = GetLocale() + +local addonNamespaceOptions = { + ChangeOnlyRegisteredFont = false, +} +local optionsHelp = { + ChangeOnlyRegisteredFont = "when changing the language, won't change the font if the font isn't registered for the language or region", +} + +local debugElabled = false +local printDebug = function(functionName, ...) + if (debugElabled) then + print("|cFFFFAA00Languages|r:", "|cFFFFFF00" .. functionName .. "|r", ...) + end +end local supportedGameLanguages = { ["deDE"] = true, - [CONST_LANGAGEID_ENUS] = true, + [CONST_LANGUAGEID_ENUS] = true, ["esES"] = true, ["esMX"] = true, ["frFR"] = true, ["itIT"] = true, - ["koKR"] = true, ["ptBR"] = true, + ["koKR"] = true, ["ruRU"] = true, ["zhCN"] = true, ["zhTW"] = true, } ---functionCallPath +local fontLanguageCompatibility = { + ["deDE"] = 1, + [CONST_LANGUAGEID_ENUS] = 1, + ["esES"] = 1, + ["esMX"] = 1, + ["frFR"] = 1, + ["itIT"] = 1, + ["ptBR"] = 1, + ["zhCN"] = 2, + ["zhTW"] = 2, + ["koKR"] = 3, + ["ruRU"] = 4, +} + +local fontPathToLanguageId = { + ["Fonts\\FRIZQT__.TTF"] = "enUS", + ["Fonts\\FRIZQT___CYR.TTF"] = "ruRU", +} + local functionSignature = { ["RegisterLanguage"] = "RegisterLanguage(addonID, languageID[, gameLanguageOnly])", ["SetCurrentLanguage"] = "SetCurrentLanguage(addonID, languageID)", ["GetLanguageTable"] = "GetLanguageTable(addonID[, languageID])", + ["SetFontByAlphabetOrRegion"] = "SetFontByAlphabetOrRegion(addonId, latin, cyrillic, china, korean, taiwan)", + ["SetFontForLanguageId"] = "SetFontForLanguageId(addonId, languageId, fontPath)", ["GetText"] = "GetText(addonID, phraseID[, silent])", ["RegisterObject"] = "RegisterObject(addonID, object, phraseID[, silent[, ...]])", @@ -138,18 +210,26 @@ local functionSignature = { ["RegisterObjectWithDefault"] = "RegisterObjectWithDefault(addonId, object, phraseId, defaultText[, ...])", ["RegisterTableKeyWithDefault"] = "RegisterTableKeyWithDefault(addonId, table, key, phraseId, defaultText[, ...])", - ["CreateLocTable"] = "CreateLocTable(addonId, phraseId, shouldRegister[, ...])", + ["SetOption"] = "SetOption(addonId, optionId, value)", + + ["CreateLocTable"] = "CreateLocTable(addonId, phraseId, shouldRegister[, silent[, ...]])", ["UnpackLocTable"] = "UnpackLocTable(locTable)", - ["CanRegisterLocTable"] = "CanRegisterLocTable(locTable)", - ["RegisterObjectWithLocTable"] = "RegisterObjectWithLocTable(object, locTable)", - ["SetTextWithLocTable"] = "SetTextWithLocTable(object, locTable)", ["IsLocTable"] = "IsLocTable(locTable)", + ["CanRegisterLocTable"] = "CanRegisterLocTable(locTable)", + ["RegisterObjectWithLocTable"] = "RegisterObjectWithLocTable(object, locTable[, silence])", + ["RegisterTableKeyWithLocTable"] = "RegisterTableKeyWithLocTable(table, key, locTable[, silence])", + ["SetTextWithLocTable"] = "SetTextWithLocTable(object, locTable)", + ["SetTextWithLocTableWithDefault"] = "SetTextWithLocTableWithDefault(object, locTable, defaultText)", + ["SetTextIfLocTableOrDefault"] = "SetTextIfLocTableOrDefault(object, locTable or string)", + ["CreateLanguageSelector"] = "DetailsFramework.Language.CreateLanguageSelector", } local functionCallPath = { ["RegisterLanguage"] = "DetailsFramework.Language.RegisterLanguage", ["SetCurrentLanguage"] = "DetailsFramework.Language.SetCurrentLanguage", ["GetLanguageTable"] = "DetailsFramework.Language.GetLanguageTable", + ["SetFontByAlphabetOrRegion"] = "DetailsFramework.Language.SetFontByAlphabetOrRegion", + ["SetFontForLanguageId"] = "DetailsFramework.Language.SetFontForLanguageId", ["GetText"] = "DetailsFramework.Language.GetText", ["RegisterObject"] = "DetailsFramework.Language.RegisterObject", @@ -160,19 +240,27 @@ local functionCallPath = { ["RegisterObjectWithDefault"] = "DetailsFramework.Language.RegisterObjectWithDefault", ["RegisterTableKeyWithDefault"] = "DetailsFramework.Language.RegisterTableKeyWithDefault", + ["SetOption"] = "DetailsFramework.Language.SetOption", + ["CreateLocTable"] = "DetailsFramework.Language.CreateLocTable", ["UnpackLocTable"] = "DetailsFramework.Language.UnpackLocTable", ["CanRegisterLocTable"] = "DetailsFramework.Language.CanRegisterLocTable", ["RegisterObjectWithLocTable"] = "DetailsFramework.Language.RegisterObjectWithLocTable", ["SetTextWithLocTable"] = "DetailsFramework.Language.SetTextWithLocTable", ["IsLocTable"] = "DetailsFramework.Language.IsLocTable", + ["SetTextWithLocTableWithDefault"] = "DetailsFramework.Language.SetTextWithLocTableWithDefault", + ["SetTextIfLocTableOrDefault"] = "DetailsFramework.Language.SetTextIfLocTableOrDefault", + ["RegisterTableKeyWithLocTable"] = "DetailsFramework.Language.RegisterTableKeyWithLocTable", + ["CreateLanguageSelector"] = "CreateLanguageSelector(addonId, parent, callback, selectedLanguage)", } local errorText = { ["AddonID"] = "require a valid addonID (table or string) on #%d argument", ["AddonIDInvalidOrNotRegistered"] = "invalid addonID or no languages registered", ["LanguageID"] = "require a languageID supported by the game on #%d argument", - ["PhraseID"] = "require a string on #%d argument", + ["PhraseID"] = "require a string (phrase id) on #%d argument", + ["LanguageIDInvalid"] = "require a string (language id) on #%d argument", + ["FontPathInvalid"] = "require a string (font path) on #%d argument", ["NoLanguages"] = "no languages registered for addonId", ["LanguageIDNotRegistered"] = "languageID not registered", ["PhraseIDNotRegistered"] = "phraseID not registered", @@ -184,7 +272,8 @@ local errorText = { ["InvalidTableKey"] = "require a table key on #%d argument", ["TableKeyAlreadyRegistered"] = "table already registered", --not in use ["InvalidLocTable"] = "invalid locTable on #%d argument", - ["LocTableCantRegister"] = "cannot register object, locTable.register == false", + ["LocTableCantRegister"] = "cannot register object or tableKey, locTable.register == false", + ["InvalidOptionId"] = "invalid option on #%d argument", } @@ -201,6 +290,13 @@ local isValid_AddonID = function(addonId) return true end +local isValid_LanguageID = function(languageId) + if (type(languageId) ~= "string") then + return false + end + return true +end + local isValid_PhraseID = function(phraseId) return type(phraseId) == "string" end @@ -229,11 +325,18 @@ local getOrCreateAddonNamespace = function(addonId, languageId) languages = {}, registeredObjects = {}, tableKeys = setmetatable({}, {__mode = "k"}), + fonts = {}, --set when the first language table is registered - defaultLanguageTable = nil, + defaultLanguageTable = false, + + options = {}, } + + DF.table.copy(addonNamespaceTable.options, addonNamespaceOptions) DF.Language.RegisteredNamespaces[addonId] = addonNamespaceTable + + printDebug("getOrCreateAddonNamespace", "created new addon namespace for:", addonId) end --if the language being register is the language being in use by the client, set this language as current language @@ -251,6 +354,15 @@ local getAddonNamespace = function(addonId) return DF.Language.RegisteredNamespaces[addonId] end +local setLanguageChangedCallback = function(addonNamespaceTable, callback) + printDebug("setLanguageChangedCallback", "addonId:", addonNamespaceTable.addonId, "callbackType:", type(callback)) + addonNamespaceTable.onLanguageChangeCallback = callback +end + +local getLanguageChangedCallback = function(addonNamespaceTable) + return addonNamespaceTable.onLanguageChangeCallback +end + local getLanguageTable = function(addonNamespaceTable, languageId) local languageTable = addonNamespaceTable.languages[languageId] if (not languageTable) then @@ -259,10 +371,19 @@ local getLanguageTable = function(addonNamespaceTable, languageId) return languageTable end +local getRegisteredLanguages = function(addonNamespaceTable) + return addonNamespaceTable.languages +end + local getCurrentLanguageId = function(addonNamespaceTable) return addonNamespaceTable.currentLanguageId end +local setOption = function(addonNamespaceTable, optionId, value) + printDebug("setOption", "addonId:", addonNamespaceTable.addonId, "optionId:", optionId, "value:", value, "valueType:", type(value)) + addonNamespaceTable.options[optionId] = value +end + --if invalid, the __index from the metatable get the value from the first registered table --will return nil if the languageTable is from the first registered language local getTextFromLangugeTable = function(languageTable, phraseId) @@ -273,56 +394,59 @@ local getRegisteredObjects = function(addonNamespaceTable) return addonNamespaceTable.registeredObjects end +--return a string representing a translated text and the languageId where the string was found +--attempt to get from the current selected language, then from the game language and then from english if the other two fails +--return false if the phraseId isn't found at all local getText = function(addonNamespaceTable, phraseId) local currentLanguageId = getCurrentLanguageId(addonNamespaceTable) local languageTable = getLanguageTable(addonNamespaceTable, currentLanguageId) - --if the languageTable is invalid, let the function caller handle it - --note: languageTable is always valid when the callstack started at from DF.Language.SetCurrentLanguage - if (not languageTable) then - return false - end - - --by using getTextFromLangugeTable the metatable will get the default of the first registered language - --local text = getTextFromLangugeTable(languageTable, phraseId) - local text = rawget(languageTable, phraseId) - if (isValid_Text(text)) then - return text + local text = phraseId + + --get the text from the current language table + if (languageTable) then + text = rawget(languageTable, phraseId) + if (isValid_Text(text)) then + return text, currentLanguageId + end end + --the translated string wasn't found on the current language table --attempt to get the text from the default language used in the client local clientLanguage = GetLocale() if (currentLanguageId ~= clientLanguage) then languageTable = getLanguageTable(addonNamespaceTable, clientLanguage) if (languageTable) then - --text = getTextFromLangugeTable(languageTable, phraseId) text = rawget(languageTable, phraseId) if (isValid_Text(text)) then - return text + return text, clientLanguage end end end --attempt to get from english - if (currentLanguageId ~= CONST_LANGAGEID_ENUS and clientLanguage ~= CONST_LANGAGEID_ENUS) then - languageTable = getLanguageTable(addonNamespaceTable, CONST_LANGAGEID_ENUS) + if (currentLanguageId ~= CONST_LANGUAGEID_ENUS and clientLanguage ~= CONST_LANGUAGEID_ENUS) then + languageTable = getLanguageTable(addonNamespaceTable, CONST_LANGUAGEID_ENUS) if (languageTable) then --text = getTextFromLangugeTable(languageTable, phraseId) text = rawget(languageTable, phraseId) if (isValid_Text(text)) then - return text + return text, CONST_LANGUAGEID_ENUS end end end - return false + return false, CONST_LANGUAGEID_ENUS end -local setLanguageTable = function(addonNamespaceTable, languageId, languageTable) +local setLanguageTableForLanguageId = function(addonNamespaceTable, languageId, languageTable) local isFirstLanguage = not next(addonNamespaceTable.languages) if (isFirstLanguage) then + printDebug("setLanguageTableForLanguageId", "(first to be registered) addonId:", addonNamespaceTable.addonId, "languageId:", languageId, "languageTable:", languageTable, "languageIdType:", type(languageId), "languageTableType:", type(languageTable)) + --defaultLanguageTable is constant addonNamespaceTable.defaultLanguageTable = languageTable else + printDebug("setLanguageTableForLanguageId", "addonId:", addonNamespaceTable.addonId, "languageId:", languageId, "languageTable:", languageTable, "languageIdType:", type(languageId), "languageTableType:", type(languageTable)) local defaultLanguageMetatable = {__index = function(table, key) return addonNamespaceTable.defaultLanguageTable[key] or key end} setmetatable(languageTable, defaultLanguageMetatable) end @@ -332,7 +456,15 @@ local setLanguageTable = function(addonNamespaceTable, languageId, languageTable end local setCurrentLanguageId = function(addonNamespaceTable, languageId) + printDebug("setCurrentLanguageId", "addonId:", addonNamespaceTable.addonId, "languageId:", languageId, "languageIdType:", type(languageId)) + addonNamespaceTable.currentLanguageId = languageId + + local callbackFunc = getLanguageChangedCallback(addonNamespaceTable) + if (callbackFunc) then + printDebug("setCurrentLanguageId", "addonId:", addonNamespaceTable.addonId, "calling callback", "callbackFuncType:", type(callbackFunc)) + xpcall(callbackFunc, _G["geterrorhandler"](), languageId) + end end local parseArguments = function(...) @@ -346,13 +478,55 @@ end --hold information about a localization, used by registered objects and keyTables, has .phraesId, .arguments and .key (on keyTables) local createPhraseInfoTable = function(phraseId, key, ...) - return {phraseId = phraseId, key = key, arguments = parseArguments(...)} + return { + phraseId = phraseId, + key = key, + arguments = parseArguments(...) + } end -local updatePhraseInfoArguments = function(phraseInfoTable, ...) +local updatePhraseInfo_PhraseId = function(phraseInfoTable, phraseId) + phraseInfoTable.phraseId = phraseId +end + +local updatePhraseInfo_Arguments = function(phraseInfoTable, ...) phraseInfoTable.arguments = parseArguments(...) end +local getFontForLanguageId = function(addonNamespaceTable, languageId) + return addonNamespaceTable.fonts[languageId] +end + +local shouldChangeFontForNewLanguage = function(addonNamespaceTable, oldLanguageId, newLanguageId) + --does it need to change the font? + local oldLanguageClusterId = fontLanguageCompatibility[oldLanguageId] + local newLanguageClusterId = fontLanguageCompatibility[newLanguageId] + + if (oldLanguageClusterId == newLanguageClusterId) then + --does not require to change the font + return false + else + if (addonNamespaceTable.options.ChangeOnlyRegisteredFont) then + --can change only if the font was previously registered with SetFontForLanguageId() or SetFontByAlphabetOrRegion() + local languageFontPath = getFontForLanguageId(addonNamespaceTable, newLanguageId) + if (languageFontPath) then + --the font is registered + return true, languageFontPath + end + else + local languageFontPath = getFontForLanguageId(addonNamespaceTable, newLanguageId) + if (languageFontPath) then + --the font is registered + return true, languageFontPath + else + --the font is not registered for this language, get the default font from the framework + languageFontPath = DF:GetBestFontPathForLanguage(newLanguageId) + return true, languageFontPath + end + end + end +end + --get a phraseInfo and text returning a formatted text using arguments if they exists local getFormattedText = function(phraseInfoTable, text) if (phraseInfoTable.arguments) then @@ -362,21 +536,27 @@ local getFormattedText = function(phraseInfoTable, text) end end -local updateObjectTable_PhraseId = function(phraseInfoTable, phraseId) - phraseInfoTable.phraseId = phraseId -end - local getObjectPhraseInfoTable = function(addonNamespaceTable, object) return addonNamespaceTable.registeredObjects[object] end -local setObject_InternalMembers = function(object, addonId, phraseId, arguments) +local setObject_InternalMembers = function(object, addonId, phraseId, arguments, languageId) object.__languageAddonId = addonId or object.__languageAddonId object.__languagePhraseId = phraseId or object.__languagePhraseId object.__languageArguments = arguments or object.__languageArguments + object.__languageId = languageId or object.__languageId end -local setObject_Text = function(object, phraseInfoTable, text) +local setObject_Text = function(addonNamespaceTable, object, phraseInfoTable, text, textLanguageId) + if (textLanguageId ~= object.__languageId) then + local bShouldChangeFont, fontPath = shouldChangeFontForNewLanguage(addonNamespaceTable, object.__languageId, textLanguageId) + if (bShouldChangeFont) then + local font, size, flags = object:GetFont() + object:SetFont(fontPath, size, flags) + setObject_InternalMembers(object, false, false, false, textLanguageId) + end + end + local formattedText = getFormattedText(phraseInfoTable, text) object:SetText(formattedText) end @@ -387,23 +567,38 @@ local objectMethod_SetTextByPhraseID = function(object, phraseId, ...) local addonNamespaceTable = getAddonNamespace(addonId) local phraseInfoTable = getObjectPhraseInfoTable(addonNamespaceTable, object) - updateObjectTable_PhraseId(phraseInfoTable, phraseId) - updatePhraseInfoArguments(phraseInfoTable, ...) - setObject_InternalMembers(object, addonId, phraseId, phraseInfoTable.arguments) + updatePhraseInfo_PhraseId(phraseInfoTable, phraseId) + updatePhraseInfo_Arguments(phraseInfoTable, ...) - local text = getText(addonNamespaceTable, phraseId) - setObject_Text(object, phraseInfoTable, text) + local currentLanguageId = getCurrentLanguageId(addonNamespaceTable) + + --when registering a new object, consider the font already set on the obejct to be a font compatible with the client languageId + setObject_InternalMembers(object, addonId, phraseId, phraseInfoTable.arguments, currentLanguageId) + + local text, textLanguageId = getText(addonNamespaceTable, phraseId) + setObject_Text(addonNamespaceTable, object, phraseInfoTable, text, textLanguageId) return true end local registerObject = function(addonNamespaceTable, object, phraseId, ...) - local phraseInfoTable = createPhraseInfoTable(phraseId, nil, ...) - addonNamespaceTable.registeredObjects[object] = phraseInfoTable + local phraseInfoTable = getObjectPhraseInfoTable(addonNamespaceTable, object) + + if (phraseInfoTable) then + --the object is already registered, update the phraseId and arguments + updatePhraseInfo_PhraseId(phraseInfoTable, phraseId) + updatePhraseInfo_Arguments(phraseInfoTable, ...) + else + phraseInfoTable = createPhraseInfoTable(phraseId, nil, ...) + addonNamespaceTable.registeredObjects[object] = phraseInfoTable + end + + local currentLanguageId = getCurrentLanguageId(addonNamespaceTable) --save internal information about the language directly in the object - setObject_InternalMembers(object, addonNamespaceTable.addonId, phraseId, phraseInfoTable.arguments) + setObject_InternalMembers(object, addonNamespaceTable.addonId, phraseId, phraseInfoTable.arguments, gameLanguage) + --give the object a new method object.SetTextByPhraseID = objectMethod_SetTextByPhraseID return phraseInfoTable @@ -415,8 +610,8 @@ local updateAllRegisteredObjectsText = function(addonNamespaceTable) for object, phraseInfoTable in pairs(objects) do local phraseId = phraseInfoTable.phraseId --note: text is always valid when the callstack started at from DF.Language.SetCurrentLanguage - local text = getText(addonNamespaceTable, phraseId) - setObject_Text(object, phraseInfoTable, text) + local text, textLanguageId = getText(addonNamespaceTable, phraseId) + setObject_Text(addonNamespaceTable, object, phraseInfoTable, text, textLanguageId) end end @@ -473,9 +668,17 @@ local registerTableKey = function(addonNamespaceTable, table, key, phraseId, ... registerTableKeyTable(addonNamespaceTable, table, tableKeyTable) end - --create a table for this table key as a table can hold several keys with localization strings - local phraseInfoTable = createPhraseInfoTable(phraseId, key, ...) - tableKeyTable[key] = phraseInfoTable + local phraseInfoTable = getPhraseInfoFromTableKey(tableKeyTable, key) + + if (phraseInfoTable) then + --the key is already registered for this table, update the phraseId and arguments + phraseInfoTable.phraseId = phraseId + phraseInfoTable.arguments = parseArguments(...) + else + phraseInfoTable = createPhraseInfoTable(phraseId, key, ...) + tableKeyTable[key] = phraseInfoTable + end + return tableKeyTable end @@ -486,12 +689,25 @@ local updateAllRegisteredTableKeyText = function(addonNamespaceTable) for key, phraseInfoTable in pairs(tableKeyTable) do local phraseId = phraseInfoTable.phraseId --note: text is always valid when the callstack started at from DF.Language.SetCurrentLanguage - local text = getText(addonNamespaceTable, phraseId) + local text, textLanguageId = getText(addonNamespaceTable, phraseId) setTableKey_Text(table, key, phraseInfoTable, text) end end end +local updateTextOnAllObjectsAndTableKeys = function(addonNamespaceTable) + updateAllRegisteredObjectsText(addonNamespaceTable) + updateAllRegisteredTableKeyText(addonNamespaceTable) +end + +local setFontForLanguageId = function(addonNamespaceTable, languageId, fontPath) + addonNamespaceTable.fonts[languageId] = fontPath + --add into the font combatibility table (which fonts can be used for a language) + if (not fontLanguageCompatibility[languageId]) then + fontLanguageCompatibility[languageId] = fontPath + end +end + --create a language table within an addon namespace --@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater @@ -512,15 +728,123 @@ function DF.Language.RegisterLanguage(addonId, languageId, gameLanguageOnly) --create a table to hold traslations for this languageId local languageTable = {} - setLanguageTable(addonNamespaceTable, languageId, languageTable) + setLanguageTableForLanguageId(addonNamespaceTable, languageId, languageTable) return languageTable end +--@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater +--@optionId: the ID of the option, check +function DF.Language.SetOption(addonId, optionId, value) + if (not isValid_AddonID(addonId)) then + error(functionCallPath["SetOption"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["SetOption"] .. ".") + end + + if (not addonNamespaceOptions[optionId]) then + error(functionCallPath["SetOption"] .. ": " .. format(errorText["InvalidOptionId"], 2) .. ", use: " .. functionSignature["SetOption"] .. ".") + end + + local addonNamespaceTable = getAddonNamespace(addonId) + if (not addonNamespaceTable) then + error(functionCallPath["SetOption"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") + end + + setOption(addonNamespaceTable, optionId, value) +end + +--print to chat the available option +function DF.Language.ShowOptionsHelp() + for optionId, descriptionString in pairs(optionsHelp) do + print(optionId .. ": " .. descriptionString) + end +end + + +--@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater +--@languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other string value to represent a language +--@fontPath: a path for a font +function DF.Language.SetFontForLanguageId(addonId, languageId, fontPath) + if (not isValid_AddonID(addonId)) then + error(functionCallPath["SetFontForLanguageId"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["SetFontForLanguageId"] .. ".") + end + + if (not isValid_LanguageID(languageId)) then + error(functionCallPath["SetFontForLanguageId"] .. ": " .. format(errorText["LanguageIDInvalid"], 2) .. ", use: " .. functionSignature["SetFontForLanguageId"] .. ".") + end + + if (type(fontPath) ~= "string") then + error(functionCallPath["SetFontForLanguageId"] .. ": " .. format(errorText["FontPathInvalid"], 3) .. ", use: " .. functionSignature["SetFontForLanguageId"] .. ".") + end + + local addonNamespaceTable = getAddonNamespace(addonId) + if (not addonNamespaceTable) then + error(functionCallPath["SetFontForLanguageId"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") + end + + setFontForLanguageId(addonNamespaceTable, languageId, fontPath) +end + + +--@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater +--@regions: accept a font name, ignored is nil is passed +function DF.Language.SetFontByAlphabetOrRegion(addonId, latin, cyrillic, china, korean, taiwan) + if (not isValid_AddonID(addonId)) then + error(functionCallPath["SetFontByAlphabetOrRegion"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["SetFontByAlphabetOrRegion"] .. ".") + end + + local addonNamespaceTable = getAddonNamespace(addonId) + if (not addonNamespaceTable) then + error(functionCallPath["SetFontByAlphabetOrRegion"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") + end + + if (latin) then + local fontPath = latin + if (type(fontPath) == "string") then + setFontForLanguageId(addonNamespaceTable, "deDE", fontPath) + setFontForLanguageId(addonNamespaceTable, "enUS", fontPath) + setFontForLanguageId(addonNamespaceTable, "esES", fontPath) + setFontForLanguageId(addonNamespaceTable, "esMX", fontPath) + setFontForLanguageId(addonNamespaceTable, "frFR", fontPath) + setFontForLanguageId(addonNamespaceTable, "itIT", fontPath) + setFontForLanguageId(addonNamespaceTable, "ptBR", fontPath) + end + end + + if (cyrillic) then + local fontPath = cyrillic + if (type(fontPath) == "string") then + setFontForLanguageId(addonNamespaceTable, "ruRU", fontPath) + end + end + + if (china) then + local fontPath = china + if (type(fontPath) == "string") then + setFontForLanguageId(addonNamespaceTable, "zhCN", fontPath) + end + end + + if (korean) then + local fontPath = korean + if (type(fontPath) == "string") then + setFontForLanguageId(addonNamespaceTable, "zhTW", fontPath) + end + end + + if (taiwan) then + local fontPath = taiwan + if (type(fontPath) == "string") then + local taiwanCountryLanguageId = "zhTW" + setFontForLanguageId(addonNamespaceTable, taiwanCountryLanguageId, fontPath) + end + end +end + + --get the languageTable for the requested languageId within the addon namespace --@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater ---@languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other value if 'gameLanguageOnly' is false (default) +--@languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other string value to represent a language if 'gameLanguageOnly' is false (default) --return value: languageTable function DF.Language.GetLanguageTable(addonId, languageId) if (not isValid_AddonID(addonId)) then @@ -549,8 +873,8 @@ end --set the language used when retriving a languageTable with DF.Language.GetLanguageTable() without passing the second argument (languageId) --use this in combination with a savedVariable to use a language of the user choice --@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater ---@languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other value if 'gameLanguageOnly' is false (default) -function DF.Language.SetCurrentLanguage(addonId, languageId) +--@languageId: game languages: "deDE", "enUS", "esES", "esMX", "frFR", "itIT", "koKR", "ptBR", "ruRU", "zhCN", "zhTW", or any other string value to represent a language if 'gameLanguageOnly' is false (default) +function DF.Language.SetCurrentLanguage(addonId, newLanguageId) if (not isValid_AddonID(addonId)) then error(functionCallPath["SetCurrentLanguage"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["SetCurrentLanguage"] .. ".") end @@ -560,16 +884,16 @@ function DF.Language.SetCurrentLanguage(addonId, languageId) error(functionCallPath["SetCurrentLanguage"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") end - local languageTable = getLanguageTable(addonNamespaceTable, languageId) + local languageTable = getLanguageTable(addonNamespaceTable, newLanguageId) if (not languageTable) then error(functionCallPath["SetCurrentLanguage"] .. ": " .. errorText["LanguageIDNotRegistered"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") end - setCurrentLanguageId(languageId) + setCurrentLanguageId(addonNamespaceTable, newLanguageId) --go into the registered objects and KeyTables and change their text - updateAllRegisteredObjectsText(addonNamespaceTable) - updateAllRegisteredTableKeyText(addonNamespaceTable) + updateTextOnAllObjectsAndTableKeys(addonNamespaceTable) + return true end @@ -590,9 +914,9 @@ function DF.Language.GetText(addonId, phraseId, silent) error(functionCallPath["GetText"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") end - local text = getText(addonNamespaceTable, phraseId) + local text, textLanguageId = getText(addonNamespaceTable, phraseId) if (isValid_Text(text)) then - return text + return text, textLanguageId end if (not silent) then @@ -628,7 +952,15 @@ function DF.Language.RegisterObject(addonId, object, phraseId, silent, ...) local objectTable = registerObject(addonNamespaceTable, object, phraseId, ...) - local text = getText(addonNamespaceTable, phraseId) + --on being registered the FontObject is not being checked for the current font set on it + --this causes the font to have a enUS font from when it was created but wronfully signed as having ruRU font + --causing the fontstring to not change the font when settings the text + + --solution: when registering a font string, get the font on it a attempt to identify the font set on it + --solution 2: will be most likely to the font to be the default from the client language, e.g. frizz_quadrata_tt if the client is running enUS + --solution 3: consider the font being used as the languageId of the client + + local text, textLanguageId = getText(addonNamespaceTable, phraseId) if (not isValid_Text(text)) then if (not silent) then error(functionCallPath["RegisterObject"] .. ": " .. errorText["PhraseIDNotRegistered"] .. ", use: " .. functionSignature["GetLanguageTable"] .. "['PhraseID'] = 'translated text'.") @@ -637,7 +969,7 @@ function DF.Language.RegisterObject(addonId, object, phraseId, silent, ...) end end - setObject_Text(object, objectTable, text) + setObject_Text(addonNamespaceTable, object, objectTable, text, textLanguageId) return true end @@ -663,10 +995,10 @@ function DF.Language.UpdateObjectArguments(addonId, object, ...) if (not phraseInfoTable) then error(functionCallPath["UpdateObjectArguments"] .. ": " .. errorText["ObjectNotRegistered"] .. ", use: " .. functionSignature["RegisterObject"] .. ".") end - updatePhraseInfoArguments(phraseInfoTable, ...) + updatePhraseInfo_Arguments(phraseInfoTable, ...) - local text = getText(addonNamespaceTable, phraseInfoTable.phraseId) - setObject_Text(object, phraseInfoTable, text) + local text, textLanguageId = getText(addonNamespaceTable, phraseInfoTable.phraseId) + setObject_Text(addonNamespaceTable, object, phraseInfoTable, text, textLanguageId) return true end @@ -701,7 +1033,7 @@ function DF.Language.RegisterTableKey(addonId, table, key, phraseId, silent, ... local tableKeyTable = registerTableKey(addonNamespaceTable, table, key, phraseId, ...) - local text = getText(addonNamespaceTable, phraseId) + local text, textLanguageId = getText(addonNamespaceTable, phraseId) if (not isValid_Text(text)) then if (not silent) then error(functionCallPath["RegisterTableKey"] .. ": " .. errorText["PhraseIDNotRegistered"] .. ", use: " .. functionSignature["GetLanguageTable"] .. "['PhraseID'] = 'translated text'.") @@ -747,9 +1079,9 @@ function DF.Language.UpdateTableKeyArguments(addonId, table, key, ...) end local phraseInfo = getPhraseInfoFromTableKey(tableKeyTable, key) --can't nil as the line above checked if it exists - updatePhraseInfoArguments(phraseInfo, key, ...) + updatePhraseInfo_Arguments(phraseInfo, key, ...) - local text = getText(addonNamespaceTable, phraseInfo.phraseId) + local text, textLanguageId = getText(addonNamespaceTable, phraseInfo.phraseId) setTableKey_Text(table, key, tableKeyTable, text) return true end @@ -777,7 +1109,7 @@ function DF.Language.RegisterObjectWithDefault(addonId, object, phraseId, defaul end -function DF.Language.CreateLocTable(addonId, phraseId, shouldRegister, ...) +function DF.Language.CreateLocTable(addonId, phraseId, shouldRegister, silent, ...) if (not isValid_AddonID(addonId)) then error(functionCallPath["CreateLocTable"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["CreateLocTable"] .. ".") end @@ -786,6 +1118,23 @@ function DF.Language.CreateLocTable(addonId, phraseId, shouldRegister, ...) error(functionCallPath["CreateLocTable"] .. ": " .. format(errorText["PhraseID"], 2) .. ", use: " .. functionSignature["CreateLocTable"] .. ".") end + local addonNamespaceTable = getAddonNamespace(addonId) + if (not addonNamespaceTable) then + error(functionCallPath["CreateLocTable"] .. ": " .. errorText["NoLanguages"] .. ", use: " .. functionSignature["CreateLocTable"] .. ".") + end + + local text, textLanguageId = getText(addonNamespaceTable, phraseId) + if (not text) then + if (not silent) then + error(functionCallPath["CreateLocTable"] .. ": " .. errorText["PhraseIDNotRegistered"] .. ", use: " .. functionSignature["CreateLocTable"] .. ".") + end + return + end + + if (type(shouldRegister) == "nil") then + shouldRegister = true + end + local newLocTable = { addonId = addonId, phraseId = phraseId, @@ -824,7 +1173,22 @@ function DF.Language.UnpackLocTable(locTable) end -function DF.Language.RegisterObjectWithLocTable(object, locTable) +function DF.Language.RegisterTableKeyWithLocTable(table, key, locTable, silence) + if (not DF.Language.IsLocTable(locTable)) then + error(functionCallPath["RegisterTableKeyWithLocTable"] .. ": " .. format(errorText["InvalidLocTable"], 3) .. ", use: " .. functionSignature["RegisterTableKeyWithLocTable"] .. ".") + end + + local addonId, phraseId, shouldRegister, arguments = DF.Language.UnpackLocTable(locTable) + + if (not shouldRegister) then + error(functionCallPath["RegisterTableKeyWithLocTable"] .. ": " .. errorText["LocTableCantRegister"] .. ", use: " .. functionSignature["RegisterTableKeyWithLocTable"] .. ".") + end + + DF.Language.RegisterTableKey(addonId, table, key, phraseId, silence, arguments and unpack(arguments)) +end + + +function DF.Language.RegisterObjectWithLocTable(object, locTable, silence) if (not isValid_Object(object)) then error(functionCallPath["RegisterObjectWithLocTable"] .. ": " .. format(errorText["InvalidObject"], 1) .. ", use: " .. functionSignature["RegisterObjectWithLocTable"] .. ".") end @@ -847,7 +1211,7 @@ function DF.Language.RegisterObjectWithLocTable(object, locTable) error(functionCallPath["RegisterObjectWithLocTable"] .. ": " .. errorText["LocTableCantRegister"] .. ", use: " .. functionSignature["RegisterObjectWithLocTable"] .. ".") end - DF.Language.RegisterObject(addonId, object, phraseId, true, arguments and unpack(arguments)) + DF.Language.RegisterObject(addonId, object, phraseId, silence, arguments and unpack(arguments)) end @@ -872,9 +1236,82 @@ function DF.Language.SetTextWithLocTable(object, locTable) return true end - local text = getText(addonNamespaceTable, phraseId) + local text, textLanguageId = getText(addonNamespaceTable, phraseId) --can use the locTable instead of the phraseInfoTable because both has the .arguments member - setObject_Text(object, locTable, text) + setObject_Text(addonNamespaceTable, object, locTable, text, textLanguageId) return true +end + +--use the locTable is valid or set the text using 'defaultText' +--@object: any UIObject or table with SetText method +--@locTable: a locTable created from CreateLocTable() +--@defaultText: a text string +function DF.Language.SetTextWithLocTableWithDefault(object, locTable, defaultText) + if (not isValid_Object(object)) then + error(functionCallPath["SetTextWithLocTableWithDefault"] .. ": " .. format(errorText["InvalidObject"], 1) .. ", use: " .. functionSignature["SetTextWithLocTableWithDefault"] .. ".") + end + + if (not DF.Language.IsLocTable(locTable)) then + object:SetText(defaultText or "") + else + DF.Language.SetTextWithLocTable(object, locTable) + end +end + +--if the second parameter is a regular string, the text set is the string, otherwise it'll handle the locTable and its parameters +--@object: any UIObject or table with SetText method +--@locTable: a locTable created from CreateLocTable() +function DF.Language.SetTextIfLocTableOrDefault(object, locTable) + if (not isValid_Object(object)) then + error(functionCallPath["SetTextIfLocTableOrDefault"] .. ": " .. format(errorText["InvalidObject"], 1) .. ", use: " .. functionSignature["SetTextIfLocTableOrDefault"] .. ".") + end + + if (not DF.Language.IsLocTable(locTable)) then + local textString = locTable + object:SetText(textString) + else + DF.Language.SetTextWithLocTable(object, locTable) + end +end + +--@addonId: an identifier, can be any table or string, will be used when getting the table with phrase translations, example: "DetailsLocalization", "Details", "PlaterLoc", _G.Plater +--@parent: a frame to use as parent while creating the language selector dropdown +--@callback: a function which will be called when the user select a new language function(languageId) print("new language:", languageId) end +--@selectedLanguage: default selected language +function DF.Language.CreateLanguageSelector(addonId, parent, callback, selectedLanguage) + if (not isValid_AddonID(addonId)) then + error(functionCallPath["CreateLanguageSelector"] .. ": " .. format(errorText["AddonID"], 1) .. ", use: " .. functionSignature["CreateLanguageSelector"] .. ".") + end + + if (type(parent) ~= "table" or not parent.GetObjectType or not parent.CreateTexture) then + error(functionCallPath["CreateLanguageSelector"] .. ": " .. format("Require a frame on #%2 argument", 2) .. ", use: " .. functionSignature["CreateLanguageSelector"] .. ".") + end + + local addonNamespaceTable = getAddonNamespace(addonId) + if (not addonNamespaceTable) then + error(functionCallPath["CreateLanguageSelector"] .. ": " .. errorText["AddonIDInvalidOrNotRegistered"] .. ", use: " .. functionSignature["RegisterLanguage"] .. ".") + end + + setLanguageChangedCallback(addonNamespaceTable, callback) + + local allLanguagesRegistered = getRegisteredLanguages(addonNamespaceTable) + + local onSelectLanguage = function(self, addonId, languageId) + DF.Language.SetCurrentLanguage(addonId, languageId) + end + + local buildOptionsFunc = function() + local resultTable = {} + + for languageId in pairs(allLanguagesRegistered) do + resultTable[#resultTable+1] = {value = languageId, label = languageId, onclick = onSelectLanguage} --, icon = icon, iconcolor = iconcolor, iconsize = iconsize + end + + return resultTable + end + + local languageSelector = DF:CreateDropDown(parent, buildOptionsFunc, selectedLanguage or getCurrentLanguageId(addonNamespaceTable), 80, 20, nil, nil, DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + languageSelector:SetFixedParameter(addonId) + return languageSelector end \ No newline at end of file diff --git a/Libs/DF/math.lua b/Libs/DF/math.lua index 671d7a8f..11ffe615 100644 --- a/Libs/DF/math.lua +++ b/Libs/DF/math.lua @@ -14,7 +14,7 @@ SMALL_FLOAT = 0.000001 --find distance between two players function DF:GetDistance_Unit (unit1, unit2) - if (UnitExists (unit1) and UnitExists (unit2)) then + if (UnitExists(unit1) and UnitExists(unit2)) then local u1X, u1Y = UnitPosition (unit1) local u2X, u2Y = UnitPosition (unit2) diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua index 92f02770..13cace98 100644 --- a/Libs/DF/mixins.lua +++ b/Libs/DF/mixins.lua @@ -6,6 +6,10 @@ end local _ +local getFrame = function(frame) + return rawget(frame, "widget") or frame +end + detailsFramework.WidgetFunctions = { GetCapsule = function(self) return self.MyObject @@ -26,6 +30,53 @@ detailsFramework.DefaultMetaFunctionsGet = { end, } +detailsFramework.TooltipHandlerMixin = { + SetTooltip = function(self, tooltip) + if (tooltip) then + if (detailsFramework.Language.IsLocTable(tooltip)) then + --register the locTable as a tableKey + local locTable = tooltip + detailsFramework.Language.RegisterTableKeyWithLocTable(self, "have_tooltip", locTable) + else + self.have_tooltip = tooltip + end + else + self.have_tooltip = nil + end + end, + + GetTooltip = function(self) + return self.have_tooltip + end, + + ShowTooltip = function(self) + local tooltipText = self:GetTooltip() + + if (type(tooltipText) == "function") then + local tooltipFunction = tooltipText + local gotTooltip, tooltipString = pcall(tooltipFunction) + if (gotTooltip) then + tooltipText = tooltipString + end + end + + if (tooltipText) then + GameCooltip:Preset(2) + GameCooltip:AddLine(tooltipText) + GameCooltip:ShowCooltip(getFrame(self), "tooltip") + end + end, + + HideTooltip = function(self) + local tooltipText = self:GetTooltip() + if (tooltipText) then + if (GameCooltip:IsOwner(getFrame(self))) then + GameCooltip:Hide() + end + end + end, +} + detailsFramework.DefaultMetaFunctionsSet = { parent = function(object, value) return object:SetParent(value) @@ -72,10 +123,6 @@ detailsFramework.LayeredRegionMetaFunctionsGet = { end, } -local getFrame = function(frame) - return rawget(frame, "widget") or frame -end - detailsFramework.FrameMixin = { SetFrameStrata = function(self, strata) self = getFrame(self) @@ -296,6 +343,73 @@ detailsFramework.PayloadMixin = { end, } +detailsFramework.ScriptHookMixin = { + RunHooksForWidget = function(self, event, ...) + local hooks = self.HookList[event] + + if (not hooks) then + print(self.widget:GetName(), "no hooks for", event) + return + end + + for i, func in ipairs(hooks) do + local success, canInterrupt = pcall(func, ...) + if (not success) then + error("Details! Framework: " .. event .. " hook for " .. self:GetName() .. ": " .. canInterrupt) + + elseif (canInterrupt) then + return true + end + end + end, + + SetHook = function(self, hookType, func) + if (self.HookList[hookType]) then + if (type(func) == "function") then + local isRemoval = false + for i = #self.HookList[hookType], 1, -1 do + if (self.HookList[hookType][i] == func) then + tremove(self.HookList[hookType], i) + isRemoval = true + break + end + end + + if (not isRemoval) then + tinsert(self.HookList[hookType], func) + end + else + if (detailsFramework.debug) then + print(debugstack()) + error("Details! Framework: invalid function for widget " .. self.WidgetType .. ".") + end + end + else + if (detailsFramework.debug) then + error("Details! Framework: unknown hook type for widget " .. self.WidgetType .. ": '" .. hookType .. "'.") + end + end + end, + + HasHook = function(self, hookType, func) + if (self.HookList[hookType]) then + if (type(func) == "function") then + for i = #self.HookList[hookType], 1, -1 do + if (self.HookList[hookType][i] == func) then + return true + end + end + end + end + end, + + ClearHooks = function(self) + for hookType, hookTable in pairs(self.HookList) do + table.wipe(hookTable) + end + end, +} + detailsFramework.ScrollBoxFunctions = { Refresh = function(self) --hide all frames and tag as not in use diff --git a/Libs/DF/normal_bar.lua b/Libs/DF/normal_bar.lua index ae919c4d..e1323130 100644 --- a/Libs/DF/normal_bar.lua +++ b/Libs/DF/normal_bar.lua @@ -20,9 +20,6 @@ local APIBarFunctions do local metaPrototype = { WidgetType = "normal_bar", - SetHook = DF.SetHook, - RunHooksForWidget = DF.RunHooksForWidget, - dversion = DF.dversion, } @@ -44,7 +41,8 @@ do end end -local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] +local BarMetaFunctions = _G[DF.GlobalWidgetControlNames["normal_bar"]] +DF:Mixin(BarMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables @@ -227,7 +225,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local smember_color = function(_object, _value) local _value1, _value2, _value3, _value4 = DF:ParseColors(_value) - _object.statusbar:SetStatusBarColor (_value1, _value2, _value3, _value4) + _object.statusbar:SetStatusBarColor(_value1, _value2, _value3, _value4) _object._texture.original_colors = {_value1, _value2, _value3, _value4} _object.timer_texture:SetVertexColor(_value1, _value2, _value3, _value4) @@ -246,7 +244,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local _value1, _value2 = _unpack(_value) _object._icon:SetTexture(_value1) if (_value2) then - _object._icon:SetTexCoord (_unpack(_value2)) + _object._icon:SetTexCoord(_unpack(_value2)) end else _object._icon:SetTexture(_value) @@ -261,12 +259,12 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] _object.timer_texture:SetTexture(_value1) _object.timer_textureR:SetTexture(_value1) if (_value2) then - _object._texture:SetTexCoord (_unpack(_value2)) - _object.timer_texture:SetTexCoord (_unpack(_value2)) - _object.timer_textureR:SetTexCoord (_unpack(_value2)) + _object._texture:SetTexCoord(_unpack(_value2)) + _object.timer_texture:SetTexCoord(_unpack(_value2)) + _object.timer_textureR:SetTexCoord(_unpack(_value2)) end else - if (_value:find ("\\")) then + if (_value:find("\\")) then _object._texture:SetTexture(_value) else local file = SharedMedia:Fetch ("statusbar", _value) @@ -285,7 +283,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] end --background texture local smember_backgroundtexture = function(_object, _value) - if (_value:find ("\\")) then + if (_value:find("\\")) then _object.background:SetTexture(_value) else local file = SharedMedia:Fetch ("statusbar", _value) @@ -310,8 +308,8 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] --font color local smember_textcolor = function(_object, _value) local _value1, _value2, _value3, _value4 = DF:ParseColors(_value) - _object.textleft:SetTextColor (_value1, _value2, _value3, _value4) - return _object.textright:SetTextColor (_value1, _value2, _value3, _value4) + _object.textleft:SetTextColor(_value1, _value2, _value3, _value4) + return _object.textright:SetTextColor(_value1, _value2, _value3, _value4) end --outline (shadow) local smember_outline = function(_object, _value) @@ -421,7 +419,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] r, g, b, a = DF:ParseColors(r, g, b, a) self._texture:SetVertexColor(r, g, b, a) - self.statusbar:SetStatusBarColor (r, g, b, a) + self.statusbar:SetStatusBarColor(r, g, b, a) self._texture.original_colors = {r, g, b, a} end @@ -430,7 +428,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] self._icon:SetTexture(texture) if (...) then local L, R, U, D = _unpack(...) - self._icon:SetTexCoord (L, R, U, D) + self._icon:SetTexCoord(L, R, U, D) end end @@ -490,7 +488,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnEnter = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnEnter", frame, capsule) + local kill = capsule:RunHooksForWidget("OnEnter", frame, capsule) if (kill) then return end @@ -507,7 +505,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnLeave = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnLeave", frame, capsule) + local kill = capsule:RunHooksForWidget("OnLeave", frame, capsule) if (kill) then return end @@ -521,7 +519,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnHide = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnHide", frame, capsule) + local kill = capsule:RunHooksForWidget("OnHide", frame, capsule) if (kill) then return end @@ -529,7 +527,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnShow = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnShow", frame, capsule) + local kill = capsule:RunHooksForWidget("OnShow", frame, capsule) if (kill) then return end @@ -537,7 +535,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnMouseDown = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseDown", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseDown", frame, button, capsule) if (kill) then return end @@ -552,7 +550,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] local OnMouseUp = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseUp", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseUp", frame, button, capsule) if (kill) then return end @@ -568,7 +566,7 @@ local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] function BarMetaFunctions:OnTimerEnd() local capsule = self - local kill = capsule:RunHooksForWidget ("OnTimerEnd", self.widget, capsule) + local kill = capsule:RunHooksForWidget("OnTimerEnd", self.widget, capsule) if (kill) then return end @@ -762,14 +760,14 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name) DF.BarNameCounter = DF.BarNameCounter + 1 elseif (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) elseif (not container) then container = parent end - if (name:find ("$parent")) then - local parentName = DF.GetParentName (parent) - name = name:gsub ("$parent", parentName) + if (name:find("$parent")) then + local parentName = DF.GetParentName(parent) + name = name:gsub("$parent", parentName) end local BarObject = {type = "bar", dframework = true} @@ -797,7 +795,7 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name) --create widgets BarObject.statusbar = CreateFrame("statusbar", name, parent) - DF:Mixin (BarObject.statusbar, DF.WidgetFunctions) + DF:Mixin(BarObject.statusbar, DF.WidgetFunctions) build_statusbar (BarObject.statusbar) @@ -805,7 +803,7 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name) if (not APIBarFunctions) then APIBarFunctions = true - local idx = getmetatable (BarObject.statusbar).__index + local idx = getmetatable(BarObject.statusbar).__index for funcName, funcAddress in pairs(idx) do if (not BarMetaFunctions [funcName]) then BarMetaFunctions [funcName] = function(object, ...) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index fb6a954e..60ffbcb6 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -1,7 +1,7 @@ local detailsFramework = _G ["DetailsFramework"] if (not detailsFramework or not DetailsFrameworkCanLoad) then - return + return end local _ @@ -28,7 +28,7 @@ end local PixelUtil = PixelUtil or DFPixelUtil -local UnitGroupRolesAssigned = DetailsFramework.UnitGroupRolesAssigned +local UnitGroupRolesAssigned = detailsFramework.UnitGroupRolesAssigned local cleanfunction = function() end local APIFrameFunctions @@ -36,9 +36,6 @@ local APIFrameFunctions do local metaPrototype = { WidgetType = "panel", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, - dversion = detailsFramework.dversion, } @@ -56,11 +53,12 @@ do end else --first time loading the framework - _G[detailsFramework.GlobalWidgetControlNames ["panel"]] = metaPrototype + _G[detailsFramework.GlobalWidgetControlNames["panel"]] = metaPrototype end end -local PanelMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames ["panel"]] +local PanelMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["panel"]] +detailsFramework:Mixin(PanelMetaFunctions, detailsFramework.ScriptHookMixin) --default options for the frame layout local default_framelayout_options = { @@ -86,29 +84,29 @@ detailsFramework.LayoutFrame = { if (point == "top") then self:ClearAllPoints() self:SetPoint("bottom", anchor, "top", x or 0, y or 0) - + elseif (point == "bottom") then self:ClearAllPoints() self:SetPoint("top", anchor, "bottom", x or 0, y or 0) - + elseif (point == "left") then self:ClearAllPoints() self:SetPoint("right", anchor, "left", x or 0, y or 0) - + elseif (point == "right") then self:ClearAllPoints() self:SetPoint("left", anchor, "right", x or 0, y or 0) end end, - + ArrangeFrames = function(self, frameList, options) if (not frameList) then frameList = {self:GetChildren()} end - + options = options or {} detailsFramework.table.deploy(options, default_framelayout_options) - + local breakLine = options.amount_per_line + 1 local currentX, currentY = options.start_x, options.start_y local offsetX, offsetY = options.offset_x, options.offset_y @@ -116,15 +114,15 @@ detailsFramework.LayoutFrame = { local anchorAt = options.anchor_relative local latestFrame = self local firstRowFrame = frameList[1] - + if (options.is_vertical) then - for i = 1, #frameList do + for i = 1, #frameList do local thisFrame = frameList[i] if (options.break_if_hidden and not thisFrame:IsShown()) then break end thisFrame:ClearAllPoints() - + if (options.anchor_to_child) then if (i == breakLine) then if (options.grow_right) then @@ -147,24 +145,24 @@ detailsFramework.LayoutFrame = { currentX = currentX - offsetX end currentY = options.start_y - + firstRowFrame = thisFrame breakLine = breakLine + options.amount_per_line end - + thisFrame:SetPoint(anchorPoint, self, anchorAt, currentX, currentY) currentY = currentY - offsetY end end - + else - for i = 1, #frameList do + for i = 1, #frameList do local thisFrame = frameList [i] if (options.break_if_hidden and not thisFrame:IsShown()) then break end thisFrame:ClearAllPoints() - + if (options.anchor_to_child) then if (i == breakLine) then if (options.grow_down) then @@ -187,11 +185,11 @@ detailsFramework.LayoutFrame = { currentY = currentY + offsetY end currentX = options.start_x - + firstRowFrame = thisFrame breakLine = breakLine + options.amount_per_line end - + thisFrame:SetPoint(anchorPoint, self, anchorAt, currentX, currentY) currentX = currentX + offsetX end @@ -236,7 +234,7 @@ detailsFramework.LayoutFrame = { end --locked local gmember_locked = function(_object) - return rawget (_object, "is_locked") + return rawget(_object, "is_locked") end PanelMetaFunctions.GetMembers = PanelMetaFunctions.GetMembers or {} @@ -247,21 +245,21 @@ detailsFramework.LayoutFrame = { PanelMetaFunctions.GetMembers ["width"] = gmember_width PanelMetaFunctions.GetMembers ["height"] = gmember_height PanelMetaFunctions.GetMembers ["locked"] = gmember_locked - + PanelMetaFunctions.__index = function(object, key) local func = PanelMetaFunctions.GetMembers[key] if (func) then return func(object, key) end - + local fromMe = rawget(object, key) if (fromMe) then return fromMe end - + return PanelMetaFunctions[key] end - + --tooltip local smember_tooltip = function(_object, _value) return _object:SetTooltip (_value) @@ -306,18 +304,18 @@ detailsFramework.LayoutFrame = { rawset (_object, "is_locked", false) return end - end - + end + --backdrop local smember_backdrop = function(_object, _value) return _object.frame:SetBackdrop(_value) end - + --close with right button local smember_right_close = function(_object, _value) return rawset (_object, "rightButtonClose", _value) end - + PanelMetaFunctions.SetMembers = PanelMetaFunctions.SetMembers or {} PanelMetaFunctions.SetMembers["tooltip"] = smember_tooltip PanelMetaFunctions.SetMembers["show"] = smember_show @@ -346,12 +344,12 @@ detailsFramework.LayoutFrame = { local text width = width or 20 height = height or 20 - + if (showCloseText) then text = showCloseText else if (textType) then - textType = string.lower (textType) + textType = string.lower(textType) if (textType == "short") then text = "close window" @@ -365,7 +363,7 @@ detailsFramework.LayoutFrame = { text = "close window" end end - + return detailsFramework:NewLabel(self, _, "$parentRightMouseToClose", nil, "|TInterface\\TUTORIALFRAME\\UI-TUTORIAL-FRAME:" .. width .. ":" .. height .. ":0:1:512:512:8:70:328:409|t " .. text) end @@ -387,8 +385,8 @@ detailsFramework.LayoutFrame = { end return self.widget:SetPoint(v1, v2, v3, v4, v5) end - --- sizes + +-- sizes function PanelMetaFunctions:SetSize(w, h) if (w) then self.frame:SetWidth(w) @@ -397,10 +395,10 @@ detailsFramework.LayoutFrame = { self.frame:SetHeight(h) end end - + -- clear function PanelMetaFunctions:HideWidgets() - for widgetName, widgetSelf in pairs(self) do + for widgetName, widgetSelf in pairs(self) do if (type(widgetSelf) == "table" and widgetSelf.dframework) then widgetSelf:Hide() end @@ -409,13 +407,13 @@ detailsFramework.LayoutFrame = { -- backdrop function PanelMetaFunctions:SetBackdrop(background, edge, tilesize, edgesize, tile, left, right, top, bottom) - + if (type(background) == "boolean" and not background) then return self.frame:SetBackdrop(nil) - + elseif (type(background) == "table") then self.frame:SetBackdrop(background) - + else local currentBackdrop = self.frame:GetBackdrop() or {edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", bgFile="Interface\\DialogFrame\\UI-DialogBox-Background", tile=true, tileSize=16, edgeSize=16, insets={left=1, right=0, top=0, bottom=0}} currentBackdrop.bgFile = background or currentBackdrop.bgFile @@ -430,7 +428,7 @@ detailsFramework.LayoutFrame = { self.frame:SetBackdrop(currentBackdrop) end end - + -- backdropcolor function PanelMetaFunctions:SetBackdropColor(color, arg2, arg3, arg4) if (arg2) then @@ -440,8 +438,8 @@ detailsFramework.LayoutFrame = { self.frame:SetBackdropColor(_value1, _value2, _value3, _value4) end end - --- border color + +-- border color function PanelMetaFunctions:SetBackdropBorderColor(color, arg2, arg3, arg4) if (arg2) then return self.frame:SetBackdropBorderColor(color, arg2, arg3, arg4) @@ -449,7 +447,7 @@ detailsFramework.LayoutFrame = { local _value1, _value2, _value3, _value4 = detailsFramework:ParseColors(color) self.frame:SetBackdropBorderColor(_value1, _value2, _value3, _value4) end - + -- tooltip function PanelMetaFunctions:SetTooltip (tooltip) if (tooltip) then @@ -459,7 +457,7 @@ detailsFramework.LayoutFrame = { end end function PanelMetaFunctions:GetTooltip() - return rawget (self, "have_tooltip") + return rawget(self, "have_tooltip") end -- frame levels @@ -489,15 +487,15 @@ detailsFramework.LayoutFrame = { ------------------------------------------------------------------------------------------------------------ --scripts - + local OnEnter = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnEnter", frame, capsule) + local kill = capsule:RunHooksForWidget("OnEnter", frame, capsule) if (kill) then return end - - if (frame.MyObject.have_tooltip) then + + if (frame.MyObject.have_tooltip) then GameCooltip2:Reset() GameCooltip2:SetType ("tooltip") GameCooltip2:SetColor ("main", "transparent") @@ -509,67 +507,67 @@ detailsFramework.LayoutFrame = { local OnLeave = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnLeave", frame, capsule) + local kill = capsule:RunHooksForWidget("OnLeave", frame, capsule) if (kill) then return end - - if (frame.MyObject.have_tooltip) then + + if (frame.MyObject.have_tooltip) then GameCooltip2:ShowMe(false) end - + end - + local OnHide = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnHide", frame, capsule) + local kill = capsule:RunHooksForWidget("OnHide", frame, capsule) if (kill) then return end end - + local OnShow = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnShow", frame, capsule) + local kill = capsule:RunHooksForWidget("OnShow", frame, capsule) if (kill) then return end end - + local OnMouseDown = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseDown", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseDown", frame, button, capsule) if (kill) then return end - + if (frame.MyObject.container == UIParent) then if (not frame.isLocked and frame:IsMovable()) then frame.isMoving = true frame:StartMoving() end - + elseif (not frame.MyObject.container.isLocked and frame.MyObject.container:IsMovable()) then if (not frame.isLocked and frame:IsMovable()) then frame.MyObject.container.isMoving = true frame.MyObject.container:StartMoving() end end - + end - + local OnMouseUp = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseUp", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseUp", frame, button, capsule) if (kill) then return end - + if (button == "RightButton" and frame.MyObject.rightButtonClose) then frame.MyObject:Hide() end - + if (frame.MyObject.container == UIParent) then if (frame.isMoving) then frame:StopMovingOrSizing() @@ -582,7 +580,7 @@ detailsFramework.LayoutFrame = { end end end - + ------------------------------------------------------------------------------------------------------------ --object constructor function detailsFramework:CreatePanel (parent, w, h, backdrop, backdropcolor, bordercolor, member, name) @@ -601,17 +599,17 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr if (not container) then container = parent end - - if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + + if (name:find("$parent")) then + name = name:gsub("$parent", parent:GetName()) end - + local PanelObject = {type = "panel", dframework = true} - + if (member) then parent [member] = PanelObject end - + if (parent.dframework) then parent = parent.widget end @@ -624,7 +622,7 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr PanelObject.is_locked = true PanelObject.container = container PanelObject.rightButtonClose = false - + PanelObject.frame = CreateFrame("frame", name, parent,"BackdropTemplate") PanelObject.frame:SetSize(100, 100) PanelObject.frame.Gradient = { @@ -632,13 +630,13 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr ["OnLeave"] = {0.9, 0.7, 0.7, 1} } PanelObject.frame:SetBackdrop({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 10, tileSize = 64, tile = true}) - + PanelObject.widget = PanelObject.frame - + if (not APIFrameFunctions) then APIFrameFunctions = {} - local idx = getmetatable (PanelObject.frame).__index - for funcName, funcAddress in pairs(idx) do + local idx = getmetatable(PanelObject.frame).__index + for funcName, funcAddress in pairs(idx) do if (not PanelMetaFunctions [funcName]) then PanelMetaFunctions [funcName] = function(object, ...) local x = loadstring ( "return _G['"..object.frame:GetName().."']:"..funcName.."(...)") @@ -647,12 +645,12 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr end end end - + PanelObject.frame:SetWidth(w or 100) PanelObject.frame:SetHeight(h or 100) - + PanelObject.frame.MyObject = PanelObject - + PanelObject.HookList = { OnEnter = {}, OnLeave = {}, @@ -661,7 +659,7 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr OnMouseDown = {}, OnMouseUp = {}, } - + --hooks PanelObject.frame:SetScript("OnEnter", OnEnter) PanelObject.frame:SetScript("OnLeave", OnLeave) @@ -669,7 +667,7 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr PanelObject.frame:SetScript("OnShow", OnShow) PanelObject.frame:SetScript("OnMouseDown", OnMouseDown) PanelObject.frame:SetScript("OnMouseUp", OnMouseUp) - + setmetatable(PanelObject, PanelMetaFunctions) if (backdrop) then @@ -677,11 +675,11 @@ function detailsFramework:NewPanel(parent, container, name, member, w, h, backdr elseif (type(backdrop) == "boolean") then PanelObject.frame:SetBackdrop(nil) end - + if (backdropcolor) then PanelObject:SetBackdropColor(backdropcolor) end - + if (bordercolor) then PanelObject:SetBackdropBorderColor(bordercolor) end @@ -694,19 +692,19 @@ end local button_on_enter = function(self) self.MyObject._icon:SetBlendMode("ADD") if (self.MyObject.onenter_func) then - pcall (self.MyObject.onenter_func, self.MyObject) + pcall(self.MyObject.onenter_func, self.MyObject) end end local button_on_leave = function(self) self.MyObject._icon:SetBlendMode("BLEND") if (self.MyObject.onleave_func) then - pcall (self.MyObject.onleave_func, self.MyObject) + pcall(self.MyObject.onleave_func, self.MyObject) end end local add_row = function(self, t, need_update) local index = #self.rows+1 - + local thisrow = detailsFramework:NewPanel(self, self, "$parentHeader_" .. self._name .. index, nil, 1, 20) thisrow.backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]]} thisrow.color = {.3, .3, .3, .9} @@ -716,19 +714,19 @@ local add_row = function(self, t, need_update) thisrow.notext = t.notext thisrow.icon = t.icon thisrow.iconalign = t.iconalign - + thisrow.hidden = t.hidden or false - + thisrow.onenter = t.onenter thisrow.onleave = t.onleave - + local text = detailsFramework:NewLabel(thisrow, nil, self._name .. "$parentLabel" .. index, "text") text:SetPoint("left", thisrow, "left", 2, 0) text:SetText(t.name) tinsert(self._raw_rows, t) tinsert(self.rows, thisrow) - + if (need_update) then self:AlignRows() end @@ -745,12 +743,12 @@ local align_rows = function(self) local cur_width = 1 local row_width = self._width / max(rows_shown, 0.0001) - + local sindex = 1 - + wipe (self._anchors) - + for index, row in ipairs(self.rows) do if (not row.hidden) then if (self._autowidth) then @@ -768,7 +766,7 @@ local align_rows = function(self) tinsert(self._anchors, cur_width) cur_width = cur_width + self._raw_rows [index].width + 1 end - + row:Show() local rowType = row.type @@ -784,7 +782,7 @@ local align_rows = function(self) tinsert(line.text_inuse, text) text:SetPoint("left", line, "left", self._anchors [#self._anchors], 0) text:SetWidth(row.width) - + detailsFramework:SetFontSize (text, row.textsize or 10) text:SetJustifyH(row.textalign or "left") end @@ -804,10 +802,10 @@ local align_rows = function(self) entry:SetWidth(row.width) end entry.func = row.func - + entry.onenter_func = nil entry.onleave_func = nil - + if (row.onenter) then entry.onenter_func = row.onenter end @@ -816,7 +814,7 @@ local align_rows = function(self) end end - elseif (rowType == "checkbox") then + elseif (rowType == "checkbox") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] local checkbox = tremove(line.checkbox_available) @@ -854,7 +852,7 @@ local align_rows = function(self) else button:SetWidth(row.width) end - + if (row.icon) then button._icon.texture = row.icon button._icon:ClearAllPoints() @@ -868,22 +866,22 @@ local align_rows = function(self) button._icon:SetPoint("left", button, "left") end end - + if (row.name and not row.notext) then button._text:SetPoint("left", button._icon, "right", 2, 0) button._text.text = row.name end - + button.onenter_func = nil button.onleave_func = nil - + if (row.onenter) then button.onenter_func = row.onenter end if (row.onleave) then button.onleave_func = row.onleave end - + end elseif (rowType == "icon") then for i = 1, #self.scrollframe.lines do @@ -897,7 +895,7 @@ local align_rows = function(self) icon:SetPoint("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) icon.func = row.func end - + elseif (rowType == "texture") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] @@ -909,15 +907,15 @@ local align_rows = function(self) tinsert(line.texture_inuse, texture) texture:SetPoint("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) end - + end - + sindex = sindex + 1 else row:Hide() end end - + if (#self.rows > 0) then if (self._autowidth) then self.rows [#self.rows]:SetWidth(row_width - rows_shown + 1) @@ -925,7 +923,7 @@ local align_rows = function(self) self.rows [#self.rows]:SetWidth(self._raw_rows [rows_shown].width - rows_shown + 1) end end - + self.showing_amt = rows_shown end @@ -934,7 +932,7 @@ local update_rows = function(self, updated_rows) for i = 1, #updated_rows do local t = updated_rows [i] local raw = self._raw_rows [i] - + if (not raw) then self:AddRow (t) else @@ -942,31 +940,31 @@ local update_rows = function(self, updated_rows) raw.hidden = t.hidden or false raw.textsize = t.textsize raw.textalign = t.textalign - + local widget = self.rows [i] widget.name = t.name widget.textsize = t.textsize widget.textalign = t.textalign widget.hidden = t.hidden or false - + -- widget.onenter = t.onenter widget.onleave = t.onleave -- - + widget.text:SetText(t.name) detailsFramework:SetFontSize (widget.text, raw.textsize or 10) widget.text:SetJustifyH(raw.textalign or "left") end end - + for i = #updated_rows+1, #self._raw_rows do local raw = self._raw_rows [i] local widget = self.rows [i] raw.hidden = true widget.hidden = true end - + for index, row in ipairs(self.scrollframe.lines) do for i = #row.text_inuse, 1, -1 do tinsert(row.text_available, tremove(row.text_inuse, i)) @@ -974,14 +972,14 @@ local update_rows = function(self, updated_rows) for i = 1, #row.text_available do row.text_available[i]:Hide() end - + for i = #row.entry_inuse, 1, -1 do tinsert(row.entry_available, tremove(row.entry_inuse, i)) end for i = 1, #row.entry_available do row.entry_available[i]:Hide() end - + for i = #row.button_inuse, 1, -1 do tinsert(row.button_available, tremove(row.button_inuse, i)) end @@ -995,14 +993,14 @@ local update_rows = function(self, updated_rows) for i = 1, #row.checkbox_available do row.checkbox_available[i]:Hide() end - + for i = #row.icon_inuse, 1, -1 do tinsert(row.icon_available, tremove(row.icon_inuse, i)) end for i = 1, #row.icon_available do row.icon_available[i]:Hide() end - + for i = #row.texture_inuse, 1, -1 do tinsert(row.texture_available, tremove(row.texture_inuse, i)) end @@ -1010,9 +1008,9 @@ local update_rows = function(self, updated_rows) row.texture_available[i]:Hide() end end - + self.current_header = updated_rows - + self:AlignRows() end @@ -1027,30 +1025,30 @@ local create_panel_entry = function(self, row) row.entry_total = row.entry_total + 1 local editbox = detailsFramework:NewTextEntry(row, nil, "$parentEntry" .. row.entry_total, "entry", 120, 20) editbox.align = "left" - + editbox:SetHook("OnEnterPressed", function() editbox.widget.focuslost = true editbox:ClearFocus() editbox.func (editbox.index, editbox.text) return true end) - + editbox:SetHook("OnEnter", function() if (editbox.onenter_func) then - pcall (editbox.onenter_func, editbox) + pcall(editbox.onenter_func, editbox) end end) editbox:SetHook("OnLeave", function() if (editbox.onleave_func) then - pcall (editbox.onleave_func, editbox) + pcall(editbox.onleave_func, editbox) end end) editbox.editbox.current_bordercolor = {1, 1, 1, 0.1} - + editbox:SetTemplate(detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) editbox:SetBackdropColor(.2, .2, .2, 0.7) - + tinsert(row.entry_available, editbox) end @@ -1070,15 +1068,15 @@ local create_panel_button = function(self, row) local button = detailsFramework:NewButton(row, nil, "$parentButton" .. row.button_total, "button" .. row.button_total, 120, 20) --create icon and the text - local icon = detailsFramework:NewImage (button, nil, 20, 20) + local icon = detailsFramework:NewImage(button, nil, 20, 20) local text = detailsFramework:NewLabel(button) - + button._icon = icon button._text = text button:SetHook("OnEnter", button_on_enter) button:SetHook("OnLeave", button_on_leave) - + tinsert(row.button_available, button) end @@ -1090,16 +1088,16 @@ end local create_panel_icon = function(self, row) row.icon_total = row.icon_total + 1 local iconbutton = detailsFramework:NewButton(row, nil, "$parentIconButton" .. row.icon_total, "iconbutton", 22, 20) - + iconbutton:SetHook("OnEnter", button_on_enter) iconbutton:SetHook("OnLeave", button_on_leave) - + iconbutton:SetHook("OnMouseUp", function() detailsFramework:IconPick (icon_onclick, true, iconbutton) return true end) - - local icon = detailsFramework:NewImage (iconbutton, nil, 20, 20, "artwork", nil, "_icon", "$parentIcon" .. row.icon_total) + + local icon = detailsFramework:NewImage(iconbutton, nil, 20, 20, "artwork", nil, "_icon", "$parentIcon" .. row.icon_total) iconbutton._icon = icon icon:SetPoint("center", iconbutton, "center", 0, 0) @@ -1109,7 +1107,7 @@ end local create_panel_texture = function(self, row) row.texture_total = row.texture_total + 1 - local texture = detailsFramework:NewImage (row, nil, 20, 20, "artwork", nil, "_icon" .. row.texture_total, "$parentIcon" .. row.texture_total) + local texture = detailsFramework:NewImage(row, nil, 20, 20, "artwork", nil, "_icon" .. row.texture_total, "$parentIcon" .. row.texture_total) tinsert(row.texture_available, texture) end @@ -1125,16 +1123,16 @@ end local fillpanel_update_size = function(self, elapsed) local panel = self.MyObject - + panel._width = panel:GetWidth() panel._height = panel:GetHeight() - + panel:UpdateRowAmount() if (panel.current_header) then update_rows (panel, panel.current_header) end panel:Refresh() - + self:SetScript("OnUpdate", nil) end @@ -1143,14 +1141,14 @@ end function detailsFramework:CreateFillPanel(parent, rows, w, h, total_lines, fill_row, autowidth, options, member, name) return detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options) end - + function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options) local panel = detailsFramework:NewPanel(parent, parent, name, member, w, h) panel.backdrop = nil - + options = options or {rowheight = 20} panel.rows = {} - + panel.AddRow = add_row panel.AlignRows = align_rows panel.UpdateRows = update_rows @@ -1163,7 +1161,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l panel.SetFillFunction = set_fill_function panel.SetTotalFunction = set_total_function panel.DropHeader = drop_header_function - + panel._name = name panel._width = w panel._height = h @@ -1172,31 +1170,31 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l panel._fillfunc = fill_row panel._totalfunc = total_lines panel._autowidth = autowidth - - panel:SetScript("OnSizeChanged", function() + + panel:SetScript("OnSizeChanged", function() panel:SetScript("OnUpdate", fillpanel_update_size) end) - - for index, t in ipairs(rows) do + + for index, t in ipairs(rows) do panel.AddRow(panel, t) end local refresh_fillbox = function(self) local offset = FauxScrollFrame_GetOffset(self) - local filled_lines = panel._totalfunc(panel) - + local filled_lines = panel._totalfunc(panel) + for index = 1, #self.lines do local row = self.lines [index] if (index <= filled_lines) then local real_index = index + offset local results = panel._fillfunc (real_index, panel) - + if (results and results [1]) then row:Show() local text, entry, button, icon, texture, checkbox = 1, 1, 1, 1, 1, 1 - + for index, t in ipairs(panel.rows) do if (not t.hidden) then if (t.type == "text") then @@ -1210,7 +1208,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l local entrywidget = row.entry_inuse [entry] entry = entry + 1 entrywidget.index = real_index - + if (type(results [index]) == "table") then entrywidget:SetText(results [index].text) entrywidget.id = results [index].id @@ -1219,11 +1217,11 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l else entrywidget:SetText(results [index]) end - + entrywidget:SetCursorPosition(0) - + entrywidget:Show() - + elseif (t.type == "checkbox") then local checkboxwidget = row.checkbox_inuse [button] checkbox = checkbox + 1 @@ -1245,11 +1243,11 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l if (results [index].text) then buttonwidget:SetText(results [index].text) end - + if (results [index].icon) then buttonwidget._icon:SetTexture(results [index].icon) end - + if (results [index].func) then local func = function() t.func (real_index, results [index].value) @@ -1263,11 +1261,11 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l end buttonwidget:SetClickFunction(func) end - + buttonwidget.id = results [index].id buttonwidget.data1 = results [index].data1 buttonwidget.data2 = results [index].data2 - + else local func = function() t.func (real_index, index) @@ -1276,31 +1274,31 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l buttonwidget:SetClickFunction(func) buttonwidget:SetText(results [index]) end - + buttonwidget:Show() - + elseif (t.type == "icon") then local iconwidget = row.icon_inuse [icon] icon = icon + 1 - + iconwidget.line = index iconwidget.index = real_index if (type(results [index]) == "string") then - local result = results [index]:gsub (".-%\\", "") + local result = results [index]:gsub(".-%\\", "") iconwidget._icon.texture = results [index] - iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9) - + iconwidget._icon:SetTexCoord(0.1, .9, 0.1, .9) + elseif (type(results [index]) == "table") then iconwidget._icon:SetTexture(results [index].texture) local textCoord = results [index].texcoord if (textCoord) then - iconwidget._icon:SetTexCoord (unpack(textCoord)) + iconwidget._icon:SetTexCoord(unpack(textCoord)) else - iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9) + iconwidget._icon:SetTexCoord(0.1, .9, 0.1, .9) end - + local color = results [index].color if (color) then local r, g, b, a = detailsFramework:ParseColors(color) @@ -1310,32 +1308,32 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l end else iconwidget._icon:SetTexture(results [index]) - iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9) + iconwidget._icon:SetTexCoord(0.1, .9, 0.1, .9) end - + iconwidget:Show() - + elseif (t.type == "texture") then local texturewidget = row.texture_inuse [texture] texture = texture + 1 - + texturewidget.line = index texturewidget.index = real_index if (type(results [index]) == "string") then - local result = results [index]:gsub (".-%\\", "") + local result = results [index]:gsub(".-%\\", "") texturewidget.texture = results [index] - + elseif (type(results [index]) == "table") then texturewidget:SetTexture(results [index].texture) local textCoord = results [index].texcoord if (textCoord) then - texturewidget:SetTexCoord (unpack(textCoord)) + texturewidget:SetTexCoord(unpack(textCoord)) else - texturewidget:SetTexCoord (0, 1, 0, 1) + texturewidget:SetTexCoord(0, 1, 0, 1) end - + local color = results [index].color if (color) then local r, g, b, a = detailsFramework:ParseColors(color) @@ -1347,7 +1345,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l else texturewidget:SetTexture(results [index]) end - + texturewidget:Show() end end @@ -1361,7 +1359,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l end end end - + function panel:Refresh() if (type(panel._totalfunc) == "boolean") then --not yet initialized @@ -1374,7 +1372,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l FauxScrollFrame_Update (panel.scrollframe, filled_lines, scroll_total_lines, line_height) panel.scrollframe:Show() end - + local scrollframe = CreateFrame("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate", "BackdropTemplate") scrollframe:SetScript("OnVerticalScroll", function(self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 20, panel.Refresh) end) scrollframe:SetPoint("topleft", panel.widget, "topleft", 0, -21) @@ -1384,9 +1382,9 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l scrollframe:SetSize(w, h) panel.scrollframe = scrollframe scrollframe.lines = {} - + detailsFramework:ReskinSlider(scrollframe) - + --create lines function panel:UpdateRowAmount() local size = options.rowheight @@ -1396,31 +1394,31 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l local row = CreateFrame("frame", panel:GetName() .. "Row_" .. i, panel.widget,"BackdropTemplate") row:SetSize(1, size) row.color = {1, 1, 1, .2} - + row:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]]}) - + if (i%2 == 0) then row:SetBackdropColor(.5, .5, .5, 0.2) else row:SetBackdropColor(1, 1, 1, 0.00) end - + row:SetPoint("topleft", scrollframe, "topleft", 0, (i-1) * size * -1) row:SetPoint("topright", scrollframe, "topright", 0, (i-1) * size * -1) tinsert(scrollframe.lines, row) - + row.text_available = {} row.text_inuse = {} row.text_total = 0 - + row.entry_available = {} row.entry_inuse = {} row.entry_total = 0 - + row.button_available = {} row.button_inuse = {} row.button_total = 0 - + row.checkbox_available = {} row.checkbox_inuse = {} row.checkbox_total = 0 @@ -1437,7 +1435,7 @@ function detailsFramework:NewFillPanel(parent, rows, name, member, w, h, total_l panel:UpdateRowAmount() panel.AlignRows (panel) - + return panel end @@ -1459,17 +1457,17 @@ function detailsFramework:ColorPick (frame, r, g, b, alpha, callback) ColorPickerFrame:ClearAllPoints() ColorPickerFrame:SetPoint("bottomleft", frame, "topright", 0, 0) - + ColorPickerFrame.dcallback = callback ColorPickerFrame.dframe = frame - + ColorPickerFrame.func = color_pick_func ColorPickerFrame.opacityFunc = color_pick_func ColorPickerFrame.cancelFunc = color_pick_func_cancel - + ColorPickerFrame.opacity = alpha ColorPickerFrame.hasOpacity = alpha and true - + ColorPickerFrame.previousValues = {r, g, b} ColorPickerFrame:SetParent(UIParent) ColorPickerFrame:SetFrameStrata("tooltip") @@ -1481,71 +1479,71 @@ end ------------icon pick function detailsFramework:IconPick (callback, close_when_select, param1, param2) - if (not detailsFramework.IconPickFrame) then - + if (not detailsFramework.IconPickFrame) then + local string_lower = string.lower - + detailsFramework.IconPickFrame = CreateFrame("frame", "DetailsFrameworkIconPickFrame", UIParent, "BackdropTemplate") tinsert(UISpecialFrames, "DetailsFrameworkIconPickFrame") detailsFramework.IconPickFrame:SetFrameStrata("FULLSCREEN") - + detailsFramework.IconPickFrame:SetPoint("center", UIParent, "center") detailsFramework.IconPickFrame:SetWidth(416) detailsFramework.IconPickFrame:SetHeight(350) detailsFramework.IconPickFrame:EnableMouse(true) detailsFramework.IconPickFrame:SetMovable(true) - + detailsFramework:CreateTitleBar (detailsFramework.IconPickFrame, "Details! Framework Icon Picker") - + detailsFramework.IconPickFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) detailsFramework.IconPickFrame:SetBackdropBorderColor(0, 0, 0) detailsFramework.IconPickFrame:SetBackdropColor(24/255, 24/255, 24/255, .8) detailsFramework.IconPickFrame:SetFrameLevel(5000) - + detailsFramework.IconPickFrame:SetScript("OnMouseDown", function(self) if (not self.isMoving) then detailsFramework.IconPickFrame:StartMoving() self.isMoving = true end end) - + detailsFramework.IconPickFrame:SetScript("OnMouseUp", function(self) if (self.isMoving) then detailsFramework.IconPickFrame:StopMovingOrSizing() self.isMoving = nil end end) - + detailsFramework.IconPickFrame.emptyFunction = function() end detailsFramework.IconPickFrame.callback = detailsFramework.IconPickFrame.emptyFunction - + detailsFramework.IconPickFrame.preview = CreateFrame("frame", nil, UIParent, "BackdropTemplate") detailsFramework.IconPickFrame.preview:SetFrameStrata("tooltip") detailsFramework.IconPickFrame.preview:SetFrameLevel(6001) detailsFramework.IconPickFrame.preview:SetSize(76, 76) - - local preview_image_bg = detailsFramework:NewImage (detailsFramework.IconPickFrame.preview, nil, 76, 76) - preview_image_bg:SetDrawLayer ("background", 0) + + local preview_image_bg = detailsFramework:NewImage(detailsFramework.IconPickFrame.preview, nil, 76, 76) + preview_image_bg:SetDrawLayer("background", 0) preview_image_bg:SetAllPoints(detailsFramework.IconPickFrame.preview) - preview_image_bg:SetColorTexture (0, 0, 0) - - local preview_image = detailsFramework:NewImage (detailsFramework.IconPickFrame.preview, nil, 76, 76) + preview_image_bg:SetColorTexture(0, 0, 0) + + local preview_image = detailsFramework:NewImage(detailsFramework.IconPickFrame.preview, nil, 76, 76) preview_image:SetAllPoints(detailsFramework.IconPickFrame.preview) - + detailsFramework.IconPickFrame.preview.icon = preview_image detailsFramework.IconPickFrame.preview:Hide() - + --serach detailsFramework.IconPickFrame.searchLabel = detailsFramework:NewLabel(detailsFramework.IconPickFrame, nil, "$parentSearchBoxLabel", nil, "Search:") detailsFramework.IconPickFrame.searchLabel:SetPoint("topleft", detailsFramework.IconPickFrame, "topleft", 12, -36) detailsFramework.IconPickFrame.searchLabel:SetTemplate(detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) detailsFramework.IconPickFrame.searchLabel.fontsize = 12 - + detailsFramework.IconPickFrame.search = detailsFramework:NewTextEntry(detailsFramework.IconPickFrame, nil, "$parentSearchBox", nil, 140, 20) detailsFramework.IconPickFrame.search:SetPoint("left", detailsFramework.IconPickFrame.searchLabel, "right", 2, 0) detailsFramework.IconPickFrame.search:SetTemplate(detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - - detailsFramework.IconPickFrame.search:SetHook("OnTextChanged", function() + + detailsFramework.IconPickFrame.search:SetHook("OnTextChanged", function() detailsFramework.IconPickFrame.searching = detailsFramework.IconPickFrame.search:GetText() if (detailsFramework.IconPickFrame.searching == "") then detailsFramework.IconPickFrameScroll:Show() @@ -1558,27 +1556,27 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) detailsFramework.IconPickFrameScroll.RefreshIcons() end end) - + --manually enter the icon path detailsFramework.IconPickFrame.customIcon = detailsFramework:CreateLabel(detailsFramework.IconPickFrame, "Icon Path:", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) detailsFramework.IconPickFrame.customIcon:SetPoint("bottomleft", detailsFramework.IconPickFrame, "bottomleft", 12, 16) detailsFramework.IconPickFrame.customIcon.fontsize = 12 - - detailsFramework.IconPickFrame.customIconEntry = detailsFramework:CreateTextEntry (detailsFramework.IconPickFrame, function()end, 200, 20, "CustomIconEntry", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + + detailsFramework.IconPickFrame.customIconEntry = detailsFramework:CreateTextEntry(detailsFramework.IconPickFrame, function()end, 200, 20, "CustomIconEntry", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) detailsFramework.IconPickFrame.customIconEntry:SetPoint("left", detailsFramework.IconPickFrame.customIcon, "right", 2, 0) - - detailsFramework.IconPickFrame.customIconEntry:SetHook("OnTextChanged", function() + + detailsFramework.IconPickFrame.customIconEntry:SetHook("OnTextChanged", function() detailsFramework.IconPickFrame.preview:SetPoint("bottom", detailsFramework.IconPickFrame.customIconEntry.widget, "top", 0, 2) detailsFramework.IconPickFrame.preview.icon:SetTexture(detailsFramework.IconPickFrame.customIconEntry:GetText()) detailsFramework.IconPickFrame.preview:Show() end) - - detailsFramework.IconPickFrame.customIconEntry:SetHook("OnEnter", function() + + detailsFramework.IconPickFrame.customIconEntry:SetHook("OnEnter", function() detailsFramework.IconPickFrame.preview:SetPoint("bottom", detailsFramework.IconPickFrame.customIconEntry.widget, "top", 0, 2) detailsFramework.IconPickFrame.preview.icon:SetTexture(detailsFramework.IconPickFrame.customIconEntry:GetText()) detailsFramework.IconPickFrame.preview:Show() end) - + --close button local close_button = CreateFrame("button", nil, detailsFramework.IconPickFrame, "UIPanelCloseButton", "BackdropTemplate") close_button:SetWidth(32) @@ -1586,21 +1584,21 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) close_button:SetPoint("TOPRIGHT", detailsFramework.IconPickFrame, "TOPRIGHT", -8, -7) close_button:SetFrameLevel(close_button:GetFrameLevel()+2) close_button:SetAlpha(0) --just hide, it is used below - + --accept custom icon button local accept_custom_icon = function() local path = detailsFramework.IconPickFrame.customIconEntry:GetText() - + detailsFramework:QuickDispatch (detailsFramework.IconPickFrame.callback, path, detailsFramework.IconPickFrame.param1, detailsFramework.IconPickFrame.param2) - + if (detailsFramework.IconPickFrame.click_close) then close_button:Click() end end - + detailsFramework.IconPickFrame.customIconAccept = detailsFramework:CreateButton(detailsFramework.IconPickFrame, accept_custom_icon, 82, 20, "Accept", nil, nil, nil, nil, nil, nil, detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"), detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) detailsFramework.IconPickFrame.customIconAccept:SetPoint("left", detailsFramework.IconPickFrame.customIconEntry, "right", 2, 0) - + --fill with icons local MACRO_ICON_FILENAMES = {} local SPELLNAMES_CACHE = {} @@ -1608,12 +1606,12 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) detailsFramework.IconPickFrame:SetScript("OnShow", function() MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK" local index = 2 - + for i = 1, GetNumSpellTabs() do local tab, tabTex, offset, numSpells, _ = GetSpellTabInfo(i) offset = offset + 1 local tabEnd = offset + numSpells - + for j = offset, tabEnd - 1 do --to get spell info by slot, you have to pass in a pet argument local spellType, ID = GetSpellBookItemInfo(j, "player") @@ -1625,7 +1623,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) elseif (spellType == "FLYOUT") then local _, _, numSlots, isKnown = GetFlyoutInfo(ID) if (isKnown and numSlots > 0) then - for k = 1, numSlots do + for k = 1, numSlots do local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo(ID, k) if (isKnown) then MACRO_ICON_FILENAMES [index] = GetSpellTexture(spellID) or 0 @@ -1637,7 +1635,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) end end end - + GetLooseMacroItemIcons(MACRO_ICON_FILENAMES) GetLooseMacroIcons(MACRO_ICON_FILENAMES) GetMacroIcons(MACRO_ICON_FILENAMES) @@ -1648,25 +1646,25 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) --reset the search text entry detailsFramework.IconPickFrame.search:SetText("") end) - + detailsFramework.IconPickFrame:SetScript("OnHide", function() wipe(MACRO_ICON_FILENAMES) wipe(SPELLNAMES_CACHE) detailsFramework.IconPickFrame.preview:Hide() collectgarbage() end) - + detailsFramework.IconPickFrame.buttons = {} - - local onClickFunction = function(self) - + + local onClickFunction = function(self) + detailsFramework:QuickDispatch (detailsFramework.IconPickFrame.callback, self.icon:GetTexture(), detailsFramework.IconPickFrame.param1, detailsFramework.IconPickFrame.param2) - + if (detailsFramework.IconPickFrame.click_close) then close_button:Click() end end - + local onEnter = function(self) detailsFramework.IconPickFrame.preview:SetPoint("bottom", self, "top", 0, 2) detailsFramework.IconPickFrame.preview.icon:SetTexture(self.icon:GetTexture()) @@ -1677,14 +1675,14 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) detailsFramework.IconPickFrame.preview:Hide() self.icon:SetBlendMode("BLEND") end - + local backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1} for _, button in ipairs(detailsFramework.IconPickFrame.buttons) do button:SetBackdropBorderColor(0, 0, 0, 1) end - + local width = 412 local height = 248 local linesAmount = 6 @@ -1783,7 +1781,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) line:SetBackdropColor(.2, .2, .2, .5) line.buttons = {} - + local lastButton for o = 1, 10 do @@ -1813,14 +1811,14 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) detailsFramework.IconPickFrameScroll = scroll detailsFramework.IconPickFrame:Hide() end - + detailsFramework.IconPickFrame.param1, detailsFramework.IconPickFrame.param2 = param1, param2 detailsFramework.IconPickFrame:Show() detailsFramework.IconPickFrame.callback = callback or detailsFramework.IconPickFrame.emptyFunction detailsFramework.IconPickFrame.click_close = close_when_select detailsFramework.IconPickFrameScroll.RefreshIcons() - -end + +end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -1832,12 +1830,12 @@ function detailsFramework:ShowPanicWarning (text) detailsFramework.PanicWarningWindow:SetBackdropColor(1, 0, 0, 0.2) detailsFramework.PanicWarningWindow:SetPoint("topleft", UIParent, "topleft", 0, -250) detailsFramework.PanicWarningWindow:SetPoint("topright", UIParent, "topright", 0, -250) - + detailsFramework.PanicWarningWindow.text = detailsFramework.PanicWarningWindow:CreateFontString(nil, "overlay", "GameFontNormal") detailsFramework.PanicWarningWindow.text:SetPoint("center", detailsFramework.PanicWarningWindow, "center") - detailsFramework.PanicWarningWindow.text:SetTextColor (1, 0.6, 0) + detailsFramework.PanicWarningWindow.text:SetTextColor(1, 0.6, 0) end - + detailsFramework.PanicWarningWindow.text:SetText(text) detailsFramework.PanicWarningWindow:Show() end @@ -1921,7 +1919,7 @@ function detailsFramework:CreateScaleBar(frame, config) --~scale editbox.defaultValue = newScale end end) - + editbox:SetScript("OnEscapePressed", function() editbox:ClearFocus() editbox:Hide() @@ -1956,7 +1954,7 @@ function detailsFramework:CreateScaleBar(frame, config) --~scale config.scale = value end end - + scaleBar:SetAlpha(0.70) editbox.defaultValue = config.scale editbox:SetFocus(false) @@ -1974,11 +1972,11 @@ end local no_options = {} function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_options, db) - + if (db and name and not db [name]) then db [name] = {scale = 1} end - + if (not name) then name = "DetailsFrameworkSimplePanel" .. detailsFramework.SimplePanelCounter detailsFramework.SimplePanelCounter = detailsFramework.SimplePanelCounter + 1 @@ -1986,9 +1984,9 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt if (not parent) then parent = UIParent end - + panel_options = panel_options or no_options - + local f = CreateFrame("frame", name, UIParent,"BackdropTemplate") f:SetSize(w or 400, h or 250) f:SetPoint("center", UIParent, "center", 0, 0) @@ -1998,13 +1996,13 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt f:SetBackdrop(SimplePanel_frame_backdrop) f:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color)) f:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color)) - + f.DontRightClickClose = panel_options.DontRightClickClose - + if (not panel_options.NoTUISpecialFrame) then tinsert(UISpecialFrames, name) end - + local title_bar = CreateFrame("frame", name .. "TitleBar", f,"BackdropTemplate") title_bar:SetPoint("topleft", f, "topleft", 2, -3) title_bar:SetPoint("topright", f, "topright", -2, -3) @@ -2013,7 +2011,7 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt title_bar:SetBackdropColor(.2, .2, .2, 1) title_bar:SetBackdropBorderColor(0, 0, 0, 1) f.TitleBar = title_bar - + local close = CreateFrame("button", name and name .. "CloseButton", title_bar) close:SetFrameLevel(detailsFramework.FRAMELEVEL_OVERLAY) close:SetSize(16, 16) @@ -2028,29 +2026,29 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt close:SetAlpha(0.7) close:SetScript("OnClick", simple_panel_close_click) f.Close = close - + local title_string = title_bar:CreateFontString(name and name .. "Title", "overlay", "GameFontNormal") - title_string:SetTextColor (.8, .8, .8, 1) + title_string:SetTextColor(.8, .8, .8, 1) title_string:SetText(title or "") f.Title = title_string - + if (panel_options.UseScaleBar and db [name]) then detailsFramework:CreateScaleBar (f, db [name]) f:SetScale(db [name].scale) end - + f.Title:SetPoint("center", title_bar, "center") f.Close:SetPoint("right", title_bar, "right", -2, 0) if (panel_options.NoCloseButton) then f.Close:Hide() end - + f:SetScript("OnMouseDown", simple_panel_mouse_down) f:SetScript("OnMouseUp", simple_panel_mouse_up) - + f.SetTitle = simple_panel_settitle - + return f end @@ -2065,9 +2063,9 @@ local Panel1PxOnToggleLock = function(self) self.IsLocked = false self:SetMovable(true) self:EnableMouse(true) - self.Lock:GetNormalTexture():SetTexCoord (16/64, 32/64, 0, 1) - self.Lock:GetHighlightTexture():SetTexCoord (16/32, 32/64, 0, 1) - self.Lock:GetPushedTexture():SetTexCoord (16/64, 32/64, 0, 1) + self.Lock:GetNormalTexture():SetTexCoord(16/64, 32/64, 0, 1) + self.Lock:GetHighlightTexture():SetTexCoord(16/32, 32/64, 0, 1) + self.Lock:GetPushedTexture():SetTexCoord(16/64, 32/64, 0, 1) if (self.OnUnlock) then self:OnUnlock() end @@ -2078,9 +2076,9 @@ local Panel1PxOnToggleLock = function(self) self.IsLocked = true self:SetMovable(false) self:EnableMouse(false) - self.Lock:GetNormalTexture():SetTexCoord (0/64, 16/64, 0, 1) - self.Lock:GetHighlightTexture():SetTexCoord (0/64, 16/64, 0, 1) - self.Lock:GetPushedTexture():SetTexCoord (0/64, 16/64, 0, 1) + self.Lock:GetNormalTexture():SetTexCoord(0/64, 16/64, 0, 1) + self.Lock:GetHighlightTexture():SetTexCoord(0/64, 16/64, 0, 1) + self.Lock:GetPushedTexture():SetTexCoord(0/64, 16/64, 0, 1) if (self.OnLock) then self:OnLock() end @@ -2173,25 +2171,25 @@ function detailsFramework:Create1PxPanel(parent, width, height, title, name, con local newFrame = CreateFrame("frame", name, parent or UIParent, "BackdropTemplate") newFrame:SetSize(width or 100, height or 75) newFrame:SetPoint("center", UIParent, "center", 0, 0) - + if (name and not noSpecialFrame) then tinsert(UISpecialFrames, name) end - + newFrame:SetScript("OnMouseDown", simple_panel_mouse_down) newFrame:SetScript("OnMouseUp", simple_panel_mouse_up) - + newFrame:SetBackdrop(Panel1PxBackdrop) newFrame:SetBackdropColor(0, 0, 0, 0.5) - + newFrame.IsLocked = (config and config.IsLocked ~= nil and config.IsLocked) or false newFrame:SetMovable(true) newFrame:EnableMouse(true) newFrame:SetUserPlaced (true) - + newFrame.db = config Panel1PxReadConfig(newFrame) - + local closeButton = CreateFrame("button", name and name .. "CloseButton", newFrame, "BackdropTemplate") closeButton:SetSize(16, 16) closeButton:SetNormalTexture([[Interface\GLUES\LOGIN\Glues-CheckBox-Check]]) @@ -2201,7 +2199,7 @@ function detailsFramework:Create1PxPanel(parent, width, height, title, name, con closeButton:GetHighlightTexture():SetDesaturated(true) closeButton:GetPushedTexture():SetDesaturated(true) closeButton:SetAlpha(0.7) - + local lockButton = CreateFrame("button", name and name .. "LockButton", newFrame, "BackdropTemplate") lockButton:SetSize(16, 16) lockButton:SetNormalTexture([[Interface\GLUES\CharacterSelect\Glues-AddOn-Icons]]) @@ -2211,23 +2209,18 @@ function detailsFramework:Create1PxPanel(parent, width, height, title, name, con lockButton:GetHighlightTexture():SetDesaturated(true) lockButton:GetPushedTexture():SetDesaturated(true) lockButton:SetAlpha(0.7) - + closeButton:SetPoint("topright", newFrame, "topright", -3, -3) lockButton:SetPoint("right", closeButton, "left", 3, 0) - + closeButton:SetScript("OnClick", Panel1PxOnClickClose) lockButton:SetScript("OnClick", Panel1PxOnClickLock) - + local titleString = newFrame:CreateFontString(name and name .. "Title", "overlay", "GameFontNormal") titleString:SetPoint("topleft", newFrame, "topleft", 5, -5) - if (detailsFramework.Language.IsLocTable(title)) then - local locTable = title - detailsFramework.Language.SetTextWithLocTable(titleString, locTable) - else - titleString:SetText(title or "") - end - + detailsFramework.Language.SetTextIfLocTableOrDefault(titleString, title or "") + if (titleAnchor) then if (titleAnchor == "top") then titleString:ClearAllPoints() @@ -2238,18 +2231,18 @@ function detailsFramework:Create1PxPanel(parent, width, height, title, name, con end newFrame.title_anchor = titleAnchor end - + newFrame.SetTitle = Panel1PxSetTitle newFrame.Title = titleString newFrame.Lock = lockButton newFrame.Close = closeButton newFrame.HasPosition = Panel1PxHasPosition newFrame.SavePosition = Panel1PxSavePosition - + newFrame.IsLocked = not newFrame.IsLocked newFrame.SetLocked = Panel1PxSetLocked Panel1PxOnToggleLock(newFrame) - + return newFrame end @@ -2258,78 +2251,78 @@ end --@dontOverride: won't show another prompt if theres already a shown prompt function detailsFramework:ShowPromptPanel(message, trueCallback, falseCallback, dontOverride, width) if (not DetailsFrameworkPromptSimple) then - local promptFrame = CreateFrame("frame", "DetailsFrameworkPromptSimple", UIParent, "BackdropTemplate") + local promptFrame = CreateFrame("frame", "DetailsFrameworkPromptSimple", UIParent, "BackdropTemplate") promptFrame:SetSize(400, 80) promptFrame:SetFrameStrata("DIALOG") promptFrame:SetPoint("center", UIParent, "center", 0, 300) detailsFramework:ApplyStandardBackdrop(promptFrame) tinsert(UISpecialFrames, "DetailsFrameworkPromptSimple") - + detailsFramework:CreateTitleBar(promptFrame, "Prompt!") detailsFramework:ApplyStandardBackdrop(promptFrame) - + local prompt = promptFrame:CreateFontString(nil, "overlay", "GameFontNormal") prompt:SetPoint("top", promptFrame, "top", 0, -28) prompt:SetJustifyH("center") promptFrame.prompt = prompt - + local button_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - + local buttonTrue = detailsFramework:CreateButton(promptFrame, nil, 60, 20, "Yes", nil, nil, nil, nil, nil, nil, options_dropdown_template) buttonTrue:SetPoint("bottomright", promptFrame, "bottomright", -5, 5) promptFrame.button_true = buttonTrue - + local buttonFalse = detailsFramework:CreateButton(promptFrame, nil, 60, 20, "No", nil, nil, nil, nil, nil, nil, options_dropdown_template) buttonFalse:SetPoint("bottomleft", promptFrame, "bottomleft", 5, 5) promptFrame.button_false = buttonFalse - + buttonTrue:SetClickFunction(function() local my_func = buttonTrue.true_function if (my_func) then - local okey, errormessage = pcall (my_func, true) + local okey, errormessage = pcall(my_func, true) if (not okey) then print("error:", errormessage) end promptFrame:Hide() end end) - + buttonFalse:SetClickFunction(function() local my_func = buttonFalse.false_function if (my_func) then - local okey, errormessage = pcall (my_func, true) + local okey, errormessage = pcall(my_func, true) if (not okey) then print("error:", errormessage) end promptFrame:Hide() end end) - - promptFrame.ShowAnimation = detailsFramework:CreateAnimationHub(promptFrame, function() - promptFrame:SetBackdropBorderColor(0, 0, 0, 0) - promptFrame.TitleBar:SetBackdropBorderColor(0, 0, 0, 0) - end, - function() - promptFrame:SetBackdropBorderColor(0, 0, 0, 1) - promptFrame.TitleBar:SetBackdropBorderColor(0, 0, 0, 1) + + promptFrame.ShowAnimation = detailsFramework:CreateAnimationHub(promptFrame, function() + promptFrame:SetBackdropBorderColor(0, 0, 0, 0) + promptFrame.TitleBar:SetBackdropBorderColor(0, 0, 0, 0) + end, + function() + promptFrame:SetBackdropBorderColor(0, 0, 0, 1) + promptFrame.TitleBar:SetBackdropBorderColor(0, 0, 0, 1) end) detailsFramework:CreateAnimation(promptFrame.ShowAnimation, "scale", 1, .075, .2, .2, 1.1, 1.1, "center", 0, 0) detailsFramework:CreateAnimation(promptFrame.ShowAnimation, "scale", 2, .075, 1, 1, .90, .90, "center", 0, 0) - + promptFrame.FlashTexture = promptFrame:CreateTexture(nil, "overlay") - promptFrame.FlashTexture:SetColorTexture (1, 1, 1, 1) + promptFrame.FlashTexture:SetColorTexture(1, 1, 1, 1) promptFrame.FlashTexture:SetAllPoints() - + promptFrame.FlashAnimation = detailsFramework:CreateAnimationHub(promptFrame.FlashTexture, function() promptFrame.FlashTexture:Show() end, function() promptFrame.FlashTexture:Hide() end) detailsFramework:CreateAnimation(promptFrame.FlashAnimation, "alpha", 1, .075, 0, .25) detailsFramework:CreateAnimation(promptFrame.FlashAnimation, "alpha", 2, .075, .35, 0) - + promptFrame:Hide() detailsFramework.promtp_panel = promptFrame end - + assert(type(trueCallback) == "function" and type(falseCallback) == "function", "ShowPromptPanel expects two functions.") if (dontOverride) then @@ -2337,442 +2330,91 @@ function detailsFramework:ShowPromptPanel(message, trueCallback, falseCallback, return end end - + if (width) then detailsFramework.promtp_panel:SetWidth(width) else detailsFramework.promtp_panel:SetWidth(400) end - + detailsFramework.promtp_panel.prompt:SetText(message) detailsFramework.promtp_panel.button_true.true_function = trueCallback detailsFramework.promtp_panel.button_false.false_function = falseCallback - + detailsFramework.promtp_panel:Show() - + detailsFramework.promtp_panel.ShowAnimation:Play() detailsFramework.promtp_panel.FlashAnimation:Play() end -function detailsFramework:ShowTextPromptPanel (message, callback) - +function detailsFramework:ShowTextPromptPanel(message, callback) if (not detailsFramework.text_prompt_panel) then - - local f = CreateFrame("frame", "DetailsFrameworkPrompt", UIParent, "BackdropTemplate") - f:SetSize(400, 120) - f:SetFrameStrata("FULLSCREEN") - f:SetPoint("center", UIParent, "center", 0, 100) - f:EnableMouse(true) - f:SetMovable(true) - f:RegisterForDrag ("LeftButton") - f:SetScript("OnDragStart", function() f:StartMoving() end) - f:SetScript("OnDragStop", function() f:StopMovingOrSizing() end) - f:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then f.EntryBox:ClearFocus() f:Hide() end end) + local promptFrame = CreateFrame("frame", "DetailsFrameworkPrompt", UIParent, "BackdropTemplate") + promptFrame:SetSize(400, 120) + promptFrame:SetFrameStrata("FULLSCREEN") + promptFrame:SetPoint("center", UIParent, "center", 0, 100) + promptFrame:EnableMouse(true) + promptFrame:SetMovable(true) + promptFrame:RegisterForDrag ("LeftButton") + promptFrame:SetScript("OnDragStart", function() promptFrame:StartMoving() end) + promptFrame:SetScript("OnDragStop", function() promptFrame:StopMovingOrSizing() end) + promptFrame:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then promptFrame.EntryBox:ClearFocus() promptFrame:Hide() end end) tinsert(UISpecialFrames, "DetailsFrameworkPrompt") - - detailsFramework:CreateTitleBar (f, "Prompt!") - detailsFramework:ApplyStandardBackdrop(f) - - local prompt = f:CreateFontString(nil, "overlay", "GameFontNormal") - prompt:SetPoint("top", f, "top", 0, -25) + + detailsFramework:CreateTitleBar (promptFrame, "Prompt!") + detailsFramework:ApplyStandardBackdrop(promptFrame) + + local prompt = promptFrame:CreateFontString(nil, "overlay", "GameFontNormal") + prompt:SetPoint("top", promptFrame, "top", 0, -25) prompt:SetJustifyH("center") prompt:SetSize(360, 36) - f.prompt = prompt + promptFrame.prompt = prompt local button_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - local textbox = detailsFramework:CreateTextEntry (f, function()end, 380, 20, "textbox", nil, nil, options_dropdown_template) - textbox:SetPoint("topleft", f, "topleft", 10, -60) - f.EntryBox = textbox + local textbox = detailsFramework:CreateTextEntry(promptFrame, function()end, 380, 20, "textbox", nil, nil, options_dropdown_template) + textbox:SetPoint("topleft", promptFrame, "topleft", 10, -60) + promptFrame.EntryBox = textbox - local button_true = detailsFramework:CreateButton(f, nil, 60, 20, "Okey", nil, nil, nil, nil, nil, nil, options_dropdown_template) - button_true:SetPoint("bottomright", f, "bottomright", -10, 5) - f.button_true = button_true + local buttonTrue = detailsFramework:CreateButton(promptFrame, nil, 60, 20, "Okey", nil, nil, nil, nil, nil, nil, options_dropdown_template) + buttonTrue:SetPoint("bottomright", promptFrame, "bottomright", -10, 5) + promptFrame.button_true = buttonTrue + + local buttonFalse = detailsFramework:CreateButton(promptFrame, function() promptFrame.textbox:ClearFocus() promptFrame:Hide() end, 60, 20, "Cancel", nil, nil, nil, nil, nil, nil, options_dropdown_template) + buttonFalse:SetPoint("bottomleft", promptFrame, "bottomleft", 10, 5) + promptFrame.button_false = buttonFalse - local button_false = detailsFramework:CreateButton(f, function() f.textbox:ClearFocus() f:Hide() end, 60, 20, "Cancel", nil, nil, nil, nil, nil, nil, options_dropdown_template) - button_false:SetPoint("bottomleft", f, "bottomleft", 10, 5) - f.button_false = button_false - local executeCallback = function() - local my_func = button_true.true_function + local my_func = buttonTrue.true_function if (my_func) then - local okey, errormessage = pcall (my_func, textbox:GetText()) + local okey, errormessage = pcall(my_func, textbox:GetText()) textbox:ClearFocus() if (not okey) then print("error:", errormessage) end - f:Hide() + promptFrame:Hide() end end - - button_true:SetClickFunction(function() + + buttonTrue:SetClickFunction(function() executeCallback() end) - + textbox:SetHook("OnEnterPressed", function() executeCallback() end) - - f:Hide() - detailsFramework.text_prompt_panel = f + + promptFrame:Hide() + detailsFramework.text_prompt_panel = promptFrame end detailsFramework.text_prompt_panel:Show() - DetailsFrameworkPrompt.EntryBox:SetText("") detailsFramework.text_prompt_panel.prompt:SetText(message) detailsFramework.text_prompt_panel.button_true.true_function = callback - detailsFramework.text_prompt_panel.textbox:SetFocus (true) - -end - ------------------------------------------------------------------------------------------------------------------------------------------------- ---options button -- ~options -function detailsFramework:CreateOptionsButton (parent, callback, name) - - local b = CreateFrame("button", name, parent, "BackdropTemplate") - b:SetSize(14, 14) - b:SetNormalTexture([[Interface\GossipFrame\BinderGossipIcon]]) - b:SetHighlightTexture([[Interface\GossipFrame\BinderGossipIcon]]) - b:SetPushedTexture([[Interface\GossipFrame\BinderGossipIcon]]) - b:GetNormalTexture():SetDesaturated(true) - b:GetHighlightTexture():SetDesaturated(true) - b:GetPushedTexture():SetDesaturated(true) - b:SetAlpha(0.7) - - b:SetScript("OnClick", callback) - b:SetScript("OnEnter", function(self) - GameCooltip2:Reset() - GameCooltip2:AddLine("Options") - GameCooltip2:ShowCooltip(self, "tooltip") - end) - b:SetScript("OnLeave", function(self) - GameCooltip2:Hide() - end) - - return b - -end - ------------------------------------------------------------------------------------------------------------------------------------------------- ---feedback panel -- ~feedback - -function detailsFramework:CreateFeedbackButton (parent, callback, name) - local b = CreateFrame("button", name, parent, "BackdropTemplate") - b:SetSize(12, 13) - b:SetScript("OnClick", callback) - b:SetScript("OnEnter", function(self) - GameCooltip2:Reset() - GameCooltip2:AddLine("Send Feedback") - GameCooltip2:ShowCooltip(self, "tooltip") - end) - b:SetScript("OnLeave", function(self) - GameCooltip2:Hide() - end) - - print("Framework:CreateFeedbackButton() is deprecated.") - - return b -end - -local backdrop_fb_line = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, -tile = true, tileSize = 64, insets = {left = 2, right = 2, top = 2, bottom = 2}} - -local on_enter_feedback = function(self) - self:SetBackdropColor(1, 1, 0, 0.5) -end -local on_leave_feedback = function(self) - self:SetBackdropColor(0, 0, 0, 0.3) -end - -local on_click_feedback = function(self) - - local feedback_link_textbox = detailsFramework.feedback_link_textbox - - if (not feedback_link_textbox) then - local editbox = detailsFramework:CreateTextEntry (AddonFeedbackPanel, _, 275, 34) - editbox:SetAutoFocus (false) - editbox:SetHook("OnEditFocusGained", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox:SetHook("OnEditFocusLost", function() - editbox:Hide() - end) - editbox:SetHook("OnChar", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox.text = "" - - detailsFramework.feedback_link_textbox = editbox - feedback_link_textbox = editbox - end - - feedback_link_textbox.link = self.link - feedback_link_textbox.text = self.link - feedback_link_textbox:Show() - - feedback_link_textbox:SetPoint("topleft", self.icon, "topright", 3, 0) - - feedback_link_textbox:HighlightText() - - feedback_link_textbox:SetFocus() - feedback_link_textbox:SetFrameLevel(self:GetFrameLevel()+2) -end - -local feedback_get_fb_line = function(self) - - local line = self.feedback_lines [self.next_feedback] - if (not line) then - line = CreateFrame("frame", "AddonFeedbackPanelFB" .. self.next_feedback, self, "BackdropTemplate") - line:SetBackdrop(backdrop_fb_line) - line:SetBackdropColor(0, 0, 0, 0.3) - line:SetSize(390, 42) - line:SetPoint("topleft", self.feedback_anchor, "bottomleft", 0, -5 + ((self.next_feedback-1) * 46 * -1)) - line:SetScript("OnEnter", on_enter_feedback) - line:SetScript("OnLeave", on_leave_feedback) - line:SetScript("OnMouseUp", on_click_feedback) - - line.icon = line:CreateTexture(nil, "overlay") - line.icon:SetSize(90, 36) - - line.desc = line:CreateFontString(nil, "overlay", "GameFontHighlightSmall") - - line.icon:SetPoint("left", line, "left", 5, 0) - line.desc:SetPoint("left", line.icon, "right", 5, 0) - - local arrow = line:CreateTexture(nil, "overlay") - arrow:SetTexture([[Interface\Buttons\JumpUpArrow]]) - arrow:SetRotation (-1.55) - arrow:SetPoint("right", line, "right", -5, 0) - - self.feedback_lines [self.next_feedback] = line - end - - self.next_feedback = self.next_feedback + 1 - - return line -end - -local on_click_feedback = function(self) - - local feedback_link_textbox = detailsFramework.feedback_link_textbox - - if (not feedback_link_textbox) then - local editbox = detailsFramework:CreateTextEntry (AddonFeedbackPanel, _, 275, 34) - editbox:SetAutoFocus (false) - editbox:SetHook("OnEditFocusGained", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox:SetHook("OnEditFocusLost", function() - editbox:Hide() - end) - editbox:SetHook("OnChar", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox.text = "" - - detailsFramework.feedback_link_textbox = editbox - feedback_link_textbox = editbox - end - - feedback_link_textbox.link = self.link - feedback_link_textbox.text = self.link - feedback_link_textbox:Show() - - feedback_link_textbox:SetPoint("topleft", self.icon, "topright", 3, 0) - - feedback_link_textbox:HighlightText() - - feedback_link_textbox:SetFocus() - feedback_link_textbox:SetFrameLevel(self:GetFrameLevel()+2) -end - -local on_enter_addon = function(self) - if (self.tooltip) then - GameCooltip2:Preset(2) - GameCooltip2:AddLine("|cFFFFFF00" .. self.name .. "|r") - GameCooltip2:AddLine("") - GameCooltip2:AddLine(self.tooltip) - GameCooltip2:ShowCooltip(self, "tooltip") - end - self.icon:SetBlendMode("ADD") -end -local on_leave_addon = function(self) - if (self.tooltip) then - GameCooltip2:Hide() - end - self.icon:SetBlendMode("BLEND") -end -local on_click_addon = function(self) - local addon_link_textbox = detailsFramework.addon_link_textbox - - if (not addon_link_textbox) then - local editbox = detailsFramework:CreateTextEntry (AddonFeedbackPanel, _, 128, 64) - editbox:SetAutoFocus (false) - editbox:SetHook("OnEditFocusGained", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox:SetHook("OnEditFocusLost", function() - editbox:Hide() - end) - editbox:SetHook("OnChar", function() - editbox.text = editbox.link - editbox:HighlightText() - end) - editbox.text = "" - - detailsFramework.addon_link_textbox = editbox - addon_link_textbox = editbox - end - - addon_link_textbox.link = self.link - addon_link_textbox.text = self.link - addon_link_textbox:Show() - - addon_link_textbox:SetPoint("topleft", self.icon, "topleft", 0, 0) - - addon_link_textbox:HighlightText() - - addon_link_textbox:SetFocus() - addon_link_textbox:SetFrameLevel(self:GetFrameLevel()+2) -end - -local feedback_get_addons_line = function(self) - local line = self.addons_lines [self.next_addons] - if (not line) then - - line = CreateFrame("frame", "AddonFeedbackPanelSA" .. self.next_addons, self, "BackdropTemplate") - line:SetSize(128, 64) - - if (self.next_addons == 1) then - line:SetPoint("topleft", self.addons_anchor, "bottomleft", 0, -5) - elseif (self.next_addons_line_break == self.next_addons) then - line:SetPoint("topleft", self.addons_anchor, "bottomleft", 0, -5 + floor(self.next_addons_line_break/3) * 66 * -1) - self.next_addons_line_break = self.next_addons_line_break + 3 - else - local previous = self.addons_lines [self.next_addons - 1] - line:SetPoint("topleft", previous, "topright", 2, 0) - end - - line:SetScript("OnEnter", on_enter_addon) - line:SetScript("OnLeave", on_leave_addon) - line:SetScript("OnMouseUp", on_click_addon) - - line.icon = line:CreateTexture(nil, "overlay") - line.icon:SetSize(128, 64) - - line.icon:SetPoint("topleft", line, "topleft", 0, 0) - - self.addons_lines [self.next_addons] = line - end - - self.next_addons = self.next_addons + 1 - - return line -end - -local default_coords = {0, 1, 0, 1} -local feedback_add_fb = function(self, table) - local line = self:GetFeedbackLine() - line.icon:SetTexture(table.icon) - line.icon:SetTexCoord (unpack(table.coords or default_coords)) - line.desc:SetText(table.desc) - line.link = table.link - line:Show() -end - -local feedback_add_addon = function(self, table) - local block = self:GetAddonsLine() - block.icon:SetTexture(table.icon) - block.icon:SetTexCoord (unpack(table.coords or default_coords)) - block.link = table.link - block.tooltip = table.desc - block.name = table.name - block:Show() -end - -local feedback_hide_all = function(self) - self.next_feedback = 1 - self.next_addons = 1 - - for index, line in ipairs(self.feedback_lines) do - line:Hide() - end - - for index, line in ipairs(self.addons_lines) do - line:Hide() - end -end - --- feedback_methods = { { icon = icon path, desc = description, link = url}} -function detailsFramework:ShowFeedbackPanel (addon_name, version, feedback_methods, more_addons) - - local f = _G.AddonFeedbackPanel - - if (not f) then - f = detailsFramework:Create1PxPanel(UIParent, 400, 100, addon_name .. " Feedback", "AddonFeedbackPanel", nil) - f:SetFrameStrata("FULLSCREEN") - f:SetPoint("center", UIParent, "center") - f:SetBackdropColor(0, 0, 0, 0.8) - f.feedback_lines = {} - f.addons_lines = {} - f.next_feedback = 1 - f.next_addons = 1 - f.next_addons_line_break = 4 - - local feedback_anchor = f:CreateFontString(nil, "overlay", "GameFontNormal") - feedback_anchor:SetText("Feedback:") - feedback_anchor:SetPoint("topleft", f, "topleft", 5, -30) - f.feedback_anchor = feedback_anchor - local excla_text = f:CreateFontString(nil, "overlay", "GameFontNormal") - excla_text:SetText("click and copy the link") - excla_text:SetPoint("topright", f, "topright", -5, -30) - excla_text:SetTextColor (1, 0.8, 0.2, 0.6) - - local addons_anchor = f:CreateFontString(nil, "overlay", "GameFontNormal") - addons_anchor:SetText("AddOns From the Same Author:") - f.addons_anchor = addons_anchor - local excla_text2 = f:CreateFontString(nil, "overlay", "GameFontNormal") - excla_text2:SetText("click and copy the link") - excla_text2:SetTextColor (1, 0.8, 0.2, 0.6) - f.excla_text2 = excla_text2 - - f.GetFeedbackLine = feedback_get_fb_line - f.GetAddonsLine = feedback_get_addons_line - f.AddFeedbackMethod = feedback_add_fb - f.AddOtherAddon = feedback_add_addon - f.HideAll = feedback_hide_all - - detailsFramework:SetFontSize (f.Title, 14) - - end - - f:HideAll() - f:SetTitle (addon_name) - - for index, feedback in ipairs(feedback_methods) do - f:AddFeedbackMethod (feedback) - end - - f.addons_anchor:SetPoint("topleft", f, "topleft", 5, f.next_feedback * 50 * -1) - f.excla_text2:SetPoint("topright", f, "topright", -5, f.next_feedback * 50 * -1) - - for index, addon in ipairs(more_addons) do - f:AddOtherAddon (addon) - end - - f:SetHeight(80 + ((f.next_feedback-1) * 50) + (ceil ((f.next_addons-1)/3) * 66)) - - f:Show() - - return true + detailsFramework.text_prompt_panel.textbox:SetFocus(true) end @@ -2783,55 +2425,50 @@ local chart_panel_backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Backgrou edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", edgeSize = 32, insets = {left = 5, right = 5, top = 5, bottom = 5}} local chart_panel_align_timelabels = function(self, elapsed_time) - self.TimeScale = elapsed_time - local linha = self.TimeLabels [17] - local minutos, segundos = math.floor(elapsed_time / 60), math.floor(elapsed_time % 60) - if (segundos < 10) then - segundos = "0" .. segundos + local linha = self.TimeLabels[17] + local minutes, seconds = math.floor(elapsed_time / 60), math.floor(elapsed_time % 60) + if (seconds < 10) then + seconds = "0" .. seconds end - - if (minutos > 0) then - if (minutos < 10) then - minutos = "0" .. minutos + + if (minutes > 0) then + if (minutes < 10) then + minutes = "0" .. minutes end - linha:SetText(minutos .. ":" .. segundos) + linha:SetText(minutes .. ":" .. seconds) else - linha:SetText("00:" .. segundos) + linha:SetText("00:" .. seconds) end - + local time_div = elapsed_time / 16 --786 -- 49.125 - + for i = 2, 16 do - local linha = self.TimeLabels [i] - local this_time = time_div * (i-1) - local minutos, segundos = math.floor(this_time / 60), math.floor(this_time % 60) - - if (segundos < 10) then - segundos = "0" .. segundos + local minutes, seconds = math.floor(this_time / 60), math.floor(this_time % 60) + + if (seconds < 10) then + seconds = "0" .. seconds end - - if (minutos > 0) then - if (minutos < 10) then - minutos = "0" .. minutos + + if (minutes > 0) then + if (minutes < 10) then + minutes = "0" .. minutes end - linha:SetText(minutos .. ":" .. segundos) + linha:SetText(minutes .. ":" .. seconds) else - linha:SetText("00:" .. segundos) + linha:SetText("00:" .. seconds) end - end - end local chart_panel_set_scale = function(self, amt, func, text) if (type(amt) ~= "number") then return end - + --each line amount, then multiply the line index by this number local piece = amt / 8 @@ -2842,7 +2479,7 @@ local chart_panel_set_scale = function(self, amt, func, text) if (piece*i > 1) then self ["dpsamt" .. math.abs(i-9)]:SetText(detailsFramework.FormatNumber (piece*i)) else - self ["dpsamt" .. math.abs(i-9)]:SetText(format ("%.3f", piece*i)) + self ["dpsamt" .. math.abs(i-9)]:SetText(format("%.3f", piece*i)) end end end @@ -2862,15 +2499,14 @@ local chart_panel_overlay_reset = function(self) end local chart_panel_reset = function(self) - self.Graphic:ResetData() self.Graphic.max_value = 0 - + self.TimeScale = nil self.BoxLabelsAmount = 1 - table.wipe (self.GData) - table.wipe (self.OData) - + table.wipe(self.GData) + table.wipe(self.OData) + for index, box in ipairs(self.BoxLabels) do box.check:Hide() box.button:Hide() @@ -2879,14 +2515,14 @@ local chart_panel_reset = function(self) box.border:Hide() box.showing = false end - + chart_panel_overlay_reset (self) end local chart_panel_enable_line = function(f, thisbox) local index = thisbox.index local boxType = thisbox.type - + if (thisbox.enabled) then --disable thisbox.check:Hide() @@ -2896,20 +2532,20 @@ local chart_panel_enable_line = function(f, thisbox) thisbox.check:Show() thisbox.enabled = true end - + if (boxType == "graphic") then f.Graphic:ResetData() f.Graphic.max_value = 0 - + local max = 0 local max_time = 0 - + for index, box in ipairs(f.BoxLabels) do if (box.type == boxType and box.showing and box.enabled) then local data = f.GData[index] - + f.Graphic:AddDataSeries(data[1], data[2], nil, data[3]) - + if (data[4] > max) then max = data[4] end @@ -2918,13 +2554,13 @@ local chart_panel_enable_line = function(f, thisbox) end end end - + f:SetScale(max) f:SetTime (max_time) - + elseif (boxType == "overlay") then chart_panel_overlay_reset (f) - + for index, box in ipairs(f.BoxLabels) do if (box.type == boxType and box.showing and box.enabled) then f:AddOverlay(box.index) @@ -2934,21 +2570,20 @@ local chart_panel_enable_line = function(f, thisbox) end local create_box = function(self, next_box) - local thisbox = {} self.BoxLabels [next_box] = thisbox - - local box = detailsFramework:NewImage (self.Graphic, nil, 16, 16, "border") + + local box = detailsFramework:NewImage(self.Graphic, nil, 16, 16, "border") local text = detailsFramework:NewLabel(self.Graphic) - - local border = detailsFramework:NewImage (self.Graphic, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork") + + local border = detailsFramework:NewImage(self.Graphic, [[Interface\DialogFrame\UI-DialogBox-Gold-Corner]], 30, 30, "artwork") border:SetPoint("center", box, "center", -3, -4) border:SetTexture([[Interface\DialogFrame\UI-DialogBox-Gold-Corner]]) - - local checktexture = detailsFramework:NewImage (self.Graphic, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay") + + local checktexture = detailsFramework:NewImage(self.Graphic, [[Interface\Buttons\UI-CheckBox-Check]], 18, 18, "overlay") checktexture:SetPoint("center", box, "center", 0, -1) checktexture:SetTexture([[Interface\Buttons\UI-CheckBox-Check]]) - + thisbox.box = box thisbox.text = text thisbox.border = border @@ -2962,15 +2597,15 @@ local create_box = function(self, next_box) end) button:SetPoint("topleft", box.widget or box, "topleft", 0, 0) button:SetPoint("bottomright", box.widget or box, "bottomright", 0, 0) - + button:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) button:SetBackdropColor(0, 0, 0, 0.0) button:SetBackdropBorderColor(0, 0, 0, 1) - + thisbox.button = button - + thisbox.box:SetPoint("right", text, "left", -4, 0) - + if (next_box == 1) then thisbox.text:SetPoint("topright", self, "topright", -35, -16) else @@ -2978,11 +2613,10 @@ local create_box = function(self, next_box) end return thisbox - + end local realign_labels = function(self) - if (not self.ShowHeader) then for _, box in ipairs(self.BoxLabels) do box.check:Hide() @@ -2993,22 +2627,22 @@ local realign_labels = function(self) end return end - + local width = self:GetWidth() - 108 - + local first_box = self.BoxLabels [1] first_box.text:SetPoint("topright", self, "topright", -35, -16) - + local line_width = first_box.text:GetStringWidth() + 26 - + for i = 2, #self.BoxLabels do - + local box = self.BoxLabels [i] - + if (box.box:IsShown()) then - + line_width = line_width + box.text:GetStringWidth() + 26 - + if (line_width > width) then line_width = box.text:GetStringWidth() + 26 box.text:SetPoint("topright", self, "topright", -35, -40) @@ -3019,7 +2653,7 @@ local realign_labels = function(self) break end end - + if (self.HeaderOnlyIndicator) then for _, box in ipairs(self.BoxLabels) do box.check:Hide() @@ -3027,37 +2661,34 @@ local realign_labels = function(self) end return end - end local chart_panel_add_label = function(self, color, name, type, number) - local next_box = self.BoxLabelsAmount local thisbox = self.BoxLabels [next_box] - + if (not thisbox) then thisbox = create_box (self, next_box) end - + self.BoxLabelsAmount = self.BoxLabelsAmount + 1 - + thisbox.type = type thisbox.index = number - - thisbox.box:SetColorTexture (unpack(color)) + + thisbox.box:SetColorTexture(unpack(color)) thisbox.text:SetText(name) - + thisbox.check:Show() thisbox.button:Show() thisbox.border:Hide() thisbox.box:Show() thisbox.text:Show() - + thisbox.showing = true thisbox.enabled = true - - realign_labels (self) - + + realign_labels(self) end local line_default_color = {1, 1, 1} @@ -3066,18 +2697,18 @@ local draw_overlay = function(self, this_overlay, overlayData, color) local pixel = self.Graphic:GetWidth() / self.TimeScale local index = 1 local r, g, b, a = unpack(color or line_default_color) - + for i = 1, #overlayData, 2 do local aura_start = overlayData [i] local aura_end = overlayData [i+1] - + local this_block = this_overlay [index] if (not this_block) then this_block = self.Graphic:CreateTexture(nil, "border") tinsert(this_overlay, this_block) end this_block:SetHeight(self.Graphic:GetHeight()) - + this_block:SetPoint("left", self.Graphic, "left", pixel * aura_start, 0) if (aura_end) then this_block:SetWidth((aura_end-aura_start)*pixel) @@ -3085,19 +2716,17 @@ local draw_overlay = function(self, this_overlay, overlayData, color) --malformed table this_block:SetWidth(pixel*5) end - - this_block:SetColorTexture (r, g, b, a or 0.25) + + this_block:SetColorTexture(r, g, b, a or 0.25) this_block:Show() - + index = index + 1 end - end local chart_panel_add_overlay = function(self, overlayData, color, name, icon) - if (not self.TimeScale) then - error ("Use SetTime (time) before adding an overlay.") + error("Use SetTime (time) before adding an overlay.") end if (type(overlayData) == "number") then @@ -3133,14 +2762,14 @@ end local calc_lowess_smoothing = function(self, data, bandwidth) local length = #data local newData = {} - + for i = 1, length do local A = 0 local B = 0 local C = 0 local D = 0 local E = 0 - + -- Calculate span of values to be included in the regression local jmin = floor(i-bandwidth/2) local jmax = ceil (i+bandwidth/2) @@ -3150,9 +2779,9 @@ local calc_lowess_smoothing = function(self, data, bandwidth) if jmax > length then jmax = length end - - -- For all the values in the span, compute the weight and then the linear fit - + + -- For all the values in the span, compute the weight and then the linear fit + for j = jmin, jmax do w = calc_cubeweight (i, j, bandwidth/2) x = j @@ -3164,16 +2793,14 @@ local calc_lowess_smoothing = function(self, data, bandwidth) D = D + w*x*y E = E + w end - + -- Calculate a (slope) and b (offset) for the linear fit local a = (A*B-D*E)/(A^2 - C*E) local b = (A*D-B*C)/(A^2 - C*E) -- Calculate the smoothed value by the formula y=a*x+b (x <- i) newData [i] = a*i+b - end - return newData end @@ -3183,113 +2810,108 @@ local calc_stddev = function(self, data) total = total + data[i] end local mean = total / #data - + local totalDistance = 0 for i = 1, #data do totalDistance = totalDistance + ((data[i] - mean) ^ 2) end - + local deviation = math.sqrt (totalDistance / #data) return deviation end - - local SMA_table = {} local SMA_max = 0 local reset_SMA = function() - table.wipe (SMA_table) + table.wipe(SMA_table) SMA_max = 0 end local calc_SMA calc_SMA = function(a, b, ...) - if (b) then - return calc_SMA (a + b, ...) - else + if (b) then + return calc_SMA (a + b, ...) + else return a - end + end end local do_SMA = function(value, max_value) - - if (#SMA_table == 10) then + if (#SMA_table == 10) then tremove(SMA_table, 1) end - + SMA_table [#SMA_table + 1] = value - + local new_value = calc_SMA (unpack(SMA_table)) / #SMA_table - + if (new_value > SMA_max) then SMA_max = new_value return new_value, SMA_max else return new_value end - end local chart_panel_onresize = function(self) local width, height = self:GetSize() local spacement = width - 78 - 60 spacement = spacement / 16 - + for i = 1, 17 do local label = self.TimeLabels [i] label:SetPoint("bottomleft", self, "bottomleft", 78 + ((i-1)*spacement), self.TimeLabelsHeight) label.line:SetHeight(height - 45) end - + local spacement = (self.Graphic:GetHeight()) / 8 for i = 1, 8 do self ["dpsamt"..i]:SetPoint("TOPLEFT", self, "TOPLEFT", 27, -25 + (-(spacement* (i-1))) ) self ["dpsamt"..i].line:SetWidth(width-20) end - + self.Graphic:SetSize(width - 135, height - 67) self.Graphic:SetPoint("topleft", self, "topleft", 108, -35) end local chart_panel_add_data = function(self, graphicData, color, name, elapsed_time, lineTexture, smoothLevel, firstIndex) - local f = self self = self.Graphic local _data = {} local max_value = graphicData.max_value local amount = #graphicData - + local scaleW = 1/self:GetWidth() - + local content = graphicData tinsert(content, 1, 0) tinsert(content, 1, 0) tinsert(content, #content+1, 0) tinsert(content, #content+1, 0) - + local _i = 3 - + local graphMaxDps = math.max(self.max_value, max_value) - + if (not smoothLevel) then - while (_i <= #content-2) do + while (_i <= #content-2) do local v = (content[_i-2]+content[_i-1]+content[_i]+content[_i+1]+content[_i+2])/5 --normalize _data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --x and y coords _i = _i + 1 end - + elseif (smoothLevel == "SHORT") then - while (_i <= #content-2) do + while (_i <= #content-2) do local value = (content[_i] + content[_i+1]) / 2 _data [#_data+1] = {scaleW*(_i-2), value} _data [#_data+1] = {scaleW*(_i-2), value} _i = _i + 2 end - + elseif (smoothLevel == "SMA") then reset_SMA() - while (_i <= #content-2) do + while (_i <= #content-2) do local value, is_new_max_value = do_SMA (content[_i], max_value) if (is_new_max_value) then max_value = is_new_max_value @@ -3297,70 +2919,69 @@ local chart_panel_add_data = function(self, graphicData, color, name, elapsed_ti _data [#_data+1] = {scaleW*(_i-2), value} --x and y coords _i = _i + 1 end - + elseif (smoothLevel == -1) then while (_i <= #content-2) do local current = content[_i] - + local minus_2 = content[_i-2] * 0.6 local minus_1 = content[_i-1] * 0.8 local plus_1 = content[_i+1] * 0.8 local plus_2 = content[_i+2] * 0.6 - + local v = (current + minus_2 + minus_1 + plus_1 + plus_2)/5 --normalize _data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --x and y coords _i = _i + 1 end - + elseif (smoothLevel == 1) then _i = 2 - while (_i <= #content-1) do + while (_i <= #content-1) do local v = (content[_i-1]+content[_i]+content[_i+1])/3 --normalize _data [#_data+1] = {scaleW*(_i-1), v/graphMaxDps} --x and y coords _i = _i + 1 end - + elseif (smoothLevel == 2) then _i = 1 - while (_i <= #content) do + while (_i <= #content) do local v = content[_i] --do not normalize _data [#_data+1] = {scaleW*(_i), v/graphMaxDps} --x and y coords _i = _i + 1 end - + end - + tremove(content, 1) tremove(content, 1) tremove(content, #graphicData) tremove(content, #graphicData) - if (max_value > self.max_value) then + if (max_value > self.max_value) then --normalize previous data if (self.max_value > 0) then local normalizePercent = self.max_value / max_value - for dataIndex, Data in ipairs(self.Data) do + for dataIndex, Data in ipairs(self.Data) do local Points = Data.Points - for i = 1, #Points do + for i = 1, #Points do Points[i][2] = Points[i][2]*normalizePercent end end end - + self.max_value = max_value f:SetScale(max_value) - end - + tinsert(f.GData, {_data, color or line_default_color, lineTexture, max_value, elapsed_time}) if (name) then f:AddLabel (color or line_default_color, name, "graphic", #f.GData) end - + if (firstIndex) then if (lineTexture) then - if (not lineTexture:find ("\\") and not lineTexture:find ("//")) then - local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)LibGraph%-2%.0%.lua") + if (not lineTexture:find("\\") and not lineTexture:find("//")) then + local path = string.match(debugstack (1, 1, 0), "AddOns\\(.+)LibGraph%-2%.0%.lua") if path then lineTexture = "Interface\\AddOns\\" .. path .. lineTexture else @@ -3368,39 +2989,36 @@ local chart_panel_add_data = function(self, graphicData, color, name, elapsed_ti end end end - + table.insert (self.Data, 1, {Points = _data, Color = color or line_default_color, lineTexture = lineTexture, ElapsedTime = elapsed_time}) self.NeedsUpdate = true else self:AddDataSeries (_data, color or line_default_color, nil, lineTexture) self.Data [#self.Data].ElapsedTime = elapsed_time end - + local max_time = 0 for _, data in ipairs(self.Data) do if (data.ElapsedTime > max_time) then max_time = data.ElapsedTime end end - - f:SetTime (max_time) - + + f:SetTime(max_time) chart_panel_onresize (f) end - - local chart_panel_vlines_on = function(self) for i = 1, 17 do - local label = self.TimeLabels [i] + local label = self.TimeLabels[i] label.line:Show() end end local chart_panel_vlines_off = function(self) for i = 1, 17 do - local label = self.TimeLabels [i] + local label = self.TimeLabels[i] label.line:Hide() end end @@ -3421,6 +3039,7 @@ local chart_panel_mousedown = function(self, button) end end end + local chart_panel_mouseup = function(self, button) if (button == "LeftButton" and self.isMoving) then self:StopMovingOrSizing() @@ -3443,12 +3062,11 @@ local chart_panel_right_click_close = function(self, value) end function detailsFramework:CreateChartPanel(parent, w, h, name) - if (not name) then name = "DFPanel" .. detailsFramework.PanelCounter detailsFramework.PanelCounter = detailsFramework.PanelCounter + 1 end - + parent = parent or UIParent w = w or 800 h = h or 500 @@ -3457,7 +3075,7 @@ function detailsFramework:CreateChartPanel(parent, w, h, name) f:SetSize(w or 500, h or 400) f:EnableMouse(true) f:SetMovable(true) - + f:SetScript("OnMouseDown", chart_panel_mousedown) f:SetScript("OnMouseUp", chart_panel_mouseup) @@ -3471,20 +3089,20 @@ function detailsFramework:CreateChartPanel(parent, w, h, name) c:SetFrameLevel(f:GetFrameLevel()+1) c:SetAlpha(0.9) f.CloseButton = c - + local title = detailsFramework:NewLabel(f, nil, "$parentTitle", "chart_title", "Chart!", nil, 20, {1, 1, 0}) title:SetPoint("topleft", f, "topleft", 110, -13) f.Overlays = {} f.OverlaysAmount = 1 - + f.BoxLabels = {} f.BoxLabelsAmount = 1 - + f.ShowHeader = true f.HeaderOnlyIndicator = false f.HeaderShowOverlays = true - + --graphic local g = LibStub:GetLibrary("LibGraph-2.0"):CreateGraphLine (name .. "Graphic", f, "topleft","topleft", 108, -35, w - 120, h - 67) g:SetXAxis (-1,1) @@ -3501,56 +3119,56 @@ function detailsFramework:CreateChartPanel(parent, w, h, name) g:SetBorderSize ("bottom", 0.001) g.VerticalLines = {} g.max_value = 0 - + g:SetLineTexture ("line") - + f.Graphic = g f.GData = {} f.OData = {} f.ChartFrames = {} - + --div lines for i = 1, 8, 1 do local line = g:CreateTexture(nil, "overlay") - line:SetColorTexture (1, 1, 1, .05) + line:SetColorTexture(1, 1, 1, .05) line:SetWidth(670) line:SetHeight(1.1) - + local s = f:CreateFontString(nil, "overlay", "GameFontHighlightSmall") f ["dpsamt"..i] = s s:SetText("100k") s:SetPoint("topleft", f, "topleft", 27, -61 + (-(24.6*i))) - + line:SetPoint("topleft", s, "bottom", -27, 0) line:SetPoint("topright", g, "right", 0, 0) s.line = line end - + --create time labels and the bottom texture to use as a background to these labels f.TimeLabels = {} f.TimeLabelsHeight = 16 - - for i = 1, 17 do + + for i = 1, 17 do local timeString = f:CreateFontString(nil, "overlay", "GameFontHighlightSmall") timeString:SetText("00:00") timeString:SetPoint("bottomleft", f, "bottomleft", 78 + ((i-1)*36), f.TimeLabelsHeight) f.TimeLabels [i] = timeString - + local line = f:CreateTexture(nil, "border") line:SetSize(1, h-45) - line:SetColorTexture (1, 1, 1, .1) + line:SetColorTexture(1, 1, 1, .1) line:SetPoint("bottomleft", timeString, "topright", 0, -10) line:Hide() timeString.line = line - end - - local bottom_texture = detailsFramework:NewImage (f, nil, 702, 25, "background", nil, nil, "$parentBottomTexture") - bottom_texture:SetColorTexture (.1, .1, .1, .7) + end + + local bottom_texture = detailsFramework:NewImage(f, nil, 702, 25, "background", nil, nil, "$parentBottomTexture") + bottom_texture:SetColorTexture(.1, .1, .1, .7) bottom_texture:SetPoint("topright", g, "bottomright", 0, 0) bottom_texture:SetPoint("bottomleft", f, "bottomleft", 8, 12) - - - + + + f.SetTime = chart_panel_align_timelabels f.EnableVerticalLines = chart_panel_vlines_on f.DisableVerticalLines = chart_panel_vlines_off @@ -3565,10 +3183,10 @@ function detailsFramework:CreateChartPanel(parent, w, h, name) f.RightClickClose = chart_panel_right_click_close f.CalcStdDev = calc_stddev f.CalcLowessSmoothing = calc_lowess_smoothing - + f:SetScript("OnSizeChanged", chart_panel_onresize) - chart_panel_onresize (f) - + chart_panel_onresize(f) + return f end @@ -3580,7 +3198,7 @@ local gframe_on_enter_line = function(self) local parent = self:GetParent() local ball = self.ball ball:SetBlendMode("ADD") - + local on_enter = parent._onenter_line if (on_enter) then return on_enter (self, parent) @@ -3589,11 +3207,11 @@ end local gframe_on_leave_line = function(self) self:SetBackdropColor(0, 0, 0, .6) - + local parent = self:GetParent() local ball = self.ball ball:SetBlendMode("BLEND") - + local on_leave = parent._onleave_line if (on_leave) then return on_leave (self, parent) @@ -3602,15 +3220,15 @@ end local gframe_create_line = function(self) local index = #self._lines+1 - + local f = CreateFrame("frame", nil, self, "BackdropTemplate") self._lines [index] = f f.id = index f:SetScript("OnEnter", gframe_on_enter_line) f:SetScript("OnLeave", gframe_on_leave_line) - + f:SetWidth(self._linewidth) - + if (index == 1) then f:SetPoint("topleft", self, "topleft") f:SetPoint("bottomleft", self, "bottomleft") @@ -3619,14 +3237,14 @@ local gframe_create_line = function(self) f:SetPoint("topleft", previous_line, "topright") f:SetPoint("bottomleft", previous_line, "bottomright") end - + local t = f:CreateTexture(nil, "background") t:SetWidth(1) t:SetPoint("topright", f, "topright") t:SetPoint("bottomright", f, "bottomright") - t:SetColorTexture (1, 1, 1, .1) + t:SetColorTexture(1, 1, 1, .1) f.grid = t - + local b = f:CreateTexture(nil, "overlay") b:SetTexture([[Interface\COMMON\Indicator-Yellow]]) b:SetSize(16, 16) @@ -3634,27 +3252,27 @@ local gframe_create_line = function(self) local anchor = CreateFrame("frame", nil, f, "BackdropTemplate") anchor:SetAllPoints(b) b.tooltip_anchor = anchor - + local spellicon = f:CreateTexture(nil, "artwork") spellicon:SetPoint("bottom", b, "bottom", 0, 10) spellicon:SetSize(16, 16) f.spellicon = spellicon - + local text = f:CreateFontString(nil, "overlay", "GameFontNormal") local textBackground = f:CreateTexture(nil, "artwork") textBackground:SetSize(30, 16) - textBackground:SetColorTexture (0, 0, 0, 0.5) + textBackground:SetColorTexture(0, 0, 0, 0.5) textBackground:SetPoint("bottom", f.ball, "top", 0, -6) text:SetPoint("center", textBackground, "center") detailsFramework:SetFontSize (text, 10) f.text = text f.textBackground = textBackground - + local timeline = f:CreateFontString(nil, "overlay", "GameFontNormal") timeline:SetPoint("bottomright", f, "bottomright", -2, 0) detailsFramework:SetFontSize (timeline, 8) f.timeline = timeline - + return f end @@ -3680,27 +3298,26 @@ local gframe_reset = function(self) end local gframe_update = function(self, lines) - local g = LibStub:GetLibrary ("LibGraph-2.0") local h = self:GetHeight()/100 local amtlines = #lines local linewidth = self._linewidth - + local max_value = 0 for i = 1, amtlines do if (lines [i].value > max_value) then max_value = lines [i].value end end - + self.MaxValue = max_value - + local o = 1 local lastvalue = self:GetHeight()/2 max_value = math.max(max_value, 0.0000001) - + for i = 1, min (amtlines, self._maxlines) do - + local data = lines [i] local pvalue = data.value / max_value * 100 @@ -3708,19 +3325,19 @@ local gframe_update = function(self, lines) pvalue = 98 end pvalue = pvalue * h - + g:DrawLine (self, (o-1)*linewidth, lastvalue, o*linewidth, pvalue, linewidth, {1, 1, 1, 1}, "overlay") lastvalue = pvalue local line = self:GetLine (i) line:Show() line.ball:Show() - + line.ball:SetPoint("bottomleft", self, "bottomleft", (o*linewidth)-8, pvalue-8) line.spellicon:SetTexture(nil) line.timeline:SetText(data.text) line.timeline:Show() - + if (data.utext) then line.text:Show() line.textBackground:Show() @@ -3729,77 +3346,69 @@ local gframe_update = function(self, lines) line.text:Hide() line.textBackground:Hide() end - + line.data = data - + o = o + 1 end - + end function detailsFramework:CreateGFrame (parent, w, h, linewidth, onenter, onleave, member, name) local f = CreateFrame("frame", name, parent, "BackdropTemplate") f:SetSize(w or 450, h or 150) --f.CustomLine = [[Interface\AddOns\Details\Libs\LibGraph-2.0\line]] - + if (member) then parent [member] = f end - + f.CreateLine = gframe_create_line f.GetLine = gframe_getline f.Reset = gframe_reset f.UpdateLines = gframe_update - + f.MaxValue = 0 - + f._lines = {} - + f._onenter_line = onenter f._onleave_line = onleave - + f._linewidth = linewidth or 50 f._maxlines = floor(f:GetWidth() / f._linewidth) - + return f end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --- ~buttoncontainer - -function detailsFramework:CreateButtonContainer (parent, name) - local f = CreateFrame("frame", name, parent, "BackdropTemplate") --- f. -end - - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --options tabs and buttons -dot -function detailsFramework:FindHighestParent (self) - local f +function detailsFramework:FindHighestParent(self) + local highestParent if (self:GetParent() == UIParent) then - f = self + highestParent = self end - if (not f) then - f = self + + if (not highestParent) then + highestParent = self for i = 1, 6 do - local parent = f:GetParent() + local parent = highestParent:GetParent() if (parent == UIParent) then break else - f = parent + highestParent = parent end end end - - return f + + return highestParent end detailsFramework.TabContainerFunctions = {} -local button_tab_template = detailsFramework.table.copy ({}, detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) +local button_tab_template = detailsFramework.table.copy({}, detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) button_tab_template.backdropbordercolor = nil detailsFramework.TabContainerFunctions.CreateUnderlineGlow = function(button) @@ -3807,7 +3416,7 @@ detailsFramework.TabContainerFunctions.CreateUnderlineGlow = function(button) selectedGlow:SetPoint("topleft", button.widget, "bottomleft", -7, 0) selectedGlow:SetPoint("topright", button.widget, "bottomright", 7, 0) selectedGlow:SetTexture([[Interface\BUTTONS\UI-Panel-Button-Glow]]) - selectedGlow:SetTexCoord (0, 95/128, 30/64, 38/64) + selectedGlow:SetTexCoord(0, 95/128, 30/64, 38/64) selectedGlow:SetBlendMode("ADD") selectedGlow:SetHeight(8) selectedGlow:SetAlpha(.75) @@ -3819,7 +3428,7 @@ detailsFramework.TabContainerFunctions.OnMouseDown = function(self, button) --search for UIParent local f = detailsFramework:FindHighestParent (self) local container = self:GetParent() - + if (button == "LeftButton") then if (not f.IsMoving and f:IsMovable()) then f:StartMoving() @@ -3853,7 +3462,7 @@ end detailsFramework.TabContainerFunctions.SelectIndex = function(self, fixedParam, menuIndex) local mainFrame = self.AllFrames and self or self.mainFrame or self:GetParent() - + for i = 1, #mainFrame.AllFrames do mainFrame.AllFrames[i]:Hide() if (mainFrame.ButtonNotSelectedBorderColor) then @@ -3863,7 +3472,7 @@ detailsFramework.TabContainerFunctions.SelectIndex = function(self, fixedParam, mainFrame.AllButtons[i].selectedUnderlineGlow:Hide() end end - + mainFrame.AllFrames[menuIndex]:Show() if mainFrame.AllFrames[menuIndex].RefreshOptions then mainFrame.AllFrames[menuIndex]:RefreshOptions() @@ -3896,7 +3505,7 @@ function detailsFramework:CreateTabContainer (parent, title, frame_name, frameLi local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") - + options_table = options_table or {} local parentFrameWidth = parent:GetWidth() local y_offset = options_table.y_offset or 0 @@ -3906,47 +3515,47 @@ function detailsFramework:CreateTabContainer (parent, title, frame_name, frameLi local buttonAnchorY = options_table.button_y or -32 local button_text_size = options_table.button_text_size or 10 local containerWidthOffset = options_table.container_width_offset or 0 - + local mainFrame = CreateFrame("frame", frame_name, parent.widget or parent, "BackdropTemplate") mainFrame:SetAllPoints() - detailsFramework:Mixin (mainFrame, detailsFramework.TabContainerFunctions) + detailsFramework:Mixin(mainFrame, detailsFramework.TabContainerFunctions) mainFrame.hookList = hookList or {} - + local mainTitle = detailsFramework:CreateLabel(mainFrame, title, 24, "white") mainTitle:SetPoint("topleft", mainFrame, "topleft", 10, -30 + y_offset) - + mainFrame:SetFrameLevel(200) - + mainFrame.AllFrames = {} mainFrame.AllButtons = {} mainFrame.CurrentIndex = 1 mainFrame.IsContainer = true mainFrame.ButtonSelectedBorderColor = options_table.button_selected_border_color or {1, 1, 0, 1} mainFrame.ButtonNotSelectedBorderColor = options_table.button_border_color or {0, 0, 0, 0} - + if (options_table.right_click_interact ~= nil) then mainFrame.CanCloseWithRightClick = options_table.right_click_interact else mainFrame.CanCloseWithRightClick = true end - + for i, frame in ipairs(frameList) do local f = CreateFrame("frame", "$parent" .. frame.name, mainFrame, "BackdropTemplate") f:SetAllPoints() f:SetFrameLevel(210) f:Hide() - + local title = detailsFramework:CreateLabel(f, frame.title, 16, "silver") title:SetPoint("topleft", mainTitle, "bottomleft", 0, 0) f.titleText = title - + local tabButton = detailsFramework:CreateButton(mainFrame, detailsFramework.TabContainerFunctions.SelectIndex, buttonWidth, buttonHeight, frame.title, i, nil, nil, nil, "$parentTabButton" .. frame.name, false, button_tab_template) PixelUtil.SetSize(tabButton, buttonWidth, buttonHeight) tabButton:SetFrameLevel(220) tabButton.textsize = button_text_size tabButton.mainFrame = mainFrame detailsFramework.TabContainerFunctions.CreateUnderlineGlow (tabButton) - + local right_click_to_back if (i == 1 or options_table.rightbutton_always_close) then right_click_to_back = detailsFramework:CreateLabel(f, "right click to close", 10, "gray") @@ -3962,18 +3571,18 @@ function detailsFramework:CreateTabContainer (parent, title, frame_name, frameLi right_click_to_back:SetAlpha(options_table.close_text_alpha) end end - + if (options_table.hide_click_label) then right_click_to_back:Hide() end - + f:SetScript("OnMouseDown", detailsFramework.TabContainerFunctions.OnMouseDown) f:SetScript("OnMouseUp", detailsFramework.TabContainerFunctions.OnMouseUp) - + tinsert(mainFrame.AllFrames, f) tinsert(mainFrame.AllButtons, tabButton) end - + --order buttons local x = buttonAnchorX local y = buttonAnchorY @@ -3981,21 +3590,21 @@ function detailsFramework:CreateTabContainer (parent, title, frame_name, frameLi local allocatedSpaceForButtons = parentFrameWidth - ((#frameList - 2) * spaceBetweenButtons) - buttonAnchorX + containerWidthOffset local amountButtonsPerRow = floor(allocatedSpaceForButtons / buttonWidth) - + mainFrame.AllButtons[1]:SetPoint("topleft", mainTitle, "topleft", x, y) x = x + buttonWidth + 2 - + for i = 2, #mainFrame.AllButtons do local button = mainFrame.AllButtons[i] PixelUtil.SetPoint(button, "topleft", mainTitle, "topleft", x, y) x = x + buttonWidth + 2 - + if (i % amountButtonsPerRow == 0) then x = buttonAnchorX y = y - buttonHeight - 1 end end - + --when show the frame, reset to the current internal index mainFrame:SetScript("OnShow", tab_container_on_show) --select the first frame @@ -4025,7 +3634,7 @@ end -- ~listbox local simple_list_box_ResetWidgets = function(self) - for _, widget in ipairs(self.widgets) do + for _, widget in ipairs(self.widgets) do widget:Hide() end self.nextWidget = 1 @@ -4050,16 +3659,16 @@ local simple_list_box_GetOrCreateWidget = function(self) widget.textcolor = self.options.textcolor widget.textsize = self.options.text_size widget.onleave_backdrop = self.options.backdrop_color - + widget.XButton = detailsFramework:CreateButton(widget, function()end, 16, 16) widget.XButton:SetPoint("topright", widget.widget, "topright") widget.XButton:SetIcon ([[Interface\BUTTONS\UI-Panel-MinimizeButton-Up]], 16, 16, "overlay", nil, nil, 0, -4, 0, false) widget.XButton.icon:SetDesaturated(true) - + if (not self.options.show_x_button) then widget.XButton:Hide() end - + tinsert(self.widgets, widget) end self.nextWidget = self.nextWidget + 1 @@ -4073,9 +3682,9 @@ local simple_list_box_RefreshWidgets = function(self) local widget = self:GetOrCreateWidget() widget:SetPoint("topleft", self, "topleft", 1, -self.options.row_height * (self.nextWidget-2) - 4) widget:SetPoint("topright", self, "topright", -1, -self.options.row_height * (self.nextWidget-2) - 4) - + widget:SetClickFunction(self.func, value) - + if (self.options.show_x_button) then widget.XButton:SetClickFunction(self.options.x_button_func, value) widget.XButton.value = value @@ -4083,14 +3692,14 @@ local simple_list_box_RefreshWidgets = function(self) else widget.XButton:Hide() end - + widget.value = value - + if (self.options.icon) then if (type(self.options.icon) == "string" or type(self.options.icon) == "number") then local coords = type(self.options.iconcoords) == "table" and self.options.iconcoords or {0, 1, 0, 1} widget:SetIcon (self.options.icon, self.options.row_height - 2, self.options.row_height - 2, "overlay", coords) - + elseif (type(self.options.icon) == "function") then local icon = self.options.icon (value) if (icon) then @@ -4101,7 +3710,7 @@ local simple_list_box_RefreshWidgets = function(self) else widget:SetIcon ("", self.options.row_height, self.options.row_height) end - + if (self.options.text) then if (type(self.options.text) == "function") then local text = self.options.text (value) @@ -4116,12 +3725,12 @@ local simple_list_box_RefreshWidgets = function(self) else widget:SetText("") end - + widget.value = value - + local r, g, b, a = detailsFramework:ParseColors(self.options.backdrop_color) widget:SetBackdropColor(r, g, b, a) - + widget:Show() amt = amt + 1 end @@ -4134,17 +3743,17 @@ end local backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1} local default_options = { - height = 400, + height = 400, row_height = 16, - width = 230, - icon = false, + width = 230, + icon = false, text = "", text_size = 10, textcolor = "wheat", - + backdrop_color = {1, 1, 1, .5}, panel_border_color = {0, 0, 0, 0.5}, - + onenter = function(self, capsule) if (capsule) then capsule.textcolor = "white" @@ -4164,7 +3773,7 @@ end function detailsFramework:CreateSimpleListBox (parent, name, title, empty_text, list_table, onclick, options) local f = CreateFrame("frame", name, parent, "BackdropTemplate") - + f.ResetWidgets = simple_list_box_ResetWidgets f.GetOrCreateWidget = simple_list_box_GetOrCreateWidget f.Refresh = simple_list_box_RefreshWidgets @@ -4177,12 +3786,12 @@ function detailsFramework:CreateSimpleListBox (parent, name, title, empty_text, f:Refresh() end f.widgets = {} - + detailsFramework:ApplyStandardBackdrop(f) - + f.options = options or {} self.table.deploy(f.options, default_options) - + if (f.options.x_button_func) then local original_X_function = f.options.x_button_func f.options.x_button_func = function(self, button, value) @@ -4190,16 +3799,16 @@ function detailsFramework:CreateSimpleListBox (parent, name, title, empty_text, f:Refresh() end end - + f:SetBackdropBorderColor(unpack(f.options.panel_border_color)) - + f:SetSize(f.options.width + 2, f.options.height) - + local name = detailsFramework:CreateLabel(f, title, 12, "silver") name:SetTemplate(detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) name:SetPoint("bottomleft", f, "topleft", 0, 2) f.Title = name - + local emptyLabel = detailsFramework:CreateLabel(f, empty_text, 12, "gray") emptyLabel:SetAlpha(.6) emptyLabel:SetSize(f.options.width-10, f.options.height) @@ -4207,7 +3816,7 @@ function detailsFramework:CreateSimpleListBox (parent, name, title, empty_text, emptyLabel:Hide() emptyLabel.align = "center" f.EmptyLabel = emptyLabel - + return f end @@ -4217,9 +3826,9 @@ end function detailsFramework:CreateScrollBox (parent, name, refreshFunc, data, width, height, lineAmount, lineHeight, createLineFunc, autoAmount, noScroll) local scroll = CreateFrame("scrollframe", name, parent, "FauxScrollFrameTemplate, BackdropTemplate") - + detailsFramework:ApplyStandardBackdrop(scroll) - + scroll:SetSize(width, height) scroll.LineAmount = lineAmount scroll.LineHeight = lineHeight @@ -4228,16 +3837,16 @@ function detailsFramework:CreateScrollBox (parent, name, refreshFunc, data, widt scroll.Frames = {} scroll.ReajustNumFrames = autoAmount scroll.CreateLineFunc = createLineFunc - + detailsFramework:Mixin(scroll, detailsFramework.SortFunctions) detailsFramework:Mixin(scroll, detailsFramework.ScrollBoxFunctions) - + scroll.refresh_func = refreshFunc scroll.data = data - + scroll:SetScript("OnVerticalScroll", scroll.OnVerticalScroll) scroll:SetScript("OnSizeChanged", detailsFramework.ScrollBoxFunctions.OnSizeChanged) - + return scroll end @@ -4248,26 +3857,26 @@ end function detailsFramework:CreateResizeGrips (parent) if (parent) then local parentName = parent:GetName() - + local leftResizer = CreateFrame("button", parentName and parentName .. "LeftResizer" or nil, parent, "BackdropTemplate") local rightResizer = CreateFrame("button", parentName and parentName .. "RightResizer" or nil, parent, "BackdropTemplate") - + leftResizer:SetPoint("bottomleft", parent, "bottomleft") rightResizer:SetPoint("bottomright", parent, "bottomright") leftResizer:SetSize(16, 16) rightResizer:SetSize(16, 16) - + rightResizer:SetNormalTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) rightResizer:SetHighlightTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) rightResizer:SetPushedTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) leftResizer:SetNormalTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) leftResizer:SetHighlightTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) leftResizer:SetPushedTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) - - leftResizer:GetNormalTexture():SetTexCoord (1, 0, 0, 1) - leftResizer:GetHighlightTexture():SetTexCoord (1, 0, 0, 1) - leftResizer:GetPushedTexture():SetTexCoord (1, 0, 0, 1) - + + leftResizer:GetNormalTexture():SetTexCoord(1, 0, 0, 1) + leftResizer:GetHighlightTexture():SetTexCoord(1, 0, 0, 1) + leftResizer:GetPushedTexture():SetTexCoord(1, 0, 0, 1) + return leftResizer, rightResizer end end @@ -4335,28 +3944,28 @@ local keybind_set_data = function(self, new_data_table) end function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, height, line_amount, line_height) - + local options_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") - + local SCROLL_ROLL_AMOUNT = line_amount - + --keybind set frame local new_keybind_frame = CreateFrame("frame", name, parent, "BackdropTemplate") new_keybind_frame:SetSize(width, height) - + -- keybind scrollframe local keybindScroll = CreateFrame("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate, BackdropTemplate") keybindScroll:SetSize(1019, 348) keybindScroll.Frames = {} new_keybind_frame.keybindScroll = keybindScroll - + --waiting the player to press a key new_keybind_frame.IsListening = false - + --check for valid data table if (type(data) ~= "table") then print("error: data must be a table. DF > CreateKeybindBox()") @@ -4365,7 +3974,7 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, if (not next (data)) then --build data table for the character class - local _, unitClass = UnitClass ("player") + local _, unitClass = UnitClass("player") if (unitClass) then local specIds = detailsFramework:GetClassSpecIDs (unitClass) if (specIds) then @@ -4375,27 +3984,27 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, end end end - + new_keybind_frame.Data = data new_keybind_frame.SetData = keybind_set_data - + new_keybind_frame.EditingSpec = detailsFramework:GetCurrentSpec() new_keybind_frame.CurrentKeybindEditingSet = new_keybind_frame.Data [new_keybind_frame.EditingSpec] - + local allSpecButtons = {} local switch_spec = function(self, button, specID) new_keybind_frame.EditingSpec = specID new_keybind_frame.CurrentKeybindEditingSet = new_keybind_frame.Data [specID] - + for _, button in ipairs(allSpecButtons) do button.selectedTexture:Hide() end self.MyObject.selectedTexture:Show() - + --feedback ao jogador uma vez que as keybinds podem ter o mesmo valor C_Timer.After(.04, function() new_keybind_frame:Hide() end) C_Timer.After(.06, function() new_keybind_frame:Show() end) - + --atualiza a scroll keybindScroll:UpdateScroll() end @@ -4405,12 +4014,12 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, local spec2 = detailsFramework:CreateButton(new_keybind_frame, switch_spec, 160, 20, "Spec2 Placeholder Text", 1, _, _, "SpecButton2", _, 0, options_button_template, options_text_template) local spec3 = detailsFramework:CreateButton(new_keybind_frame, switch_spec, 160, 20, "Spec3 Placeholder Text", 1, _, _, "SpecButton3", _, 0, options_button_template, options_text_template) local spec4 = detailsFramework:CreateButton(new_keybind_frame, switch_spec, 160, 20, "Spec4 Placeholder Text", 1, _, _, "SpecButton4", _, 0, options_button_template, options_text_template) - + --format the button label and icon with the spec information - local className, class = UnitClass ("player") + local className, class = UnitClass("player") local i = 1 local specIds = detailsFramework:GetClassSpecIDs (class) - + for index, specId in ipairs(specIds) do local button = new_keybind_frame ["SpecButton" .. index] local spec_id, spec_name, spec_description, spec_icon, spec_background, spec_role, spec_class = DetailsFramework.GetSpecializationInfoByID (specId) @@ -4418,31 +4027,31 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, button:SetClickFunction(switch_spec, specId) button:SetIcon (spec_icon) button.specID = specId - + local selectedTexture = button:CreateTexture(nil, "background") selectedTexture:SetAllPoints() - selectedTexture:SetColorTexture (1, 1, 1, 0.5) + selectedTexture:SetColorTexture(1, 1, 1, 0.5) if (specId ~= new_keybind_frame.EditingSpec) then selectedTexture:Hide() end button.selectedTexture = selectedTexture - + tinsert(allSpecButtons, button) i = i + 1 end - + local specsTitle = detailsFramework:CreateLabel(new_keybind_frame, "Config keys for spec:", 12, "silver") specsTitle:SetPoint("topleft", new_keybind_frame, "topleft", 10, mainStartY) - + keybindScroll:SetPoint("topleft", specsTitle.widget, "bottomleft", 0, -120) - + spec1:SetPoint("topleft", specsTitle, "bottomleft", 0, -10) spec2:SetPoint("topleft", specsTitle, "bottomleft", 0, -30) spec3:SetPoint("topleft", specsTitle, "bottomleft", 0, -50) if (class == "DRUID") then spec4:SetPoint("topleft", specsTitle, "bottomleft", 0, -70) end - + local enter_the_key = CreateFrame("frame", nil, new_keybind_frame, "BackdropTemplate") enter_the_key:SetFrameStrata("tooltip") enter_the_key:SetSize(200, 60) @@ -4452,8 +4061,8 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, enter_the_key.text = detailsFramework:CreateLabel(enter_the_key, "- Press a keyboard key to bind.\n- Click to bind a mouse button.\n- Press escape to cancel.", 11, "orange") enter_the_key.text:SetPoint("center", enter_the_key, "center") enter_the_key:Hide() - - local registerKeybind = function(self, key) + + local registerKeybind = function(self, key) if (ignoredKeys [key]) then return end @@ -4463,23 +4072,23 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, new_keybind_frame:SetScript("OnKeyDown", nil) return end - + local bind = (IsShiftKeyDown() and "SHIFT-" or "") .. (IsControlKeyDown() and "CTRL-" or "") .. (IsAltKeyDown() and "ALT-" or "") bind = bind .. key - + --adiciona para a tabela de keybinds local keybind = new_keybind_frame.CurrentKeybindEditingSet [self.keybindIndex] keybind.key = bind - + new_keybind_frame.IsListening = false new_keybind_frame:SetScript("OnKeyDown", nil) - + enter_the_key:Hide() new_keybind_frame.keybindScroll:UpdateScroll() - + detailsFramework:QuickDispatch (callback) end - + local set_keybind_key = function(self, button, keybindIndex) if (new_keybind_frame.IsListening) then key = mouseKeys [button] or button @@ -4488,30 +4097,30 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, new_keybind_frame.IsListening = true new_keybind_frame.keybindIndex = keybindIndex new_keybind_frame:SetScript("OnKeyDown", registerKeybind) - + enter_the_key:Show() enter_the_key:SetPoint("bottom", self, "top") end - + local new_key_bind = function(self, button, specID) tinsert(new_keybind_frame.CurrentKeybindEditingSet, {key = "-none-", action = "_target", actiontext = ""}) FauxScrollFrame_SetOffset (new_keybind_frame.keybindScroll, max(#new_keybind_frame.CurrentKeybindEditingSet-SCROLL_ROLL_AMOUNT, 0)) new_keybind_frame.keybindScroll:UpdateScroll() - end - + end + local set_action_text = function(keybindIndex, _, text) local keybind = new_keybind_frame.CurrentKeybindEditingSet [keybindIndex] keybind.actiontext = text detailsFramework:QuickDispatch (callback) end - + local set_action_on_espace_press = function(textentry, capsule) capsule = capsule or textentry.MyObject local keybind = new_keybind_frame.CurrentKeybindEditingSet [capsule.CurIndex] textentry:SetText(keybind.actiontext) detailsFramework:QuickDispatch (callback) end - + local lock_textentry = { ["_target"] = true, ["_taunt"] = true, @@ -4520,7 +4129,7 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, ["_spell"] = false, ["_macro"] = false, } - + local change_key_action = function(self, keybindIndex, value) local keybind = new_keybind_frame.CurrentKeybindEditingSet [keybindIndex] keybind.action = value @@ -4528,13 +4137,13 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, detailsFramework:QuickDispatch (callback) end local fill_action_dropdown = function() - - local locClass, class = UnitClass ("player") - + + local locClass, class = UnitClass("player") + local taunt = "" local interrupt = "" local dispel = "" - + if (type(dispel) == "table") then local dispelString = "\n" for specID, spellid in pairs(dispel) do @@ -4546,7 +4155,7 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, else dispel = "" end - + return { --{value = "_target", label = "Target", onclick = change_key_action, desc = "Target the unit"}, --{value = "_taunt", label = "Taunt", onclick = change_key_action, desc = "Cast the taunt spell for your class\n\n|cFFFFFFFFSpell: " .. taunt}, @@ -4556,7 +4165,7 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, {value = "_macro", label = "Run Macro", onclick = change_key_action, desc = "Type your macro in the text box"}, } end - + local copy_keybind = function(self, button, keybindIndex) local keybind = new_keybind_frame.CurrentKeybindEditingSet [keybindIndex] for specID, t in pairs(new_keybind_frame.Data) do @@ -4569,13 +4178,13 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, end detailsFramework:QuickDispatch (callback) end - + local delete_keybind = function(self, button, keybindIndex) tremove(new_keybind_frame.CurrentKeybindEditingSet, keybindIndex) new_keybind_frame.keybindScroll:UpdateScroll() detailsFramework:QuickDispatch (callback) end - + local newTitle = detailsFramework:CreateLabel(new_keybind_frame, "Create a new Keybind:", 12, "silver") newTitle:SetPoint("topleft", new_keybind_frame, "topleft", 200, mainStartY) local createNewKeybind = detailsFramework:CreateButton(new_keybind_frame, new_key_bind, 160, 20, "New Key Bind", 1, _, _, "NewKeybindButton", _, 0, options_button_template, options_text_template) @@ -4583,11 +4192,11 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, --createNewKeybind:SetIcon ([[Interface\Buttons\UI-GuildButton-PublicNote-Up]]) local update_keybind_list = function(self) - + local keybinds = new_keybind_frame.CurrentKeybindEditingSet FauxScrollFrame_Update (self, #keybinds, SCROLL_ROLL_AMOUNT, 21) local offset = FauxScrollFrame_GetOffset (self) - + for i = 1, SCROLL_ROLL_AMOUNT do local index = i + offset local f = self.Frames [i] @@ -4598,11 +4207,11 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, f.Index.text = index --keybind local keyBindText = keysToMouse [data.key] or data.key - - keyBindText = keyBindText:gsub ("type1", "LeftButton") - keyBindText = keyBindText:gsub ("type2", "RightButton") - keyBindText = keyBindText:gsub ("type3", "MiddleButton") - + + keyBindText = keyBindText:gsub("type1", "LeftButton") + keyBindText = keyBindText:gsub("type2", "RightButton") + keyBindText = keyBindText:gsub("type3", "MiddleButton") + f.KeyBind.text = keyBindText f.KeyBind:SetClickFunction(set_keybind_key, index, nil, "left") f.KeyBind:SetClickFunction(set_keybind_key, index, nil, "right") @@ -4613,34 +4222,34 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, f.ActionText.text = data.actiontext f.ActionText:SetEnterFunction (set_action_text, index) f.ActionText.CurIndex = index - + if (lock_textentry [data.action]) then f.ActionText:Disable() else f.ActionText:Enable() end - + --copy f.Copy:SetClickFunction(copy_keybind, index) --delete f.Delete:SetClickFunction(delete_keybind, index) - + f:Show() else f:Hide() end end - + self:Show() end - - + + keybindScroll:SetScript("OnVerticalScroll", function(self, offset) FauxScrollFrame_OnVerticalScroll (self, offset, 21, update_keybind_list) end) keybindScroll.UpdateScroll = update_keybind_list - + local backdropColor = {.3, .3, .3, .3} local backdropColorOnEnter = {.6, .6, .6, .6} local on_enter = function(self) @@ -4649,9 +4258,9 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, local on_leave = function(self) self:SetBackdropColor(unpack(backdropColor)) end - + local font = "GameFontHighlightSmall" - + for i = 1, SCROLL_ROLL_AMOUNT do local f = CreateFrame("frame", "$KeyBindFrame" .. i, keybindScroll, "BackdropTemplate") f:SetSize(1009, 20) @@ -4661,27 +4270,27 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, f:SetScript("OnEnter", on_enter) f:SetScript("OnLeave", on_leave) tinsert(keybindScroll.Frames, f) - + f.Index = detailsFramework:CreateLabel(f, "1") f.KeyBind = detailsFramework:CreateButton(f, set_key_bind, 100, 20, "", _, _, _, "SetNewKeybindButton", _, 0, options_button_template, options_text_template) f.ActionDrop = detailsFramework:CreateDropDown (f, fill_action_dropdown, 0, 120, 20, "ActionDropdown", _, options_dropdown_template) - f.ActionText = detailsFramework:CreateTextEntry (f, function()end, 660, 20, "TextBox", _, _, options_dropdown_template) + f.ActionText = detailsFramework:CreateTextEntry(f, function()end, 660, 20, "TextBox", _, _, options_dropdown_template) f.Copy = detailsFramework:CreateButton(f, copy_keybind, 20, 20, "", _, _, _, "CopyKeybindButton", _, 0, options_button_template, options_text_template) f.Delete = detailsFramework:CreateButton(f, delete_keybind, 16, 20, "", _, _, _, "DeleteKeybindButton", _, 2, options_button_template, options_text_template) - + f.Index:SetPoint("left", f, "left", 10, 0) f.KeyBind:SetPoint("left", f, "left", 43, 0) f.ActionDrop:SetPoint("left", f, "left", 150, 0) f.ActionText:SetPoint("left", f, "left", 276, 0) f.Copy:SetPoint("left", f, "left", 950, 0) f.Delete:SetPoint("left", f, "left", 990, 0) - + f.Copy:SetIcon ([[Interface\Buttons\UI-GuildButton-PublicNote-Up]], nil, nil, nil, nil, nil, nil, 4) f.Delete:SetIcon ([[Interface\Buttons\UI-StopButton]], nil, nil, nil, nil, nil, nil, 4) - + f.Copy.tooltip = "copy this keybind to other specs" f.Delete.tooltip = "erase this keybind" - + --editbox f.ActionText:SetJustifyH("left") f.ActionText:SetHook("OnEscapePressed", set_action_on_espace_press) @@ -4698,22 +4307,22 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, end f.ActionText.WordList = playerSpells end) - + f.ActionText:SetAsAutoComplete ("WordList") end - + local header = CreateFrame("frame", "$parentOptionsPanelFrameHeader", keybindScroll, "BackdropTemplate") header:SetPoint("bottomleft", keybindScroll, "topleft", 0, 2) header:SetPoint("bottomright", keybindScroll, "topright", 0, 2) header:SetHeight(16) - + header.Index = detailsFramework:CreateLabel (header, "Index", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) header.Key = detailsFramework:CreateLabel (header, "Key", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) header.Action = detailsFramework:CreateLabel (header, "Action", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) header.Macro = detailsFramework:CreateLabel (header, "Spell Name / Macro", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) header.Copy = detailsFramework:CreateLabel (header, "Copy", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) header.Delete = detailsFramework:CreateLabel (header, "Delete", detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - + header.Index:SetPoint("left", header, "left", 10, 0) header.Key:SetPoint("left", header, "left", 43, 0) header.Action:SetPoint("left", header, "left", 150, 0) @@ -4722,10 +4331,10 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, header.Delete:SetPoint("left", header, "left", 990, 0) new_keybind_frame:SetScript("OnShow", function() - + --new_keybind_frame.EditingSpec = EnemyGrid.CurrentSpec --new_keybind_frame.CurrentKeybindEditingSet = EnemyGrid.CurrentKeybindSet - + for _, button in ipairs(allSpecButtons) do if (new_keybind_frame.EditingSpec ~= button.specID) then button.selectedTexture:Hide() @@ -4733,10 +4342,10 @@ function detailsFramework:CreateKeybindBox (parent, name, data, callback, width, button.selectedTexture:Show() end end - + keybindScroll:UpdateScroll() end) - + new_keybind_frame:SetScript("OnHide", function() if (new_keybind_frame.IsListening) then new_keybind_frame.IsListening = false @@ -4750,21 +4359,21 @@ end function detailsFramework:BuildKeybindFunctions (data, prefix) --~keybind - local classLoc, class = UnitClass ("player") + local classLoc, class = UnitClass("player") local bindingList = data - + local bindString = "self:ClearBindings()" local bindKeyBindTypeFunc = [[local unitFrame = ...]] local bindMacroTextFunc = [[local unitFrame = ...]] local isMouseBinding - + for i = 1, #bindingList do local bind = bindingList [i] local bindType - + --which button to press - if (bind.key:find ("type")) then - local keyNumber = tonumber (bind.key:match ("%d")) + if (bind.key:find("type")) then + local keyNumber = tonumber(bind.key:match ("%d")) bindType = keyNumber isMouseBinding = true else @@ -4773,24 +4382,24 @@ function detailsFramework:BuildKeybindFunctions (data, prefix) bindType = "-" .. prefix .. "" .. i isMouseBinding = nil end - + --keybind type local shift, alt, ctrl = bind.key:match ("SHIFT"), bind.key:match ("ALT"), bind.key:match ("CTRL") local CommandKeys = alt and alt .. "-" or "" CommandKeys = ctrl and CommandKeys .. ctrl .. "-" or CommandKeys CommandKeys = shift and CommandKeys .. shift .. "-" or CommandKeys - + local keyBindType if (isMouseBinding) then keyBindType = [[unitFrame:SetAttribute ("@COMMANDtype@BINDTYPE", "macro")]] else keyBindType = [[unitFrame:SetAttribute ("type@BINDTYPE", "macro")]] end - - keyBindType = keyBindType:gsub ("@BINDTYPE", bindType) - keyBindType = keyBindType:gsub ("@COMMAND", CommandKeys) + + keyBindType = keyBindType:gsub("@BINDTYPE", bindType) + keyBindType = keyBindType:gsub("@COMMAND", CommandKeys) bindKeyBindTypeFunc = bindKeyBindTypeFunc .. keyBindType - + --spell or macro if (bind.action == "_spell") then local macroTextLine @@ -4799,11 +4408,11 @@ function detailsFramework:BuildKeybindFunctions (data, prefix) else macroTextLine = [[unitFrame:SetAttribute ("macrotext@BINDTYPE", "/cast [@mouseover] @SPELL")]] end - macroTextLine = macroTextLine:gsub ("@BINDTYPE", bindType) - macroTextLine = macroTextLine:gsub ("@SPELL", bind.actiontext) - macroTextLine = macroTextLine:gsub ("@COMMAND", CommandKeys) + macroTextLine = macroTextLine:gsub("@BINDTYPE", bindType) + macroTextLine = macroTextLine:gsub("@SPELL", bind.actiontext) + macroTextLine = macroTextLine:gsub("@COMMAND", CommandKeys) bindMacroTextFunc = bindMacroTextFunc .. macroTextLine - + elseif (bind.action == "_macro") then local macroTextLine if (isMouseBinding) then @@ -4811,32 +4420,32 @@ function detailsFramework:BuildKeybindFunctions (data, prefix) else macroTextLine = [[unitFrame:SetAttribute ("macrotext@BINDTYPE", "@MACRO")]] end - macroTextLine = macroTextLine:gsub ("@BINDTYPE", bindType) - macroTextLine = macroTextLine:gsub ("@MACRO", bind.actiontext) - macroTextLine = macroTextLine:gsub ("@COMMAND", CommandKeys) + macroTextLine = macroTextLine:gsub("@BINDTYPE", bindType) + macroTextLine = macroTextLine:gsub("@MACRO", bind.actiontext) + macroTextLine = macroTextLine:gsub("@COMMAND", CommandKeys) bindMacroTextFunc = bindMacroTextFunc .. macroTextLine - + end end - + --~key local bindTypeFuncLoaded = loadstring (bindKeyBindTypeFunc) local bindMacroFuncLoaded = loadstring (bindMacroTextFunc) - + if (not bindMacroFuncLoaded or not bindTypeFuncLoaded) then return end - + return bindString, bindTypeFuncLoaded, bindMacroFuncLoaded end function detailsFramework:SetKeybindsOnProtectedFrame (frame, bind_string, bind_type_func, bind_macro_func) - + bind_type_func (frame) bind_macro_func (frame) frame:SetAttribute ("_onenter", bind_string) - + end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -4861,9 +4470,9 @@ function detailsFramework:ApplyStandardBackdrop(frame, solidColor, alphaScale) else frame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) frame:SetBackdropColor(red, green, blue, alpha * alphaScale) - frame:SetBackdropBorderColor(0, 0, 0, 0.95) + frame:SetBackdropBorderColor(0, 0, 0, 0.95) end - + if (not frame.__background) then frame.__background = frame:CreateTexture(nil, "background") frame.__background:SetColorTexture(red, green, blue) @@ -4880,22 +4489,22 @@ detailsFramework.TitleFunctions = { SetTitle = function(self, titleText, titleColor, font, size) self.TitleLabel:SetText(titleText or self.TitleLabel:GetText()) - + if (titleColor) then local r, g, b, a = detailsFramework:ParseColors(titleColor) - self.TitleLabel:SetTextColor (r, g, b, a) + self.TitleLabel:SetTextColor(r, g, b, a) end - + if (font) then detailsFramework:SetFontFace (self.TitleLabel, font) end - + if (size) then detailsFramework:SetFontSize (self.TitleLabel, size) end end - - + + } function detailsFramework:CreateTitleBar (f, titleText) @@ -4907,7 +4516,7 @@ function detailsFramework:CreateTitleBar (f, titleText) titleBar:SetBackdrop(SimplePanel_frame_backdrop) --it's an upload from this file titleBar:SetBackdropColor(.2, .2, .2, 1) titleBar:SetBackdropBorderColor(0, 0, 0, 1) - + local closeButton = CreateFrame("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar, "BackdropTemplate") closeButton:SetSize(16, 16) @@ -4920,25 +4529,25 @@ function detailsFramework:CreateTitleBar (f, titleText) closeButton:SetAlpha(0.7) closeButton:SetScript("OnClick", simple_panel_close_click) --upvalue from this file - + local titleLabel = titleBar:CreateFontString(titleBar:GetName() and titleBar:GetName() .. "TitleText" or nil, "overlay", "GameFontNormal") - titleLabel:SetTextColor (.8, .8, .8, 1) + titleLabel:SetTextColor(.8, .8, .8, 1) titleLabel:SetText(titleText or "") - + --anchors closeButton:SetPoint("right", titleBar, "right", -2, 0) titleLabel:SetPoint("center", titleBar, "center") - + --members f.TitleBar = titleBar f.CloseButton = closeButton f.TitleLabel = titleLabel - + titleBar.CloseButton = closeButton titleBar.Text = titleLabel - - detailsFramework:Mixin (f, detailsFramework.TitleFunctions) - + + detailsFramework:Mixin(f, detailsFramework.TitleFunctions) + return titleBar end @@ -4947,56 +4556,56 @@ end -- ~icon row detailsFramework.IconRowFunctions = { - + GetIcon = function(self) local iconFrame = self.IconPool [self.NextIcon] - + if (not iconFrame) then local newIconFrame = CreateFrame("frame", "$parentIcon" .. self.NextIcon, self, "BackdropTemplate") newIconFrame.parentIconRow = self - + newIconFrame.Texture = newIconFrame:CreateTexture(nil, "artwork") - PixelUtil.SetPoint (newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1) - PixelUtil.SetPoint (newIconFrame.Texture, "bottomright", newIconFrame, "bottomright", -1, 1) - + PixelUtil.SetPoint(newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1) + PixelUtil.SetPoint(newIconFrame.Texture, "bottomright", newIconFrame, "bottomright", -1, 1) + newIconFrame.Border = newIconFrame:CreateTexture(nil, "background") newIconFrame.Border:SetAllPoints() - newIconFrame.Border:SetColorTexture (0, 0, 0) + newIconFrame.Border:SetColorTexture(0, 0, 0) newIconFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) newIconFrame:SetBackdropBorderColor(0, 0, 0, 0) newIconFrame:EnableMouse(false) - + local cooldownFrame = CreateFrame("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate, BackdropTemplate") cooldownFrame:SetAllPoints() cooldownFrame:EnableMouse(false) cooldownFrame:SetFrameLevel(newIconFrame:GetFrameLevel()+1) cooldownFrame:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer) cooldownFrame.noCooldownCount = self.options.surpress_tulla_omni_cc - + newIconFrame.CountdownText = cooldownFrame:CreateFontString(nil, "overlay", "GameFontNormal") --newIconFrame.CountdownText:SetPoint("center") newIconFrame.CountdownText:SetPoint(self.options.text_anchor or "center", newIconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) newIconFrame.CountdownText:Hide() - + newIconFrame.StackText = newIconFrame:CreateFontString(nil, "overlay", "GameFontNormal") --newIconFrame.StackText:SetPoint("bottomright") newIconFrame.StackText:SetPoint(self.options.stack_text_anchor or "center", newIconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) newIconFrame.StackText:Hide() - + newIconFrame.Desc = newIconFrame:CreateFontString(nil, "overlay", "GameFontNormal") --newIconFrame.Desc:SetPoint("bottom", newIconFrame, "top", 0, 2) newIconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", newIconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) newIconFrame.Desc:Hide() - + newIconFrame.Cooldown = cooldownFrame - + self.IconPool [self.NextIcon] = newIconFrame iconFrame = newIconFrame end - + iconFrame:ClearAllPoints() - + local anchor = self.options.anchor local anchorTo = self.NextIcon == 1 and self or self.IconPool [self.NextIcon - 1] local xPadding = self.NextIcon == 1 and self.options.left_padding or self.options.icon_padding or 1 @@ -5004,92 +4613,92 @@ detailsFramework.IconRowFunctions = { if (growDirection == 1) then --grow to right if (self.NextIcon == 1) then - PixelUtil.SetPoint (iconFrame, "left", anchorTo, "left", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "left", xPadding, 0) else - PixelUtil.SetPoint (iconFrame, "left", anchorTo, "right", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0) end - + elseif (growDirection == 2) then --grow to left if (self.NextIcon == 1) then - PixelUtil.SetPoint (iconFrame, "right", anchorTo, "right", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "right", xPadding, 0) else - PixelUtil.SetPoint (iconFrame, "right", anchorTo, "left", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0) end - + end - + detailsFramework:SetFontColor(iconFrame.CountdownText, self.options.text_color) - + self.NextIcon = self.NextIcon + 1 return iconFrame end, - + --adds only if not existing already in the cache AddSpecificIcon = function(self, identifierKey, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff) if not identifierKey or identifierKey == "" then return end - + if not self.AuraCache[identifierKey] then local icon = self:SetIcon (spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff or false) icon.identifierKey = identifierKey self.AuraCache[identifierKey] = true end end, - + SetIcon = function(self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge, spellName, isBuff, modRate) - + local actualSpellName, _, spellIcon = GetSpellInfo(spellId) - + if forceTexture then spellIcon = forceTexture end - + spellName = spellName or actualSpellName or "unknown_aura" modRate = modRate or 1 - + if (spellIcon) then local iconFrame = self:GetIcon() iconFrame.Texture:SetTexture(spellIcon) - iconFrame.Texture:SetTexCoord (unpack(self.options.texcoord)) - + iconFrame.Texture:SetTexCoord(unpack(self.options.texcoord)) + if (borderColor) then iconFrame:SetBackdropBorderColor(Plater:ParseColors(borderColor)) else iconFrame:SetBackdropBorderColor(0, 0, 0 ,0) - end - + end + if (startTime) then CooldownFrame_Set (iconFrame.Cooldown, startTime, duration, true, true, modRate) - + if (self.options.show_text) then iconFrame.CountdownText:Show() - + local now = GetTime() - + iconFrame.timeRemaining = (startTime + duration - now) / modRate iconFrame.expirationTime = startTime + duration - + local formattedTime = (iconFrame.timeRemaining > 0) and self.options.decimal_timer and iconFrame.parentIconRow.FormatCooldownTimeDecimal(iconFrame.timeRemaining) or iconFrame.parentIconRow.FormatCooldownTime(iconFrame.timeRemaining) or "" iconFrame.CountdownText:SetText(formattedTime) - + iconFrame.CountdownText:SetPoint(self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) detailsFramework:SetFontSize (iconFrame.CountdownText, self.options.text_size) detailsFramework:SetFontFace (iconFrame.CountdownText, self.options.text_font) detailsFramework:SetFontOutline (iconFrame.CountdownText, self.options.text_outline) - + if self.options.on_tick_cooldown_update then iconFrame.lastUpdateCooldown = now iconFrame:SetScript("OnUpdate", self.OnIconTick) else iconFrame:SetScript("OnUpdate", nil) end - + else iconFrame:SetScript("OnUpdate", nil) iconFrame.CountdownText:Hide() end - + iconFrame.Cooldown:SetReverse (self.options.cooldown_reverse) iconFrame.Cooldown:SetDrawSwipe (self.options.cooldown_swipe_enabled) iconFrame.Cooldown:SetEdgeTexture (self.options.cooldown_edge_texture) @@ -5100,11 +4709,11 @@ detailsFramework.IconRowFunctions = { iconFrame:SetScript("OnUpdate", nil) iconFrame.CountdownText:Hide() end - + if (descText and self.options.desc_text) then iconFrame.Desc:Show() iconFrame.Desc:SetText(descText.text) - iconFrame.Desc:SetTextColor (detailsFramework:ParseColors(descText.text_color or self.options.desc_text_color)) + iconFrame.Desc:SetTextColor(detailsFramework:ParseColors(descText.text_color or self.options.desc_text_color)) iconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) detailsFramework:SetFontSize (iconFrame.Desc, descText.text_size or self.options.desc_text_size) detailsFramework:SetFontFace (iconFrame.Desc, self.options.desc_text_font) @@ -5112,11 +4721,11 @@ detailsFramework.IconRowFunctions = { else iconFrame.Desc:Hide() end - + if (count and count > 1 and self.options.stack_text) then iconFrame.StackText:Show() iconFrame.StackText:SetText(count) - iconFrame.StackText:SetTextColor (detailsFramework:ParseColors(self.options.desc_text_color)) + iconFrame.StackText:SetTextColor(detailsFramework:ParseColors(self.options.desc_text_color)) iconFrame.StackText:SetPoint(self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) detailsFramework:SetFontSize (iconFrame.StackText, self.options.stack_text_size) detailsFramework:SetFontFace (iconFrame.StackText, self.options.stack_text_font) @@ -5124,10 +4733,10 @@ detailsFramework.IconRowFunctions = { else iconFrame.StackText:Hide() end - + PixelUtil.SetSize(iconFrame, self.options.icon_width, self.options.icon_height) iconFrame:Show() - + --update the size of the frame self:SetWidth((self.options.left_padding * 2) + (self.options.icon_padding * (self.NextIcon-2)) + (self.options.icon_width * (self.NextIcon - 1))) self:SetHeight(self.options.icon_height + (self.options.top_padding * 2)) @@ -5142,9 +4751,9 @@ detailsFramework.IconRowFunctions = { iconFrame.canStealOrPurge = canStealOrPurge iconFrame.isBuff = isBuff iconFrame.spellName = spellName - + iconFrame.identifierKey = nil -- only used for "specific" add/remove - + --add the spell into the cache self.AuraCache [spellId or -1] = true self.AuraCache [spellName] = true @@ -5153,11 +4762,11 @@ detailsFramework.IconRowFunctions = { --show the frame self:Show() - + return iconFrame end end, - + OnIconTick = function(self, deltaTime) local now = GetTime() if (self.lastUpdateCooldown + 0.05) <= now then @@ -5174,20 +4783,20 @@ detailsFramework.IconRowFunctions = { self.lastUpdateCooldown = now end end, - + FormatCooldownTime = function(formattedTime) if (formattedTime >= 3600) then formattedTime = floor(formattedTime / 3600) .. "h" - + elseif (formattedTime >= 60) then formattedTime = floor(formattedTime / 60) .. "m" - + else formattedTime = floor(formattedTime) end return formattedTime end, - + FormatCooldownTimeDecimal = function(formattedTime) if formattedTime < 10 then return ("%.1f"):format(formattedTime) @@ -5201,14 +4810,14 @@ detailsFramework.IconRowFunctions = { return ("%dd %02dh"):format(formattedTime/86400, (formattedTime/3600) - (floor(formattedTime/86400) * 24)) end end, - + RemoveSpecificIcon = function(self, identifierKey) if not identifierKey or identifierKey == "" then return end - - table.wipe (self.AuraCache) - + + table.wipe(self.AuraCache) + local iconPool = self.IconPool local countStillShown = 0 for i = 1, self.NextIcon -1 do @@ -5225,16 +4834,16 @@ detailsFramework.IconRowFunctions = { countStillShown = countStillShown + 1 end end - + self:AlignAuraIcons() - + end, - + ClearIcons = function(self, resetBuffs, resetDebuffs) resetBuffs = resetBuffs ~= false resetDebuffs = resetDebuffs ~= false - table.wipe (self.AuraCache) - + table.wipe(self.AuraCache) + local iconPool = self.IconPool for i = 1, self.NextIcon -1 do local iconFrame = iconPool[i] @@ -5254,19 +4863,19 @@ detailsFramework.IconRowFunctions = { self.AuraCache.hasEnrage = self.AuraCache.hasEnrage or iconFrame.debuffType == "" --yes, enrages are empty-string... end end - + self:AlignAuraIcons() - + end, - + AlignAuraIcons = function(self) - + local iconPool = self.IconPool local iconAmount = #iconPool local countStillShown = 0 - + table.sort (iconPool, function(i1, i2) return i1:IsShown() and not i2:IsShown() end) - + if iconAmount == 0 then self:Hide() else @@ -5277,41 +4886,41 @@ detailsFramework.IconRowFunctions = { local anchorTo = i == 1 and self or self.IconPool [i - 1] local xPadding = i == 1 and self.options.left_padding or self.options.icon_padding or 1 local growDirection = self.options.grow_direction - + countStillShown = countStillShown + (iconFrame:IsShown() and 1 or 0) - + iconFrame:ClearAllPoints() if (growDirection == 1) then --grow to right if (i == 1) then - PixelUtil.SetPoint (iconFrame, "left", anchorTo, "left", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "left", xPadding, 0) else - PixelUtil.SetPoint (iconFrame, "left", anchorTo, "right", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "left", anchorTo, "right", xPadding, 0) end - + elseif (growDirection == 2) then --grow to left if (i == 1) then - PixelUtil.SetPoint (iconFrame, "right", anchorTo, "right", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "right", xPadding, 0) else - PixelUtil.SetPoint (iconFrame, "right", anchorTo, "left", xPadding, 0) + PixelUtil.SetPoint(iconFrame, "right", anchorTo, "left", xPadding, 0) end - + end end end - + self.NextIcon = countStillShown + 1 - + end, - + GetIconGrowDirection = function(self) local side = self.options.anchor.side - + if (side == 1) then return 1 elseif (side == 2) then return 2 elseif (side == 3) then - return 1 + return 1 elseif (side == 4) then return 1 elseif (side == 5) then @@ -5334,7 +4943,7 @@ detailsFramework.IconRowFunctions = { return 1 end end, - + OnOptionChanged = function(self, optionName) self:SetBackdropColor(unpack(self.options.backdrop_color)) self:SetBackdropBorderColor(unpack(self.options.backdrop_border_color)) @@ -5342,8 +4951,8 @@ detailsFramework.IconRowFunctions = { } local default_icon_row_options = { - icon_width = 20, - icon_height = 20, + icon_width = 20, + icon_height = 20, texcoord = {.1, .9, .1, .9}, show_text = true, text_color = {1, 1, 1, 1}, @@ -5373,7 +4982,7 @@ local default_icon_row_options = { stack_text_x_offset = 0, stack_text_y_offset = 0, left_padding = 1, --distance between right and left - top_padding = 1, --distance between top and bottom + top_padding = 1, --distance between top and bottom icon_padding = 1, --distance between each icon backdrop = {}, backdrop_color = {0, 0, 0, 0.5}, @@ -5394,18 +5003,18 @@ function detailsFramework:CreateIconRow (parent, name, options) f.IconPool = {} f.NextIcon = 1 f.AuraCache = {} - - detailsFramework:Mixin (f, detailsFramework.IconRowFunctions) - detailsFramework:Mixin (f, detailsFramework.OptionsFunctions) - + + detailsFramework:Mixin(f, detailsFramework.IconRowFunctions) + detailsFramework:Mixin(f, detailsFramework.OptionsFunctions) + f:BuildOptionsTable (default_icon_row_options, options) - + f:SetSize(f.options.icon_width, f.options.icon_height + (f.options.top_padding * 2)) - + f:SetBackdrop(f.options.backdrop) f:SetBackdropColor(unpack(f.options.backdrop_color)) f:SetBackdropBorderColor(unpack(f.options.backdrop_border_color)) - + return f end @@ -5426,30 +5035,30 @@ detailsFramework.HeaderFunctions = { AlignWithHeader = function(self, headerFrame, anchor) local columnHeaderFrames = headerFrame.columnHeadersCreated anchor = anchor or "topleft" - + for i = 1, #self.FramesToAlign do local frame = self.FramesToAlign[i] frame:ClearAllPoints() - + local columnHeader = columnHeaderFrames[i] local offset = 0 - + if (columnHeader.columnAlign == "right") then offset = columnHeader:GetWidth() if (frame:GetObjectType() == "FontString") then frame:SetJustifyH("right") end end - + frame:SetPoint(columnHeader.columnAlign, self, anchor, columnHeader.XPosition + columnHeader.columnOffset + offset, 0) end end, --@self: column header button OnClick = function(self, buttonClicked) - + --get the header main frame - local headerFrame = self:GetParent() + local headerFrame = self:GetParent() --if this header does not have a clickable header, just ignore if (not headerFrame.columnSelected) then @@ -5500,7 +5109,7 @@ detailsFramework.HeaderCoreFunctions = { GetSelectedColumn = function(self) return self.columnSelected, self.columnHeadersCreated[self.columnSelected or 1].order end, - + --clean up and rebuild the header following the header options --@self: main header frame Refresh = function(self) @@ -5508,34 +5117,34 @@ detailsFramework.HeaderCoreFunctions = { self:SetBackdrop(self.options.backdrop) self:SetBackdropColor(unpack(self.options.backdrop_color)) self:SetBackdropBorderColor(unpack(self.options.backdrop_border_color)) - + --reset all header frames for i = 1, #self.columnHeadersCreated do local columnHeader = self.columnHeadersCreated[i] columnHeader.InUse = false columnHeader:Hide() end - + local previousColumnHeader local growDirection = string.lower(self.options.grow_direction) - + --update header frames local headerSize = #self.HeaderTable for i = 1, headerSize do --get the header button, a new one is created if it doesn't exists yet local columnHeader = self:GetNextHeader() self:UpdateColumnHeader(columnHeader, i) - + --grow direction if (not previousColumnHeader) then columnHeader:SetPoint("topleft", self, "topleft", 0, 0) - + if (growDirection == "right") then if (self.options.use_line_separators) then columnHeader.Separator:Show() columnHeader.Separator:SetWidth(self.options.line_separator_width) columnHeader.Separator:SetColorTexture(unpack(self.options.line_separator_color)) - + columnHeader.Separator:ClearAllPoints() if (self.options.line_separator_gap_align) then columnHeader.Separator:SetPoint("topleft", columnHeader, "topright", 0, 0) @@ -5553,7 +5162,7 @@ detailsFramework.HeaderCoreFunctions = { columnHeader.Separator:Show() columnHeader.Separator:SetWidth(self.options.line_separator_width) columnHeader.Separator:SetColorTexture(unpack(self.options.line_separator_color)) - + columnHeader.Separator:ClearAllPoints() if (self.options.line_separator_gap_align) then columnHeader.Separator:SetPoint("topleft", columnHeader, "topright", 0, 0) @@ -5561,35 +5170,35 @@ detailsFramework.HeaderCoreFunctions = { columnHeader.Separator:SetPoint("topleft", columnHeader, "topright", 0, 0) end columnHeader.Separator:SetHeight(self.options.line_separator_height) - + if (headerSize == i) then columnHeader.Separator:Hide() end end - + elseif (growDirection == "left") then columnHeader:SetPoint("topright", previousColumnHeader, "topleft", -self.options.padding, 0) - + elseif (growDirection == "bottom") then columnHeader:SetPoint("topleft", previousColumnHeader, "bottomleft", 0, -self.options.padding) - + elseif (growDirection == "top") then columnHeader:SetPoint("bottomleft", previousColumnHeader, "topleft", 0, self.options.padding) end end - + previousColumnHeader = columnHeader end - + self:SetSize(self.HeaderWidth, self.HeaderHeight) end, - + --@self: main header frame UpdateSortArrow = function(self, columnHeader, defaultShown, defaultOrder) local options = self.options local order = defaultOrder or columnHeader.order local arrowIcon = columnHeader.Arrow - + if (type(defaultShown) ~= "boolean") then arrowIcon:Show() else @@ -5616,35 +5225,35 @@ detailsFramework.HeaderCoreFunctions = { --@self: main header frame UpdateColumnHeader = function(self, columnHeader, headerIndex) local headerData = self.HeaderTable[headerIndex] - + if (headerData.icon) then columnHeader.Icon:SetTexture(headerData.icon) - + if (headerData.texcoord) then columnHeader.Icon:SetTexCoord(unpack(headerData.texcoord)) else columnHeader.Icon:SetTexCoord(0, 1, 0, 1) end - + columnHeader.Icon:SetPoint("left", columnHeader, "left", self.options.padding, 0) columnHeader.Icon:Show() end - + if (headerData.text) then columnHeader.Text:SetText(headerData.text) - + --text options detailsFramework:SetFontColor(columnHeader.Text, self.options.text_color) detailsFramework:SetFontSize(columnHeader.Text, self.options.text_size) detailsFramework:SetFontOutline(columnHeader.Text, self.options.text_shadow) - + --point if (not headerData.icon) then columnHeader.Text:SetPoint("left", columnHeader, "left", self.options.padding, 0) else columnHeader.Text:SetPoint("left", columnHeader.Icon, "right", self.options.padding, 0) end - + columnHeader.Text:Show() end @@ -5698,7 +5307,7 @@ detailsFramework.HeaderCoreFunctions = { columnHeader:Show() columnHeader.InUse = true end, - + --reset column header backdrop --@self: main header frame ResetColumnHeaderBackdrop = function(self, columnHeader) @@ -5717,21 +5326,21 @@ detailsFramework.HeaderCoreFunctions = { ClearColumnHeader = function(self, columnHeader) columnHeader:SetSize(self.options.header_width, self.options.header_height) self:ResetColumnHeaderBackdrop(columnHeader) - + columnHeader:ClearAllPoints() - + columnHeader.Icon:SetTexture("") columnHeader.Icon:Hide() columnHeader.Text:SetText("") columnHeader.Text:Hide() end, - + --get the next column header, create one if doesn't exists --@self: main header frame GetNextHeader = function(self) local nextHeader = self.NextHeader local columnHeader = self.columnHeadersCreated[nextHeader] - + if (not columnHeader) then --create a new column header local newHeader = CreateFrame("button", "$parentHeaderIndex" .. nextHeader, self, "BackdropTemplate") @@ -5752,16 +5361,16 @@ detailsFramework.HeaderCoreFunctions = { newHeader.Arrow:Hide() self:UpdateSortArrow(newHeader, false, "DESC") - + tinsert(self.columnHeadersCreated, newHeader) columnHeader = newHeader end - + self:ClearColumnHeader(columnHeader) self.NextHeader = self.NextHeader + 1 return columnHeader end, - + NextHeader = 1, HeaderWidth = 0, HeaderHeight = 0, @@ -5777,7 +5386,7 @@ local default_header_options = { text_shadow = false, grow_direction = "RIGHT", padding = 2, - + --each piece of the header header_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, header_backdrop_color = {0, 0, 0, 0.5}, @@ -5803,16 +5412,16 @@ local default_header_options = { function detailsFramework:CreateHeader(parent, headerTable, options, frameName) local newHeader = CreateFrame("frame", frameName or "$parentHeaderLine", parent, "BackdropTemplate") - + detailsFramework:Mixin(newHeader, detailsFramework.OptionsFunctions) detailsFramework:Mixin(newHeader, detailsFramework.HeaderCoreFunctions) - + newHeader:BuildOptionsTable(default_header_options, options) - + newHeader:SetBackdrop(newHeader.options.backdrop) newHeader:SetBackdropColor(unpack(newHeader.options.backdrop_color)) newHeader:SetBackdropBorderColor(unpack(newHeader.options.backdrop_border_color)) - + newHeader:SetHeaderTable(headerTable) return newHeader @@ -5838,7 +5447,7 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox:Disable() end end, - + Enable = function(self) local frameList = self:GetAllCheckboxes() for _, checkbox in ipairs(frameList) do @@ -5846,7 +5455,7 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox:Enable() end end, - + DeselectAll = function(self) local frameList = self:GetAllCheckboxes() for _, checkbox in ipairs(frameList) do @@ -5861,14 +5470,14 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox:SetAlpha(1) end end, - + FadeOut = function(self) local frameList = self:GetAllCheckboxes() for _, checkbox in ipairs(frameList) do checkbox:SetAlpha(.7) end end, - + SetFadeState = function(self, state) if (state) then self:FadeIn() @@ -5889,13 +5498,13 @@ detailsFramework.RadioGroupCoreFunctions = { end return checkbox end, - + CreateCheckbox = function(self) local checkbox = detailsFramework:CreateSwitch(self, function()end, false, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) checkbox:SetAsCheckBox() checkbox.Icon = detailsFramework:CreateImage(checkbox, "", 16, 16) checkbox.Label = detailsFramework:CreateLabel(checkbox, "") - + return checkbox end, @@ -5911,36 +5520,36 @@ detailsFramework.RadioGroupCoreFunctions = { RadioOnClick = function(checkbox, fixedParam, value) --turn off all checkboxes checkbox:GetParent():DeselectAll() - + --turn on the clicked checkbox checkbox:SetValue(true) - + --callback if (checkbox._callback) then detailsFramework:QuickDispatch(checkbox._callback, fixedParam, checkbox._optionid) end end, - + RefreshCheckbox = function(self, checkbox, optionTable, optionId) checkbox = checkbox.GetCapsule and checkbox:GetCapsule() or checkbox - + local setFunc = self.options.is_radio and self.RadioOnClick or optionTable.set checkbox:SetSwitchFunction(setFunc) checkbox._callback = optionTable.callback checkbox._set = self.options.is_radio and optionTable.callback or optionTable.set checkbox._optionid = optionId checkbox:SetFixedParameter(optionTable.param or optionId) - + local isChecked = type(optionTable.get) == "function" and detailsFramework:Dispatch(optionTable.get) or false checkbox:SetValue(isChecked) - + checkbox.Label:SetText(optionTable.name) - + if (optionTable.texture) then checkbox.Icon:SetTexture(optionTable.texture) checkbox.Icon:SetPoint("left", checkbox, "right", 2, 0) checkbox.Label:SetPoint("left", checkbox.Icon, "right", 2, 0) - + if (optionTable.texcoord) then checkbox.Icon:SetTexCoord(unpack(optionTable.texcoord)) else @@ -5963,11 +5572,11 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox:Show() self:RefreshCheckbox(checkbox, optionsTable, optionId) end - + --sending false to automatically use the radio group children self:ArrangeFrames(false, self.AnchorOptions) end, - + SetOptions = function(self, radioOptions) self.RadioOptionsTable = radioOptions self:Refresh() @@ -5988,26 +5597,26 @@ detailsFramework.RadioGroupCoreFunctions = { --]=] function detailsFramework:CreateCheckboxGroup(parent, radioOptions, name, options, anchorOptions) local f = CreateFrame("frame", name, parent, "BackdropTemplate") - - detailsFramework:Mixin (f, detailsFramework.OptionsFunctions) - detailsFramework:Mixin (f, detailsFramework.RadioGroupCoreFunctions) - detailsFramework:Mixin (f, detailsFramework.LayoutFrame) - + + detailsFramework:Mixin(f, detailsFramework.OptionsFunctions) + detailsFramework:Mixin(f, detailsFramework.RadioGroupCoreFunctions) + detailsFramework:Mixin(f, detailsFramework.LayoutFrame) + f:BuildOptionsTable (default_radiogroup_options, options) - + f:SetSize(f.options.width, f.options.height) f:SetBackdrop(f.options.backdrop) f:SetBackdropColor(unpack(f.options.backdrop_color)) f:SetBackdropBorderColor(unpack(f.options.backdrop_border_color)) - + f.AnchorOptions = anchorOptions or {} - + if (f.options.title) then local titleLabel = detailsFramework:CreateLabel(f, f.options.title, detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) titleLabel:SetPoint("bottomleft", f, "topleft", 0, 2) f.Title = titleLabel end - + f:SetOptions (radioOptions) return f @@ -6060,29 +5669,29 @@ function detailsFramework:CreateLoadFilterParser (callback) end f:RegisterEvent ("ENCOUNTER_START") f:RegisterEvent ("PLAYER_REGEN_ENABLED") - + f:SetScript("OnEvent", function(self, event, ...) if (event == "ENCOUNTER_START") then local encounterID = ... f.EncounterIDCached = encounterID - + elseif (event == "ENCOUNTER_END") then f.EncounterIDCached = nil - + elseif (event == "PLAYER_REGEN_ENABLED") then --f.EncounterIDCached = nil --when the player dies during an encounter, the game is triggering regen enabled - + elseif (event == "PLAYER_SPECIALIZATION_CHANGED") then if (DetailsFrameworkLoadConditionsPanel and DetailsFrameworkLoadConditionsPanel:IsShown()) then DetailsFrameworkLoadConditionsPanel:Refresh() end - + local unit = ... - if (not unit or not UnitIsUnit ("player", unit)) then + if (not unit or not UnitIsUnit("player", unit)) then return end - + elseif (event == "PLAYER_ROLES_ASSIGNED") then local assignedRole = UnitGroupRolesAssigned("player") if (assignedRole == "NONE") then @@ -6091,57 +5700,57 @@ function detailsFramework:CreateLoadFilterParser (callback) assignedRole = DetailsFramework.GetSpecializationRole (spec) end end - + if (detailsFramework.CurrentPlayerRole == assignedRole) then return end - + detailsFramework.CurrentPlayerRole = assignedRole end - + --print("Plater Script Update:", event, ...) - + detailsFramework:QuickDispatch (callback, f.EncounterIDCached) end) end -function detailsFramework:PassLoadFilters (loadTable, encounterID) +function detailsFramework:PassLoadFilters(loadTable, encounterID) --class local passLoadClass if (loadTable.class.Enabled) then - local _, classFileName = UnitClass ("player") - if (not loadTable.class [classFileName]) then + local _, classFileName = UnitClass("player") + if (not loadTable.class[classFileName]) then return false else passLoadClass = true end end - + --spec if (IS_WOW_PROJECT_MAINLINE and loadTable.spec.Enabled) then local canCheckTalents = true - + if (passLoadClass) then --if is allowed to load on this class, check if the talents isn't from another class - local _, classFileName = UnitClass ("player") + local _, classFileName = UnitClass("player") local specsForThisClass = detailsFramework:GetClassSpecIDs (classFileName) - + canCheckTalents = false - + for _, specID in ipairs(specsForThisClass) do - if (loadTable.spec [specID] or loadTable.spec [specID..""]) then + if (loadTable.spec[specID] or loadTable.spec[specID..""]) then --theres a talent for this class canCheckTalents = true break end end end - + if (canCheckTalents) then local specIndex = DetailsFramework.GetSpecialization() if (specIndex) then - local specID = DetailsFramework.GetSpecializationInfo (specIndex) - if not specID or (not loadTable.spec [specID] and not loadTable.spec [specID..""]) then + local specID = DetailsFramework.GetSpecializationInfo(specIndex) + if not specID or (not loadTable.spec[specID] and not loadTable.spec[specID .. ""]) then return false end else @@ -6149,7 +5758,7 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) end end end - + --race if (loadTable.race.Enabled) then local raceName, raceFileName, raceID = UnitRace ("player") @@ -6157,7 +5766,7 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) return false end end - + --talents if (IS_WOW_PROJECT_MAINLINE and loadTable.talent.Enabled) then local talentsInUse = detailsFramework:GetCharacterTalents (false, true) @@ -6172,7 +5781,7 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) return false end end - + --pvptalent if (IS_WOW_PROJECT_MAINLINE and loadTable.pvptalent.Enabled) then local talentsInUse = detailsFramework:GetCharacterPvPTalents (false, true) @@ -6187,7 +5796,7 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) return false end end - + --group if (loadTable.group.Enabled) then local _, zoneType = GetInstanceInfo() @@ -6195,7 +5804,7 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) return end end - + --role if (loadTable.role.Enabled) then local assignedRole = UnitGroupRolesAssigned("player") @@ -6209,14 +5818,14 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) return false end end - + --affix if (IS_WOW_PROJECT_MAINLINE and loadTable.affix.Enabled) then local isInMythicDungeon = C_ChallengeMode.IsChallengeModeActive() if (not isInMythicDungeon) then return false end - + local level, affixes, wasEnergized = C_ChallengeMode.GetActiveKeystoneInfo() local hasAffix = false for _, affixID in ipairs(affixes) do @@ -6225,12 +5834,12 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) break end end - + if (not hasAffix) then return false end end - + --encounter id if (loadTable.encounter_ids.Enabled) then if (not encounterID) then @@ -6247,12 +5856,12 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) end end end - + --map id if (loadTable.map_ids.Enabled) then local _, _, _, _, _, _, _, zoneMapID = GetInstanceInfo() local uiMapID = C_Map.GetBestMapForUnit ("player") - + local hasMapID for _, ID in pairs(loadTable.map_ids) do if (ID == zoneMapID or ID == uiMapID) then @@ -6264,12 +5873,12 @@ function detailsFramework:PassLoadFilters (loadTable, encounterID) end end end - + return true end --this func will deploy the default values from the prototype into the config table -function detailsFramework:UpdateLoadConditionsTable (configTable) +function detailsFramework:UpdateLoadConditionsTable(configTable) configTable = configTable or {} detailsFramework.table.deploy(configTable, default_load_conditions) return configTable @@ -6277,23 +5886,21 @@ end --/run Plater.OpenOptionsPanel()PlaterOptionsPanelContainer:SelectIndex (Plater, 14) -function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frameOptions) - +function detailsFramework:OpenLoadConditionsPanel(optionsTable, callback, frameOptions) frameOptions = frameOptions or {} detailsFramework.table.deploy(frameOptions, default_load_conditions_frame_options) - detailsFramework:UpdateLoadConditionsTable (optionsTable) + detailsFramework:UpdateLoadConditionsTable(optionsTable) if (not DetailsFrameworkLoadConditionsPanel) then - - local f = detailsFramework:CreateSimplePanel(UIParent, 970, 505, "Load Conditions", "DetailsFrameworkLoadConditionsPanel") - f:SetBackdropColor(0, 0, 0, 1) - f.AllRadioGroups = {} - f.AllTextEntries = {} - f.OptionsTable = optionsTable - - detailsFramework:ApplyStandardBackdrop(f, false, 1.1) - + local loadConditionsFrame = detailsFramework:CreateSimplePanel(UIParent, 970, 505, "Load Conditions", "DetailsFrameworkLoadConditionsPanel") + loadConditionsFrame:SetBackdropColor(0, 0, 0, 1) + loadConditionsFrame.AllRadioGroups = {} + loadConditionsFrame.AllTextEntries = {} + loadConditionsFrame.OptionsTable = optionsTable + + detailsFramework:ApplyStandardBackdrop(loadConditionsFrame, false, 1.1) + local xStartAt = 10 local x2StartAt = 500 local anchorPositions = { @@ -6308,137 +5915,137 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame encounter_ids = {x2StartAt, -420}, map_ids = {x2StartAt, -460}, } - - local editingLabel = detailsFramework:CreateLabel(f, "Load Conditions For:") - local editingWhatLabel = detailsFramework:CreateLabel(f, "") - editingLabel:SetPoint("topleft", f, "topleft", 10, -35) + + local editingLabel = detailsFramework:CreateLabel(loadConditionsFrame, "Load Conditions For:") + local editingWhatLabel = detailsFramework:CreateLabel(loadConditionsFrame, "") + editingLabel:SetPoint("topleft", loadConditionsFrame, "topleft", 10, -35) editingWhatLabel:SetPoint("left", editingLabel, "right", 2, 0) - + --this label store the name of what is being edited - f.EditingLabel = editingWhatLabel - + loadConditionsFrame.EditingLabel = editingWhatLabel + --when the user click on an option, run the callback - f.RunCallback = function() - detailsFramework:Dispatch (f.CallbackFunc) + loadConditionsFrame.RunCallback = function() + detailsFramework:Dispatch (loadConditionsFrame.CallbackFunc) end --when the user click on an option or when the panel is opened --check if there's an option enabled and fadein all options, fadeout otherwise - f.OnRadioStateChanged = function(radioGroup, subConfigTable) + loadConditionsFrame.OnRadioStateChanged = function(radioGroup, subConfigTable) subConfigTable.Enabled = nil subConfigTable.Enabled = next (subConfigTable) and true or nil radioGroup:SetFadeState (subConfigTable.Enabled) end --create the radio group for character class - f.OnRadioCheckboxClick = function(self, key, value) + loadConditionsFrame.OnRadioCheckboxClick = function(self, key, value) --hierarchy: DBKey ["class"] key ["HUNTER"] value TRUE local DBKey = self:GetParent().DBKey - f.OptionsTable [DBKey] [key and key .. ""] = value and true or nil + loadConditionsFrame.OptionsTable [DBKey] [key and key .. ""] = value and true or nil if not value then -- cleanup "number" type values - f.OptionsTable [DBKey] [key] = nil + loadConditionsFrame.OptionsTable [DBKey] [key] = nil end - f.OnRadioStateChanged (self:GetParent(), f.OptionsTable [DBKey]) - f.RunCallback() + loadConditionsFrame.OnRadioStateChanged (self:GetParent(), loadConditionsFrame.OptionsTable [DBKey]) + loadConditionsFrame.RunCallback() end - + --create the radio group for classes local classes = {} for _, classTable in pairs(detailsFramework:GetClassList()) do tinsert(classes, { - name = classTable.Name, - set = f.OnRadioCheckboxClick, - param = classTable.FileString, - get = function() return f.OptionsTable.class [classTable.FileString] end, + name = classTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, + param = classTable.FileString, + get = function() return loadConditionsFrame.OptionsTable.class[classTable.FileString] end, texture = classTable.Texture, texcoord = classTable.TexCoord, }) end - - local classGroup = detailsFramework:CreateCheckboxGroup (f, classes, name, {width = 200, height = 200, title = "Character Class"}, {offset_x = 130, amount_per_line = 3}) - classGroup:SetPoint("topleft", f, "topleft", anchorPositions.class [1], anchorPositions.class [2]) + + local classGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, classes, name, {width = 200, height = 200, title = "Character Class"}, {offset_x = 130, amount_per_line = 3}) + classGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.class[1], anchorPositions.class[2]) classGroup.DBKey = "class" - tinsert(f.AllRadioGroups, classGroup) - + tinsert(loadConditionsFrame.AllRadioGroups, classGroup) + --create the radio group for character spec if IS_WOW_PROJECT_MAINLINE then local specs = {} - for _, specID in ipairs(detailsFramework:GetClassSpecIDs (select(2, UnitClass ("player")))) do + for _, specID in ipairs(detailsFramework:GetClassSpecIDs (select(2, UnitClass("player")))) do local specID, specName, specDescription, specIcon, specBackground, specRole, specClass = DetailsFramework.GetSpecializationInfoByID (specID) tinsert(specs, { name = specName, - set = f.OnRadioCheckboxClick, + set = loadConditionsFrame.OnRadioCheckboxClick, param = specID, - get = function() return f.OptionsTable.spec [specID] or f.OptionsTable.spec [specID..""] end, + get = function() return loadConditionsFrame.OptionsTable.spec[specID] or loadConditionsFrame.OptionsTable.spec[specID..""] end, texture = specIcon, }) end - local specGroup = detailsFramework:CreateCheckboxGroup (f, specs, name, {width = 200, height = 200, title = "Character Spec"}, {offset_x = 130, amount_per_line = 4}) - specGroup:SetPoint("topleft", f, "topleft", anchorPositions.spec [1], anchorPositions.spec [2]) + local specGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, specs, name, {width = 200, height = 200, title = "Character Spec"}, {offset_x = 130, amount_per_line = 4}) + specGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.spec[1], anchorPositions.spec[2]) specGroup.DBKey = "spec" - tinsert(f.AllRadioGroups, specGroup) + tinsert(loadConditionsFrame.AllRadioGroups, specGroup) end - + --create radio group for character races local raceList = {} for _, raceTable in ipairs(detailsFramework:GetCharacterRaceList()) do tinsert(raceList, { - name = raceTable.Name, - set = f.OnRadioCheckboxClick, + name = raceTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, param = raceTable.FileString, - get = function() return f.OptionsTable.race [raceTable.FileString] end, + get = function() return loadConditionsFrame.OptionsTable.race [raceTable.FileString] end, }) end - local raceGroup = detailsFramework:CreateCheckboxGroup (f, raceList, name, {width = 200, height = 200, title = "Character Race"}) - raceGroup:SetPoint("topleft", f, "topleft", anchorPositions.race [1], anchorPositions.race [2]) + local raceGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, raceList, name, {width = 200, height = 200, title = "Character Race"}) + raceGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.race [1], anchorPositions.race [2]) raceGroup.DBKey = "race" - tinsert(f.AllRadioGroups, raceGroup) - + tinsert(loadConditionsFrame.AllRadioGroups, raceGroup) + --create radio group for talents if IS_WOW_PROJECT_MAINLINE then local talentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterTalents()) do tinsert(talentList, { - name = talentTable.Name, - set = f.OnRadioCheckboxClick, + name = talentTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, param = talentTable.ID, - get = function() return f.OptionsTable.talent [talentTable.ID] or f.OptionsTable.talent [talentTable.ID .. ""] end, + get = function() return loadConditionsFrame.OptionsTable.talent [talentTable.ID] or loadConditionsFrame.OptionsTable.talent [talentTable.ID .. ""] end, texture = talentTable.Texture, }) end - local talentGroup = detailsFramework:CreateCheckboxGroup (f, talentList, name, {width = 200, height = 200, title = "Characer Talents"}, {offset_x = 150, amount_per_line = 3}) - talentGroup:SetPoint("topleft", f, "topleft", anchorPositions.talent [1], anchorPositions.talent [2]) + local talentGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, talentList, name, {width = 200, height = 200, title = "Characer Talents"}, {offset_x = 150, amount_per_line = 3}) + talentGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.talent [1], anchorPositions.talent [2]) talentGroup.DBKey = "talent" - tinsert(f.AllRadioGroups, talentGroup) - f.TalentGroup = talentGroup - + tinsert(loadConditionsFrame.AllRadioGroups, talentGroup) + loadConditionsFrame.TalentGroup = talentGroup + do --create a frame to show talents selected in other specs or characters - local otherTalents = CreateFrame("frame", nil, f, "BackdropTemplate") + local otherTalents = CreateFrame("frame", nil, loadConditionsFrame, "BackdropTemplate") otherTalents:SetSize(26, 26) otherTalents:SetPoint("left", talentGroup.Title.widget, "right", 10, -2) otherTalents.Texture = detailsFramework:CreateImage(otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24) otherTalents.Texture:SetAllPoints() - + local removeTalent = function(_, _, talentID) - f.OptionsTable.talent [talentID] = nil + loadConditionsFrame.OptionsTable.talent [talentID] = nil GameCooltip2:Hide() - f.OnRadioStateChanged (talentGroup, f.OptionsTable [talentGroup.DBKey]) - f.CanShowTalentWarning() + loadConditionsFrame.OnRadioStateChanged (talentGroup, loadConditionsFrame.OptionsTable [talentGroup.DBKey]) + loadConditionsFrame.CanShowTalentWarning() end - + local buildTalentMenu = function() local playerTalents = detailsFramework:GetCharacterTalents() local indexedTalents = {} for _, talentTable in ipairs(playerTalents) do tinsert(indexedTalents, talentTable.ID) end - + --talents selected to load GameCooltip2:AddLine("select a talent to remove it (added from a different spec or character)", "", 1, "orange", "orange", 9) GameCooltip2:AddLine("$div", nil, nil, -1, -1) - - for talentID, _ in pairs(f.OptionsTable.talent) do + + for talentID, _ in pairs(loadConditionsFrame.OptionsTable.talent) do if (type(talentID) == "number" and not detailsFramework.table.find (indexedTalents, talentID)) then local talentID, name, texture, selected, available = GetTalentInfoByID (talentID) if (name) then @@ -6449,7 +6056,7 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end end end - + otherTalents.CoolTip = { Type = "menu", BuildFunc = buildTalentMenu, @@ -6465,9 +6072,9 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame GameCooltip2:SetOption("ButtonsYMod", -4) GameCooltip2:SetOption("YSpacingMod", -4) GameCooltip2:SetOption("IgnoreButtonAutoHeight", true) - + GameCooltip2:SetColor (1, 0.5, 0.5, 0.5, 0) - + local preset2_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true, edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} local gray_table = {0.37, 0.37, 0.37, 0.95} local black_table = {0.2, 0.2, 0.2, 1} @@ -6476,14 +6083,14 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end, } GameCooltip2:CoolTipInject (otherTalents) - - function f.CanShowTalentWarning() + + function loadConditionsFrame.CanShowTalentWarning() local playerTalents = detailsFramework:GetCharacterTalents() local indexedTalents = {} for _, talentTable in ipairs(playerTalents) do tinsert(indexedTalents, talentTable.ID) end - for talentID, _ in pairs(f.OptionsTable.talent) do + for talentID, _ in pairs(loadConditionsFrame.OptionsTable.talent) do if (type(talentID) == "number" and not detailsFramework.table.find (indexedTalents, talentID)) then otherTalents:Show() return @@ -6493,52 +6100,52 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end end end - + --create radio group for pvp talents if IS_WOW_PROJECT_MAINLINE then local pvpTalentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterPvPTalents()) do tinsert(pvpTalentList, { - name = talentTable.Name, - set = f.OnRadioCheckboxClick, + name = talentTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, param = talentTable.ID, - get = function() return f.OptionsTable.pvptalent [talentTable.ID] or f.OptionsTable.pvptalent [talentTable.ID .. ""] end, + get = function() return loadConditionsFrame.OptionsTable.pvptalent [talentTable.ID] or loadConditionsFrame.OptionsTable.pvptalent [talentTable.ID .. ""] end, texture = talentTable.Texture, }) end - local pvpTalentGroup = detailsFramework:CreateCheckboxGroup (f, pvpTalentList, name, {width = 200, height = 200, title = "Characer PvP Talents"}, {offset_x = 150, amount_per_line = 3}) - pvpTalentGroup:SetPoint("topleft", f, "topleft", anchorPositions.pvptalent [1], anchorPositions.pvptalent [2]) + local pvpTalentGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, pvpTalentList, name, {width = 200, height = 200, title = "Characer PvP Talents"}, {offset_x = 150, amount_per_line = 3}) + pvpTalentGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.pvptalent [1], anchorPositions.pvptalent [2]) pvpTalentGroup.DBKey = "pvptalent" - tinsert(f.AllRadioGroups, pvpTalentGroup) - f.PvPTalentGroup = pvpTalentGroup - + tinsert(loadConditionsFrame.AllRadioGroups, pvpTalentGroup) + loadConditionsFrame.PvPTalentGroup = pvpTalentGroup + do --create a frame to show talents selected in other specs or characters - local otherTalents = CreateFrame("frame", nil, f, "BackdropTemplate") + local otherTalents = CreateFrame("frame", nil, loadConditionsFrame, "BackdropTemplate") otherTalents:SetSize(26, 26) otherTalents:SetPoint("left", pvpTalentGroup.Title.widget, "right", 10, -2) otherTalents.Texture = detailsFramework:CreateImage(otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24) otherTalents.Texture:SetAllPoints() - + local removeTalent = function(_, _, talentID) - f.OptionsTable.pvptalent [talentID] = nil + loadConditionsFrame.OptionsTable.pvptalent [talentID] = nil GameCooltip2:Hide() - f.OnRadioStateChanged (pvpTalentGroup, f.OptionsTable [pvpTalentGroup.DBKey]) - f.CanShowPvPTalentWarning() + loadConditionsFrame.OnRadioStateChanged (pvpTalentGroup, loadConditionsFrame.OptionsTable [pvpTalentGroup.DBKey]) + loadConditionsFrame.CanShowPvPTalentWarning() end - + local buildTalentMenu = function() local playerTalents = detailsFramework:GetCharacterPvPTalents() local indexedTalents = {} for _, talentTable in ipairs(playerTalents) do tinsert(indexedTalents, talentTable.ID) end - + --talents selected to load GameCooltip2:AddLine("select a talent to remove it (added from a different spec or character)", "", 1, "orange", "orange", 9) GameCooltip2:AddLine("$div", nil, nil, -1, -1) - - for talentID, _ in pairs(f.OptionsTable.pvptalent) do + + for talentID, _ in pairs(loadConditionsFrame.OptionsTable.pvptalent) do if (type(talentID) == "number" and not detailsFramework.table.find (indexedTalents, talentID)) then local _, name, texture = GetPvpTalentInfoByID (talentID) if (name) then @@ -6549,7 +6156,7 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end end end - + otherTalents.CoolTip = { Type = "menu", BuildFunc = buildTalentMenu, @@ -6565,9 +6172,9 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame GameCooltip2:SetOption("ButtonsYMod", -4) GameCooltip2:SetOption("YSpacingMod", -4) GameCooltip2:SetOption("IgnoreButtonAutoHeight", true) - + GameCooltip2:SetColor (1, 0.5, 0.5, 0.5, 0) - + local preset2_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true, edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} local gray_table = {0.37, 0.37, 0.37, 0.95} local black_table = {0.2, 0.2, 0.2, 1} @@ -6576,14 +6183,14 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end, } GameCooltip2:CoolTipInject (otherTalents) - - function f.CanShowPvPTalentWarning() + + function loadConditionsFrame.CanShowPvPTalentWarning() local playerTalents = detailsFramework:GetCharacterPvPTalents() local indexedTalents = {} for _, talentTable in ipairs(playerTalents) do tinsert(indexedTalents, talentTable.ID) end - for talentID, _ in pairs(f.OptionsTable.pvptalent) do + for talentID, _ in pairs(loadConditionsFrame.OptionsTable.pvptalent) do if (type(talentID) == "number" and not detailsFramework.table.find (indexedTalents, talentID)) then otherTalents:Show() return @@ -6598,32 +6205,32 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame local groupTypes = {} for _, groupTable in ipairs(detailsFramework:GetGroupTypes()) do tinsert(groupTypes, { - name = groupTable.Name, - set = f.OnRadioCheckboxClick, + name = groupTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, param = groupTable.ID, - get = function() return f.OptionsTable.group [groupTable.ID] or f.OptionsTable.group [groupTable.ID .. ""] end, + get = function() return loadConditionsFrame.OptionsTable.group [groupTable.ID] or loadConditionsFrame.OptionsTable.group [groupTable.ID .. ""] end, }) end - local groupTypesGroup = detailsFramework:CreateCheckboxGroup (f, groupTypes, name, {width = 200, height = 200, title = "Group Types"}) - groupTypesGroup:SetPoint("topleft", f, "topleft", anchorPositions.group [1], anchorPositions.group [2]) + local groupTypesGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, groupTypes, name, {width = 200, height = 200, title = "Group Types"}) + groupTypesGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.group [1], anchorPositions.group [2]) groupTypesGroup.DBKey = "group" - tinsert(f.AllRadioGroups, groupTypesGroup) - + tinsert(loadConditionsFrame.AllRadioGroups, groupTypesGroup) + --create radio for character roles local roleTypes = {} for _, roleTable in ipairs(detailsFramework:GetRoleTypes()) do tinsert(roleTypes, { - name = roleTable.Texture .. " " .. roleTable.Name, - set = f.OnRadioCheckboxClick, + name = roleTable.Texture .. " " .. roleTable.Name, + set = loadConditionsFrame.OnRadioCheckboxClick, param = roleTable.ID, - get = function() return f.OptionsTable.role [roleTable.ID] or f.OptionsTable.role [roleTable.ID .. ""] end, + get = function() return loadConditionsFrame.OptionsTable.role [roleTable.ID] or loadConditionsFrame.OptionsTable.role [roleTable.ID .. ""] end, }) end - local roleTypesGroup = detailsFramework:CreateCheckboxGroup (f, roleTypes, name, {width = 200, height = 200, title = "Role Types"}) - roleTypesGroup:SetPoint("topleft", f, "topleft", anchorPositions.role [1], anchorPositions.role [2]) + local roleTypesGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, roleTypes, name, {width = 200, height = 200, title = "Role Types"}) + roleTypesGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.role [1], anchorPositions.role [2]) roleTypesGroup.DBKey = "role" - tinsert(f.AllRadioGroups, roleTypesGroup) - + tinsert(loadConditionsFrame.AllRadioGroups, roleTypesGroup) + --create radio group for mythic+ affixes if IS_WOW_PROJECT_MAINLINE then local affixes = {} @@ -6631,50 +6238,50 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame local affixName, desc, texture = C_ChallengeMode.GetAffixInfo (i) if (affixName) then tinsert(affixes, { - name = affixName, - set = f.OnRadioCheckboxClick, - param = i, - get = function() return f.OptionsTable.affix [i] or f.OptionsTable.affix [i .. ""] end, + name = affixName, + set = loadConditionsFrame.OnRadioCheckboxClick, + param = i, + get = function() return loadConditionsFrame.OptionsTable.affix [i] or loadConditionsFrame.OptionsTable.affix [i .. ""] end, texture = texture, }) end end - local affixTypesGroup = detailsFramework:CreateCheckboxGroup (f, affixes, name, {width = 200, height = 200, title = "M+ Affixes"}) - affixTypesGroup:SetPoint("topleft", f, "topleft", anchorPositions.affix [1], anchorPositions.affix [2]) + local affixTypesGroup = detailsFramework:CreateCheckboxGroup (loadConditionsFrame, affixes, name, {width = 200, height = 200, title = "M+ Affixes"}) + affixTypesGroup:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.affix [1], anchorPositions.affix [2]) affixTypesGroup.DBKey = "affix" - tinsert(f.AllRadioGroups, affixTypesGroup) + tinsert(loadConditionsFrame.AllRadioGroups, affixTypesGroup) end - + --text entries functions local textEntryRefresh = function(self) - local idList = f.OptionsTable [self.DBKey] + local idList = loadConditionsFrame.OptionsTable [self.DBKey] self:SetText("") for _, id in pairs(idList) do if tonumber(id) then self:SetText(self:GetText() .. " " .. id) end end - self:SetText(self:GetText():gsub ("^ ", "")) + self:SetText(self:GetText():gsub("^ ", "")) end - + local textEntryOnEnterPressed = function(_, self) - wipe (f.OptionsTable [self.DBKey]) + wipe (loadConditionsFrame.OptionsTable [self.DBKey]) local text = self:GetText() - + for _, ID in ipairs({strsplit(" ", text)}) do ID = detailsFramework:trim (ID) - ID = tonumber (ID) + ID = tonumber(ID) if (ID) then - tinsert(f.OptionsTable [self.DBKey], ID) - f.OptionsTable [self.DBKey].Enabled = true + tinsert(loadConditionsFrame.OptionsTable [self.DBKey], ID) + loadConditionsFrame.OptionsTable [self.DBKey].Enabled = true end end end - + --create the text entry to type the encounter ID - local encounterIDLabel = detailsFramework:CreateLabel(f, "Encounter ID", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) - local encounterIDEditbox = detailsFramework:CreateTextEntry (f, function()end, 200, 20, "EncounterEditbox", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - encounterIDLabel:SetPoint("topleft", f, "topleft", anchorPositions.encounter_ids [1], anchorPositions.encounter_ids [2]) + local encounterIDLabel = detailsFramework:CreateLabel(loadConditionsFrame, "Encounter ID", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) + local encounterIDEditbox = detailsFramework:CreateTextEntry(loadConditionsFrame, function()end, 200, 20, "EncounterEditbox", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + encounterIDLabel:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.encounter_ids [1], anchorPositions.encounter_ids [2]) encounterIDEditbox:SetPoint("topleft", encounterIDLabel, "bottomleft", 0, -2) encounterIDEditbox.DBKey = "encounter_ids" encounterIDEditbox.Refresh = textEntryRefresh @@ -6683,26 +6290,26 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame encounterIDEditbox.tooltip = encounterIDEditbox.tooltip .. encounterTable.ID .. " - " .. encounterTable.Name .. "\n" end encounterIDEditbox:SetHook("OnEnterPressed", textEntryOnEnterPressed) - tinsert(f.AllTextEntries, encounterIDEditbox) - + tinsert(loadConditionsFrame.AllTextEntries, encounterIDEditbox) + --create the text entry for map ID - local mapIDLabel = detailsFramework:CreateLabel(f, "Map ID", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) - local mapIDEditbox = detailsFramework:CreateTextEntry (f, function()end, 200, 20, "MapEditbox", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) - mapIDLabel:SetPoint("topleft", f, "topleft", anchorPositions.map_ids [1], anchorPositions.map_ids [2]) + local mapIDLabel = detailsFramework:CreateLabel(loadConditionsFrame, "Map ID", detailsFramework:GetTemplate("font", "ORANGE_FONT_TEMPLATE")) + local mapIDEditbox = detailsFramework:CreateTextEntry(loadConditionsFrame, function()end, 200, 20, "MapEditbox", _, _, detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + mapIDLabel:SetPoint("topleft", loadConditionsFrame, "topleft", anchorPositions.map_ids [1], anchorPositions.map_ids [2]) mapIDEditbox:SetPoint("topleft", mapIDLabel, "bottomleft", 0, -2) mapIDEditbox.DBKey = "map_ids" mapIDEditbox.Refresh = textEntryRefresh mapIDEditbox.tooltip = "Enter multiple IDs separating with a whitespace\nExample: 35 45 95" mapIDEditbox:SetHook("OnEnterPressed", textEntryOnEnterPressed) - tinsert(f.AllTextEntries, mapIDEditbox) + tinsert(loadConditionsFrame.AllTextEntries, mapIDEditbox) - function f.Refresh (self) + function loadConditionsFrame.Refresh (self) if IS_WOW_PROJECT_MAINLINE then --update the talents (might have changed if the player changed its specialization) local talentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterTalents()) do tinsert(talentList, { - name = talentTable.Name, + name = talentTable.Name, set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick, param = talentTable.ID, get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID .. ""] end, @@ -6711,12 +6318,12 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end DetailsFrameworkLoadConditionsPanel.TalentGroup:SetOptions (talentList) end - + if IS_WOW_PROJECT_MAINLINE then local pvpTalentList = {} for _, talentTable in ipairs(detailsFramework:GetCharacterPvPTalents()) do tinsert(pvpTalentList, { - name = talentTable.Name, + name = talentTable.Name, set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick, param = talentTable.ID, get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.pvptalent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.pvptalent [talentTable.ID .. ""] end, @@ -6725,24 +6332,24 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame end DetailsFrameworkLoadConditionsPanel.PvPTalentGroup:SetOptions (pvpTalentList) end - + --refresh the radio group for _, radioGroup in ipairs(DetailsFrameworkLoadConditionsPanel.AllRadioGroups) do radioGroup:Refresh() DetailsFrameworkLoadConditionsPanel.OnRadioStateChanged (radioGroup, DetailsFrameworkLoadConditionsPanel.OptionsTable [radioGroup.DBKey]) end - + --refresh text entries for _, textEntry in ipairs(DetailsFrameworkLoadConditionsPanel.AllTextEntries) do textEntry:Refresh() end - + if IS_WOW_PROJECT_MAINLINE then DetailsFrameworkLoadConditionsPanel.CanShowTalentWarning() DetailsFrameworkLoadConditionsPanel.CanShowPvPTalentWarning() end end - + end --set the options table @@ -6758,7 +6365,7 @@ function detailsFramework:OpenLoadConditionsPanel (optionsTable, callback, frame --show the panel to the user DetailsFrameworkLoadConditionsPanel:Show() - + DetailsFrameworkLoadConditionsPanel:Refresh() end @@ -6773,7 +6380,7 @@ detailsFramework.DataScrollFunctions = { if (type(filter) == "string" and filter ~= "") then for i = 1, #data do for o = 1, #data[i] do - if (data[i][o]:find (filter)) then + if (data[i][o]:find(filter)) then tinsert(currentData, data[i]) break end @@ -6782,11 +6389,11 @@ detailsFramework.DataScrollFunctions = { else currentData = data end - + if (self.SortAlphabetical) then table.sort (currentData, function(t1, t2) return t1[1] < t2[1] end) end - + --update the scroll for i = 1, totalLines do local index = i + offset @@ -6797,34 +6404,34 @@ detailsFramework.DataScrollFunctions = { end end end, - + CreateLine = function(self, index) --create a new line local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate") line.Update = self.options.update_line_func - + --set its parameters line:SetPoint("topleft", self, "topleft", 1, -((index-1) * (self.options.line_height+1)) - 1) line:SetSize(self.options.width - 2, self.options.line_height) line:RegisterForClicks ("LeftButtonDown", "RightButtonDown") - + line:SetScript("OnEnter", self.options.on_enter) line:SetScript("OnLeave", self.options.on_leave) line:SetScript("OnClick", self.options.on_click) - + line:SetBackdrop(self.options.backdrop) line:SetBackdropColor(unpack(self.options.backdrop_color)) line:SetBackdropBorderColor(unpack(self.options.backdrop_border_color)) - + local title = detailsFramework:CreateLabel(line, "", detailsFramework:GetTemplate("font", self.options.title_template)) local date = detailsFramework:CreateLabel(line, "", detailsFramework:GetTemplate("font", self.options.title_template)) local text = detailsFramework:CreateLabel(line, "", detailsFramework:GetTemplate("font", self.options.text_tempate)) - + title.textsize = 14 date.textsize = 14 text:SetSize(self.options.width - 20, self.options.line_height) text:SetJustifyV ("top") - + --setup anchors if (self.options.show_title) then title:SetPoint("topleft", line, "topleft", 2, 0) @@ -6837,27 +6444,27 @@ detailsFramework.DataScrollFunctions = { line.Title = title line.Date = date line.Text = text - + line.backdrop_color = self.options.backdrop_color or {.1, .1, .1, .3} line.backdrop_color_highlight = self.options.backdrop_color_highlight or {.3, .3, .3, .5} - + return line end, - + LineOnEnter = function(self) self:SetBackdropColor(unpack(self.backdrop_color_highlight)) end, LineOnLeave = function(self) self:SetBackdropColor(unpack(self.backdrop_color)) end, - + OnClick = function(self) - + end, - + UpdateLine = function(line, lineIndex, data) local parent = line:GetParent() - + if (parent.options.show_title) then line.Title.text = data [2] or "" line.Date.text = data [3] or "" @@ -6865,7 +6472,7 @@ detailsFramework.DataScrollFunctions = { else line.Text.text = data [2] or "" end - + if (line:GetParent().OnUpdateLineHook) then detailsFramework:CoreDispatch ((line:GetName() or "ScrollBoxDataScrollUpdateLineHook") .. ":UpdateLineHook()", line:GetParent().OnUpdateLineHook, line, lineIndex, data) end @@ -6877,24 +6484,24 @@ local default_datascroll_options = { height = 700, line_amount = 10, line_height = 20, - + show_title = true, - + backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdrop_color = {0, 0, 0, 0.2}, backdrop_color_highlight = {.2, .2, .2, 0.4}, backdrop_border_color = {0.1, 0.1, 0.1, .2}, - + title_template = "ORANGE_FONT_TEMPLATE", text_tempate = "OPTIONS_FONT_TEMPLATE", - + create_line_func = detailsFramework.DataScrollFunctions.CreateLine, update_line_func = detailsFramework.DataScrollFunctions.UpdateLine, refresh_func = detailsFramework.DataScrollFunctions.RefreshScroll, on_enter = detailsFramework.DataScrollFunctions.LineOnEnter, on_leave = detailsFramework.DataScrollFunctions.LineOnLeave, on_click = detailsFramework.DataScrollFunctions.OnClick, - + data = {}, } @@ -6911,23 +6518,23 @@ function detailsFramework:CreateDataScrollFrame (parent, name, options) local optionsTable = {} detailsFramework.OptionsFunctions.BuildOptionsTable (optionsTable, default_datascroll_options, options) optionsTable = optionsTable.options - + --scroll frame local newScroll = detailsFramework:CreateScrollBox (parent, name, optionsTable.refresh_func, optionsTable.data, optionsTable.width, optionsTable.height, optionsTable.line_amount, optionsTable.line_height) detailsFramework:ReskinSlider(newScroll) - - detailsFramework:Mixin (newScroll, detailsFramework.OptionsFunctions) - detailsFramework:Mixin (newScroll, detailsFramework.LayoutFrame) - + + detailsFramework:Mixin(newScroll, detailsFramework.OptionsFunctions) + detailsFramework:Mixin(newScroll, detailsFramework.LayoutFrame) + newScroll:BuildOptionsTable (default_datascroll_options, options) - + --create the scrollbox lines - for i = 1, newScroll.options.line_amount do + for i = 1, newScroll.options.line_amount do newScroll:CreateLine (newScroll.options.create_line_func) end - + newScroll:Refresh() - + return newScroll end @@ -6937,14 +6544,14 @@ end local default_newsframe_options = { width = 400, height = 700, - + line_amount = 16, line_height = 40, - + backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdrop_color = {0, 0, 0, 0.2}, backdrop_border_color = {0.1, 0.1, 0.1, .2}, - + title = "What's New?", show_title = true, } @@ -6961,13 +6568,13 @@ detailsFramework.NewsFrameFunctions = { function detailsFramework:GetNumNews (newsTable, lastNewsTime) local now = time() local nonReadNews = 0 - + for _, news in ipairs(newsTable) do if (news[1] > lastNewsTime) then nonReadNews = nonReadNews + 1 end end - + return nonReadNews end @@ -6980,21 +6587,21 @@ end @db = (optional) an empty table from the addon database to store the position of the frame between game sessions --]=] function detailsFramework:CreateNewsFrame (parent, name, options, newsTable, db) - + local f = detailsFramework:CreateSimplePanel(parent, 400, 700, options and options.title or default_newsframe_options.title, name, {UseScaleBar = db and true}, db) f:SetFrameStrata("MEDIUM") detailsFramework:ApplyStandardBackdrop(f) - - detailsFramework:Mixin (f, detailsFramework.OptionsFunctions) - detailsFramework:Mixin (f, detailsFramework.LayoutFrame) - + + detailsFramework:Mixin(f, detailsFramework.OptionsFunctions) + detailsFramework:Mixin(f, detailsFramework.LayoutFrame) + f:BuildOptionsTable (default_newsframe_options, options) - + f:SetSize(f.options.width, f.options.height) f:SetBackdrop(f.options.backdrop) f:SetBackdropColor(unpack(f.options.backdrop_color)) f:SetBackdropBorderColor(unpack(f.options.backdrop_border_color)) - + local scrollOptions = { data = newsTable, width = f.options.width - 32, --frame distance from walls and scroll bar space @@ -7010,9 +6617,9 @@ function detailsFramework:CreateNewsFrame (parent, name, options, newsTable, db) else newsScroll:SetPoint("topleft", f, "topleft", 5, -30) end - + f.NewsScroll = newsScroll - + return f end @@ -7035,22 +6642,22 @@ function detailsFramework:BuildStatusbarAuthorInfo(f, addonBy, authorsNameString authorName.textcolor = "silver" local discordLabel = detailsFramework:CreateLabel(f, "Discord: ") discordLabel.textcolor = "silver" - + local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - local discordTextEntry = detailsFramework:CreateTextEntry (f, function()end, 200, 18, "DiscordTextBox", _, _, options_dropdown_template) + local discordTextEntry = detailsFramework:CreateTextEntry(f, function()end, 200, 18, "DiscordTextBox", _, _, options_dropdown_template) discordTextEntry:SetText("https://discord.gg/AGSzAZX") discordTextEntry:SetFrameLevel(5000) - + authorName:SetPoint("left", f, "left", 2, 0) discordLabel:SetPoint("left", authorName, "right", 20, 0) discordTextEntry:SetPoint("left", discordLabel, "right", 2, 0) - + --format authorName:SetAlpha(.6) discordLabel:SetAlpha(.6) discordTextEntry:SetAlpha(.6) discordTextEntry:SetBackdropBorderColor(1, 1, 1, 0) - + discordTextEntry:SetHook("OnEditFocusGained", function() discordTextEntry:HighlightText() end) @@ -7066,9 +6673,9 @@ local statusbar_default_options = { function detailsFramework:CreateStatusBar(f, options) local statusBar = CreateFrame("frame", nil, f, "BackdropTemplate") - - detailsFramework:Mixin (statusBar, detailsFramework.OptionsFunctions) - detailsFramework:Mixin (statusBar, detailsFramework.LayoutFrame) + + detailsFramework:Mixin(statusBar, detailsFramework.OptionsFunctions) + detailsFramework:Mixin(statusBar, detailsFramework.LayoutFrame) statusBar:BuildOptionsTable (statusbar_default_options, options) @@ -7100,7 +6707,7 @@ end statusBar:GetColor() statusBar: statusBar: - + --]=] detailsFramework.StatusBarFunctions = { @@ -7130,7 +6737,7 @@ detailsFramework.StatusBarFunctions = { SetColor = function(self, r, g, b, a) r, g, b, a = detailsFramework:ParseColors(r, g, b, a) - self:SetStatusBarColor (r, g, b, a) + self:SetStatusBarColor(r, g, b, a) end, GetColor = function(self) @@ -7292,9 +6899,9 @@ detailsFramework.StatusBarFunctions = { @parent = frame to pass for the CreateFrame function @name = absolute name of the frame, if omitted it uses the parent's name .. "HealthBar" @settingsOverride = table with keys and values to replace the defaults from the framework - + methods: - healthbar:SetUnit (unit) + healthbar:SetUnit(unit) healthBar:GetTexture() healthBar:SetTexture(texture) --]=] @@ -7314,20 +6921,20 @@ detailsFramework.StatusBarFunctions = { local function CalcPerformance (type, data) if (type == "event") then debugPerformance.eventCall [data] = (debugPerformance.eventCall [data] or 0) + 1 - + elseif (type == "unit") then debugPerformance.unitCall [data] = (debugPerformance.unitCall [data] or 0) + 1 - + elseif (type == "call") then debugPerformance.functionCall [data] = (debugPerformance.functionCall [data] or 0) + 1 - + end end function DF_CalcCpuUsage (name) local cpu = debugPerformance.CPUUsageByFunction [name] or {usage = 0, last = 0, active = false} debugPerformance.CPUUsageByFunction [name] = cpu - + if (cpu.active) then cpu.active = false local diff = debugprofilestop() - cpu.last @@ -7342,7 +6949,7 @@ detailsFramework.StatusBarFunctions = { for functionName, functionTable in pairs(debugPerformance.CPUUsageByFunction) do debugPerformance.CPUUsageByFunction [functionName] = floor(functionTable.usage) end - + for functionName, functionTable in pairs(debugPerformance.CPUUsageByFunction) do debugPerformance.CPUUsageByFunction [functionName] = {usage = 0, last = 0, active = false} end @@ -7352,9 +6959,6 @@ detailsFramework.StatusBarFunctions = { --healthBar meta prototype local healthBarMetaPrototype = { WidgetType = "healthBar", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, - dversion = detailsFramework.dversion, } @@ -7372,16 +6976,17 @@ detailsFramework.StatusBarFunctions = { end else --first time loading the framework - _G[detailsFramework.GlobalWidgetControlNames ["healthBar"]] = healthBarMetaPrototype + _G[detailsFramework.GlobalWidgetControlNames["healthBar"]] = healthBarMetaPrototype end - local healthBarMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames ["healthBar"]] + local healthBarMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["healthBar"]] + detailsFramework:Mixin(healthBarMetaFunctions, detailsFramework.ScriptHookMixin) --hook list local defaultHooksForHealthBar = { - OnHide = {}, - OnShow = {}, - OnHealthChange = {}, + OnHide = {}, + OnShow = {}, + OnHealthChange = {}, OnHealthMaxChange = {}, } @@ -7389,7 +6994,7 @@ detailsFramework.StatusBarFunctions = { healthBarMetaFunctions.HookList = healthBarMetaFunctions.HookList or defaultHooksForHealthBar --copy the non existing values from a new version to the already existing hook table detailsFramework.table.deploy(healthBarMetaFunctions.HookList, defaultHooksForHealthBar) - + --Health Bar Meta Functions --health bar settings @@ -7397,7 +7002,7 @@ detailsFramework.StatusBarFunctions = { CanTick = false, --if true calls the method 'OnTick' every tick, the function needs to be overloaded, it receives self and deltaTime as parameters ShowHealingPrediction = true, --when casting a healing pass, show the amount of health that spell will heal ShowShields = true, --indicator of the amount of damage absortion the unit has - + --appearance BackgroundColor = detailsFramework:CreateColorTable (.2, .2, .2, .8), Texture = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]], @@ -7419,11 +7024,11 @@ detailsFramework.StatusBarFunctions = { {(IS_WOW_PROJECT_MAINLINE) and "UNIT_ABSORB_AMOUNT_CHANGED", true}, {(IS_WOW_PROJECT_MAINLINE) and "UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true}, } - + --setup the castbar to be used by another unit healthBarMetaFunctions.SetUnit = function(self, unit, displayedUnit) if (self.unit ~= unit or self.displayedUnit ~= displayedUnit or unit == nil) then - + self.unit = unit self.displayedUnit = displayedUnit or unit @@ -7431,7 +7036,7 @@ detailsFramework.StatusBarFunctions = { if (unit) then self.currentHealth = UnitHealth (unit) or 0 self.currentHealthMax = UnitHealthMax (unit) or 0 - + for _, eventTable in ipairs(self.HealthBarEvents) do local event = eventTable [1] local isUnitEvent = eventTable [2] @@ -7443,7 +7048,7 @@ detailsFramework.StatusBarFunctions = { end end end - + --check for settings and update some events if (not self.Settings.ShowHealingPrediction) then self:UnregisterEvent ("UNIT_HEAL_PREDICTION") @@ -7460,14 +7065,14 @@ detailsFramework.StatusBarFunctions = { self.shieldAbsorbIndicator:Hide() self.shieldAbsorbGlow:Hide() end - + --set scripts self:SetScript("OnEvent", self.OnEvent) - + if (self.Settings.CanTick) then self:SetScript("OnUpdate", self.OnTick) end - + self:PLAYER_ENTERING_WORLD (self.unit, self.displayedUnit) else --remove all registered events @@ -7477,7 +7082,7 @@ detailsFramework.StatusBarFunctions = { self:UnregisterEvent (event) end end - + --remove scripts self:SetScript("OnEvent", nil) self:SetScript("OnUpdate", nil) @@ -7485,15 +7090,15 @@ detailsFramework.StatusBarFunctions = { end end end - + healthBarMetaFunctions.Initialize = function(self) PixelUtil.SetWidth (self, self.Settings.Width, 1) - PixelUtil.SetHeight (self, self.Settings.Height, 1) - + PixelUtil.SetHeight(self, self.Settings.Height, 1) + self:SetTexture(self.Settings.Texture) - + self.background:SetAllPoints() - self.background:SetColorTexture (self.Settings.BackgroundColor:GetColor()) + self.background:SetColorTexture(self.Settings.BackgroundColor:GetColor()) --setpoint of these widgets are set inside the function that updates the incoming heal self.incomingHealIndicator:SetTexture(self:GetTexture()) @@ -7507,10 +7112,10 @@ detailsFramework.StatusBarFunctions = { self.shieldAbsorbGlow:SetPoint("topright", self, "topright", 8, 0) self.shieldAbsorbGlow:SetPoint("bottomright", self, "bottomright", 8, 0) self.shieldAbsorbGlow:Hide() - - self:SetUnit (nil) + + self:SetUnit(nil) end - + --call every tick healthBarMetaFunctions.OnTick = function(self, deltaTime) end --if overrided, set 'CanTick' to true on the settings table @@ -7529,7 +7134,7 @@ detailsFramework.StatusBarFunctions = { self:SetMinMaxValues(0, maxHealth) self.currentHealthMax = maxHealth - self:RunHooksForWidget ("OnHealthMaxChange", self, self.displayedUnit) + self:RunHooksForWidget("OnHealthMaxChange", self, self.displayedUnit) end healthBarMetaFunctions.UpdateHealth = function(self) @@ -7537,34 +7142,34 @@ detailsFramework.StatusBarFunctions = { -- local maxHealth = UnitHealthMax (self.displayedUnit) -- self:SetMinMaxValues(0, maxHealth) -- self.currentHealthMax = maxHealth - + self.oldHealth = self.currentHealth local health = UnitHealth(self.displayedUnit) self.currentHealth = health PixelUtil.SetStatusBarValue(self, health) - self:RunHooksForWidget ("OnHealthChange", self, self.displayedUnit) + self:RunHooksForWidget("OnHealthChange", self, self.displayedUnit) end - + --health and absorbs prediction healthBarMetaFunctions.UpdateHealPrediction = function(self) local currentHealth = self.currentHealth local currentHealthMax = self.currentHealthMax local healthPercent = currentHealth / currentHealthMax - + if (not currentHealthMax or currentHealthMax <= 0) then return end - + --order is: the health of the unit > damage absorb > heal absorb > incoming heal local width = self:GetWidth() - + if (self.Settings.ShowHealingPrediction) then --incoming heal on the unit from all sources local unitHealIncoming = self.displayedUnit and UnitGetIncomingHeals (self.displayedUnit) or 0 --heal absorbs local unitHealAbsorb = IS_WOW_PROJECT_MAINLINE and self.displayedUnit and UnitGetTotalHealAbsorbs (self.displayedUnit) or 0 - + if (unitHealIncoming > 0) then --calculate what is the percent of health incoming based on the max health the player has local incomingPercent = unitHealIncoming / currentHealthMax @@ -7575,7 +7180,7 @@ detailsFramework.StatusBarFunctions = { else self.incomingHealIndicator:Hide() end - + if (unitHealAbsorb > 0) then local healAbsorbPercent = unitHealAbsorb / currentHealthMax self.healAbsorbIndicator:Show() @@ -7586,11 +7191,11 @@ detailsFramework.StatusBarFunctions = { self.healAbsorbIndicator:Hide() end end - + if (self.Settings.ShowShields and IS_WOW_PROJECT_MAINLINE) then --damage absorbs local unitDamageAbsorb = self.displayedUnit and UnitGetTotalAbsorbs (self.displayedUnit) or 0 - + if (unitDamageAbsorb > 0) then local damageAbsorbPercent = unitDamageAbsorb / currentHealthMax self.shieldAbsorbIndicator:Show() @@ -7599,7 +7204,7 @@ detailsFramework.StatusBarFunctions = { self.shieldAbsorbIndicator:SetWidth(max(1, min (width * damageAbsorbPercent, abs(healthPercent - 1) * width))) self.shieldAbsorbIndicator:SetPoint("topleft", self, "topleft", width * healthPercent, 0) self.shieldAbsorbIndicator:SetPoint("bottomleft", self, "bottomleft", width * healthPercent, 0) - + --if the absorb percent pass 100%, show the glow if ((healthPercent + damageAbsorbPercent) > 1) then self.shieldAbsorbGlow:Show() @@ -7617,13 +7222,13 @@ detailsFramework.StatusBarFunctions = { end --Health Events - healthBarMetaFunctions.PLAYER_ENTERING_WORLD = function(self, ...) + healthBarMetaFunctions.PLAYER_ENTERING_WORLD = function(self, ...) self:UpdateMaxHealth() self:UpdateHealth() self:UpdateHealPrediction() end - healthBarMetaFunctions.UNIT_HEALTH = function(self, ...) + healthBarMetaFunctions.UNIT_HEALTH = function(self, ...) self:UpdateHealth() self:UpdateHealPrediction() end @@ -7662,51 +7267,51 @@ detailsFramework.StatusBarFunctions = { -- ~healthbar function detailsFramework:CreateHealthBar (parent, name, settingsOverride) - assert (name or parent:GetName(), "DetailsFramework:CreateHealthBar parameter 'name' omitted and parent has no name.") + assert(name or parent:GetName(), "DetailsFramework:CreateHealthBar parameter 'name' omitted and parent has no name.") local healthBar = CreateFrame("StatusBar", name or (parent:GetName() .. "HealthBar"), parent, "BackdropTemplate") do --layers --background healthBar.background = healthBar:CreateTexture(nil, "background") - healthBar.background:SetDrawLayer ("background", -6) - + healthBar.background:SetDrawLayer("background", -6) + --artwork --healing incoming healthBar.incomingHealIndicator = healthBar:CreateTexture(nil, "artwork") - healthBar.incomingHealIndicator:SetDrawLayer ("artwork", 4) + healthBar.incomingHealIndicator:SetDrawLayer("artwork", 4) --current shields on the unit healthBar.shieldAbsorbIndicator = healthBar:CreateTexture(nil, "artwork") - healthBar.shieldAbsorbIndicator:SetDrawLayer ("artwork", 5) + healthBar.shieldAbsorbIndicator:SetDrawLayer("artwork", 5) --debuff absorbing heal healthBar.healAbsorbIndicator = healthBar:CreateTexture(nil, "artwork") - healthBar.healAbsorbIndicator:SetDrawLayer ("artwork", 6) + healthBar.healAbsorbIndicator:SetDrawLayer("artwork", 6) --the shield fills all the bar, show that cool glow healthBar.shieldAbsorbGlow = healthBar:CreateTexture(nil, "artwork") - healthBar.shieldAbsorbGlow:SetDrawLayer ("artwork", 7) + healthBar.shieldAbsorbGlow:SetDrawLayer("artwork", 7) --statusbar texture healthBar.barTexture = healthBar:CreateTexture(nil, "artwork") healthBar:SetStatusBarTexture (healthBar.barTexture) end --mixins - detailsFramework:Mixin (healthBar, healthBarMetaFunctions) - detailsFramework:Mixin (healthBar, detailsFramework.StatusBarFunctions) + detailsFramework:Mixin(healthBar, healthBarMetaFunctions) + detailsFramework:Mixin(healthBar, detailsFramework.StatusBarFunctions) healthBar:CreateTextureMask() - + --settings and hooks - local settings = detailsFramework.table.copy ({}, healthBarMetaFunctions.Settings) + local settings = detailsFramework.table.copy({}, healthBarMetaFunctions.Settings) if (settingsOverride) then - detailsFramework.table.copy (settings, settingsOverride) + detailsFramework.table.copy(settings, settingsOverride) end healthBar.Settings = settings --hook list - healthBar.HookList = detailsFramework.table.copy ({}, healthBarMetaFunctions.HookList) - + healthBar.HookList = detailsFramework.table.copy({}, healthBarMetaFunctions.HookList) + --initialize the cast bar healthBar:Initialize() - + return healthBar end @@ -7722,32 +7327,29 @@ end --]=] detailsFramework.PowerFrameFunctions = { - WidgetType = "powerBar", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, - + HookList = { - OnHide = {}, + OnHide = {}, OnShow = {}, }, - + Settings = { --misc ShowAlternatePower = true, --if true it'll show alternate power over the regular power the unit uses ShowPercentText = true, --if true show a text with the current energy percent HideIfNoPower = true, --if true and the UnitMaxPower returns zero, it'll hide the power bar with self:Hide() CanTick = false, --if it calls the OnTick function every tick - + --appearance BackgroundColor = detailsFramework:CreateColorTable (.2, .2, .2, .8), Texture = [[Interface\RaidFrame\Raid-Bar-Resource-Fill]], - + --default size Width = 100, Height = 20, }, - + PowerBarEvents = { {"PLAYER_ENTERING_WORLD"}, {"UNIT_DISPLAYPOWER", true}, @@ -7757,33 +7359,33 @@ detailsFramework.PowerFrameFunctions = { {"UNIT_POWER_UPDATE", true}, {"UNIT_POWER_FREQUENT", true}, }, - + --setup the castbar to be used by another unit SetUnit = function(self, unit, displayedUnit) if (self.unit ~= unit or self.displayedUnit ~= displayedUnit or unit == nil) then self.unit = unit self.displayedUnit = displayedUnit or unit - + --register events if (unit) then for _, eventTable in ipairs(self.PowerBarEvents) do local event = eventTable [1] local isUnitEvent = eventTable [2] - + if (isUnitEvent) then self:RegisterUnitEvent (event, self.displayedUnit) else self:RegisterEvent (event) end end - + --set scripts self:SetScript("OnEvent", self.OnEvent) - + if (self.Settings.CanTick) then self:SetScript("OnUpdate", self.OnTick) end - + self:Show() self:UpdatePowerBar() else @@ -7792,7 +7394,7 @@ detailsFramework.PowerFrameFunctions = { local event = eventTable [1] self:UnregisterEvent (event) end - + --remove scripts self:SetScript("OnEvent", nil) self:SetScript("OnUpdate", nil) @@ -7800,30 +7402,30 @@ detailsFramework.PowerFrameFunctions = { end end end, - + Initialize = function(self) PixelUtil.SetWidth (self, self.Settings.Width) - PixelUtil.SetHeight (self, self.Settings.Height) - + PixelUtil.SetHeight(self, self.Settings.Height) + self:SetTexture(self.Settings.Texture) - + self.background:SetAllPoints() - self.background:SetColorTexture (self.Settings.BackgroundColor:GetColor()) - + self.background:SetColorTexture(self.Settings.BackgroundColor:GetColor()) + if (self.Settings.ShowPercentText) then self.percentText:Show() - PixelUtil.SetPoint (self.percentText, "center", self, "center", 0, 0) - + PixelUtil.SetPoint(self.percentText, "center", self, "center", 0, 0) + detailsFramework:SetFontSize (self.percentText, 9) detailsFramework:SetFontColor(self.percentText, "white") detailsFramework:SetFontOutline (self.percentText, "OUTLINE") else self.percentText:Hide() end - - self:SetUnit (nil) + + self:SetUnit(nil) end, - + --call every tick OnTick = function(self, deltaTime) end, --if overrided, set 'CanTick' to true on the settings table @@ -7835,19 +7437,19 @@ detailsFramework.PowerFrameFunctions = { eventFunc (self, ...) end end, - + UpdatePowerBar = function(self) self:UpdatePowerInfo() self:UpdateMaxPower() self:UpdatePower() self:UpdatePowerColor() end, - + --power update UpdateMaxPower = function(self) self.currentPowerMax = UnitPowerMax (self.displayedUnit, self.powerType) self:SetMinMaxValues(self.minPower, self.currentPowerMax) - + if (self.currentPowerMax == 0 and self.Settings.HideIfNoPower) then self:Hide() end @@ -7855,14 +7457,14 @@ detailsFramework.PowerFrameFunctions = { UpdatePower = function(self) self.currentPower = UnitPower (self.displayedUnit, self.powerType) PixelUtil.SetStatusBarValue (self, self.currentPower) - + if (self.Settings.ShowPercentText) then self.percentText:SetText(floor(self.currentPower / self.currentPowerMax * 100) .. "%") end end, - + --when a event different from unit_power_update is triggered, update which type of power the unit should show - UpdatePowerInfo = function(self) + UpdatePowerInfo = function(self) if (IS_WOW_PROJECT_MAINLINE and self.Settings.ShowAlternatePower) then -- not available in classic local barID = UnitPowerBarID(self.displayedUnit) local barInfo = GetUnitPowerBarInfoByID(barID) @@ -7874,55 +7476,55 @@ detailsFramework.PowerFrameFunctions = { return end end - + self.powerType = UnitPowerType (self.displayedUnit) self.minPower = 0 end, - + --tint the bar with the color of the power, e.g. blue for a mana bar UpdatePowerColor = function(self) if (not UnitIsConnected (self.unit)) then - self:SetStatusBarColor (.5, .5, .5) + self:SetStatusBarColor(.5, .5, .5) return end - + if (self.powerType == ALTERNATE_POWER_INDEX) then --don't change this, keep the same color as the game tints on CompactUnitFrame.lua - self:SetStatusBarColor (0.7, 0.7, 0.6) + self:SetStatusBarColor(0.7, 0.7, 0.6) return end - + local powerColor = PowerBarColor [self.powerType] --don't appear to be, but PowerBarColor is a global table with all power colors /run Details:Dump (PowerBarColor) if (powerColor) then - self:SetStatusBarColor (powerColor.r, powerColor.g, powerColor.b) + self:SetStatusBarColor(powerColor.r, powerColor.g, powerColor.b) return end - + local _, _, r, g, b = UnitPowerType (self.displayedUnit) if (r) then - self:SetStatusBarColor (r, g, b) + self:SetStatusBarColor(r, g, b) return end - + --if everything else fails, tint as rogue energy powerColor = PowerBarColor ["ENERGY"] - self:SetStatusBarColor (powerColor.r, powerColor.g, powerColor.b) + self:SetStatusBarColor(powerColor.r, powerColor.g, powerColor.b) end, --events PLAYER_ENTERING_WORLD = function(self, ...) self:UpdatePowerBar() end, - UNIT_DISPLAYPOWER = function(self, ...) + UNIT_DISPLAYPOWER = function(self, ...) self:UpdatePowerBar() end, - UNIT_POWER_BAR_SHOW = function(self, ...) + UNIT_POWER_BAR_SHOW = function(self, ...) self:UpdatePowerBar() end, UNIT_POWER_BAR_HIDE = function(self, ...) self:UpdatePowerBar() end, - + UNIT_MAXPOWER = function(self, ...) self:UpdateMaxPower() self:UpdatePower() @@ -7935,17 +7537,18 @@ detailsFramework.PowerFrameFunctions = { end, } --- ~powerbar -function detailsFramework:CreatePowerBar (parent, name, settingsOverride) +detailsFramework:Mixin(detailsFramework.PowerFrameFunctions, detailsFramework.ScriptHookMixin) - assert (name or parent:GetName(), "DetailsFramework:CreatePowerBar parameter 'name' omitted and parent has no name.") +-- ~powerbar +function detailsFramework:CreatePowerBar(parent, name, settingsOverride) + assert(name or parent:GetName(), "DetailsFramework:CreatePowerBar parameter 'name' omitted and parent has no name.") local powerBar = CreateFrame("StatusBar", name or (parent:GetName() .. "PowerBar"), parent, "BackdropTemplate") do --layers --background powerBar.background = powerBar:CreateTexture(nil, "background") - powerBar.background:SetDrawLayer ("background", -6) - + powerBar.background:SetDrawLayer("background", -6) + --artwork powerBar.barTexture = powerBar:CreateTexture(nil, "artwork") powerBar:SetStatusBarTexture (powerBar.barTexture) @@ -7955,27 +7558,27 @@ function detailsFramework:CreatePowerBar (parent, name, settingsOverride) end --mixins - detailsFramework:Mixin (powerBar, detailsFramework.PowerFrameFunctions) - detailsFramework:Mixin (powerBar, detailsFramework.StatusBarFunctions) + detailsFramework:Mixin(powerBar, detailsFramework.PowerFrameFunctions) + detailsFramework:Mixin(powerBar, detailsFramework.StatusBarFunctions) powerBar:CreateTextureMask() - + --settings and hooks - local settings = detailsFramework.table.copy ({}, detailsFramework.PowerFrameFunctions.Settings) + local settings = detailsFramework.table.copy({}, detailsFramework.PowerFrameFunctions.Settings) if (settingsOverride) then - detailsFramework.table.copy (settings, settingsOverride) + detailsFramework.table.copy(settings, settingsOverride) end powerBar.Settings = settings - - local hookList = detailsFramework.table.copy ({}, detailsFramework.PowerFrameFunctions.HookList) + + local hookList = detailsFramework.table.copy({}, detailsFramework.PowerFrameFunctions.HookList) powerBar.HookList = hookList - + --initialize the cast bar powerBar:Initialize() - + return powerBar end - + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --cast bar frame @@ -7988,15 +7591,12 @@ end --]=] detailsFramework.CastFrameFunctions = { - WidgetType = "castBar", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, - + HookList = { - OnHide = {}, + OnHide = {}, OnShow = {}, - + --can be regular cast or channel OnCastStart = {}, }, @@ -8014,7 +7614,7 @@ detailsFramework.CastFrameFunctions = { {"UNIT_SPELLCAST_STOP", true}, {"UNIT_SPELLCAST_FAILED", true}, }, - + Settings = { NoFadeEffects = false, --if true it won't play fade effects when a cast if finished ShowTradeSkills = false, --if true, it shows cast for trade skills, e.g. creating an icon with blacksmith @@ -8025,11 +7625,11 @@ detailsFramework.CastFrameFunctions = { FadeOutTime = 0.5, --amount of time in seconds to go from 100% to zero alpha when the cast finishes CanLazyTick = true, --if true, it'll execute the lazy tick function, it ticks in a much slower pace comparece with the regular tick LazyUpdateCooldown = 0.2, --amount of time to wait for the next lazy update, this updates non critical things like the cast timer - + --default size Width = 100, Height = 20, - + --colour the castbar statusbar by the type of the cast Colors = { Casting = detailsFramework:CreateColorTable (1, 0.73, .1, 1), @@ -8056,94 +7656,94 @@ detailsFramework.CastFrameFunctions = { SparkHeight = 16, SparkOffset = 0, }, - + Initialize = function(self) self.unit = "unutilized unit" self.lazyUpdateCooldown = self.Settings.LazyUpdateCooldown self.Colors = self.Settings.Colors - - self:SetUnit (nil) + + self:SetUnit(nil) PixelUtil.SetWidth (self, self.Settings.Width) - PixelUtil.SetHeight (self, self.Settings.Height) - - self.background:SetColorTexture (self.Settings.BackgroundColor:GetColor()) - self.background:SetAllPoints() - self.extraBackground:SetColorTexture (0, 0, 0, 1) + PixelUtil.SetHeight(self, self.Settings.Height) + + self.background:SetColorTexture(self.Settings.BackgroundColor:GetColor()) + self.background:SetAllPoints() + self.extraBackground:SetColorTexture(0, 0, 0, 1) self.extraBackground:SetVertexColor(self.Settings.BackgroundColor:GetColor()) self.extraBackground:SetAllPoints() - + self:SetTexture(self.Settings.Texture) - + self.BorderShield:SetPoint("center", self, "left", 0, 0) self.BorderShield:SetTexture(self.Settings.BorderShieldTexture) - self.BorderShield:SetTexCoord (unpack(self.Settings.BorderShieldCoords)) + self.BorderShield:SetTexCoord(unpack(self.Settings.BorderShieldCoords)) self.BorderShield:SetSize(self.Settings.BorderShieldWidth, self.Settings.BorderShieldHeight) - + self.Icon:SetPoint("center", self, "left", 2, 0) self.Icon:SetSize(self.Settings.SpellIconWidth, self.Settings.SpellIconHeight) - + self.Spark:SetTexture(self.Settings.SparkTexture) self.Spark:SetSize(self.Settings.SparkWidth, self.Settings.SparkHeight) - + self.percentText:SetPoint("right", self, "right", -2, 0) self.percentText:SetJustifyH("right") - + self.fadeOutAnimation.alpha1:SetDuration(self.Settings.FadeOutTime) self.fadeInAnimation.alpha1:SetDuration(self.Settings.FadeInTime) end, - + SetDefaultColor = function(self, colorType, r, g, b, a) - assert (type(colorType) == "string", "DetailsFramework: CastBar:SetDefaultColor require a string in the first argument.") + assert(type(colorType) == "string", "DetailsFramework: CastBar:SetDefaultColor require a string in the first argument.") self.Colors [colorType]:SetColor (r, g, b, a) end, - + --this get a color suggestion based on the type of cast being shown in the cast bar GetCastColor = function(self) if (not self.canInterrupt) then return self.Colors.NonInterruptible - + elseif (self.channeling) then return self.Colors.Channeling - + elseif (self.failed) then return self.Colors.Failed - + elseif (self.interrupted) then return self.Colors.Interrupted - + elseif (self.finished) then return self.Colors.Finished - - else + + else return self.Colors.Casting end end, - + --update all colors of the cast bar UpdateCastColor = function(self) local castColor = self:GetCastColor() self:SetColor (castColor) --SetColor handles with ParseColors() end, - + --initial checks to know if this is a valid cast and should show the cast bar, if this fails the cast bar won't show IsValid = function(self, unit, castName, isTradeSkill, ignoreVisibility) if (not ignoreVisibility and not self:IsShown()) then return false end - + if (not self.Settings.ShowTradeSkills) then if (isTradeSkill) then return false end end - + if (not castName) then return false end - + return true end, - + --handle the interrupt state of the cast --this does not change the cast bar color because this function is called inside the start cast where is already handles the cast color UpdateInterruptState = function(self) @@ -8153,7 +7753,7 @@ detailsFramework.CastFrameFunctions = { self.BorderShield:Hide() end end, - + --this check if the cast did reach 100% in the statusbar, mostly called from OnTick CheckCastIsDone = function(self, event, isFinished) @@ -8163,13 +7763,13 @@ detailsFramework.CastFrameFunctions = { if (self.value >= self.maxValue) then isFinished = true end - + elseif (self.channeling) then if (self.value > self.maxValue or self.value <= 0) then isFinished = true end end - + --check if passed an event (not begin used at the moment) if (event) then if (event == UNIT_SPELLCAST_STOP or event == UNIT_SPELLCAST_CHANNEL_STOP) then @@ -8177,7 +7777,7 @@ detailsFramework.CastFrameFunctions = { end end end - + --the cast is finished if (isFinished) then if (self.casting) then @@ -8186,11 +7786,11 @@ detailsFramework.CastFrameFunctions = { elseif (self.channeling) then self.UNIT_SPELLCAST_CHANNEL_STOP (self, self.unit, self.unit, self.castID, self.spellID) end - + return true end end, - + --setup the castbar to be used by another unit SetUnit = function(self, unit, displayedUnit) if (self.unit ~= unit or self.displayedUnit ~= displayedUnit or unit == nil) then @@ -8201,13 +7801,13 @@ detailsFramework.CastFrameFunctions = { self.casting = nil self.channeling = nil self.caninterrupt = nil - + --register events if (unit) then for _, eventTable in ipairs(self.CastBarEvents) do local event = eventTable [1] local isUnitEvent = eventTable [2] - + if event then if (isUnitEvent) then self:RegisterUnitEvent (event, unit) @@ -8216,16 +7816,16 @@ detailsFramework.CastFrameFunctions = { end end end - + --set scripts self:SetScript("OnEvent", self.OnEvent) self:SetScript("OnShow", self.OnShow) self:SetScript("OnHide", self.OnHide) - + if (self.Settings.CanTick) then self:SetScript("OnUpdate", self.OnTick) end - + --check is can show the cast time text if (self.Settings.ShowCastTime and self.Settings.CanLazyTick) then self.percentText:Show() @@ -8238,7 +7838,7 @@ detailsFramework.CastFrameFunctions = { --self:PLAYER_ENTERING_WORLD (unit, unit) self:OnEvent ("PLAYER_ENTERING_WORLD", unit, unit) - + else for _, eventTable in ipairs(self.CastBarEvents) do local event = eventTable [1] @@ -8246,22 +7846,22 @@ detailsFramework.CastFrameFunctions = { self:UnregisterEvent (event) end end - + --register main events self:SetScript("OnUpdate", nil) self:SetScript("OnEvent", nil) self:SetScript("OnShow", nil) self:SetScript("OnHide", nil) - + self:Hide() end end end, - + --executed after a scheduled to hide timer is done DoScheduledHide = function(timerObject) timerObject.castBar.scheduledHideTime = nil - + --just to make sure it isn't casting if (not timerObject.castBar.casting and not timerObject.castBar.channeling) then if (not timerObject.castBar.Settings.NoFadeEffects) then @@ -8271,24 +7871,24 @@ detailsFramework.CastFrameFunctions = { end end end, - + HasScheduledHide = function(self) return self.scheduledHideTime and not self.scheduledHideTime:IsCancelled() end, - + CancelScheduleToHide = function(self) if (self:HasScheduledHide()) then self.scheduledHideTime:Cancel() end end, - + --after an interrupt, do not immediately hide the cast bar, let it up for short amount of time to give feedback to the player ScheduleToHide = function(self, delay) if (not delay) then if (self.scheduledHideTime and not self.scheduledHideTime:IsCancelled()) then self.scheduledHideTime:Cancel() end - + self.scheduledHideTime = nil return end @@ -8297,7 +7897,7 @@ detailsFramework.CastFrameFunctions = { if (self.scheduledHideTime and not self.scheduledHideTime:IsCancelled()) then self.scheduledHideTime:Cancel() end - + self.scheduledHideTime = C_Timer.NewTimer(delay, self.DoScheduledHide) self.scheduledHideTime.castBar = self end, @@ -8308,12 +7908,12 @@ detailsFramework.CastFrameFunctions = { --cancel any timer to hide scheduled self:CancelScheduleToHide() end, - + --just update the current value if a spell is being cast since it wasn't running its tick function during the hide state --everything else should be in the correct state OnShow = function(self) self.flashTexture:Hide() - + if (self.unit) then if (self.casting) then local name, text, texture, startTime = UnitCastingInfo (self.unit) @@ -8324,8 +7924,8 @@ detailsFramework.CastFrameFunctions = { self.value = GetTime() - self.spellStartTime end - self:RunHooksForWidget ("OnShow", self, self.unit) - + self:RunHooksForWidget("OnShow", self, self.unit) + elseif (self.channeling) then local name, text, texture, endTime = UnitChannelInfo (self.unit) if (name) then @@ -8335,11 +7935,11 @@ detailsFramework.CastFrameFunctions = { self.value = self.spellEndTime - GetTime() end - self:RunHooksForWidget ("OnShow", self, self.unit) + self:RunHooksForWidget("OnShow", self, self.unit) end end end, - + --it's triggering several events since it's not registered for the unit with RegisterUnitEvent OnEvent = function(self, event, ...) local arg1 = ... @@ -8351,7 +7951,7 @@ detailsFramework.CastFrameFunctions = { self.OnEvent (self, newEvent, unit) return end - + elseif (arg1 ~= unit) then return end @@ -8361,47 +7961,47 @@ detailsFramework.CastFrameFunctions = { eventFunc (self, unit, ...) end end, - + OnTick_LazyTick = function(self) --run the lazy tick if allowed if (self.Settings.CanLazyTick) then --update the cast time if (self.Settings.ShowCastTime) then if (self.casting) then - self.percentText:SetText(format ("%.1f", abs(self.value - self.maxValue))) - + self.percentText:SetText(format("%.1f", abs(self.value - self.maxValue))) + elseif (self.channeling) then local remainingTime = abs(self.value) if (remainingTime > 999) then self.percentText:SetText("") else - self.percentText:SetText(format ("%.1f", remainingTime)) + self.percentText:SetText(format("%.1f", remainingTime)) end else self.percentText:SetText("") end end - + return true else return false end end, - + --tick function for regular casts OnTick_Casting = function(self, deltaTime) self.value = self.value + deltaTime - + if (self:CheckCastIsDone()) then return else self:SetValue(self.value) end - + --update spark position local sparkPosition = self.value / self.maxValue * self:GetWidth() self.Spark:SetPoint("center", self, "left", sparkPosition + self.Settings.SparkOffset, 0) - + --in order to allow the lazy tick run, it must return true, it tell that the cast didn't finished return true end, @@ -8409,20 +8009,20 @@ detailsFramework.CastFrameFunctions = { --tick function for channeling casts OnTick_Channeling = function(self, deltaTime) self.value = self.value - deltaTime - + if (self:CheckCastIsDone()) then return else self:SetValue(self.value) end - + --update spark position local sparkPosition = self.value / self.maxValue * self:GetWidth() self.Spark:SetPoint("center", self, "left", sparkPosition + self.Settings.SparkOffset, 0) - + return true end, - + OnTick = function(self, deltaTime) if (self.casting) then if (not self:OnTick_Casting (deltaTime)) then @@ -8435,12 +8035,12 @@ detailsFramework.CastFrameFunctions = { self:OnTick_LazyTick() self.lazyUpdateCooldown = self.Settings.LazyUpdateCooldown end - + elseif (self.channeling) then if (not self:OnTick_Channeling (deltaTime)) then return end - + --lazy tick self.lazyUpdateCooldown = self.lazyUpdateCooldown - deltaTime if (self.lazyUpdateCooldown < 0) then @@ -8449,90 +8049,90 @@ detailsFramework.CastFrameFunctions = { end end end, - + --animation start script Animation_FadeOutStarted = function(self) - + end, - + --animation finished script Animation_FadeOutFinished = function(self) local castBar = self:GetParent() castBar:SetAlpha(1) castBar:Hide() end, - + --animation start script Animation_FadeInStarted = function(self) - + end, - + --animation finished script Animation_FadeInFinished = function(self) local castBar = self:GetParent() castBar:Show() castBar:SetAlpha(1) end, - + --animation calls Animation_FadeOut = function(self) self:ScheduleToHide (false) - + if (self.fadeInAnimation:IsPlaying()) then self.fadeInAnimation:Stop() end - + if (not self.fadeOutAnimation:IsPlaying()) then self.fadeOutAnimation:Play() end end, - + Animation_FadeIn = function(self) self:ScheduleToHide (false) - + if (self.fadeOutAnimation:IsPlaying()) then self.fadeOutAnimation:Stop() end - + if (not self.fadeInAnimation:IsPlaying()) then self.fadeInAnimation:Play() end end, - + Animation_Flash = function(self) if (not self.flashAnimation:IsPlaying()) then self.flashAnimation:Play() end end, - + Animation_StopAllAnimations = function(self) if (self.flashAnimation:IsPlaying()) then self.flashAnimation:Stop() end - + if (self.fadeOutAnimation:IsPlaying()) then self.fadeOutAnimation:Stop() end - + if (self.fadeInAnimation:IsPlaying()) then self.fadeInAnimation:Stop() end end, - + PLAYER_ENTERING_WORLD = function(self, unit, arg1) local isChannel = UnitChannelInfo (unit) local isRegularCast = UnitCastingInfo (unit) - + if (isChannel) then self.channeling = true self:UpdateChannelInfo(unit) return self.unit == arg1 and "UNIT_SPELLCAST_CHANNEL_START" - + elseif (isRegularCast) then self.casting = true self:UpdateCastingInfo(unit) return self.unit == arg1 and "UNIT_SPELLCAST_START" - + else self.casting = nil self.channeling = nil @@ -8543,15 +8143,15 @@ detailsFramework.CastFrameFunctions = { self:Hide() end end, - + UpdateCastingInfo = function(self, unit) local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible, spellID = UnitCastingInfo (unit) - + --is valid? if (not self:IsValid (unit, name, isTradeSkill, true)) then return end - + --setup cast self.casting = true self.channeling = nil @@ -8567,45 +8167,45 @@ detailsFramework.CastFrameFunctions = { self.spellEndTime = endTime / 1000 self.value = GetTime() - self.spellStartTime self.maxValue = self.spellEndTime - self.spellStartTime - + self:SetMinMaxValues(0, self.maxValue) self:SetValue(self.value) self:SetAlpha(1) self.Icon:SetTexture(texture) self.Icon:Show() self.Text:SetText(text or name) - + if (self.Settings.ShowCastTime and self.Settings.CanLazyTick) then self.percentText:Show() end - + self.flashTexture:Hide() self:Animation_StopAllAnimations() self:SetAlpha(1) - + --set the statusbar color self:UpdateCastColor() - + if (not self:IsShown()) then self:Animation_FadeIn() end - + self.Spark:Show() self:Show() --update the interrupt cast border self:UpdateInterruptState() - + end, - + UNIT_SPELLCAST_START = function(self, unit) self:UpdateCastingInfo(unit) - - self:RunHooksForWidget ("OnCastStart", self, self.unit, "UNIT_SPELLCAST_START") + + self:RunHooksForWidget("OnCastStart", self, self.unit, "UNIT_SPELLCAST_START") end, - + UpdateChannelInfo = function(self, unit, ...) local name, text, texture, startTime, endTime, isTradeSkill, notInterruptible, spellID = UnitChannelInfo (unit) @@ -8629,88 +8229,88 @@ detailsFramework.CastFrameFunctions = { self.spellEndTime = endTime / 1000 self.value = self.spellEndTime - GetTime() self.maxValue = self.spellEndTime - self.spellStartTime - + self:SetMinMaxValues(0, self.maxValue) self:SetValue(self.value) - + self:SetAlpha(1) self.Icon:SetTexture(texture) self.Icon:Show() self.Text:SetText(text) - + if (self.Settings.ShowCastTime and self.Settings.CanLazyTick) then self.percentText:Show() end - + self.flashTexture:Hide() self:Animation_StopAllAnimations() - + self:SetAlpha(1) - + --set the statusbar color self:UpdateCastColor() if (not self:IsShown()) then self:Animation_FadeIn() end - + self.Spark:Show() self:Show() - + --update the interrupt cast border self:UpdateInterruptState() - + end, - + UNIT_SPELLCAST_CHANNEL_START = function(self, unit, ...) - + self:UpdateChannelInfo(unit, ...) - self:RunHooksForWidget ("OnCastStart", self, self.unit, "UNIT_SPELLCAST_CHANNEL_START") + self:RunHooksForWidget("OnCastStart", self, self.unit, "UNIT_SPELLCAST_CHANNEL_START") end, - + UNIT_SPELLCAST_STOP = function(self, unit, ...) local unitID, castID, spellID = ... if (self.castID == castID) then self.Spark:Hide() self.percentText:Hide() - + local value = self:GetValue() local _, maxValue = self:GetMinMaxValues() self:SetValue(self.maxValue or maxValue or 1) - + self.casting = nil self.finished = true - + if (not self:HasScheduledHide()) then --check if settings has no fade option or if its parents are not visible if (not self:IsVisible()) then self:Hide() - + elseif (self.Settings.NoFadeEffects) then self:ScheduleToHide (0.3) - + else self:Animation_Flash() self:Animation_FadeOut() end end - + self:UpdateCastColor() end end, UNIT_SPELLCAST_CHANNEL_STOP = function(self, unit, ...) local unitID, castID, spellID = ... - + if (self.channeling and castID == self.castID) then self.Spark:Hide() self.percentText:Hide() - + local value = self:GetValue() local _, maxValue = self:GetMinMaxValues() self:SetValue(self.maxValue or maxValue or 1) - + self.channeling = nil self.finished = true @@ -8718,41 +8318,41 @@ detailsFramework.CastFrameFunctions = { --check if settings has no fade option or if its parents are not visible if (not self:IsVisible()) then self:Hide() - + elseif (self.Settings.NoFadeEffects) then self:ScheduleToHide (0.3) - + else self:Animation_Flash() self:Animation_FadeOut() end end - + self:UpdateCastColor() - end + end end, UNIT_SPELLCAST_FAILED = function(self, unit, ...) local unitID, castID, spellID = ... - + if ((self.casting or self.channeling) and castID == self.castID and not self.fadeOut) then self.casting = nil self.channeling = nil self.failed = true self.finished = true self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1) - + --set the statusbar color self:UpdateCastColor() self.Spark:Hide() self.percentText:Hide() self.Text:SetText(FAILED) --auto locale within the global namespace - + self:ScheduleToHide (1) end end, - + UNIT_SPELLCAST_INTERRUPTED = function(self, unit, ...) local unitID, castID, spellID = ... @@ -8762,21 +8362,21 @@ detailsFramework.CastFrameFunctions = { self.interrupted = true self.finished = true self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1) - + local castColor = self:GetCastColor() self:SetColor (castColor) --SetColor handles with ParseColors() - + self.Spark:Hide() self.percentText:Hide() self.Text:SetText(INTERRUPTED) --auto locale within the global namespace - + self:ScheduleToHide (1) end end, UNIT_SPELLCAST_DELAYED = function(self, unit, ...) local name, text, texture, startTime, endTime, isTradeSkill, castID, notInterruptible = UnitCastingInfo (unit) - + if (not self:IsValid (unit, name, isTradeSkill)) then return end @@ -8791,32 +8391,32 @@ detailsFramework.CastFrameFunctions = { UNIT_SPELLCAST_CHANNEL_UPDATE = function(self, unit, ...) local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo (unit) - + if (not self:IsValid (unit, name, isTradeSkill)) then return end - + --update the cast time self.spellStartTime = startTime / 1000 self.spellEndTime = endTime / 1000 self.value = self.spellEndTime - GetTime() - if (self.value < 0) then - self.value = 0 + if (self.value < 0) then + self.value = 0 end self.maxValue = self.spellEndTime - self.spellStartTime self:SetMinMaxValues(0, self.maxValue) self:SetValue(self.value) end, - + --cast changed its state to interruptable UNIT_SPELLCAST_INTERRUPTIBLE = function(self, unit, ...) self.canInterrupt = true self:UpdateCastColor() self:UpdateInterruptState() end, - + --cast changed its state to non interruptable UNIT_SPELLCAST_NOT_INTERRUPTIBLE = function(self, unit, ...) self.canInterrupt = false @@ -8826,6 +8426,8 @@ detailsFramework.CastFrameFunctions = { } +detailsFramework:Mixin(detailsFramework.CastFrameFunctions, detailsFramework.ScriptHookMixin) + -- for classic era use LibClassicCasterino: local LibCC = LibStub("LibClassicCasterino", true) if IS_WOW_PROJECT_CLASSIC_ERA and LibCC then @@ -8902,97 +8504,96 @@ if IS_WOW_PROJECT_CLASSIC_ERA and LibCC then UnitCastingInfo = function(unit) return LibCC:UnitCastingInfo (unit) - end + end UnitChannelInfo = function(unit) return LibCC:UnitChannelInfo (unit) - end + end end end -- end classic era -- ~castbar -function detailsFramework:CreateCastBar (parent, name, settingsOverride) - - assert (name or parent:GetName(), "DetailsFramework:CreateCastBar parameter 'name' omitted and parent has no name.") - +function detailsFramework:CreateCastBar(parent, name, settingsOverride) + assert(name or parent:GetName(), "DetailsFramework:CreateCastBar parameter 'name' omitted and parent has no name.") + local castBar = CreateFrame("StatusBar", name or (parent:GetName() .. "CastBar"), parent, "BackdropTemplate") - + do --layers - + --these widgets was been made with back compatibility in mind --they are using the same names as the retail game uses on the nameplate castbar --this should make Plater core and Plater scripts made by users compatible with the new unit frame made on the framework - + --background castBar.background = castBar:CreateTexture(nil, "background", nil, -6) castBar.extraBackground = castBar:CreateTexture(nil, "background", nil, -5) - + --overlay castBar.Text = castBar:CreateFontString(nil, "overlay", "SystemFont_Shadow_Small") - castBar.Text:SetDrawLayer ("overlay", 1) + castBar.Text:SetDrawLayer("overlay", 1) castBar.Text:SetPoint("center", 0, 0) - + castBar.BorderShield = castBar:CreateTexture(nil, "overlay", nil, 5) castBar.BorderShield:Hide() - + castBar.Icon = castBar:CreateTexture(nil, "overlay", nil, 4) castBar.Icon:Hide() - + castBar.Spark = castBar:CreateTexture(nil, "overlay", nil, 3) castBar.Spark:SetBlendMode("ADD") - + --time left on the cast castBar.percentText = castBar:CreateFontString(nil, "overlay", "SystemFont_Shadow_Small") - castBar.percentText:SetDrawLayer ("overlay", 7) - + castBar.percentText:SetDrawLayer("overlay", 7) + --statusbar texture castBar.barTexture = castBar:CreateTexture(nil, "artwork", nil, -6) castBar:SetStatusBarTexture (castBar.barTexture) - + --animations fade in and out local fadeOutAnimationHub = detailsFramework:CreateAnimationHub (castBar, detailsFramework.CastFrameFunctions.Animation_FadeOutStarted, detailsFramework.CastFrameFunctions.Animation_FadeOutFinished) fadeOutAnimationHub.alpha1 = detailsFramework:CreateAnimation(fadeOutAnimationHub, "ALPHA", 1, 1, 1, 0) castBar.fadeOutAnimation = fadeOutAnimationHub - + local fadeInAnimationHub = detailsFramework:CreateAnimationHub (castBar, detailsFramework.CastFrameFunctions.Animation_FadeInStarted, detailsFramework.CastFrameFunctions.Animation_FadeInFinished) fadeInAnimationHub.alpha1 = detailsFramework:CreateAnimation(fadeInAnimationHub, "ALPHA", 1, 0.150, 0, 1) castBar.fadeInAnimation = fadeInAnimationHub - + --animatios flash local flashTexture = castBar:CreateTexture(nil, "overlay", nil, 7) - flashTexture:SetColorTexture (1, 1, 1, 1) + flashTexture:SetColorTexture(1, 1, 1, 1) flashTexture:SetAllPoints() flashTexture:SetAlpha(0) flashTexture:Hide() flashTexture:SetBlendMode("ADD") castBar.flashTexture = flashTexture - + local flashAnimationHub = detailsFramework:CreateAnimationHub (flashTexture, function() flashTexture:Show() end, function() flashTexture:Hide() end) detailsFramework:CreateAnimation(flashAnimationHub, "ALPHA", 1, 0.2, 0, 0.8) detailsFramework:CreateAnimation(flashAnimationHub, "ALPHA", 2, 0.2, 1, 0) - castBar.flashAnimation = flashAnimationHub + castBar.flashAnimation = flashAnimationHub end - + --mixins - detailsFramework:Mixin (castBar, detailsFramework.CastFrameFunctions) - detailsFramework:Mixin (castBar, detailsFramework.StatusBarFunctions) + detailsFramework:Mixin(castBar, detailsFramework.CastFrameFunctions) + detailsFramework:Mixin(castBar, detailsFramework.StatusBarFunctions) castBar:CreateTextureMask() castBar:AddMaskTexture(castBar.flashTexture) castBar:AddMaskTexture(castBar.background) castBar:AddMaskTexture(castBar.extraBackground) - + --settings and hooks - local settings = detailsFramework.table.copy ({}, detailsFramework.CastFrameFunctions.Settings) + local settings = detailsFramework.table.copy({}, detailsFramework.CastFrameFunctions.Settings) if (settingsOverride) then - detailsFramework.table.copy (settings, settingsOverride) + detailsFramework.table.copy(settings, settingsOverride) end castBar.Settings = settings - - local hookList = detailsFramework.table.copy ({}, detailsFramework.CastFrameFunctions.HookList) + + local hookList = detailsFramework.table.copy({}, detailsFramework.CastFrameFunctions.HookList) castBar.HookList = hookList - + --initialize the cast bar castBar:Initialize() @@ -9016,70 +8617,69 @@ detailsFramework.BorderFunctions = { texture:SetVertexColor(r, g, b, a) end end, - + SetBorderThickness = function(self, newThickness) PixelUtil.SetWidth (self.leftBorder, newThickness, newThickness) PixelUtil.SetWidth (self.rightBorder, newThickness, newThickness) - PixelUtil.SetHeight (self.topBorder, newThickness, newThickness) - PixelUtil.SetHeight (self.bottomBorder, newThickness, newThickness) + PixelUtil.SetHeight(self.topBorder, newThickness, newThickness) + PixelUtil.SetHeight(self.bottomBorder, newThickness, newThickness) end, - + WidgetType = "border", } -- ~borderframe function detailsFramework:CreateBorderFrame (parent, name) - - local parentName = name or "DetailsFrameworkBorderFrame" .. tostring (math.random (1, 100000000)) + local parentName = name or "DetailsFrameworkBorderFrame" .. tostring(math.random (1, 100000000)) local f = CreateFrame("frame", parentName, parent, "BackdropTemplate") f:SetFrameLevel(f:GetFrameLevel()+1) f:SetAllPoints() - - detailsFramework:Mixin (f, detailsFramework.BorderFunctions) - + + detailsFramework:Mixin(f, detailsFramework.BorderFunctions) + f.allTextures = {} - + --create left border local leftBorder = f:CreateTexture(nil, "overlay") - leftBorder:SetDrawLayer ("overlay", 7) - leftBorder:SetColorTexture (1, 1, 1, 1) + leftBorder:SetDrawLayer("overlay", 7) + leftBorder:SetColorTexture(1, 1, 1, 1) tinsert(f.allTextures, leftBorder) f.leftBorder = leftBorder - PixelUtil.SetPoint (leftBorder, "topright", f, "topleft", 0, 1, 0, 1) - PixelUtil.SetPoint (leftBorder, "bottomright", f, "bottomleft", 0, -1, 0, -1) + PixelUtil.SetPoint(leftBorder, "topright", f, "topleft", 0, 1, 0, 1) + PixelUtil.SetPoint(leftBorder, "bottomright", f, "bottomleft", 0, -1, 0, -1) PixelUtil.SetWidth (leftBorder, 1, 1) --create right border local rightBorder = f:CreateTexture(nil, "overlay") - rightBorder:SetDrawLayer ("overlay", 7) - rightBorder:SetColorTexture (1, 1, 1, 1) + rightBorder:SetDrawLayer("overlay", 7) + rightBorder:SetColorTexture(1, 1, 1, 1) tinsert(f.allTextures, rightBorder) f.rightBorder = rightBorder - PixelUtil.SetPoint (rightBorder, "topleft", f, "topright", 0, 1, 0, 1) - PixelUtil.SetPoint (rightBorder, "bottomleft", f, "bottomright", 0, -1, 0, -1) + PixelUtil.SetPoint(rightBorder, "topleft", f, "topright", 0, 1, 0, 1) + PixelUtil.SetPoint(rightBorder, "bottomleft", f, "bottomright", 0, -1, 0, -1) PixelUtil.SetWidth (rightBorder, 1, 1) - + --create top border local topBorder = f:CreateTexture(nil, "overlay") - topBorder:SetDrawLayer ("overlay", 7) - topBorder:SetColorTexture (1, 1, 1, 1) + topBorder:SetDrawLayer("overlay", 7) + topBorder:SetColorTexture(1, 1, 1, 1) tinsert(f.allTextures, topBorder) f.topBorder = topBorder - PixelUtil.SetPoint (topBorder, "bottomleft", f, "topleft", 0, 0, 0, 0) - PixelUtil.SetPoint (topBorder, "bottomright", f, "topright", 0, 0, 0, 0) - PixelUtil.SetHeight (topBorder, 1, 1) - + PixelUtil.SetPoint(topBorder, "bottomleft", f, "topleft", 0, 0, 0, 0) + PixelUtil.SetPoint(topBorder, "bottomright", f, "topright", 0, 0, 0, 0) + PixelUtil.SetHeight(topBorder, 1, 1) + --create border local bottomBorder = f:CreateTexture(nil, "overlay") - bottomBorder:SetDrawLayer ("overlay", 7) - bottomBorder:SetColorTexture (1, 1, 1, 1) + bottomBorder:SetDrawLayer("overlay", 7) + bottomBorder:SetColorTexture(1, 1, 1, 1) tinsert(f.allTextures, bottomBorder) f.bottomBorder = bottomBorder - PixelUtil.SetPoint (bottomBorder, "topleft", f, "bottomleft", 0, 0, 0, 0) - PixelUtil.SetPoint (bottomBorder, "topright", f, "bottomright", 0, 0, 0, 0) - PixelUtil.SetHeight (bottomBorder, 1, 1) - + PixelUtil.SetPoint(bottomBorder, "topleft", f, "bottomleft", 0, 0, 0, 0) + PixelUtil.SetPoint(bottomBorder, "topright", f, "bottomright", 0, 0, 0, 0) + PixelUtil.SetHeight(bottomBorder, 1, 1) + return f end @@ -9089,29 +8689,28 @@ end --unit frame --[=[ - DF:CreateUnitFrame (parent, name, settingsOverride) + DF:CreateUnitFrame(parent, name, settingsOverride) creates a very basic unit frame with a healthbar, castbar and power bar each unit frame has a .Settings table which isn't shared among other unit frames created with this method all members names are the same as the unit frame from the retail game - + @parent = frame to pass for the CreateFrame function @name = absolute name of the frame, if omitted a random name is created @settingsOverride = table with keys and values to replace the defaults from the framework - + --]=] ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --unit frame --return true if the unit has been claimed by another player (health bar is gray) - local unit_is_tap_denied = function(unit) - return unit and not UnitPlayerControlled (unit) and UnitIsTapDenied (unit) + local isUnitTapDenied = function(unit) + return unit and not UnitPlayerControlled(unit) and UnitIsTapDenied(unit) end detailsFramework.UnitFrameFunctions = { - WidgetType = "unitFrame", - + Settings = { --unit frames ClearUnitOnHide = true, --if tue it'll set the unit to nil when the unit frame is set to hide @@ -9119,33 +8718,33 @@ end ShowPowerBar = true, --if true it'll show the power bar for the unit, e.g. the mana bar ShowUnitName = true, --if false, the unit name won't show ShowBorder = true, --if false won't show the border frame - + --health bar color CanModifyHealhBarColor = true, --if false it won't change the color of the health bar ColorByAggro = false, --if true it'll color the healthbar with red color when the unit has aggro on player FixedHealthColor = false, --color override with a table {r=1, g=1, b=1} UseFriendlyClassColor = true, --make the healthbar class color for friendly players UseEnemyClassColor = true, --make the healthbar class color for enemy players - + --misc ShowTargetOverlay = true, --shows a highlighht for the player current target BorderColor = detailsFramework:CreateColorTable (0, 0, 0, 1), --border color, set to alpha zero for no border CanTick = false, --if true it'll run the OnTick event - + --size Width = 100, Height = 20, PowerBarHeight = 4, CastBarHeight = 8, }, - + UnitFrameEvents = { --run for all units {"PLAYER_ENTERING_WORLD"}, {"PARTY_MEMBER_DISABLE"}, {"PARTY_MEMBER_ENABLE"}, {"PLAYER_TARGET_CHANGED"}, - + --run for one unit {"UNIT_NAME_UPDATE", true}, {"UNIT_CONNECTION", true}, @@ -9164,27 +8763,27 @@ end ["UNIT_PET"] = true, ["UNIT_THREAT_LIST_UPDATE"] = true, }, - + Initialize = function(self) self.border:SetBorderColor (self.Settings.BorderColor) - - PixelUtil.SetWidth (self, self.Settings.Width, 1) - PixelUtil.SetHeight (self, self.Settings.Height, 1) - PixelUtil.SetPoint (self.powerBar, "bottomleft", self, "bottomleft", 0, 0, 1, 1) - PixelUtil.SetPoint (self.powerBar, "bottomright", self, "bottomright", 0, 0, 1, 1) - PixelUtil.SetHeight (self.powerBar, self.Settings.PowerBarHeight, 1) - + PixelUtil.SetWidth (self, self.Settings.Width, 1) + PixelUtil.SetHeight(self, self.Settings.Height, 1) + + PixelUtil.SetPoint(self.powerBar, "bottomleft", self, "bottomleft", 0, 0, 1, 1) + PixelUtil.SetPoint(self.powerBar, "bottomright", self, "bottomright", 0, 0, 1, 1) + PixelUtil.SetHeight(self.powerBar, self.Settings.PowerBarHeight, 1) + --make the castbar overlap the powerbar - PixelUtil.SetPoint (self.castBar, "bottomleft", self, "bottomleft", 0, 0, 1, 1) - PixelUtil.SetPoint (self.castBar, "bottomright", self, "bottomright", 0, 0, 1, 1) - PixelUtil.SetHeight (self.castBar, self.Settings.CastBarHeight, 1) + PixelUtil.SetPoint(self.castBar, "bottomleft", self, "bottomleft", 0, 0, 1, 1) + PixelUtil.SetPoint(self.castBar, "bottomright", self, "bottomright", 0, 0, 1, 1) + PixelUtil.SetHeight(self.castBar, self.Settings.CastBarHeight, 1) end, - + SetHealthBarColor = function(self, r, g, b, a) self.healthBar:SetColor (r, g, b, a) end, - + --register all events which will be used by the unit frame RegisterEvents = function(self) --register events @@ -9196,33 +8795,33 @@ end self:RegisterUnitEvent (event, self.unit, self.displayedUnit ~= unit and self.displayedUnit or nil) end end - + --check settings and unregister events for disabled features if (not self.Settings.ColorByAggro) then self:UnregisterEvent ("UNIT_THREAT_LIST_UPDATE") end - + --set scripts self:SetScript("OnEvent", self.OnEvent) self:SetScript("OnHide", self.OnHide) - + if (self.Settings.CanTick) then self:SetScript("OnUpdate", self.OnTick) end end, - + --unregister events, called when this unit frame losses its unit UnregisterEvents = function(self) for index, eventTable in ipairs(self.UnitFrameEvents) do local event, firstUnit, secondUnit = unpack(eventTable) self:UnregisterEvent (event) end - + self:SetScript("OnEvent", nil) self:SetScript("OnUpdate", nil) self:SetScript("OnHide", nil) end, - + --call every tick OnTick = function(self, deltaTime) end, --if overrided, set 'CanTick' to true on the settings table @@ -9243,56 +8842,56 @@ end end end end, - + OnHide = function(self) if (self.Settings.ClearUnitOnHide) then - self:SetUnit (nil) + self:SetUnit(nil) end end, - + --run if the unit currently shown is different than the new one SetUnit = function(self, unit) if (unit ~= self.unit or unit == nil) then self.unit = unit --absolute unit self.displayedUnit = unit --~todo rename to 'displayedUnit' for back compatibility with older scripts in Plater self.unitInVehicle = nil --true when the unit is in a vehicle - + if (unit) then self:RegisterEvents() - - self.healthBar:SetUnit (unit, self.displayedUnit) - + + self.healthBar:SetUnit(unit, self.displayedUnit) + --is using castbars? if (self.Settings.ShowCastBar) then - self.castBar:SetUnit (unit, self.displayedUnit) + self.castBar:SetUnit(unit, self.displayedUnit) else - self.castBar:SetUnit (nil) + self.castBar:SetUnit(nil) end - + --is using powerbars? if (self.Settings.ShowPowerBar) then - self.powerBar:SetUnit (unit, self.displayedUnit) + self.powerBar:SetUnit(unit, self.displayedUnit) else - self.powerBar:SetUnit (nil) + self.powerBar:SetUnit(nil) end - + --is using the border? if (self.Settings.ShowBorder) then self.border:Show() else self.border:Hide() end - + if (not self.Settings.ShowUnitName) then self.unitName:Hide() end else self:UnregisterEvents() - self.healthBar:SetUnit (nil) - self.castBar:SetUnit (nil) - self.powerBar:SetUnit (nil) + self.healthBar:SetUnit(nil) + self.castBar:SetUnit(nil) + self.powerBar:SetUnit(nil) end - + self:UpdateUnitFrame() end end, @@ -9302,20 +8901,20 @@ end --todo: see what 'UnitTargetsVehicleInRaidUI' is, there's a call for this in the CompactUnitFrame.lua but zero documentation CheckVehiclePossession = function(self) --this unit is possessing a vehicle? - local unitPossessVehicle = (IS_WOW_PROJECT_MAINLINE) and UnitHasVehicleUI (self.unit) or false + local unitPossessVehicle = (IS_WOW_PROJECT_MAINLINE) and UnitHasVehicleUI(self.unit) or false if (unitPossessVehicle) then if (not self.unitInVehicle) then - if (UnitIsUnit ("player", self.unit)) then + if (UnitIsUnit("player", self.unit)) then self.displayedUnit = "vehicle" self.unitInVehicle = true self:RegisterEvents() self:UpdateAllWidgets() return true end - - local prefix, id, suffix = string.match (self.unit, "([^%d]+)([%d]*)(.*)") --CompactUnitFrame.lua + + local prefix, id, suffix = string.match(self.unit, "([^%d]+)([%d]*)(.*)") --CompactUnitFrame.lua local vehicleUnitID = prefix .. "pet" .. id .. suffix - if (UnitExists (vehicleUnitID)) then + if (UnitExists(vehicleUnitID)) then self.displayedUnit = vehicleUnitID self.unitInVehicle = true self:RegisterEvents() @@ -9324,7 +8923,7 @@ end end end end - + if (self.unitInVehicle) then self.displayedUnit = self.unit self.unitInVehicle = nil @@ -9335,25 +8934,24 @@ end --find a color for the health bar, if a color has been passed in the arguments use it instead, 'CanModifyHealhBarColor' must be true for this function run UpdateHealthColor = function(self, r, g, b) - --check if color changes is disabled if (not self.Settings.CanModifyHealhBarColor) then return end - + local unit = self.displayedUnit - + --check if a color has been passed within the parameters if (r) then --check if passed a special color if (type(r) ~= "number") then r, g, b = detailsFramework:ParseColors(r) end - + self:SetHealthBarColor (r, g, b) return end - + --check if there is a color override in the settings if (self.Settings.FixedHealthColor) then local FixedHealthColor = self.Settings.FixedHealthColor @@ -9361,20 +8959,19 @@ end self:SetHealthBarColor (r, g, b) return end - + --check if the unit is a player if (UnitIsPlayer (unit)) then - --check if the unit is disconnected (in case it is a player if (not UnitIsConnected (unit)) then self:SetHealthBarColor (.5, .5, .5) return end - + --is a friendly or enemy player? if (UnitIsFriend ("player", unit)) then if (self.Settings.UseFriendlyClassColor) then - local _, className = UnitClass (unit) + local _, className = UnitClass(unit) if (className) then local classColor = RAID_CLASS_COLORS [className] if (classColor) then @@ -9388,7 +8985,7 @@ end end else if (self.Settings.UseEnemyClassColor) then - local _, className = UnitClass (unit) + local _, className = UnitClass(unit) if (className) then local classColor = RAID_CLASS_COLORS [className] if (classColor) then @@ -9402,13 +8999,13 @@ end end end end - + --is tapped? - if (unit_is_tap_denied (unit)) then + if (isUnitTapDenied (unit)) then self:SetHealthBarColor (.6, .6, .6) return end - + --is this is a npc attacking the player? if (self.Settings.ColorByAggro) then local _, threatStatus = UnitDetailedThreatSituation ("player", unit) @@ -9417,18 +9014,18 @@ end return end end - + -- get the regular color by selection r, g, b = UnitSelectionColor (unit) self:SetHealthBarColor (r, g, b) - end, + end, --misc UpdateName = function(self) if (not self.Settings.ShowUnitName) then return end - + --unit name without realm names by default local name = UnitName (self.unit) self.unitName:SetText(name) @@ -9443,61 +9040,61 @@ end return end - if (UnitIsUnit (self.displayedUnit, "target")) then + if (UnitIsUnit(self.displayedUnit, "target")) then self.targetOverlay:Show() else self.targetOverlay:Hide() end end, - + UpdateAllWidgets = function(self) - if (UnitExists (self.displayedUnit)) then + if (UnitExists(self.displayedUnit)) then local unit = self.unit local displayedUnit = self.displayedUnit - - self:SetUnit (unit, displayedUnit) - + + self:SetUnit(unit, displayedUnit) + --is using castbars? if (self.Settings.ShowCastBar) then - self.castBar:SetUnit (unit, displayedUnit) + self.castBar:SetUnit(unit, displayedUnit) end - + --is using powerbars? if (self.Settings.ShowPowerBar) then - self.powerBar:SetUnit (unit, displayedUnit) + self.powerBar:SetUnit(unit, displayedUnit) end - + self:UpdateName() self:UpdateTargetOverlay() self:UpdateHealthColor() end end, - + --update the unit frame and its widgets UpdateUnitFrame = function(self) local unitInVehicle = self:CheckVehiclePossession() - + --if the unit is inside a vehicle, the vehicle possession function will call an update on all widgets if (not unitInVehicle) then self:UpdateAllWidgets() end end, - + --event handles PLAYER_ENTERING_WORLD = function(self, ...) self:UpdateUnitFrame() end, - + --update overlays when the player changes its target PLAYER_TARGET_CHANGED = function(self, ...) self:UpdateTargetOverlay() end, - + --unit received a name update UNIT_NAME_UPDATE = function(self, ...) self:UpdateName() end, - + --this is registered only if .settings.ColorByAggro is true UNIT_THREAT_LIST_UPDATE = function(self, ...) if (self.Settings.ColorByAggro) then @@ -9506,10 +9103,10 @@ end end, --vehicle - UNIT_ENTERED_VEHICLE = function(self, ...) + UNIT_ENTERED_VEHICLE = function(self, ...) self:UpdateUnitFrame() end, - UNIT_EXITED_VEHICLE = function(self, ...) + UNIT_EXITED_VEHICLE = function(self, ...) self:UpdateUnitFrame() end, @@ -9533,78 +9130,77 @@ end -- ~unitframe local globalBaseFrameLevel = 1 -- to be increased + used across each new plate -function detailsFramework:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarSettingsOverride, castBarSettingsOverride, powerBarSettingsOverride) - - local parentName = name or ("DetailsFrameworkUnitFrame" .. tostring (math.random (1, 100000000))) - +function detailsFramework:CreateUnitFrame(parent, name, unitFrameSettingsOverride, healthBarSettingsOverride, castBarSettingsOverride, powerBarSettingsOverride) + local parentName = name or ("DetailsFrameworkUnitFrame" .. tostring(math.random (1, 100000000))) + --create the main unit frame - local f = CreateFrame("button", parentName, parent, "BackdropTemplate") - + local mewUnitFrame = CreateFrame("button", parentName, parent, "BackdropTemplate") + --base level --local baseFrameLevel = f:GetFrameLevel() local baseFrameLevel = globalBaseFrameLevel globalBaseFrameLevel = globalBaseFrameLevel + 50 - - f:SetFrameLevel(baseFrameLevel) - + + mewUnitFrame:SetFrameLevel(baseFrameLevel) + --create the healthBar - local healthBar = detailsFramework:CreateHealthBar (f, false, healthBarSettingsOverride) + local healthBar = detailsFramework:CreateHealthBar(mewUnitFrame, false, healthBarSettingsOverride) healthBar:SetFrameLevel(baseFrameLevel + 1) - f.healthBar = healthBar - + mewUnitFrame.healthBar = healthBar + --create the power bar - local powerBar = detailsFramework:CreatePowerBar (f, false, powerBarSettingsOverride) + local powerBar = detailsFramework:CreatePowerBar(mewUnitFrame, false, powerBarSettingsOverride) powerBar:SetFrameLevel(baseFrameLevel + 2) - f.powerBar = powerBar - + mewUnitFrame.powerBar = powerBar + --create the castBar - local castBar = detailsFramework:CreateCastBar (f, false, castBarSettingsOverride) + local castBar = detailsFramework:CreateCastBar(mewUnitFrame, false, castBarSettingsOverride) castBar:SetFrameLevel(baseFrameLevel + 3) - f.castBar = castBar - + mewUnitFrame.castBar = castBar + --border frame - local borderFrame = detailsFramework:CreateBorderFrame (f, f:GetName() .. "Border") - borderFrame:SetFrameLevel(f:GetFrameLevel() + 5) - f.border = borderFrame - + local borderFrame = detailsFramework:CreateBorderFrame(mewUnitFrame, mewUnitFrame:GetName() .. "Border") + borderFrame:SetFrameLevel(mewUnitFrame:GetFrameLevel() + 5) + mewUnitFrame.border = borderFrame + --overlay frame (widgets that need to stay above the unit frame) - local overlayFrame = CreateFrame("frame", "$parentOverlayFrame", f, "BackdropTemplate") - overlayFrame:SetFrameLevel(f:GetFrameLevel() + 6) - f.overlayFrame = overlayFrame - + local overlayFrame = CreateFrame("frame", "$parentOverlayFrame", mewUnitFrame, "BackdropTemplate") + overlayFrame:SetFrameLevel(mewUnitFrame:GetFrameLevel() + 6) + mewUnitFrame.overlayFrame = overlayFrame + --unit frame layers do --artwork - f.unitName = f:CreateFontString(nil, "artwork", "GameFontHighlightSmall") - PixelUtil.SetPoint (f.unitName, "topleft", healthBar, "topleft", 2, -2, 1, 1) + mewUnitFrame.unitName = mewUnitFrame:CreateFontString(nil, "artwork", "GameFontHighlightSmall") + PixelUtil.SetPoint(mewUnitFrame.unitName, "topleft", healthBar, "topleft", 2, -2, 1, 1) --target overlay - it's parented in the healthbar so other widgets won't get the overlay - f.targetOverlay = overlayFrame:CreateTexture(nil, "artwork") - f.targetOverlay:SetTexture(healthBar:GetTexture()) - f.targetOverlay:SetBlendMode("ADD") - f.targetOverlay:SetAlpha(.5) - f.targetOverlay:SetAllPoints(healthBar) + mewUnitFrame.targetOverlay = overlayFrame:CreateTexture(nil, "artwork") + mewUnitFrame.targetOverlay:SetTexture(healthBar:GetTexture()) + mewUnitFrame.targetOverlay:SetBlendMode("ADD") + mewUnitFrame.targetOverlay:SetAlpha(.5) + mewUnitFrame.targetOverlay:SetAllPoints(healthBar) end --mixins --inject mixins - detailsFramework:Mixin (f, detailsFramework.UnitFrameFunctions) - + detailsFramework:Mixin(mewUnitFrame, detailsFramework.UnitFrameFunctions) + --create the settings table and copy the overrides into it, the table is set into the frame after the mixin - local unitFrameSettings = detailsFramework.table.copy ({}, detailsFramework.UnitFrameFunctions.Settings) + local unitFrameSettings = detailsFramework.table.copy({}, detailsFramework.UnitFrameFunctions.Settings) if (unitFrameSettingsOverride) then - unitFrameSettings = detailsFramework.table.copy (unitFrameSettings, unitFrameSettingsOverride) + unitFrameSettings = detailsFramework.table.copy(unitFrameSettings, unitFrameSettingsOverride) end - f.Settings = unitFrameSettings + mewUnitFrame.Settings = unitFrameSettings --initialize scripts --unitframe - f:Initialize() + mewUnitFrame:Initialize() - return f + return mewUnitFrame end - - + + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --horizontal scroll frame @@ -9613,43 +9209,43 @@ local timeline_options = { height = 700, line_height = 20, line_padding = 1, - + show_elapsed_timeline = true, elapsed_timeline_height = 20, - + --space to put the player/spell name and icons header_width = 150, - + --how many pixels will be use to represent 1 second pixels_per_second = 20, scale_min = 0.15, scale_max = 1, - + backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdrop_color = {0, 0, 0, 0.2}, backdrop_color_highlight = {.2, .2, .2, 0.4}, backdrop_border_color = {0.1, 0.1, 0.1, .2}, - + slider_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, slider_backdrop_color = {0, 0, 0, 0.2}, slider_backdrop_border_color = {0.1, 0.1, 0.1, .2}, - + title_template = "ORANGE_FONT_TEMPLATE", text_tempate = "OPTIONS_FONT_TEMPLATE", - + on_enter = function(self) self:SetBackdropColor(unpack(self.backdrop_color_highlight)) end, on_leave = function(self) self:SetBackdropColor(unpack(self.backdrop_color)) end, - + block_on_enter = function(self) - - end, + + end, block_on_leave = function(self) - + end, } @@ -9661,9 +9257,9 @@ local elapsedtime_frame_options = { text_size = 12, text_font = "Arial Narrow", text_outline = "NONE", - + height = 20, - + distance = 200, --distance in pixels between each label informing the time distance_min = 50, --minimum distance in pixels draw_line = true, --if true it'll draw a vertical line to represent a segment @@ -9675,20 +9271,20 @@ detailsFramework.TimeLineElapsedTimeFunctions = { --get a label and update its appearance GetLabel = function(self, index) local label = self.labels [index] - + if (not label) then label = self:CreateFontString(nil, "artwork", "GameFontNormal") label.line = self:CreateTexture(nil, "artwork") - label.line:SetColorTexture (1, 1, 1) + label.line:SetColorTexture(1, 1, 1) label.line:SetPoint("topleft", label, "bottomleft", 0, -2) self.labels [index] = label end - + detailsFramework:SetFontColor(label, self.options.text_color) detailsFramework:SetFontSize (label, self.options.text_size) detailsFramework:SetFontFace (label, self.options.text_font) detailsFramework:SetFontOutline (label, self.options.text_outline) - + if (self.options.draw_line) then label.line:SetVertexColor(unpack(self.options.draw_line_color)) label.line:SetWidth(self.options.draw_line_thickness) @@ -9696,45 +9292,45 @@ detailsFramework.TimeLineElapsedTimeFunctions = { else label.line:Hide() end - + return label end, - + Reset = function(self) for i = 1, #self.labels do self.labels [i]:Hide() end end, - + Refresh = function(self, elapsedTime, scale) local parent = self:GetParent() self:SetHeight(self.options.height) local effectiveArea = self:GetWidth() --already scaled down width local pixelPerSecond = elapsedTime / effectiveArea --how much 1 pixels correlate to time - + local distance = self.options.distance --pixels between each segment local minDistance = self.options.distance_min --min pixels between each segment - + --scale the distance between each label showing the time with the parent's scale distance = distance * scale distance = max(distance, minDistance) local amountSegments = ceil (effectiveArea / distance) - + for i = 1, amountSegments do local label = self:GetLabel (i) local xOffset = distance * (i - 1) label:SetPoint("left", self, "left", xOffset, 0) - + local secondsOfTime = pixelPerSecond * xOffset - + label:SetText(detailsFramework:IntegerToTimer (floor(secondsOfTime))) - + if (label.line:IsShown()) then label.line:SetHeight(parent:GetParent():GetHeight()) end - + label:Show() end end, @@ -9743,7 +9339,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { --creates a frame to show the elapsed time in a row function detailsFramework:CreateElapsedTimeFrame(parent, name, options) local elapsedTimeFrame = CreateFrame("frame", name, parent, "BackdropTemplate") - + detailsFramework:Mixin(elapsedTimeFrame, detailsFramework.OptionsFunctions) detailsFramework:Mixin(elapsedTimeFrame, detailsFramework.LayoutFrame) detailsFramework:Mixin(elapsedTimeFrame, detailsFramework.TimeLineElapsedTimeFunctions) @@ -9752,9 +9348,9 @@ function detailsFramework:CreateElapsedTimeFrame(parent, name, options) elapsedTimeFrame:SetBackdrop(elapsedTimeFrame.options.backdrop) elapsedTimeFrame:SetBackdropColor(unpack(elapsedTimeFrame.options.backdrop_color)) - + elapsedTimeFrame.labels = {} - + return elapsedTimeFrame end @@ -9765,46 +9361,46 @@ detailsFramework.TimeLineBlockFunctions = { --get the block information --see what is the current scale --adjust the block position - + local block = self:GetBlock (index) - - --need: + + --need: --the total time of the timeline --the current scale of the timeline --the elapsed time of this block --icon of the block --text --background color - + end, - + SetBlocksFromData = function(self) local parent = self:GetParent():GetParent() local data = parent.data local defaultColor = parent.defaultColor --guarantee to have a value - + self:Show() - + --none of these values are scaled, need to calculate local pixelPerSecond = parent.pixelPerSecond local totalLength = parent.totalLength local scale = parent.currentScale - + pixelPerSecond = pixelPerSecond * scale - + local headerWidth = parent.headerWidth - + --dataIndex stores which line index from the data this line will use --lineData store members: .text .icon .timeline local lineData = data.lines [self.dataIndex] self.spellId = lineData.spellId - + --if there's an icon, anchor the text at the right side of the icon --this is the title and icon of the title if (lineData.icon) then self.icon:SetTexture(lineData.icon) - self.icon:SetTexCoord (.1, .9, .1, .9) + self.icon:SetTexCoord(.1, .9, .1, .9) self.text:SetText(lineData.text or "") self.text:SetPoint("left", self.icon.widget, "right", 2, 0) else @@ -9812,25 +9408,25 @@ detailsFramework.TimeLineBlockFunctions = { self.text:SetText(lineData.text or "") self.text:SetPoint("left", self, "left", 2, 0) end - + if (self.dataIndex % 2 == 1) then self:SetBackdropColor(0, 0, 0, 0) else local r, g, b, a = unpack(self.backdrop_color) self:SetBackdropColor(r, g, b, a) end - + self:SetWidth(5000) - + local timelineData = lineData.timeline local spellId = lineData.spellId local useIconOnBlock = data.useIconOnBlocks - + local baseFrameLevel = parent:GetFrameLevel() + 10 for i = 1, #timelineData do local blockInfo = timelineData [i] - + local timeInSeconds = blockInfo [1] local length = blockInfo [2] local isAura = blockInfo [3] @@ -9840,11 +9436,11 @@ detailsFramework.TimeLineBlockFunctions = { local xOffset = pixelPerSecond * timeInSeconds local width = pixelPerSecond * length - + if (timeInSeconds < -0.2) then xOffset = xOffset / 2.5 end - + local block = self:GetBlock(i) block:Show() block:SetFrameLevel(baseFrameLevel + i) @@ -9855,21 +9451,21 @@ detailsFramework.TimeLineBlockFunctions = { block.info.time = timeInSeconds block.info.duration = auraDuration block.info.payload = payload - + if (useIconOnBlock) then block.icon:SetTexture(lineData.icon) - block.icon:SetTexCoord (.1, .9, .1, .9) + block.icon:SetTexCoord(.1, .9, .1, .9) block.icon:SetAlpha(.834) block.icon:SetSize(self:GetHeight(), self:GetHeight()) - + if (timeInSeconds < -0.2) then block.icon:SetDesaturated(true) else block.icon:SetDesaturated(false) end - + PixelUtil.SetSize(block, self:GetHeight(), self:GetHeight()) - + if (isAura) then block.auraLength:Show() block.auraLength:SetWidth(pixelPerSecond * isAura) @@ -9877,7 +9473,7 @@ detailsFramework.TimeLineBlockFunctions = { else block.auraLength:Hide() end - + block.background:SetVertexColor(0, 0, 0, 0) else block.background:SetVertexColor(0, 0, 0, 0) @@ -9886,42 +9482,42 @@ detailsFramework.TimeLineBlockFunctions = { end end end, - + GetBlock = function(self, index) local block = self.blocks [index] if (not block) then block = CreateFrame("frame", nil, self, "BackdropTemplate") self.blocks [index] = block - + local background = block:CreateTexture(nil, "background") - background:SetColorTexture (1, 1, 1, 1) + background:SetColorTexture(1, 1, 1, 1) local icon = block:CreateTexture(nil, "artwork") local text = block:CreateFontString(nil, "artwork") local auraLength = block:CreateTexture(nil, "border") - + background:SetAllPoints() icon:SetPoint("left") text:SetPoint("left", icon, "left", 2, 0) auraLength:SetPoint("topleft", icon, "topleft", 0, 0) auraLength:SetPoint("bottomleft", icon, "bottomleft", 0, 0) - auraLength:SetColorTexture (1, 1, 1, 1) + auraLength:SetColorTexture(1, 1, 1, 1) auraLength:SetVertexColor(1, 1, 1, 0.1) - + block.icon = icon block.text = text block.background = background block.auraLength = auraLength - + block:SetScript("OnEnter", self:GetParent():GetParent().options.block_on_enter) block:SetScript("OnLeave", self:GetParent():GetParent().options.block_on_leave) - + block:SetMouseClickEnabled(false) block.info = {} end - + return block end, - + Reset = function(self) --attention, it doesn't reset icon texture, text and background color for i = 1, #self.blocks do @@ -9937,7 +9533,7 @@ detailsFramework.TimeLineFunctions = { if (not line) then --create a new line line = CreateFrame("frame", "$parentLine" .. index, self.body, "BackdropTemplate") - detailsFramework:Mixin (line, detailsFramework.TimeLineBlockFunctions) + detailsFramework:Mixin(line, detailsFramework.TimeLineBlockFunctions) self.lines [index] = line local lineHeader = CreateFrame("frame", nil, line, "BackdropTemplate") @@ -9947,12 +9543,12 @@ detailsFramework.TimeLineFunctions = { lineHeader:SetScript("OnLeave", self.options.header_on_leave) line.lineHeader = lineHeader - + --store the individual textures that shows the timeline information line.blocks = {} line.SetBlock = detailsFramework.TimeLineBlockFunctions.SetBlock line.GetBlock = detailsFramework.TimeLineBlockFunctions.GetBlock - + --set its parameters if (self.options.show_elapsed_timeline) then @@ -9961,11 +9557,11 @@ detailsFramework.TimeLineFunctions = { line:SetPoint("topleft", self.body, "topleft", 1, -((index-1) * (self.options.line_height + 1)) - 1) end line:SetSize(1, self.options.line_height) --width is set when updating the frame - + line:SetScript("OnEnter", self.options.on_enter) line:SetScript("OnLeave", self.options.on_leave) line:SetMouseClickEnabled(false) - + line:SetBackdrop(self.options.backdrop) line:SetBackdropColor(unpack(self.options.backdrop_color)) line:SetBackdropBorderColor(unpack(self.options.backdrop_border_color)) @@ -9973,18 +9569,18 @@ detailsFramework.TimeLineFunctions = { local icon = detailsFramework:CreateImage(line, "", self.options.line_height, self.options.line_height) icon:SetPoint("left", line, "left", 2, 0) line.icon = icon - + local text = detailsFramework:CreateLabel(line, "", detailsFramework:GetTemplate("font", self.options.title_template)) text:SetPoint("left", icon.widget, "right", 2, 0) line.text = text - + line.backdrop_color = self.options.backdrop_color or {.1, .1, .1, .3} line.backdrop_color_highlight = self.options.backdrop_color_highlight or {.3, .3, .3, .5} end - + return line end, - + ResetAllLines = function(self) for i = 1, #self.lines do self.lines [i]:Reset() @@ -9992,25 +9588,25 @@ detailsFramework.TimeLineFunctions = { end, AdjustScale = function(self, index) - + end, - + --todo --make the on enter and leave tooltips --set icons and texts --skin the sliders - + RefreshTimeLine = function(self) --debug --self.currentScale = 1 - + --calculate the total width local pixelPerSecond = self.options.pixels_per_second local totalLength = self.data.length or 1 local currentScale = self.currentScale - + self.scaleSlider:Enable() - + --how many pixels represent 1 second local bodyWidth = totalLength * pixelPerSecond * currentScale self.body:SetWidth(bodyWidth + self.options.header_width) @@ -10018,29 +9614,29 @@ detailsFramework.TimeLineFunctions = { --reduce the default canvas size from the body with and don't allow the max value be negative local newMaxValue = max(bodyWidth - (self:GetWidth() - self.options.header_width), 0) - + --adjust the scale slider range local oldMin, oldMax = self.horizontalSlider:GetMinMaxValues() self.horizontalSlider:SetMinMaxValues(0, newMaxValue) self.horizontalSlider:SetValue(detailsFramework:MapRangeClamped(oldMin, oldMax, 0, newMaxValue, self.horizontalSlider:GetValue())) - + local defaultColor = self.data.defaultColor or {1, 1, 1, 1} - + --cache values self.pixelPerSecond = pixelPerSecond self.totalLength = totalLength self.defaultColor = defaultColor self.headerWidth = self.options.header_width - + --calculate the total height local lineHeight = self.options.line_height local linePadding = self.options.line_padding - + local bodyHeight = (lineHeight + linePadding) * #self.data.lines self.body:SetHeight(bodyHeight) self.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) self.verticalSlider:SetValue(0) - + --refresh lines self:ResetAllLines() for i = 1, #self.data.lines do @@ -10049,17 +9645,17 @@ detailsFramework.TimeLineFunctions = { line.lineHeader:SetWidth(self.options.header_width) line:SetBlocksFromData() --the function to update runs within the line object end - + --refresh elapsed time frame --the elapsed frame must have a width before the refresh function is called self.elapsedTimeFrame:ClearAllPoints() self.elapsedTimeFrame:SetPoint("topleft", self.body, "topleft", self.options.header_width, 0) self.elapsedTimeFrame:SetPoint("topright", self.body, "topright", 0, 0) self.elapsedTimeFrame:Reset() - + self.elapsedTimeFrame:Refresh (self.data.length, self.currentScale) end, - + SetData = function(self, data) self.data = data self:RefreshTimeLine() @@ -10091,12 +9687,12 @@ function detailsFramework:CreateTimeLineFrame(parent, name, options, timelineOpt frameCanvas:SetScrollChild(frameBody) frameCanvas.body = frameBody - - frameCanvas:BuildOptionsTable(timeline_options, options) - + + frameCanvas:BuildOptionsTable(timeline_options, options) + --create elapsed time frame frameCanvas.elapsedTimeFrame = detailsFramework:CreateElapsedTimeFrame(frameBody, frameCanvas:GetName() and frameCanvas:GetName() .. "ElapsedTimeFrame", timelineOptions) - + --create horizontal slider local horizontalSlider = CreateFrame("slider", frameCanvas:GetName() .. "HorizontalSlider", parent, "BackdropTemplate") horizontalSlider.bg = horizontalSlider:CreateTexture(nil, "background") @@ -10127,7 +9723,7 @@ function detailsFramework:CreateTimeLineFrame(parent, name, options, timelineOpt frameCanvas:SetHorizontalScroll(stepValue) end end) - + --create scale slider local scaleSlider = CreateFrame("slider", frameCanvas:GetName() .. "ScaleSlider", parent, "BackdropTemplate") scaleSlider.bg = scaleSlider:CreateTexture(nil, "background") @@ -10135,11 +9731,11 @@ function detailsFramework:CreateTimeLineFrame(parent, name, options, timelineOpt scaleSlider.bg:SetTexture(0, 0, 0, 0.5) scaleSlider:Disable() frameCanvas.scaleSlider = scaleSlider - + scaleSlider:SetBackdrop(frameCanvas.options.slider_backdrop) scaleSlider:SetBackdropColor(unpack(frameCanvas.options.slider_backdrop_color)) scaleSlider:SetBackdropBorderColor(unpack(frameCanvas.options.slider_backdrop_border_color)) - + scaleSlider.thumb = scaleSlider:CreateTexture(nil, "OVERLAY") scaleSlider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") scaleSlider.thumb:SetSize(24, 24) @@ -10167,11 +9763,11 @@ function detailsFramework:CreateTimeLineFrame(parent, name, options, timelineOpt verticalSlider.bg:SetAllPoints(true) verticalSlider.bg:SetTexture(0, 0, 0, 0.5) frameCanvas.verticalSlider = verticalSlider - + verticalSlider:SetBackdrop(frameCanvas.options.slider_backdrop) verticalSlider:SetBackdropColor(unpack(frameCanvas.options.slider_backdrop_color)) verticalSlider:SetBackdropBorderColor(unpack(frameCanvas.options.slider_backdrop_border_color)) - + verticalSlider.thumb = verticalSlider:CreateTexture(nil, "OVERLAY") verticalSlider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") verticalSlider.thumb:SetSize(24, 24) @@ -10192,29 +9788,29 @@ function detailsFramework:CreateTimeLineFrame(parent, name, options, timelineOpt frameCanvas:SetScript("OnMouseWheel", function(self, delta) local minValue, maxValue = horizontalSlider:GetMinMaxValues() local currentHorizontal = horizontalSlider:GetValue() - + if (IsShiftKeyDown() and delta < 0) then local amountToScroll = frameBody:GetHeight() / 20 verticalSlider:SetValue(verticalSlider:GetValue() + amountToScroll) - + elseif (IsShiftKeyDown() and delta > 0) then local amountToScroll = frameBody:GetHeight() / 20 verticalSlider:SetValue(verticalSlider:GetValue() - amountToScroll) - + elseif (IsControlKeyDown() and delta > 0) then scaleSlider:SetValue(min(scaleSlider:GetValue() + 0.1, 1)) - + elseif (IsControlKeyDown() and delta < 0) then scaleSlider:SetValue(max(scaleSlider:GetValue() - 0.1, 0.15)) - + elseif (delta < 0 and currentHorizontal < maxValue) then local amountToScroll = frameBody:GetWidth() / 20 horizontalSlider:SetValue(currentHorizontal + amountToScroll) - + elseif (delta > 0 and maxValue > 1) then local amountToScroll = frameBody:GetWidth() / 20 horizontalSlider:SetValue(currentHorizontal - amountToScroll) - + end end) @@ -10274,9 +9870,9 @@ f:Hide() --error message box function detailsFramework:ShowErrorMessage (errorMessage, titleText) - + if (not detailsFramework.ErrorMessagePanel) then - local f = CreateFrame("frame", "DetailsFrameworkErrorMessagePanel", UIParent, "BackdropTemplate") + local f = CreateFrame("frame", "DetailsFrameworkErrorMessagePanel", UIParent, "BackdropTemplate") f:SetSize(400, 120) f:SetFrameStrata("FULLSCREEN") f:SetPoint("center", UIParent, "center", 0, 100) @@ -10288,10 +9884,10 @@ function detailsFramework:ShowErrorMessage (errorMessage, titleText) f:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then f:Hide() end end) tinsert(UISpecialFrames, "DetailsFrameworkErrorMessagePanel") detailsFramework.ErrorMessagePanel = f - + detailsFramework:CreateTitleBar (f, "Details! Framework Error!") detailsFramework:ApplyStandardBackdrop(f) - + local errorLabel = f:CreateFontString(nil, "overlay", "GameFontNormal") errorLabel:SetPoint("top", f, "top", 0, -25) errorLabel:SetJustifyH("center") @@ -10304,29 +9900,29 @@ function detailsFramework:ShowErrorMessage (errorMessage, titleText) local closeButton = detailsFramework:CreateButton(f, nil, 60, 20, "close", nil, nil, nil, nil, nil, nil, options_dropdown_template) closeButton:SetPoint("bottom", f, "bottom", 0, 5) f.closeButton = closeButton - + closeButton:SetClickFunction(function() f:Hide() end) - f.ShowAnimation = detailsFramework:CreateAnimationHub (f, function() - f:SetBackdropBorderColor(0, 0, 0, 0) - f.TitleBar:SetBackdropBorderColor(0, 0, 0, 0) - end, function() - f:SetBackdropBorderColor(0, 0, 0, 1) - f.TitleBar:SetBackdropBorderColor(0, 0, 0, 1) + f.ShowAnimation = detailsFramework:CreateAnimationHub (f, function() + f:SetBackdropBorderColor(0, 0, 0, 0) + f.TitleBar:SetBackdropBorderColor(0, 0, 0, 0) + end, function() + f:SetBackdropBorderColor(0, 0, 0, 1) + f.TitleBar:SetBackdropBorderColor(0, 0, 0, 1) end) detailsFramework:CreateAnimation(f.ShowAnimation, "scale", 1, .075, .2, .2, 1.1, 1.1, "center", 0, 0) detailsFramework:CreateAnimation(f.ShowAnimation, "scale", 2, .075, 1, 1, .90, .90, "center", 0, 0) - + f.FlashTexture = f:CreateTexture(nil, "overlay") - f.FlashTexture:SetColorTexture (1, 1, 1, 1) + f.FlashTexture:SetColorTexture(1, 1, 1, 1) f.FlashTexture:SetAllPoints() - + f.FlashAnimation = detailsFramework:CreateAnimationHub (f.FlashTexture, function() f.FlashTexture:Show() end, function() f.FlashTexture:Hide() end) detailsFramework:CreateAnimation(f.FlashAnimation, "alpha", 1, .075, 0, .05) detailsFramework:CreateAnimation(f.FlashAnimation, "alpha", 2, .075, .1, 0) - + f:Hide() end @@ -10363,7 +9959,7 @@ function detailsFramework:SetPointOffsets(frame, xOffset, yOffset) if (y >= 0) then yOffset = y + yOffset - + elseif (y < 0) then yOffset = y - yOffset end @@ -10531,9 +10127,9 @@ function detailsFramework:CreateListBox(parent, name, data, options, headerTable frameCanvas.headerLength = #headerTable --add the detele line column into the header frame - tinsert(headerTable, 1, {text = "#", width = 20, isIndex = true}) --isDelete signals the createScrollLine() to make the delete button for the line - tinsert(headerTable, {text = "Delete", width = 50, isDelete = true}) --isDelete signals the createScrollLine() to make the delete button for the line - + tinsert(headerTable, 1, {text = "#", width = 20, isIndex = true}) --isDelete signals the createScrollLine() to make the delete button for the line + tinsert(headerTable, {text = "Delete", width = 50, isDelete = true}) --isDelete signals the createScrollLine() to make the delete button for the line + local header = detailsFramework:CreateHeader(frameCanvas, headerTable, headerOptions) --set the header point header:SetPoint("topleft", frameCanvas, "topleft", 5, -5) @@ -10592,14 +10188,14 @@ end local pframe = ListBoxTest or CreateFrame("frame", "ListBoxTest", UIParent) pframe:SetSize(900, 700) pframe:SetPoint("left") - + local data = {{254154, "spell name 1", 45}, {299154, "spell name 2", 05}, {354154, "spell name 3", 99}} local headerTable = { {text = "spell id", width = 120}, {text = "spell name", width = 180}, {text = "number", width = 90}, } - + local listbox = DetailsFramework:CreateListBox(pframe, "$parentlistbox", data, nil, headerTable, nil) listbox:SetPoint("topleft", pframe, "topleft", 10, -10) diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 87e0906e..7dfaf7be 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -10,8 +10,6 @@ local APIImageFunctions = false do local metaPrototype = { WidgetType = "image", - SetHook = detailsFramework.SetHook, - RunHooksForWidget = detailsFramework.RunHooksForWidget, dversion = detailsFramework.dversion, } @@ -36,6 +34,7 @@ end local ImageMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["image"]] detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.SetPointMixin) +detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables diff --git a/Libs/DF/pictureedit.lua b/Libs/DF/pictureedit.lua index 5f936904..c9f89d92 100644 --- a/Libs/DF/pictureedit.lua +++ b/Libs/DF/pictureedit.lua @@ -26,11 +26,11 @@ local CreateImageEditorFrame = function() editorWindow.hooks = {} - local background = DF:NewImage (editorWindow, nil, nil, nil, "background", nil, "background", "$parentBackground") + local background = DF:NewImage(editorWindow, nil, nil, nil, "background", nil, "background", "$parentBackground") background:SetAllPoints() background:SetTexture(0, 0, 0, .8) - local edit_texture = DF:NewImage (editorWindow, nil, 500, 500, "artwork", nil, "edit_texture", "$parentImage") + local edit_texture = DF:NewImage(editorWindow, nil, 500, 500, "artwork", nil, "edit_texture", "$parentImage") edit_texture:SetAllPoints() _G.DetailsFrameworkImageEdit_EditTexture = edit_texture @@ -63,7 +63,7 @@ local CreateImageEditorFrame = function() --Top Slider - local topCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageTopCoord") + local topCoordTexture = DF:NewImage(editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageTopCoord") topCoordTexture:SetPoint("topleft", editorWindow, "topleft") topCoordTexture:SetPoint("topright", editorWindow, "topright") topCoordTexture:SetColorTexture(1, 0, 0) @@ -95,7 +95,7 @@ local CreateImageEditorFrame = function() --Bottom Slider - local bottomCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageBottomCoord") + local bottomCoordTexture = DF:NewImage(editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageBottomCoord") bottomCoordTexture:SetPoint("bottomleft", editorWindow, "bottomleft", 0, 0) bottomCoordTexture:SetPoint("bottomright", editorWindow, "bottomright", 0, 0) bottomCoordTexture:SetColorTexture(1, 0, 0) @@ -128,7 +128,7 @@ local CreateImageEditorFrame = function() --Left Slider - local leftCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageLeftCoord") + local leftCoordTexture = DF:NewImage(editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageLeftCoord") leftCoordTexture:SetPoint("topleft", editorWindow, "topleft", 0, 0) leftCoordTexture:SetPoint("bottomleft", editorWindow, "bottomleft", 0, 0) leftCoordTexture:SetColorTexture(1, 0, 0) @@ -159,7 +159,7 @@ local CreateImageEditorFrame = function() --Right Slider - local rightCoordTexture = DF:NewImage (editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageRightCoord") + local rightCoordTexture = DF:NewImage(editorWindow, nil, nil, nil, "overlay", nil, nil, "$parentImageRightCoord") rightCoordTexture:SetPoint("topright", editorWindow, "topright", 0, 0) rightCoordTexture:SetPoint("bottomright", editorWindow, "bottomright", 0, 0) rightCoordTexture:SetColorTexture(1, 0, 0) @@ -211,7 +211,7 @@ local CreateImageEditorFrame = function() if (alphaFrameShown) then alphaFrame:Hide() alphaFrameShown = false - button.text:SetTextColor (unpack(originalColor)) + button.text:SetTextColor(unpack(originalColor)) end if (ColorPickerFrame:IsShown()) then @@ -219,7 +219,7 @@ local CreateImageEditorFrame = function() end if (lastButton) then - lastButton.text:SetTextColor (unpack(originalColor)) + lastButton.text:SetTextColor(unpack(originalColor)) end if (editingSide == side) then @@ -232,7 +232,7 @@ local CreateImageEditorFrame = function() end editingSide = side - button.text:SetTextColor (1, 1, 1) + button.text:SetTextColor(1, 1, 1) lastButton = button editorWindow [side.."Slider"]:Show() @@ -296,11 +296,11 @@ local CreateImageEditorFrame = function() if (alphaFrameShown) then alphaFrame:Hide() alphaFrameShown = false - Alpha.button.text:SetTextColor (unpack(originalColor)) + Alpha.button.text:SetTextColor(unpack(originalColor)) end if (lastButton) then - lastButton.text:SetTextColor (unpack(originalColor)) + lastButton.text:SetTextColor(unpack(originalColor)) if (editingSide) then editorWindow [editingSide.."Slider"]:Hide() end @@ -328,7 +328,7 @@ local CreateImageEditorFrame = function() end if (lastButton) then - lastButton.text:SetTextColor (unpack(originalColor)) + lastButton.text:SetTextColor(unpack(originalColor)) if (editingSide) then editorWindow [editingSide.."Slider"]:Hide() end @@ -338,11 +338,11 @@ local CreateImageEditorFrame = function() alphaFrame:Show() alphaSlider:SetValue(edit_texture:GetAlpha()*100) alphaFrameShown = true - button.text:SetTextColor (1, 1, 1) + button.text:SetTextColor(1, 1, 1) else alphaFrame:Hide() alphaFrameShown = false - button.text:SetTextColor (unpack(originalColor)) + button.text:SetTextColor(unpack(originalColor)) end end @@ -358,8 +358,8 @@ local CreateImageEditorFrame = function() local resizer = CreateFrame("Button", nil, editorWindow.widget, "BackdropTemplate") resizer:SetNormalTexture([[Interface\AddOns\Details\images\skins\default_skin]]) resizer:SetHighlightTexture([[Interface\AddOns\Details\images\skins\default_skin]]) - resizer:GetNormalTexture():SetTexCoord (0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375) - resizer:GetHighlightTexture():SetTexCoord (0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375) + resizer:GetNormalTexture():SetTexCoord(0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375) + resizer:GetHighlightTexture():SetTexCoord(0.00146484375, 0.01513671875, 0.24560546875, 0.25927734375) resizer:SetWidth(16) resizer:SetHeight(16) resizer:SetPoint("BOTTOMRIGHT", editorWindow.widget, "BOTTOMRIGHT", 0, 0) diff --git a/Libs/DF/slider.lua b/Libs/DF/slider.lua index 5d94f856..35b5405b 100644 --- a/Libs/DF/slider.lua +++ b/Libs/DF/slider.lua @@ -10,10 +10,6 @@ local APISliderFunctions = false do local metaPrototype = { WidgetType = "slider", - SetHook = DF.SetHook, - HasHook = DF.HasHook, - ClearHooks = DF.ClearHooks, - RunHooksForWidget = DF.RunHooksForWidget, dversion = DF.dversion } @@ -39,6 +35,8 @@ local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames["slider"]] DF:Mixin(DFSliderMetaFunctions, DF.SetPointMixin) DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) +DF:Mixin(DFSliderMetaFunctions, DF.TooltipHandlerMixin) +DF:Mixin(DFSliderMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables @@ -59,6 +57,7 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) end return object.slider:GetValue() + else if (object.isSwitch) then if (type(value) == "boolean") then @@ -130,9 +129,9 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) return func(object, key) end - local fromMe = rawget(object, key) - if (fromMe) then - return fromMe + local alreadyHaveKey = rawget(object, key) + if (alreadyHaveKey) then + return alreadyHaveKey end return DFSliderMetaFunctions[key] @@ -219,7 +218,6 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) ------------------------------------------------------------------------------------------------------------ --methods - --fixed value function DFSliderMetaFunctions:SetFixedParameter(value) rawset(self, "FixedValue", value) @@ -241,18 +239,6 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) return self.thumb:SetSize(width, height) end - --tooltip - function DFSliderMetaFunctions:SetTooltip(tooltip) - if (tooltip) then - return rawset(self, "have_tooltip", tooltip) - else - return rawset(self, "have_tooltip", nil) - end - end - function DFSliderMetaFunctions:GetTooltip() - return rawget(self, "have_tooltip") - end - --clear focus function DFSliderMetaFunctions:ClearFocus() local editbox = DFSliderMetaFunctions.editbox_typevalue @@ -271,6 +257,7 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) function DFSliderMetaFunctions:Enable() self.slider:Enable() + if (not self.is_checkbox) then if (not self.lock_texture) then DF:NewImage(self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") @@ -279,12 +266,14 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) end self.lock_texture:Hide() end + self.slider.amt:Show() self:SetAlpha(1) if (self.is_checkbox) then self.checked_texture:Show() end + return rawset(self, "lockdown", false) end @@ -296,10 +285,11 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) if (not self.is_checkbox) then if (not self.lock_texture) then - DF:NewImage (self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") + DF:NewImage(self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") self.lock_texture:SetDesaturated(true) self.lock_texture:SetPoint("center", self.amt, "center") end + self.lock_texture:Show() end @@ -314,297 +304,289 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) --scripts local OnEnter = function(slider) - if (rawget (slider.MyObject, "lockdown")) then + local object = slider.MyObject + + if (rawget(object, "lockdown")) then return end - + DetailsFrameworkSliderButtons1:ShowMe(slider) - - local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnEnter", slider, capsule) + + local kill = object:RunHooksForWidget("OnEnter", slider, object) if (kill) then return end slider.thumb:SetAlpha(1) - - if (slider.MyObject.onenter_backdrop_border_color) then - slider:SetBackdropBorderColor(unpack(slider.MyObject.onenter_backdrop_border_color)) - end - - if (slider.MyObject.have_tooltip and slider.MyObject.have_tooltip ~= "Right Click to Type the Value") then - GameCooltip2:Preset(2) - GameCooltip2:AddLine(slider.MyObject.have_tooltip) - GameCooltip2:ShowCooltip(slider, "tooltip") - else - GameCooltip2:Preset(2) - GameCooltip2:AddLine("Right Click to Type the Value", "", 1, "", "", 10) - GameCooltip2:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 16, 16, 0.015625, 0.15671875, 0.640625, 0.798828125) - GameCooltip2:ShowCooltip(slider, "tooltip") + + if (object.onenter_backdrop_border_color) then + slider:SetBackdropBorderColor(unpack(object.onenter_backdrop_border_color)) end + + object:ShowTooltip() end - + local OnLeave = function(slider) - - if (rawget (slider.MyObject, "lockdown")) then + local object = slider.MyObject + + if (rawget(object, "lockdown")) then return end - + DetailsFrameworkSliderButtons1:PrepareToHide() - - local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnLeave", slider, capsule) + + local kill = object:RunHooksForWidget("OnLeave", slider, object) if (kill) then return end - + slider.thumb:SetAlpha(.7) - - if (slider.MyObject.onleave_backdrop_border_color) then - slider:SetBackdropBorderColor(unpack(slider.MyObject.onleave_backdrop_border_color)) + + if (object.onleave_backdrop_border_color) then + slider:SetBackdropBorderColor(unpack(object.onleave_backdrop_border_color)) end - - GameCooltip2:ShowMe(false) + object:HideTooltip() end - - local f = DetailsFrameworkSliderButtons1 or CreateFrame("frame", "DetailsFrameworkSliderButtons1", UIParent, "BackdropTemplate") - f:Hide() - f:SetHeight(18) - local t = 0 - f.isGoingToHide = false - local goingHide = function(self, elapsed) - t = t + elapsed - if (t > 0.3) then - f:Hide() - f:SetScript("OnUpdate", nil) - f.isGoingToHide = false + --parent frame for the plus and minus buttons which shows when the slider is hovered over + local sliderButtonsParentFrame = DetailsFrameworkSliderButtons1 or CreateFrame("frame", "DetailsFrameworkSliderButtons1", UIParent, "BackdropTemplate") + sliderButtonsParentFrame:Hide() + sliderButtonsParentFrame:SetHeight(18) --width is set by setpoint + sliderButtonsParentFrame.isGoingToHide = false + + local timeToHide = 0 + local onUpdateTimeToHide = function(self, elapsed) + timeToHide = timeToHide + elapsed + if (timeToHide > 0.3) then + sliderButtonsParentFrame:Hide() + sliderButtonsParentFrame:SetScript("OnUpdate", nil) + sliderButtonsParentFrame.isGoingToHide = false end end - function f:ShowMe(host) - f:SetParent(host) - f:ClearAllPoints() - f:SetPoint("bottomleft", host, "topleft", -5, -5) - f:SetPoint("bottomright", host, "topright", 5, -5) + function sliderButtonsParentFrame:ShowMe(sliderFrame) + sliderButtonsParentFrame:SetParent(sliderFrame) + sliderButtonsParentFrame:ClearAllPoints() + sliderButtonsParentFrame:SetPoint("bottomleft", sliderFrame, "topleft", -5, -5) + sliderButtonsParentFrame:SetPoint("bottomright", sliderFrame, "topright", 5, -5) - f:SetFrameStrata("FULLSCREEN") - f:SetFrameLevel(host:GetFrameLevel() + 1000) - f:Show() - if (f.isGoingToHide) then - f:SetScript("OnUpdate", nil) - f.isGoingToHide = false + sliderButtonsParentFrame:SetFrameStrata("FULLSCREEN") + sliderButtonsParentFrame:SetFrameLevel(sliderFrame:GetFrameLevel() + 1000) + sliderButtonsParentFrame:Show() + + if (sliderButtonsParentFrame.isGoingToHide) then + sliderButtonsParentFrame:SetScript("OnUpdate", nil) + sliderButtonsParentFrame.isGoingToHide = false end - f.host = host.MyObject + sliderButtonsParentFrame.host = sliderFrame.MyObject end - - function f:PrepareToHide() - f.isGoingToHide = true - t = 0 - f:SetScript("OnUpdate", goingHide) + + function sliderButtonsParentFrame:PrepareToHide() + sliderButtonsParentFrame.isGoingToHide = true + timeToHide = 0 + sliderButtonsParentFrame:SetScript("OnUpdate", onUpdateTimeToHide) end - - local buttonPlus = CreateFrame("button", "DetailsFrameworkSliderButtonsPlusButton", f, "BackdropTemplate") - local buttonMinor = CreateFrame("button", "DetailsFrameworkSliderButtonsMinorButton", f, "BackdropTemplate") - buttonPlus:SetFrameStrata(f:GetFrameStrata()) - buttonMinor:SetFrameStrata(f:GetFrameStrata()) - + + local buttonPlus = CreateFrame("button", "DetailsFrameworkSliderButtonsPlusButton", sliderButtonsParentFrame, "BackdropTemplate") + local buttonMinor = CreateFrame("button", "DetailsFrameworkSliderButtonsMinorButton", sliderButtonsParentFrame, "BackdropTemplate") + buttonPlus:SetFrameStrata(sliderButtonsParentFrame:GetFrameStrata()) + buttonMinor:SetFrameStrata(sliderButtonsParentFrame:GetFrameStrata()) + buttonPlus:SetScript("OnEnter", function(self) - if (f.isGoingToHide) then - f:SetScript("OnUpdate", nil) - f.isGoingToHide = false + if (sliderButtonsParentFrame.isGoingToHide) then + sliderButtonsParentFrame:SetScript("OnUpdate", nil) + sliderButtonsParentFrame.isGoingToHide = false end end) buttonMinor:SetScript("OnEnter", function(self) - if (f.isGoingToHide) then - f:SetScript("OnUpdate", nil) - f.isGoingToHide = false + if (sliderButtonsParentFrame.isGoingToHide) then + sliderButtonsParentFrame:SetScript("OnUpdate", nil) + sliderButtonsParentFrame.isGoingToHide = false end end) - + buttonPlus:SetScript("OnLeave", function(self) - f:PrepareToHide() + sliderButtonsParentFrame:PrepareToHide() end) buttonMinor:SetScript("OnLeave", function(self) - f:PrepareToHide() + sliderButtonsParentFrame:PrepareToHide() end) - + buttonPlus:SetNormalTexture([[Interface\Buttons\UI-PlusButton-Up]]) buttonMinor:SetNormalTexture([[Interface\Buttons\UI-MinusButton-Up]]) - + buttonPlus:SetPushedTexture([[Interface\Buttons\UI-PlusButton-Down]]) buttonMinor:SetPushedTexture([[Interface\Buttons\UI-MinusButton-Down]]) - + buttonPlus:SetDisabledTexture ([[Interface\Buttons\UI-PlusButton-Disabled]]) buttonMinor:SetDisabledTexture ([[Interface\Buttons\UI-MinusButton-Disabled]]) - + buttonPlus:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) buttonMinor:SetHighlightTexture([[Interface\Buttons\UI-PlusButton-Hilight]]) local plusNormalTexture = buttonPlus:GetNormalTexture() plusNormalTexture:SetDesaturated(true) + local minorNormalTexture = buttonMinor:GetNormalTexture() minorNormalTexture:SetDesaturated(true) buttonMinor:ClearAllPoints() buttonPlus:ClearAllPoints() - buttonMinor:SetPoint("bottomright", f, "bottomright", 13, -13) + buttonMinor:SetPoint("bottomright", sliderButtonsParentFrame, "bottomright", 13, -13) buttonPlus:SetPoint("left", buttonMinor, "right", -2, 0) - + buttonPlus:SetSize(16, 16) buttonMinor:SetSize(16, 16) - - local timer = 0 - local change_timer = 0 - - -- -- -- - - local plus_button_script = function() - local current = f.host.value - local editbox = DFSliderMetaFunctions.editbox_typevalue - - if (f.host.fine_tuning) then - f.host:SetValue(current + f.host.fine_tuning) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (string.format("%.2f", current + f.host.fine_tuning))) + --increate the value on pressing the button or holding the button pressed + local buttonPlusOnClick = function() + local sliderObject = sliderButtonsParentFrame.host + local currentValueOnSlider = sliderObject.value + local editboxShowingValue = DFSliderMetaFunctions.editbox_typevalue + + if (sliderObject.fine_tuning) then + sliderObject:SetValue(currentValueOnSlider + sliderObject.fine_tuning) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(string.format("%.2f", currentValueOnSlider + sliderObject.fine_tuning))) end else - if (f.host.useDecimals) then - f.host:SetValue(current + 0.1) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(string.format("%.2f", current + 0.1)) + if (sliderObject.useDecimals) then + sliderObject:SetValue(currentValueOnSlider + 0.1) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(string.format("%.2f", currentValueOnSlider + 0.1)) end else - f.host:SetValue(current + 1) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (math.floor(current + 1))) + sliderObject:SetValue(currentValueOnSlider + 1) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(math.floor(currentValueOnSlider + 1))) end end end - end - + buttonPlus:SetScript("OnMouseUp", function(self) if (not buttonPlus.got_click) then - plus_button_script() + buttonPlusOnClick() end buttonPlus.got_click = false self:SetScript("OnUpdate", nil) end) - - local on_update = function(self, elapsed) - timer = timer + elapsed - if (timer > 0.4) then - change_timer = change_timer + elapsed - if (change_timer > 0.1) then - change_timer = 0 - plus_button_script() + + --hold the plus or minus button for x amount of time before start changing the value + local delayBeforeStartSimulatingClicks = 0 + --after the delay been passed, trigger a click each x seconds + local simulateClickTimer = 0 + + local buttonPlusOnUpdate = function(self, deltaTime) + delayBeforeStartSimulatingClicks = delayBeforeStartSimulatingClicks + deltaTime + if (delayBeforeStartSimulatingClicks > 0.4) then + simulateClickTimer = simulateClickTimer + deltaTime + if (simulateClickTimer > 0.1) then + simulateClickTimer = 0 + buttonPlusOnClick() buttonPlus.got_click = true end end end + buttonPlus:SetScript("OnMouseDown", function(self) - timer = 0 - change_timer = 0 - self:SetScript("OnUpdate", on_update) + delayBeforeStartSimulatingClicks = 0 + simulateClickTimer = 0 + self:SetScript("OnUpdate", buttonPlusOnUpdate) end) - + -- -- -- - - local minor_button_script = function() - local current = f.host.value - local editbox = DFSliderMetaFunctions.editbox_typevalue - - if (f.host.fine_tuning) then - f.host:SetValue(current - f.host.fine_tuning) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (string.format("%.2f", current - f.host.fine_tuning))) + + --increate the value on pressing the button or holding the button pressed + local buttonMinusOnClick = function() + local sliderObject = sliderButtonsParentFrame.host + local currentValueOnSlider = sliderObject.value + local editboxShowingValue = DFSliderMetaFunctions.editbox_typevalue + + if (sliderObject.fine_tuning) then + sliderObject:SetValue(currentValueOnSlider - sliderObject.fine_tuning) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(string.format("%.2f", currentValueOnSlider - sliderObject.fine_tuning))) end else - if (f.host.useDecimals) then - f.host:SetValue(current - 0.1) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(string.format("%.2f", current - 0.1)) + if (sliderObject.useDecimals) then + sliderObject:SetValue(currentValueOnSlider - 0.1) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(string.format("%.2f", currentValueOnSlider - 0.1)) end else - f.host:SetValue(current - 1) - if (editbox and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (math.floor(current - 1))) + sliderObject:SetValue(currentValueOnSlider - 1) + if (editboxShowingValue and DFSliderMetaFunctions.editbox_typevalue:IsShown()) then + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(math.floor(currentValueOnSlider - 1))) end end end end - + buttonMinor:SetScript("OnMouseUp", function(self) if (not buttonMinor.got_click) then - minor_button_script() + buttonMinusOnClick() end buttonMinor.got_click = false self:SetScript("OnUpdate", nil) end) - - local on_update = function(self, elapsed) - timer = timer + elapsed - if (timer > 0.4) then - change_timer = change_timer + elapsed - if (change_timer > 0.1) then - change_timer = 0 - minor_button_script() + + local buttonMinusOnUpdate = function(self, elapsed) + delayBeforeStartSimulatingClicks = delayBeforeStartSimulatingClicks + elapsed + if (delayBeforeStartSimulatingClicks > 0.4) then + simulateClickTimer = simulateClickTimer + elapsed + if (simulateClickTimer > 0.1) then + simulateClickTimer = 0 + buttonMinusOnClick() buttonMinor.got_click = true end end end buttonMinor:SetScript("OnMouseDown", function(self) - timer = 0 - change_timer = 0 - self:SetScript("OnUpdate", on_update) + delayBeforeStartSimulatingClicks = 0 + simulateClickTimer = 0 + self:SetScript("OnUpdate", buttonMinusOnUpdate) end) - + local do_precision = function(text) - if (type(text) == "string" and text:find ("%.")) then + if (type(text) == "string" and text:find("%.")) then local left, right = strsplit(".", text) - left = tonumber (left) - right = tonumber (right) - + left = tonumber(left) + right = tonumber(right) + if (left and right) then - local newString = tostring (left) .. "." .. tostring (right) - local newNumber = tonumber (newString) - + local newString = tostring(left) .. "." .. tostring(right) + local newNumber = tonumber(newString) + if (newNumber) then return newNumber end end end - - return tonumber (text) + + return tonumber(text) end DF.TextToFloor = do_precision - + function DFSliderMetaFunctions:TypeValue() if (not self.isSwitch) then - if (not DFSliderMetaFunctions.editbox_typevalue) then - local editbox = CreateFrame("EditBox", "DetailsFrameworkSliderEditBox", UIParent, "BackdropTemplate") - editbox:SetSize(40, 20) editbox:SetJustifyH("center") - editbox:SetBackdrop({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], - edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", --edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], - tile = true, edgeSize = 8, tileSize = 5}) - editbox:SetFontObject ("GameFontHighlightSmall") + DF:ApplyStandardBackdrop(editbox) + editbox:SetFontObject("GameFontHighlightSmall") editbox:SetScript("OnEnterPressed", function() editbox:ClearFocus() editbox:Hide() editbox:GetParent().MyObject.typing_value = false - editbox:GetParent().MyObject.value = tonumber (editbox:GetText()) --do_precision (editbox:GetText()) + editbox:GetParent().MyObject.value = tonumber(editbox:GetText()) --do_precision (editbox:GetText()) end) - + editbox:SetScript("OnEscapePressed", function() editbox:ClearFocus() editbox:Hide() @@ -614,88 +596,88 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) editbox:SetScript("OnTextChanged", function() editbox:GetParent().MyObject.typing_can_change = true - editbox:GetParent().MyObject.value = tonumber (editbox:GetText()) --do_precision + editbox:GetParent().MyObject.value = tonumber(editbox:GetText()) --do_precision editbox:GetParent().MyObject.typing_can_change = false end) - + DFSliderMetaFunctions.editbox_typevalue = editbox end - + local pvalue = self.previous_value [2] self:SetValue(pvalue) - + self.typing_value = true self.typing_value_started = pvalue - + DFSliderMetaFunctions.editbox_typevalue:SetSize(self.width, self.height) DFSliderMetaFunctions.editbox_typevalue:SetPoint("center", self.widget, "center") DFSliderMetaFunctions.editbox_typevalue:SetFocus() DFSliderMetaFunctions.editbox_typevalue:SetParent(self.widget) DFSliderMetaFunctions.editbox_typevalue:SetFrameLevel(self.widget:GetFrameLevel()+1) - + if (self.useDecimals) then - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (string.format("%.1f", self.value))) + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(string.format("%.1f", self.value))) else - DFSliderMetaFunctions.editbox_typevalue:SetText(tostring (math.floor(self.value))) + DFSliderMetaFunctions.editbox_typevalue:SetText(tostring(math.floor(self.value))) end - + DFSliderMetaFunctions.editbox_typevalue:HighlightText() - + DFSliderMetaFunctions.editbox_typevalue:Show() end end - + local OnMouseDown = function(slider, button) slider.MyObject.IsValueChanging = true - + local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseDown", slider, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseDown", slider, button, capsule) if (kill) then return end - + if (button == "RightButton") then slider.MyObject:TypeValue() end end - + local OnMouseUp = function(slider, button) slider.MyObject.IsValueChanging = nil - + local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseUp", slider, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseUp", slider, button, capsule) if (kill) then return end end - + local OnHide = function(slider) local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnHide", slider, capsule) + local kill = capsule:RunHooksForWidget("OnHide", slider, capsule) if (kill) then return end - + if (slider.MyObject.typing_value) then DFSliderMetaFunctions.editbox_typevalue:ClearFocus() DFSliderMetaFunctions.editbox_typevalue:SetText("") slider.MyObject.typing_valu = false end end - + local OnShow = function(slider) local capsule = slider.MyObject - local kill = capsule:RunHooksForWidget ("OnShow", slider, capsule) + local kill = capsule:RunHooksForWidget("OnShow", slider, capsule) if (kill) then return end end - + local table_insert = table.insert local table_remove = table.remove - + local OnValueChanged = function(slider) - + local amt if (slider.MyObject.useDecimals) then amt = slider:GetValue() @@ -710,27 +692,27 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) table_insert (slider.MyObject.previous_value, 1, amt) table_remove (slider.MyObject.previous_value, 4) - + local capsule = slider.MyObject --some plugins registered OnValueChanged and others with OnValueChange - local kill = capsule:RunHooksForWidget ("OnValueChanged", slider, capsule.FixedValue, amt, capsule) + local kill = capsule:RunHooksForWidget("OnValueChanged", slider, capsule.FixedValue, amt, capsule) if (kill) then return end - local kill = capsule:RunHooksForWidget ("OnValueChange", slider, capsule.FixedValue, amt, capsule) + local kill = capsule:RunHooksForWidget("OnValueChange", slider, capsule.FixedValue, amt, capsule) if (kill) then return - end - + end + if (slider.MyObject.OnValueChanged) then slider.MyObject.OnValueChanged (slider, slider.MyObject.FixedValue, amt) end - + if (amt < 10 and amt >= 1) then amt = "0"..amt end - + if (slider.MyObject.useDecimals) then slider.amt:SetText(string.format("%.2f", amt)) else @@ -746,24 +728,24 @@ DF:Mixin(DFSliderMetaFunctions, DF.FrameMixin) local SwitchOnClick = function(self, button, forced_value, value) local slider = self.MyObject - - if (rawget (slider, "lockdown")) then + + if (rawget(slider, "lockdown")) then return end - + if (forced_value) then rawset (slider, "value", not value) end - if (rawget (slider, "value")) then --actived + if (rawget(slider, "value")) then --actived rawset (slider, "value", false) - + if (slider.backdrop_disabledcolor) then slider:SetBackdropColor(unpack(slider.backdrop_disabledcolor)) else slider:SetBackdropColor(1, 0, 0, 0.4) end - + if (slider.is_checkbox) then slider.checked_texture:Hide() else @@ -788,7 +770,7 @@ local SwitchOnClick = function(self, button, forced_value, value) end if (slider.OnSwitch and not forced_value) then - local value = rawget (slider, "value") + local value = rawget(slider, "value") if (slider.return_func) then value = slider:return_func (value) end @@ -799,7 +781,7 @@ local SwitchOnClick = function(self, button, forced_value, value) end --trigger hooks - slider:RunHooksForWidget ("OnSwitch", slider, slider.FixedValue, value) + slider:RunHooksForWidget("OnSwitch", slider, slider.FixedValue, value) end end @@ -820,7 +802,7 @@ local switch_set_value = function(self, value) if (self.switch_func) then value = self:switch_func (value) end - + SwitchOnClick (self.widget, nil, true, value) end @@ -828,40 +810,40 @@ local switch_set_fixparameter = function(self, value) rawset (self, "FixedValue", value) end -local switch_disable = function(self) - +local switch_disable = function(self) + if (self.is_checkbox) then self.checked_texture:Hide() else self._text:Hide() if (not self.lock_texture) then - DF:NewImage (self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") + DF:NewImage(self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") self.lock_texture:SetDesaturated(true) self.lock_texture:SetPoint("center", self._thumb, "center") end self.lock_texture:Show() end - + self:SetAlpha(.4) rawset (self, "lockdown", true) end local switch_enable = function(self) if (self.is_checkbox) then - if (rawget (self, "value")) then + if (rawget(self, "value")) then self.checked_texture:Show() else self.checked_texture:Hide() end else if (not self.lock_texture) then - DF:NewImage (self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") + DF:NewImage(self, [[Interface\PetBattles\PetBattle-LockIcon]], 12, 12, "overlay", {0.0546875, 0.9453125, 0.0703125, 0.9453125}, "lock_texture", "$parentLockTexture") self.lock_texture:SetDesaturated(true) self.lock_texture:SetPoint("center", self._thumb, "center") end self.lock_texture:Hide() self._text:Show() end - + self:SetAlpha(1) return rawset (self, "lockdown", false) end @@ -878,19 +860,19 @@ local set_as_checkbok = function(self) local size_pct = self:GetWidth()/32 checked:SetSize(32*size_pct, 32*size_pct) self.checked_texture = checked - + self._thumb:Hide() self._text:Hide() - + self.is_checkbox = true - - if (rawget (self, "value")) then + + if (rawget(self, "value")) then self.checked_texture:Show() if (self.backdrop_enabledcolor) then self:SetBackdropColor(unpack(self.backdrop_enabledcolor)) else self:SetBackdropColor(0, 0, 1, 0.4) - end + end else self.checked_texture:Hide() if (self.backdrop_disabledcolor) then @@ -917,23 +899,23 @@ function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defa name = "DetailsFrameWorkSlider" .. DF.SwitchCounter DF.SwitchCounter = DF.SwitchCounter + 1 elseif (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end - + --defaults ltext = ltext or "OFF" rtext = rtext or "ON" - + --build frames w = w or 60 h = h or 20 - + local slider = DF:NewButton(parent, container, name, member, w, h) slider.HookList.OnSwitch = {} - + slider.switch_func = switch_func slider.return_func = return_func slider.SetValue = switch_set_value @@ -944,24 +926,24 @@ function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defa slider.SetAsCheckBox = set_as_checkbok slider.SetTemplate = DFSliderMetaFunctions.SetTemplate slider.SetSwitchFunction = set_switch_func - + if (member) then parent [member] = slider end - + slider:SetBackdrop({edgeFile = [[Interface\Buttons\UI-SliderBar-Border]], edgeSize = 8, bgFile = [[Interface\AddOns\Details\images\background]], insets = {left = 3, right = 3, top = 5, bottom = 5}}) - + local thumb = slider:CreateTexture(nil, "artwork") thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") thumb:SetSize(34+(h*0.2), h*1.2) thumb:SetAlpha(0.7) thumb:SetPoint("left", slider.widget, "left") - + local text = slider:CreateFontString(nil, "overlay", "GameFontHighlightSmall") - text:SetTextColor (.8, .8, .8, 1) + text:SetTextColor(.8, .8, .8, 1) text:SetPoint("center", thumb, "center") - + slider._text = text slider._thumb = thumb slider._ltext = ltext @@ -969,23 +951,23 @@ function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defa slider.thumb = thumb slider.invert_colors = color_inverted - + slider:SetScript("OnClick", SwitchOnClick) slider:SetValue(default_value) slider.isSwitch = true - + if (switch_template) then slider:SetTemplate(switch_template) end - + if (with_label) then local label = DF:CreateLabel(slider.widget, with_label, nil, nil, nil, "label", nil, "overlay") label.text = with_label slider.widget:SetPoint("left", label.widget, "right", 2, 0) with_label = label - + if (label_template) then label:SetTemplate(label_template) end @@ -1003,7 +985,7 @@ function DFSliderMetaFunctions:SetTemplate(template) if (template.height) then self:SetHeight(template.height) end - + if (template.backdrop) then self:SetBackdrop(template.backdrop) end @@ -1016,12 +998,12 @@ function DFSliderMetaFunctions:SetTemplate(template) self:SetBackdropBorderColor(r, g, b, a) self.onleave_backdrop_border_color = {r, g, b, a} end - + if (template.onenterbordercolor) then local r, g, b, a = DF:ParseColors(template.onenterbordercolor) self.onenter_backdrop_border_color = {r, g, b, a} end - + if (template.onleavebordercolor) then local r, g, b, a = DF:ParseColors(template.onleavebordercolor) self.onleave_backdrop_border_color = {r, g, b, a} @@ -1048,7 +1030,7 @@ function DFSliderMetaFunctions:SetTemplate(template) self.thumb:SetVertexColor(r, g, b, a) end end - + --switch only if (template.enabled_backdropcolor) then local r, g, b, a = DF:ParseColors(template.enabled_backdropcolor) @@ -1066,65 +1048,65 @@ function DF:CreateSlider (parent, w, h, min, max, step, defaultv, isDecemal, mem end function DF:NewSlider (parent, container, name, member, w, h, min, max, step, defaultv, isDecemal, isSwitch, with_label, slider_template, label_template) - + --early checks if (not name) then name = "DetailsFrameworkSlider" .. DF.SliderCounter DF.SliderCounter = DF.SliderCounter + 1 end if (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end - - if (name:find ("$parent")) then - local parentName = DF.GetParentName (parent) - name = name:gsub ("$parent", parentName) + + if (name:find("$parent")) then + local parentName = DF.GetParentName(parent) + name = name:gsub("$parent", parentName) end - + local SliderObject = {type = "slider", dframework = true} - + if (member) then parent [member] = SliderObject - end - + end + if (parent.dframework) then parent = parent.widget end if (container.dframework) then container = container.widget end - ---defaults + +--defaults min = min or 1 max = max or 2 step = step or 1 defaultv = defaultv or min - + w = w or 130 h = h or 19 - + --default members: SliderObject.lockdown = false SliderObject.container = container - + SliderObject.slider = CreateFrame("slider", name, parent,"BackdropTemplate") SliderObject.widget = SliderObject.slider SliderObject.useDecimals = isDecemal or false - + if (SliderObject.useDecimals) then SliderObject.slider:SetValueStep (0.01) else SliderObject.slider:SetValueStep (step) end - + if (not APISliderFunctions) then APISliderFunctions = true - local idx = getmetatable (SliderObject.slider).__index - for funcName, funcAddress in pairs(idx) do + local idx = getmetatable(SliderObject.slider).__index + for funcName, funcAddress in pairs(idx) do if (not DFSliderMetaFunctions [funcName]) then DFSliderMetaFunctions [funcName] = function(object, ...) local x = loadstring ( "return _G['"..object.slider:GetName().."']:"..funcName.."(...)") @@ -1133,7 +1115,7 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de end end end - + SliderObject.slider.MyObject = SliderObject SliderObject.slider:SetWidth(w) SliderObject.slider:SetHeight(h) @@ -1153,30 +1135,30 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de SliderObject.thumb:SetAlpha(0.7) SliderObject.slider:SetThumbTexture (SliderObject.thumb) SliderObject.slider.thumb = SliderObject.thumb - + if (not isSwitch) then SliderObject.have_tooltip = "Right Click to Type the Value" end - + SliderObject.amt = SliderObject.slider:CreateFontString(nil, "overlay", "GameFontHighlightSmall") - + local amt = defaultv if (amt < 10 and amt >= 1) then amt = "0"..amt end - + if (SliderObject.useDecimals) then SliderObject.amt:SetText(string.format("%.2f", amt)) else SliderObject.amt:SetText(math.floor(amt)) end - - SliderObject.amt:SetTextColor (.8, .8, .8, 1) + + SliderObject.amt:SetTextColor(.8, .8, .8, 1) SliderObject.amt:SetPoint("center", SliderObject.thumb, "center") SliderObject.slider.amt = SliderObject.amt SliderObject.previous_value = {defaultv or 0, 0, 0} - + --hooks SliderObject.HookList = { OnEnter = {}, @@ -1185,11 +1167,11 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de OnShow = {}, OnMouseDown = {}, OnMouseUp = {}, - + OnValueChange = {}, OnValueChanged = {}, } - + SliderObject.slider:SetScript("OnEnter", OnEnter) SliderObject.slider:SetScript("OnLeave", OnLeave) SliderObject.slider:SetScript("OnHide", OnHide) @@ -1199,24 +1181,26 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de SliderObject.slider:SetScript("OnMouseUp", OnMouseUp) setmetatable(SliderObject, DFSliderMetaFunctions) - + + SliderObject:SetTooltip("right click to type the value") + if (with_label) then local label = DF:CreateLabel(SliderObject.slider, with_label, nil, nil, nil, "label", nil, "overlay") label.text = with_label SliderObject.slider:SetPoint("left", label.widget, "right", 2, 0) with_label = label - + if (label_template) then label:SetTemplate(label_template) end end - + if (slider_template) then SliderObject:SetTemplate(slider_template) end - + return SliderObject, with_label - + end DF.AdjustmentSliderOptions = { diff --git a/Libs/DF/split_bar.lua b/Libs/DF/split_bar.lua index f7a29317..9b48a768 100644 --- a/Libs/DF/split_bar.lua +++ b/Libs/DF/split_bar.lua @@ -18,16 +18,13 @@ local APISplitBarFunctions do local metaPrototype = { WidgetType = "split_bar", - SetHook = DF.SetHook, - RunHooksForWidget = DF.RunHooksForWidget, - dversion = DF.dversion, } --check if there's a metaPrototype already existing if (_G[DF.GlobalWidgetControlNames["split_bar"]]) then --get the already existing metaPrototype - local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["split_bar"]] + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["split_bar"]] --check if is older if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then --the version is older them the currently loading one @@ -38,11 +35,12 @@ do end else --first time loading the framework - _G[DF.GlobalWidgetControlNames ["split_bar"]] = metaPrototype + _G[DF.GlobalWidgetControlNames["split_bar"]] = metaPrototype end end -local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] +local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames["split_bar"]] +DF:Mixin(SplitBarMetaFunctions, DF.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --metatables @@ -238,7 +236,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local smember_lcolor = function(_object, _value) local _value1, _value2, _value3, _value4 = DF:ParseColors(_value) - _object.statusbar:SetStatusBarColor (_value1, _value2, _value3, _value4) + _object.statusbar:SetStatusBarColor(_value1, _value2, _value3, _value4) _object.texture.original_colors = {_value1, _value2, _value3, _value4} return _object.texture:SetVertexColor(_value1, _value2, _value3, _value4) end @@ -248,7 +246,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local _value1, _value2 = _unpack(_value) _object.iconright:SetTexture(_value1) if (_value2) then - _object.iconright:SetTexCoord (_unpack(_value2)) + _object.iconright:SetTexCoord(_unpack(_value2)) end else _object.iconright:SetTexture(_value) @@ -261,7 +259,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local _value1, _value2 = _unpack(_value) _object.iconleft:SetTexture(_value1) if (_value2) then - _object.iconleft:SetTexCoord (_unpack(_value2)) + _object.iconleft:SetTexCoord(_unpack(_value2)) end else _object.iconleft:SetTexture(_value) @@ -275,8 +273,8 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] _object.texture:SetTexture(_value1) _object.rightTexture:SetTexture(_value1) if (_value2) then - _object.texture:SetTexCoord (_unpack(_value2)) - _object.rightTexture:SetTexCoord (_unpack(_value2)) + _object.texture:SetTexCoord(_unpack(_value2)) + _object.rightTexture:SetTexCoord(_unpack(_value2)) end else _object.texture:SetTexture(_value) @@ -297,8 +295,8 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] --font color local smember_textcolor = function(_object, _value) local _value1, _value2, _value3, _value4 = DF:ParseColors(_value) - _object.textleft:SetTextColor (_value1, _value2, _value3, _value4) - return _object.textright:SetTextColor (_value1, _value2, _value3, _value4) + _object.textleft:SetTextColor(_value1, _value2, _value3, _value4) + return _object.textright:SetTextColor(_value1, _value2, _value3, _value4) end SplitBarMetaFunctions.SetMembers = SplitBarMetaFunctions.SetMembers or {} @@ -421,14 +419,14 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] self.iconleft:SetTexture(texture) if (...) then local L, R, U, D = unpack(...) - self.iconleft:SetTexCoord (L, R, U, D) + self.iconleft:SetTexCoord(L, R, U, D) end end function SplitBarMetaFunctions:SetRightIcon (texture, ...) self.iconright:SetTexture(texture) if (...) then local L, R, U, D = unpack(...) - self.iconright:SetTexCoord (L, R, U, D) + self.iconright:SetTexCoord(L, R, U, D) end end @@ -564,7 +562,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnEnter = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnEnter", frame, capsule) + local kill = capsule:RunHooksForWidget("OnEnter", frame, capsule) if (kill) then return end @@ -578,7 +576,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnLeave = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnLeave", frame, capsule) + local kill = capsule:RunHooksForWidget("OnLeave", frame, capsule) if (kill) then return end @@ -590,7 +588,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnHide = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnHide", frame, capsule) + local kill = capsule:RunHooksForWidget("OnHide", frame, capsule) if (kill) then return end @@ -598,7 +596,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnShow = function(frame) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnShow", frame, capsule) + local kill = capsule:RunHooksForWidget("OnShow", frame, capsule) if (kill) then return end @@ -606,7 +604,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnMouseDown = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseDown", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseDown", frame, button, capsule) if (kill) then return end @@ -621,7 +619,7 @@ local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] local OnMouseUp = function(frame, button) local capsule = frame.MyObject - local kill = capsule:RunHooksForWidget ("OnMouseUp", frame, button, capsule) + local kill = capsule:RunHooksForWidget("OnMouseUp", frame, button, capsule) if (kill) then return end @@ -716,15 +714,15 @@ function DF:NewSplitBar (parent, container, name, member, w, h) DF.SplitBarCounter = DF.SplitBarCounter + 1 end if (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end - if (name:find ("$parent")) then - local parentName = DF.GetParentName (parent) - name = name:gsub ("$parent", parentName) + if (name:find("$parent")) then + local parentName = DF.GetParentName(parent) + name = name:gsub("$parent", parentName) end local SplitBarObject = {type = "barsplit", dframework = true} @@ -754,7 +752,7 @@ function DF:NewSplitBar (parent, container, name, member, w, h) if (not APISplitBarFunctions) then APISplitBarFunctions = true - local idx = getmetatable (SplitBarObject.statusbar).__index + local idx = getmetatable(SplitBarObject.statusbar).__index for funcName, funcAddress in pairs(idx) do if (not SplitBarMetaFunctions [funcName]) then SplitBarMetaFunctions [funcName] = function(object, ...) diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index cd380be4..7f403f92 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -1,5 +1,5 @@ -local DF = _G ["DetailsFramework"] +local DF = _G["DetailsFramework"] if (not DF or not DetailsFrameworkCanLoad) then return end @@ -11,10 +11,6 @@ local APITextEntryFunctions = false do local metaPrototype = { WidgetType = "textentry", - SetHook = DF.SetHook, - HasHook = DF.HasHook, - ClearHooks = DF.ClearHooks, - RunHooksForWidget = DF.RunHooksForWidget, dversion = DF.dversion, } @@ -40,7 +36,8 @@ local TextEntryMetaFunctions = _G[DF.GlobalWidgetControlNames["textentry"]] DF:Mixin(TextEntryMetaFunctions, DF.SetPointMixin) DF:Mixin(TextEntryMetaFunctions, DF.FrameMixin) - +DF:Mixin(TextEntryMetaFunctions, DF.TooltipHandlerMixin) +DF:Mixin(TextEntryMetaFunctions, DF.ScriptHookMixin) DF.TextEntryCounter = DF.TextEntryCounter or 1 @@ -227,26 +224,13 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 self.label:SetTextColor(1, .2, .2, 1) end - --tooltip - function TextEntryMetaFunctions:SetTooltip(tooltip) - if (tooltip) then - return rawset(self, "have_tooltip", tooltip) - else - return rawset(self, "have_tooltip", nil) - end - end - - function TextEntryMetaFunctions:GetTooltip() - return rawget(self, "have_tooltip") - end - --hooks function TextEntryMetaFunctions:Enable() if (not self.editbox:IsEnabled()) then self.editbox:Enable() self.editbox:SetBackdropBorderColor(unpack(self.enabled_border_color)) self.editbox:SetBackdropColor(unpack(self.enabled_backdrop_color)) - self.editbox:SetTextColor (unpack(self.enabled_text_color)) + self.editbox:SetTextColor(unpack(self.enabled_text_color)) if (self.editbox.borderframe) then local r, g, b, a = DF:ParseColors(unpack(self.editbox.borderframe.onleave_backdrop)) self.editbox.borderframe:SetBackdropColor(r, g, b, a) @@ -286,59 +270,49 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 --scripts and hooks local OnEnter = function(textentry) - local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnEnter", textentry, capsule) + local object = textentry.MyObject + local kill = object:RunHooksForWidget("OnEnter", textentry, object) if (kill) then return end - if (capsule.have_tooltip) then - GameCooltip2:Preset(2) - GameCooltip2:AddLine(capsule.have_tooltip) - GameCooltip2:ShowCooltip(textentry, "tooltip") - end - - textentry.mouse_over = true + object:ShowTooltip() - if (textentry:IsEnabled()) then + textentry.mouse_over = true + + if (textentry:IsEnabled()) then textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()} textentry:SetBackdropBorderColor(1, 1, 1, 1) end end - + local OnLeave = function(textentry) - local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnLeave", textentry, capsule) + local object = textentry.MyObject + local kill = object:RunHooksForWidget("OnLeave", textentry, object) if (kill) then return end - if (textentry.MyObject.have_tooltip) then - GameCooltip2:ShowMe(false) - end - - textentry.mouse_over = false - - if (textentry:IsEnabled()) then + object:HideTooltip() + + textentry.mouse_over = false + + if (textentry:IsEnabled()) then textentry:SetBackdropBorderColor(unpack(textentry.current_bordercolor)) end end - + local OnHide = function(textentry) - local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnHide", textentry, capsule) + local object = textentry.MyObject + local kill = object:RunHooksForWidget("OnHide", textentry, object) if (kill) then return end end - + local OnShow = function(textentry) - local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnShow", textentry, capsule) + local object = textentry.MyObject + local kill = object:RunHooksForWidget("OnShow", textentry, object) if (kill) then return end @@ -346,7 +320,6 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 local OnEnterPressed = function(textentry, byScript) local object = textentry.MyObject - if (object.ignoreNextCallback) then DF.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) return @@ -361,6 +334,7 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 if (string.len(text) > 0) then textentry.text = text if (textentry.MyObject.func) then + --need to have a dispatch here textentry.MyObject.func(textentry.MyObject.param1, textentry.MyObject.param2, text, textentry, byScript or textentry) end else @@ -376,22 +350,21 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 end end end - + local OnEscapePressed = function(textentry) - local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnEscapePressed", textentry, capsule, capsule.text) + local object = textentry.MyObject + local kill = object:RunHooksForWidget("OnEscapePressed", textentry, object, object.text) if (kill) then return - end + end textentry.focuslost = true - textentry:ClearFocus() + textentry:ClearFocus() end local OnSpacePressed = function(textEntry) local object = textEntry.MyObject - local kill = object:RunHooksForWidget ("OnSpacePressed", textEntry, object) + local kill = object:RunHooksForWidget("OnSpacePressed", textEntry, object) if (kill) then return end @@ -399,7 +372,6 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 local OnEditFocusLost = function(textEntry) local object = textEntry.MyObject - if (object.ignoreNextCallback) then DF.Schedules.RunNextTick(function() object.ignoreNextCallback = nil end) return @@ -426,13 +398,13 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 textEntry.focuslost = false end - textEntry.MyObject.label:SetTextColor (.8, .8, .8, 1) + textEntry.MyObject.label:SetTextColor(.8, .8, .8, 1) end end local OnEditFocusGained = function(textentry) local object = textentry.MyObject - local kill = object:RunHooksForWidget ("OnEditFocusGained", textentry, object) + local kill = object:RunHooksForWidget("OnEditFocusGained", textentry, object) if (kill) then return end @@ -445,40 +417,37 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 local OnChar = function(textentry, char) local object = textentry.MyObject - local kill = object:RunHooksForWidget ("OnChar", textentry, char, object) + local kill = object:RunHooksForWidget("OnChar", textentry, char, object) if (kill) then return end end - - local OnTextChanged = function(textentry, byUser) + + local OnTextChanged = function(textentry, byUser) local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnTextChanged", textentry, byUser, capsule) + local kill = capsule:RunHooksForWidget("OnTextChanged", textentry, byUser, capsule) if (kill) then return end end - - local OnTabPressed = function(textentry) - + + local OnTabPressed = function(textentry) local capsule = textentry.MyObject - - local kill = capsule:RunHooksForWidget ("OnTabPressed", textentry, byUser, capsule) + local kill = capsule:RunHooksForWidget("OnTabPressed", textentry, byUser, capsule) if (kill) then return end - - if (textentry.MyObject.next) then - OnEnterPressed (textentry, false) + + if (textentry.MyObject.next) then + OnEnterPressed(textentry, false) textentry.MyObject.next:SetFocus() end end - - function TextEntryMetaFunctions:PressEnter (byScript) - OnEnterPressed (self.editbox, byScript) + + function TextEntryMetaFunctions:PressEnter(byScript) + OnEnterPressed(self.editbox, byScript) end - + ------------------------------------------------------------------------------------------------------------ function TextEntryMetaFunctions:SetTemplate(template) @@ -488,7 +457,7 @@ function TextEntryMetaFunctions:SetTemplate(template) if (template.height) then self.editbox:SetHeight(template.height) end - + if (template.backdrop) then self.editbox:SetBackdrop(template.backdrop) end @@ -511,199 +480,171 @@ end ------------------------------------------------------------------------------------------------------------ --object constructor -function DF:CreateTextEntry (parent, func, w, h, member, name, with_label, entry_template, label_template) +function DF:CreateTextEntry(parent, func, w, h, member, name, with_label, entry_template, label_template) return DF:NewTextEntry(parent, parent, name, member, w, h, func, nil, nil, nil, with_label, entry_template, label_template) end -function DF:NewTextEntry(parent, container, name, member, w, h, func, param1, param2, space, with_label, entry_template, label_template) - +function DF:NewTextEntry(parent, container, name, member, width, height, func, param1, param2, space, withLabel, entryTemplate, labelTemplate) if (not name) then name = "DetailsFrameworkTextEntryNumber" .. DF.TextEntryCounter DF.TextEntryCounter = DF.TextEntryCounter + 1 - + elseif (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) end - + if (not container) then container = parent end - - if (name:find ("$parent")) then - local parentName = DF.GetParentName (parent) - name = name:gsub ("$parent", parentName) + + if (name:find("$parent")) then + local parentName = DF.GetParentName(parent) + name = name:gsub("$parent", parentName) end - - local TextEntryObject = {type = "textentry", dframework = true} - + + local newTextEntryObject = {type = "textentry", dframework = true} + if (member) then - parent [member] = TextEntryObject + parent[member] = newTextEntryObject end if (parent.dframework) then parent = parent.widget end + if (container.dframework) then container = container.widget end - - --default members: - --hooks - TextEntryObject.OnEnterHook = nil - TextEntryObject.OnLeaveHook = nil - TextEntryObject.OnHideHook = nil - TextEntryObject.OnShowHook = nil - TextEntryObject.OnEnterPressedHook = nil - TextEntryObject.OnEscapePressedHook = nil - TextEntryObject.OnEditFocusGainedHook = nil - TextEntryObject.OnEditFocusLostHook = nil - TextEntryObject.OnCharHook = nil - TextEntryObject.OnTextChangedHook = nil - TextEntryObject.OnTabPressedHook = nil - --misc - TextEntryObject.container = container - TextEntryObject.have_tooltip = nil + --misc + newTextEntryObject.container = container - TextEntryObject.editbox = CreateFrame("EditBox", name, parent,"BackdropTemplate") - TextEntryObject.editbox:SetSize(232, 20) - TextEntryObject.editbox:SetBackdrop({bgFile = [["Interface\DialogFrame\UI-DialogBox-Background"]], tileSize = 64, tile = true, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 0}}) - - TextEntryObject.editbox.label = TextEntryObject.editbox:CreateFontString("$parent_Desc", "OVERLAY", "GameFontHighlightSmall") - TextEntryObject.editbox.label:SetJustifyH("left") - TextEntryObject.editbox.label:SetPoint("RIGHT", TextEntryObject.editbox, "LEFT", -2, 0) - - TextEntryObject.widget = TextEntryObject.editbox - - TextEntryObject.editbox:SetTextInsets (3, 0, 0, -3) + if (not width and space) then + width = space + end + + --editbox + newTextEntryObject.editbox = CreateFrame("EditBox", name, parent,"BackdropTemplate") + newTextEntryObject.editbox:SetSize(232, 20) + newTextEntryObject.editbox:SetBackdrop({bgFile = [["Interface\DialogFrame\UI-DialogBox-Background"]], tileSize = 64, tile = true, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10, insets = {left = 1, right = 1, top = 0, bottom = 0}}) + newTextEntryObject.editbox:SetTextInsets(3, 0, 0, -3) + newTextEntryObject.editbox:SetWidth(width) + newTextEntryObject.editbox:SetHeight(height) + newTextEntryObject.editbox:SetJustifyH("center") + newTextEntryObject.editbox:EnableMouse(true) + newTextEntryObject.editbox:SetText("") + newTextEntryObject.editbox:SetAutoFocus(false) + newTextEntryObject.editbox:SetFontObject("GameFontHighlightSmall") + + --editbox label + newTextEntryObject.editbox.label = newTextEntryObject.editbox:CreateFontString("$parent_Desc", "OVERLAY", "GameFontHighlightSmall") + newTextEntryObject.editbox.label:SetJustifyH("left") + newTextEntryObject.editbox.label:SetPoint("RIGHT", newTextEntryObject.editbox, "LEFT", -2, 0) + + newTextEntryObject.label = newTextEntryObject.editbox.label + newTextEntryObject.widget = newTextEntryObject.editbox + newTextEntryObject.editbox.MyObject = newTextEntryObject if (not APITextEntryFunctions) then APITextEntryFunctions = true - local idx = getmetatable (TextEntryObject.editbox).__index - for funcName, funcAddress in pairs(idx) do - if (not TextEntryMetaFunctions [funcName]) then - TextEntryMetaFunctions [funcName] = function(object, ...) - local x = loadstring ( "return _G['"..object.editbox:GetName().."']:"..funcName.."(...)") - return x (...) + local idx = getmetatable(newTextEntryObject.editbox).__index + for funcName, funcAddress in pairs(idx) do + if (not TextEntryMetaFunctions[funcName]) then + TextEntryMetaFunctions[funcName] = function(object, ...) + local x = loadstring( "return _G['"..object.editbox:GetName().."']:"..funcName.."(...)") + return x(...) end end end end - - TextEntryObject.editbox.MyObject = TextEntryObject - - if (not w and space) then - w = space - elseif (w and space) then - if (DF.debug) then - --print("warning: you are using width and space, try use only space for better results.") - end - end - - TextEntryObject.editbox:SetWidth(w) - TextEntryObject.editbox:SetHeight(h) - TextEntryObject.editbox:SetJustifyH("center") - TextEntryObject.editbox:EnableMouse(true) - TextEntryObject.editbox:SetText("") + newTextEntryObject.editbox.current_bordercolor = {1, 1, 1, 0.7} + newTextEntryObject.enabled_border_color = {newTextEntryObject.editbox:GetBackdropBorderColor()} + newTextEntryObject.enabled_backdrop_color = {newTextEntryObject.editbox:GetBackdropColor()} + newTextEntryObject.enabled_text_color = {newTextEntryObject.editbox:GetTextColor()} + newTextEntryObject.onleave_backdrop = {newTextEntryObject.editbox:GetBackdropColor()} + newTextEntryObject.onleave_backdrop_border_color = {newTextEntryObject.editbox:GetBackdropBorderColor()} - TextEntryObject.editbox:SetAutoFocus (false) - TextEntryObject.editbox:SetFontObject ("GameFontHighlightSmall") + newTextEntryObject.func = func + newTextEntryObject.param1 = param1 + newTextEntryObject.param2 = param2 + newTextEntryObject.next = nil + newTextEntryObject.space = space + newTextEntryObject.tab_on_enter = false - TextEntryObject.editbox.current_bordercolor = {1, 1, 1, 0.7} - TextEntryObject.editbox:SetBackdropBorderColor(1, 1, 1, 0.7) - TextEntryObject.enabled_border_color = {TextEntryObject.editbox:GetBackdropBorderColor()} - TextEntryObject.enabled_backdrop_color = {TextEntryObject.editbox:GetBackdropColor()} - TextEntryObject.enabled_text_color = {TextEntryObject.editbox:GetTextColor()} - TextEntryObject.onleave_backdrop = {TextEntryObject.editbox:GetBackdropColor()} - TextEntryObject.onleave_backdrop_border_color = {TextEntryObject.editbox:GetBackdropBorderColor()} - - TextEntryObject.func = func - TextEntryObject.param1 = param1 - TextEntryObject.param2 = param2 - TextEntryObject.next = nil - TextEntryObject.space = space - TextEntryObject.tab_on_enter = false - - TextEntryObject.label = _G [name .. "_Desc"] - TextEntryObject.editbox:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, insets = {left = 1, right = 1, top = 1, bottom = 1}}) - TextEntryObject.editbox:SetBackdropColor(.2, .2, .2, 1) + newTextEntryObject.editbox:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, insets = {left = 1, right = 1, top = 1, bottom = 1}}) + newTextEntryObject.editbox:SetBackdropColor(.2, .2, .2, 1) + newTextEntryObject.editbox:SetBackdropBorderColor(1, 1, 1, 0.7) --hooks - TextEntryObject.HookList = { - OnEnter = {}, - OnLeave = {}, - OnHide = {}, - OnShow = {}, - OnEnterPressed = {}, - OnEscapePressed = {}, - OnSpacePressed = {}, - OnEditFocusLost = {}, - OnEditFocusGained = {}, - OnChar = {}, - OnTextChanged = {}, - OnTabPressed = {}, - } - - TextEntryObject.editbox:SetScript("OnEnter", OnEnter) - TextEntryObject.editbox:SetScript("OnLeave", OnLeave) - TextEntryObject.editbox:SetScript("OnHide", OnHide) - TextEntryObject.editbox:SetScript("OnShow", OnShow) - - TextEntryObject.editbox:SetScript("OnEnterPressed", OnEnterPressed) - TextEntryObject.editbox:SetScript("OnEscapePressed", OnEscapePressed) - TextEntryObject.editbox:SetScript("OnSpacePressed", OnSpacePressed) - TextEntryObject.editbox:SetScript("OnEditFocusLost", OnEditFocusLost) - TextEntryObject.editbox:SetScript("OnEditFocusGained", OnEditFocusGained) - TextEntryObject.editbox:SetScript("OnChar", OnChar) - TextEntryObject.editbox:SetScript("OnTextChanged", OnTextChanged) - TextEntryObject.editbox:SetScript("OnTabPressed", OnTabPressed) - - setmetatable(TextEntryObject, TextEntryMetaFunctions) - - if (with_label) then - local label = DF:CreateLabel(TextEntryObject.editbox, with_label, nil, nil, nil, "label", nil, "overlay") - label.text = with_label - TextEntryObject.editbox:SetPoint("left", label.widget, "right", 2, 0) - if (label_template) then - label:SetTemplate(label_template) + newTextEntryObject.HookList = { + OnEnter = {}, + OnLeave = {}, + OnHide = {}, + OnShow = {}, + OnEnterPressed = {}, + OnEscapePressed = {}, + OnSpacePressed = {}, + OnEditFocusLost = {}, + OnEditFocusGained = {}, + OnChar = {}, + OnTextChanged = {}, + OnTabPressed = {}, + } + + newTextEntryObject.editbox:SetScript("OnEnter", OnEnter) + newTextEntryObject.editbox:SetScript("OnLeave", OnLeave) + newTextEntryObject.editbox:SetScript("OnHide", OnHide) + newTextEntryObject.editbox:SetScript("OnShow", OnShow) + newTextEntryObject.editbox:SetScript("OnEnterPressed", OnEnterPressed) + newTextEntryObject.editbox:SetScript("OnEscapePressed", OnEscapePressed) + newTextEntryObject.editbox:SetScript("OnSpacePressed", OnSpacePressed) + newTextEntryObject.editbox:SetScript("OnEditFocusLost", OnEditFocusLost) + newTextEntryObject.editbox:SetScript("OnEditFocusGained", OnEditFocusGained) + newTextEntryObject.editbox:SetScript("OnChar", OnChar) + newTextEntryObject.editbox:SetScript("OnTextChanged", OnTextChanged) + newTextEntryObject.editbox:SetScript("OnTabPressed", OnTabPressed) + + setmetatable(newTextEntryObject, TextEntryMetaFunctions) + + if (withLabel) then + local label = DF:CreateLabel(newTextEntryObject.editbox, withLabel, nil, nil, nil, "label", nil, "overlay") + label.text = withLabel + newTextEntryObject.editbox:SetPoint("left", label.widget, "right", 2, 0) + if (labelTemplate) then + label:SetTemplate(labelTemplate) end - with_label = label + withLabel = label end - - if (entry_template) then - TextEntryObject:SetTemplate(entry_template) - end - - return TextEntryObject, with_label - + + if (entryTemplate) then + newTextEntryObject:SetTemplate(entryTemplate) + end + + return newTextEntryObject, withLabel end -function DF:NewSpellEntry (parent, func, w, h, param1, param2, member, name) +function DF:NewSpellEntry(parent, func, w, h, param1, param2, member, name) local editbox = DF:NewTextEntry(parent, parent, name, member, w, h, func, param1, param2) - --- editbox:SetHook("OnEditFocusGained", SpellEntryOnEditFocusGained) --- editbox:SetHook("OnTextChanged", SpellEntryOnTextChanged) - - return editbox + return editbox end local function_gettext = function(self) return self.editbox:GetText() end + local function_settext = function(self, text) return self.editbox:SetText(text) end + local function_clearfocus = function(self) return self.editbox:ClearFocus() end + local function_setfocus = function(self) - return self.editbox:SetFocus (true) + return self.editbox:SetFocus(true) end - - - ------------------------------------------------------------------------------------ --auto complete @@ -805,7 +746,7 @@ local function ColorSelection ( self, ColorCode ) if ( CursorReplacement >= #Replacement ) then -- Cursor beyond end of color Cursor = Cursor + #COLOR_END; end - + self:SetCursorPosition( Cursor ); -- Highlight selection and wrapper self:HighlightText( Start, #ColorCode + ( #Replacement - #Selection ) + #COLOR_END + End ); @@ -830,7 +771,7 @@ end --On Text Changed local AutoComplete_OnTextChanged = function(editboxWidget, byUser, capsule) capsule = capsule or editboxWidget.MyObject or editboxWidget - + local chars_now = editboxWidget:GetText():len() if (not editboxWidget.ignore_textchange) then --backspace @@ -892,37 +833,37 @@ local AutoComplete_OnEditFocusGained = function(editboxWidget) --print("last word:", editboxWidget.lastword) editboxWidget.end_selection = nil editboxWidget.focusGained = true - capsule.characters_count = editboxWidget:GetText():len() + capsule.characters_count = editboxWidget:GetText():len() end local OptimizeAutoCompleteTable = function(self, wordList) local optimizedTable = {} - + local lower = string.lower local sub = string.sub local len = string.len - + local subTables = 0 - + for i = 1, #wordList do local thisWord = wordList [i] if (len (thisWord) > 0) then thisWord = lower (thisWord) - + local firstCharacter = sub (thisWord, 1, 1) - + local charTable = optimizedTable [firstCharacter] if (not charTable) then charTable = {} optimizedTable [firstCharacter] = charTable - + subTables = subTables + 1 end - + charTable [#charTable+1] = thisWord end end - + wordList.Optimized = optimizedTable end @@ -930,14 +871,14 @@ local AutoComplete_OnChar = function(editboxWidget, char, capsule) if (char == "") then return end - + capsule = capsule or editboxWidget.MyObject or editboxWidget editboxWidget.end_selection = nil - + if (editboxWidget.ignore_input) then return end - + --reseta a palavra se acabou de ganhar focus e apertou espa�o if (editboxWidget.focusGained and char == " ") then capsule.lastword = "" @@ -945,37 +886,37 @@ local AutoComplete_OnChar = function(editboxWidget, char, capsule) else editboxWidget.focusGained = nil end - + if (char:match ("%a") or (char == " " and capsule.lastword ~= "")) then capsule.lastword = capsule.lastword .. char else capsule.lastword = "" end - + editboxWidget.ignore_input = true - + if (capsule.lastword:len() >= 2) then - + local wordList = capsule [capsule.poolName] if (not wordList) then - error ("Details! Framework: TextEntry has AutoComplete but no word list table.") + error("Details! Framework: TextEntry has AutoComplete but no word list table.") return end - + if (capsule.ShouldOptimizeAutoComplete) then if (not wordList.Optimized) then OptimizeAutoCompleteTable (capsule, wordList) end - - local firstCharacter = string.lower (string.sub (capsule.lastword, 1, 1)) + + local firstCharacter = string.lower(string.sub (capsule.lastword, 1, 1)) wordList = wordList.Optimized [firstCharacter] - + if (wordList) then for i = 1, #wordList do local thisWord = wordList [i] - if (thisWord and (thisWord:find ("^" .. capsule.lastword) or thisWord:lower():find ("^" .. capsule.lastword))) then - local rest = thisWord:gsub (capsule.lastword, "") - rest = rest:lower():gsub (capsule.lastword, "") + if (thisWord and (thisWord:find("^" .. capsule.lastword) or thisWord:lower():find("^" .. capsule.lastword))) then + local rest = thisWord:gsub(capsule.lastword, "") + rest = rest:lower():gsub(capsule.lastword, "") local cursor_pos = editboxWidget:GetCursorPosition() editboxWidget:Insert (rest) editboxWidget:HighlightText (cursor_pos, cursor_pos + rest:len()) @@ -986,16 +927,16 @@ local AutoComplete_OnChar = function(editboxWidget, char, capsule) end end end - + editboxWidget.ignore_input = false return end - + for i = 1, #wordList do local thisWord = wordList [i] - if (thisWord and (thisWord:find ("^" .. capsule.lastword) or thisWord:lower():find ("^" .. capsule.lastword))) then - local rest = thisWord:gsub (capsule.lastword, "") - rest = rest:lower():gsub (capsule.lastword, "") + if (thisWord and (thisWord:find("^" .. capsule.lastword) or thisWord:lower():find("^" .. capsule.lastword))) then + local rest = thisWord:gsub(capsule.lastword, "") + rest = rest:lower():gsub(capsule.lastword, "") local cursor_pos = editboxWidget:GetCursorPosition() editboxWidget:Insert (rest) editboxWidget:HighlightText (cursor_pos, cursor_pos + rest:len()) @@ -1006,28 +947,28 @@ local AutoComplete_OnChar = function(editboxWidget, char, capsule) end end end - + editboxWidget.ignore_input = false end function TextEntryMetaFunctions:SetAsAutoComplete (poolName, poolTable, shouldOptimize) - + if (not self.SetHook) then --self is borderframe self = self.editbox self.editbox = self --compatible with fw functions - + self.lastword = "" self.characters_count = 0 self.poolName = poolName self.GetLastWord = get_last_word --editbox:GetLastWord() self.NoClearFocusOnEnterPressed = true --avoid auto clear focus self.ShouldOptimizeAutoComplete = shouldOptimize - + if (poolTable) then self [poolName] = poolTable end - + self:HookScript ("OnEditFocusGained", AutoComplete_OnEditFocusGained) self:HookScript ("OnEnterPressed", AutoComplete_OnEnterPressed) self:HookScript ("OnEscapePressed", AutoComplete_OnEscapePressed) @@ -1042,7 +983,7 @@ function TextEntryMetaFunctions:SetAsAutoComplete (poolName, poolTable, shouldOp self.GetLastWord = get_last_word --editbox:GetLastWord() self.NoClearFocusOnEnterPressed = true --avoid auto clear focus self.ShouldOptimizeAutoComplete = shouldOptimize - + self:SetHook("OnEditFocusGained", AutoComplete_OnEditFocusGained) self:SetHook("OnEnterPressed", AutoComplete_OnEnterPressed) self.editbox:HookScript ("OnEscapePressed", AutoComplete_OnEscapePressed) @@ -1062,36 +1003,36 @@ end function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, showLineNumbers) - if (name:find ("$parent")) then - local parentName = DF.GetParentName (parent) - name = name:gsub ("$parent", parentName) + if (name:find("$parent")) then + local parentName = DF.GetParentName(parent) + name = name:gsub("$parent", parentName) end - + local borderframe = CreateFrame("Frame", name, parent,"BackdropTemplate") borderframe:SetSize(w, h) - + if (member) then parent [member] = borderframe end - + local scrollframe = CreateFrame("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate") local scrollframeNumberLines = CreateFrame("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate") scrollframe.editbox = CreateFrame("editbox", "$parentEditBox", scrollframe,"BackdropTemplate") scrollframe.editbox:SetMultiLine (true) - scrollframe.editbox:SetAutoFocus (false) + scrollframe.editbox:SetAutoFocus(false) scrollframe.editbox:SetScript("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged) scrollframe.editbox:SetScript("OnEscapePressed", _G.EditBox_ClearFocus) - scrollframe.editbox:SetFontObject ("GameFontHighlightSmall") + scrollframe.editbox:SetFontObject("GameFontHighlightSmall") scrollframe:SetScrollChild (scrollframe.editbox) --line number if (showLineNumbers) then scrollframeNumberLines.editbox = CreateFrame("editbox", "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate") scrollframeNumberLines.editbox:SetMultiLine (true) - scrollframeNumberLines.editbox:SetAutoFocus (false) + scrollframeNumberLines.editbox:SetAutoFocus(false) scrollframeNumberLines.editbox:SetEnabled (false) - scrollframeNumberLines.editbox:SetFontObject ("GameFontHighlightSmall") + scrollframeNumberLines.editbox:SetFontObject("GameFontHighlightSmall") scrollframeNumberLines.editbox:SetJustifyH("left") scrollframeNumberLines.editbox:SetJustifyV ("top") scrollframeNumberLines.editbox:SetTextColor(.3, .3, .3, .5) @@ -1148,49 +1089,49 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show end borderframe.SetAsAutoComplete = TextEntryMetaFunctions.SetAsAutoComplete - + scrollframe:SetScript("OnSizeChanged", function(self) scrollframe.editbox:SetSize(self:GetSize()) end) - + scrollframe.editbox:SetJustifyH("left") scrollframe.editbox:SetJustifyV ("top") scrollframe.editbox:SetMaxBytes (1024000) scrollframe.editbox:SetMaxLetters (128000) - + borderframe.GetText = function_gettext borderframe.SetText = function_settext borderframe.ClearFocus = function_clearfocus borderframe.SetFocus = function_setfocus borderframe.SetTextSize = set_speciallua_editor_font_size - + borderframe.Enable = TextEntryMetaFunctions.Enable borderframe.Disable = TextEntryMetaFunctions.Disable - + borderframe.SetTemplate = TextEntryMetaFunctions.SetTemplate - + if (not nointent) then IndentationLib.enable (scrollframe.editbox, nil, 4) end - borderframe:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], + borderframe:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}}) - + scrollframe.editbox.current_bordercolor = {1, 1, 1, 0.7} borderframe:SetBackdropBorderColor(1, 1, 1, 0.7) borderframe:SetBackdropColor(0.090195, 0.090195, 0.188234, 1) - + borderframe.enabled_border_color = {borderframe:GetBackdropBorderColor()} borderframe.enabled_backdrop_color = {borderframe:GetBackdropColor()} borderframe.enabled_text_color = {scrollframe.editbox:GetTextColor()} borderframe.onleave_backdrop = {scrollframe.editbox:GetBackdropColor()} borderframe.onleave_backdrop_border_color = {scrollframe.editbox:GetBackdropBorderColor()} - + borderframe.scroll = scrollframe borderframe.editbox = scrollframe.editbox borderframe.editbox.borderframe = borderframe - + return borderframe end diff --git a/Libs/DF/timebar.lua b/Libs/DF/timebar.lua index 0de9ff20..6b4ed644 100644 --- a/Libs/DF/timebar.lua +++ b/Libs/DF/timebar.lua @@ -1,36 +1,26 @@ - -local DF = _G ["DetailsFramework"] +local DF = _G["DetailsFramework"] if (not DF or not DetailsFrameworkCanLoad) then return end local _ -local rawset = rawset -local rawget = rawget -local setmetatable = setmetatable -local unpack = unpack local type = type local floor = math.floor local GetTime = GetTime -local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - -local cleanfunction = function() end local APITimeBarFunctions do local metaPrototype = { WidgetType = "timebar", - SetHook = DF.SetHook, - RunHooksForWidget = DF.RunHooksForWidget, dversion = DF.dversion, } --check if there's a metaPrototype already existing if (_G[DF.GlobalWidgetControlNames["timebar"]]) then --get the already existing metaPrototype - local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["timebar"]] + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["timebar"]] --check if is older if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then --the version is older them the currently loading one @@ -41,12 +31,12 @@ do end else --first time loading the framework - _G[DF.GlobalWidgetControlNames ["timebar"]] = metaPrototype + _G[DF.GlobalWidgetControlNames["timebar"]] = metaPrototype end end local TimeBarMetaFunctions = _G[DF.GlobalWidgetControlNames["timebar"]] - +DF:Mixin(TimeBarMetaFunctions, DF.ScriptHookMixin) --methods TimeBarMetaFunctions.SetMembers = TimeBarMetaFunctions.SetMembers or {} @@ -62,7 +52,8 @@ TimeBarMetaFunctions.__index = function(table, key) if (fromMe) then return fromMe end - return TimeBarMetaFunctions [key] + + return TimeBarMetaFunctions[key] end TimeBarMetaFunctions.__newindex = function(table, key, value) @@ -364,16 +355,15 @@ end function DF:CreateTimeBar(parent, texture, width, height, value, member, name) - if (not name) then name = "DetailsFrameworkBarNumber" .. DF.BarNameCounter DF.BarNameCounter = DF.BarNameCounter + 1 elseif (not parent) then - return error ("Details! FrameWork: parent not found.", 2) + return error("Details! FrameWork: parent not found.", 2) end - if (name:find ("$parent")) then + if (name:find("$parent")) then local parentName = DF.GetParentName(parent) name = name:gsub("$parent", parentName) end diff --git a/Libs/LibGraph-2.0/LibGraph-2.0.lua b/Libs/LibGraph-2.0/LibGraph-2.0.lua index fe8a6e6b..50147e01 100644 --- a/Libs/LibGraph-2.0/LibGraph-2.0.lua +++ b/Libs/LibGraph-2.0/LibGraph-2.0.lua @@ -685,7 +685,7 @@ function GraphFunctions:AddDataSeries(points, color, n2, linetexture) end if linetexture then - if not linetexture:find ("\\") and not linetexture:find ("//") then + if not linetexture:find("\\") and not linetexture:find("//") then linetexture = TextureDirectory..linetexture end end @@ -1293,11 +1293,11 @@ end function GraphFunctions:SetLineTexture(texture) if (type(texture) ~= "string") then - return assert (false, "Parameter 1 for SetLineTexture must be a string") + return assert(false, "Parameter 1 for SetLineTexture must be a string") end --full path - if (texture:find ("\\") or texture:find ("//")) then + if (texture:find("\\") or texture:find("//")) then self.CustomLine = texture --using an image inside lib-graph folder else @@ -1306,10 +1306,10 @@ function GraphFunctions:SetLineTexture(texture) end function GraphFunctions:SetBorderSize(border, size) - border = string.lower (border) + border = string.lower(border) if (type(size) ~= "number") then - return assert (false, "Parameter 2 for SetBorderSize must be a number") + return assert(false, "Parameter 2 for SetBorderSize must be a number") end if (border == "left") then @@ -1326,7 +1326,7 @@ function GraphFunctions:SetBorderSize(border, size) return true end - return assert (false, "Usage: GraphObject:SetBorderSize (LEFT RIGHT TOP BOTTOM, SIZE)") + return assert(false, "Usage: GraphObject:SetBorderSize (LEFT RIGHT TOP BOTTOM, SIZE)") end function GraphFunctions:CreateGridlines() diff --git a/Libs/NickTag-1.0/NickTag-1.0.lua b/Libs/NickTag-1.0/NickTag-1.0.lua index 8f486e4b..618ee94b 100644 --- a/Libs/NickTag-1.0/NickTag-1.0.lua +++ b/Libs/NickTag-1.0/NickTag-1.0.lua @@ -76,9 +76,9 @@ end return target end - function NickTag:Msg(...) + function NickTag:Msg (...) if (NickTag.debug) then - print("|cFFFFFF00NickTag:|r", ...) + print ("|cFFFFFF00NickTag:|r", ...) end end @@ -219,15 +219,15 @@ end return end - local type, serial, arg3, name, realm, version = select(2, NickTag:Deserialize (data)) + local _type, serial, arg3, name, realm, version = select (2, NickTag:Deserialize (data)) --0x1: received a full persona - if (type == CONST_COMM_FULLPERSONA) then + if (_type == CONST_COMM_FULLPERSONA) then local receivedPersona = arg3 version = name - if (not receivedPersona or type(receivedPersona) ~= "table") then - NickTag:Msg("FULLPERSONA received but it's invalid ", source) + if (not receivedPersona or type (receivedPersona) ~= "table") then + NickTag:Msg ("FULLPERSONA received but it's invalid ", source) return end @@ -245,14 +245,14 @@ end if (allowNickName) then storedPersona [CONST_INDEX_NICKNAME] = receivedPersona [CONST_INDEX_NICKNAME] else - storedPersona [CONST_INDEX_NICKNAME] = LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_INVALID_NAME"] + storedPersona [CONST_INDEX_NICKNAME] = LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_INVALID_NAME"] end storedPersona [CONST_INDEX_NICKNAME] = receivedPersona [CONST_INDEX_NICKNAME] --update the rest --avatar path - storedPersona [CONST_INDEX_AVATAR_PATH] = type(receivedPersona [CONST_INDEX_AVATAR_PATH]) == "string" and receivedPersona [CONST_INDEX_AVATAR_PATH] or "" + storedPersona [CONST_INDEX_AVATAR_PATH] = type (receivedPersona [CONST_INDEX_AVATAR_PATH]) == "string" and receivedPersona [CONST_INDEX_AVATAR_PATH] or "" --avatar texcoord if (type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD]) == "boolean") then @@ -260,10 +260,10 @@ end elseif (type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD]) == "table") then storedPersona [CONST_INDEX_AVATAR_TEXCOORD] = storedPersona [CONST_INDEX_AVATAR_TEXCOORD] or {} - storedPersona [CONST_INDEX_AVATAR_TEXCOORD][1] = type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][1]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][1] or 0 - storedPersona [CONST_INDEX_AVATAR_TEXCOORD][2] = type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][2]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][2] or 1 - storedPersona [CONST_INDEX_AVATAR_TEXCOORD][3] = type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][3]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][3] or 0 - storedPersona [CONST_INDEX_AVATAR_TEXCOORD][4] = type(receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][4]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][4] or 1 + storedPersona [CONST_INDEX_AVATAR_TEXCOORD][1] = type (receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][1]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][1] or 0 + storedPersona [CONST_INDEX_AVATAR_TEXCOORD][2] = type (receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][2]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][2] or 1 + storedPersona [CONST_INDEX_AVATAR_TEXCOORD][3] = type (receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][3]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][3] or 0 + storedPersona [CONST_INDEX_AVATAR_TEXCOORD][4] = type (receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][4]) == "number" and receivedPersona [CONST_INDEX_AVATAR_TEXCOORD][4] or 1 else storedPersona [CONST_INDEX_AVATAR_TEXCOORD] = {0, 1, 0, 1} end @@ -274,29 +274,29 @@ end elseif (type(receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD]) == "table") then storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD] = storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD] or {} - storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1] = type(receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1] or 0 - storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2] = type(receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2] or 1 - storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3] = type(receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3] or 0 - storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4] = type(receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4] or 1 + storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1] = type (receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][1] or 0 + storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2] = type (receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][2] or 1 + storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3] = type (receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][3] or 0 + storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4] = type (receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_TEXCOORD][4] or 1 else storedPersona [CONST_INDEX_BACKGROUND_TEXCOORD] = {0, 1, 0, 1} end --background path - storedPersona [CONST_INDEX_BACKGROUND_PATH] = type(receivedPersona [CONST_INDEX_BACKGROUND_PATH]) == "string" and receivedPersona [CONST_INDEX_BACKGROUND_PATH] or "" + storedPersona [CONST_INDEX_BACKGROUND_PATH] = type (receivedPersona [CONST_INDEX_BACKGROUND_PATH]) == "string" and receivedPersona [CONST_INDEX_BACKGROUND_PATH] or "" --background color if (type(receivedPersona [CONST_INDEX_BACKGROUND_COLOR]) == "table") then storedPersona [CONST_INDEX_BACKGROUND_COLOR] = storedPersona [CONST_INDEX_BACKGROUND_COLOR] or {} - storedPersona [CONST_INDEX_BACKGROUND_COLOR][1] = type(receivedPersona [CONST_INDEX_BACKGROUND_COLOR][1]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][1] or 1 - storedPersona [CONST_INDEX_BACKGROUND_COLOR][2] = type(receivedPersona [CONST_INDEX_BACKGROUND_COLOR][2]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][2] or 1 - storedPersona [CONST_INDEX_BACKGROUND_COLOR][3] = type(receivedPersona [CONST_INDEX_BACKGROUND_COLOR][3]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][3] or 1 + storedPersona [CONST_INDEX_BACKGROUND_COLOR][1] = type (receivedPersona [CONST_INDEX_BACKGROUND_COLOR][1]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][1] or 1 + storedPersona [CONST_INDEX_BACKGROUND_COLOR][2] = type (receivedPersona [CONST_INDEX_BACKGROUND_COLOR][2]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][2] or 1 + storedPersona [CONST_INDEX_BACKGROUND_COLOR][3] = type (receivedPersona [CONST_INDEX_BACKGROUND_COLOR][3]) == "number" and receivedPersona [CONST_INDEX_BACKGROUND_COLOR][3] or 1 else storedPersona [CONST_INDEX_BACKGROUND_COLOR] = {1, 1, 1} end NickTag:SyncSiblings() - NickTag:Msg("FULLPERSONA received and updated for character: ", source, "new nickname: ", receivedPersona [CONST_INDEX_NICKNAME]) + NickTag:Msg ("FULLPERSONA received and updated for character: ", source, "new nickname: ", receivedPersona [CONST_INDEX_NICKNAME]) end end @@ -312,7 +312,7 @@ end function NickTag.OnEvent (self, event, ...) if (NickTag.EventFrame.InfoSendCooldown > time()) then if (not NickTag.EventFrame.ScheduledSend or NickTag.EventFrame.ScheduledSend._cancelled) then - NickTag.EventFrame.ScheduledSend = C_Timer.NewTimer(30, NickTag.SendPersona) + NickTag.EventFrame.ScheduledSend = C_Timer.NewTimer (30, NickTag.SendPersona) end else NickTag:SendPersona() @@ -334,7 +334,7 @@ end if (not nickTable) then return end - NickTag:Msg("SendPersona() -> broadcast") + NickTag:Msg ("SendPersona() -> broadcast") if (NickTag.EventFrame.ScheduledSend and not NickTag.EventFrame.ScheduledSend._cancelled) then NickTag.EventFrame.ScheduledSend:Cancel() @@ -346,7 +346,7 @@ end NickTag.send_scheduled = false --auto change nickname if we have an invalid nickname - if (NickTag:GetNickname (UnitName ("player")) == LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_INVALID_NAME"]) then + if (NickTag:GetNickname (UnitName ("player")) == LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_INVALID_NAME"]) then nickTable [CONST_INDEX_NICKNAME] = UnitName ("player") end @@ -378,7 +378,7 @@ end playerPersona [CONST_INDEX_BACKGROUND_COLOR] = false playerPersona [CONST_INDEX_REVISION] = playerPersona [CONST_INDEX_REVISION] + 1 - C_Timer.After(1, NickTag.SendPersona) + C_Timer.After (1, NickTag.SendPersona) end end end @@ -405,7 +405,7 @@ end pool.last_version = minor else --sometimes player guid isn't available right after logon, so, just schedule until it become available. - NickTag:ScheduleTimer("ResetCache", 0.3) + NickTag:ScheduleTimer ("ResetCache", 0.3) end end @@ -489,7 +489,7 @@ end local check_repeated = function(char) if (char == " ") then have_repeated = true - elseif (string.len(char) > 2) then + elseif (string.len (char) > 2) then have_repeated = true elseif (char == " ") then count_spaces = count_spaces + 1 @@ -502,7 +502,7 @@ end --as nicktag only work internally in the guild, we think that is not necessary a work filter to avoid people using bad language. if (type(name) ~= "string") then - return false, LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_4"] --error 4 = name isn't a valid string + return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_4"] --error 4 = name isn't a valid string end name = trim (name) @@ -532,9 +532,9 @@ end --limit nickname to 12 characters, same as wow. --cyrillic seems to double the len using 2 bytes - local len = string.len(name) + local len = string.len (name) if (len > maxLength) then - return false, LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_1"] --error 1 = nickname is too long, max of 12 characters. + return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_1"] --error 1 = nickname is too long, max of 12 characters. end --check if contain any non allowed characters, by now only accpet letters, numbers and spaces. @@ -543,13 +543,13 @@ end -- local notallow = string.find (name, "[^a-zA-Z�������%s]") -- if (notallow) then --- return false, LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --error 2 = nickname only support letters, numbers and spaces. +-- return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --error 2 = nickname only support letters, numbers and spaces. -- end --[=[ for letter in name:gmatch(".") do if (not allowedLetters[letter]) then - return false, LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --error 2 = nickname only support letters, numbers and spaces. + return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --error 2 = nickname only support letters, numbers and spaces. end end --]=] @@ -563,7 +563,7 @@ end have_repeated = true end if (have_repeated) then - return false, LibStub("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_3"] --error 3 = cant use the same letter three times consecutively, 2 spaces consecutively or 3 or more spaces. + return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_3"] --error 3 = cant use the same letter three times consecutively, 2 spaces consecutively or 3 or more spaces. end return true @@ -578,7 +578,7 @@ end --check if the nickname is okey to allowed to use. local okey, errortype = NickTag:CheckName (name) if (not okey) then - NickTag:Msg("SetNickname() invalid name ", name) + NickTag:Msg ("SetNickname() invalid name ", name) return false, errortype end @@ -607,11 +607,11 @@ end --this is a kind of protection for scripts which call SetNickname, SetColor and SetAvatar one after other, so scheduling here avoid three revisions upgrades and 3 broadcasts to the guild. if (not NickTag.send_scheduled) then NickTag.send_scheduled = true - NickTag:ScheduleTimer("SendPersona", 1) + NickTag:ScheduleTimer ("SendPersona", 1) end else - NickTag:Msg("SetNickname() name is the same on the pool ", name, nickTable [CONST_INDEX_NICKNAME]) + NickTag:Msg ("SetNickname() name is the same on the pool ", name, nickTable [CONST_INDEX_NICKNAME]) end return true @@ -622,7 +622,7 @@ end if (l == nil) then l, r, t, b = 0, 1, 0, 1 elseif (type(l) == "table") then - l, r, t, b = unpack(l) + l, r, t, b = unpack (l) end --check data before @@ -655,7 +655,7 @@ end if (not NickTag.send_scheduled) then NickTag.send_scheduled = true - NickTag:ScheduleTimer("SendPersona", 1) + NickTag:ScheduleTimer ("SendPersona", 1) end end @@ -713,7 +713,7 @@ end if (not NickTag.send_scheduled) then NickTag.send_scheduled = true - NickTag:ScheduleTimer("SendPersona", 1) + NickTag:ScheduleTimer ("SendPersona", 1) end end @@ -766,7 +766,7 @@ end if (not silent) then assert (type(playerName) == "string", "NickTag 'GetNicknameTable' expects a string on #1 argument.") else - if (not playerName or type(playerName) ~= "string") then + if (not playerName or type (playerName) ~= "string") then return end end @@ -851,9 +851,9 @@ do background_texture:SetWidth(290) background_texture:SetHeight(75) background_texture:SetTexture(NickTag.background_pool[1][1]) - background_texture:SetTexCoord (unpack(NickTag.background_pool[1][3])) + background_texture:SetTexCoord (unpack (NickTag.background_pool[1][3])) -- - local name = avatar_pick_frame:CreateFontString("AvatarPickFrameName", "overlay", "GameFontHighlightHuge") + local name = avatar_pick_frame:CreateFontString ("AvatarPickFrameName", "overlay", "GameFontHighlightHuge") name:SetPoint("left", avatar_texture, "right", -11, -17) name:SetText(UnitName ("player")) --- @@ -866,7 +866,7 @@ do elseif (button.isBackground) then local background = NickTag.background_pool [button.IconID] _G.AvatarPickFrameBackgroundPreview:SetTexture( background [1] ) - _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack(background [3])) + _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack (background [3])) avatar_pick_frame.selected_background = background [1] avatar_pick_frame.selected_texcoord = background [3] end @@ -874,7 +874,7 @@ do local selectedColor = function() local r, g, b = ColorPickerFrame:GetColorRGB() - background_texture:SetVertexColor(r, g, b) + background_texture:SetVertexColor (r, g, b) avatar_pick_frame.selected_color[1] = r avatar_pick_frame.selected_color[2] = g avatar_pick_frame.selected_color[3] = b @@ -883,7 +883,7 @@ do local okey = CreateFrame("button", "AvatarPickFrameAccept", avatar_pick_frame) okey:SetPoint("bottomright", avatar_pick_frame, "bottomright", -37, 12) okey:SetText("Accept") - okey:SetFrameLevel(avatar_pick_frame:GetFrameLevel()+2) + okey:SetFrameLevel (avatar_pick_frame:GetFrameLevel()+2) okey:SetScript("OnClick", function(self) avatar_pick_frame:Hide() if (avatar_pick_frame.callback) then @@ -893,7 +893,7 @@ do local change_color = CreateFrame("button", "AvatarPickFrameColor", avatar_pick_frame) change_color:SetPoint("bottomright", avatar_pick_frame, "bottomright", -205, 12) change_color:SetText("Color") - change_color:SetFrameLevel(avatar_pick_frame:GetFrameLevel()+2) + change_color:SetFrameLevel (avatar_pick_frame:GetFrameLevel()+2) change_color:SetScript("OnClick", function(self) ColorPickerFrame.func = selectedColor @@ -1019,8 +1019,8 @@ do end local background = NickTag.background_pool [n] _G.AvatarPickFrameBackgroundPreview:SetTexture( background [1] ) - _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack(background [3])) - _G.AvatarPickFrameBackgroundPreview:SetVertexColor(unpack(avatar_pick_frame.selected_color)) + _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack (background [3])) + _G.AvatarPickFrameBackgroundPreview:SetVertexColor (unpack (avatar_pick_frame.selected_color)) avatar_pick_frame.selected_background = background [1] end function avatar_pick_frame:SetColor (r, g, b) @@ -1033,7 +1033,7 @@ do if (type(b) ~= "number" or b > 1) then b = 1 end - _G.AvatarPickFrameBackgroundPreview:SetVertexColor(r, g, b) + _G.AvatarPickFrameBackgroundPreview:SetVertexColor (r, g, b) avatar_pick_frame.selected_color[1] = r avatar_pick_frame.selected_color[2] = g avatar_pick_frame.selected_color[3] = b @@ -1048,7 +1048,7 @@ do avatar_pick_frame:SetScript("OnShow", function() --get player avatar - local avatar = NickTag:GetNicknameTable (UnitGUID("player")) + local avatar = NickTag:GetNicknameTable (UnitGUID ("player")) if (avatar) then _G.AvatarPickFrameName:SetText( avatar [1] or UnitName ("player")) @@ -1061,7 +1061,7 @@ do avatar_pick_frame.selected_background = avatar [CONST_INDEX_BACKGROUND_PATH] or [[Interface\PetBattles\Weather-ArcaneStorm]] if (avatar [CONST_INDEX_BACKGROUND_TEXCOORD]) then - _G.AvatarPickFrameBackgroundPreview:SetTexCoord ( unpack(avatar [CONST_INDEX_BACKGROUND_TEXCOORD]) ) + _G.AvatarPickFrameBackgroundPreview:SetTexCoord ( unpack (avatar [CONST_INDEX_BACKGROUND_TEXCOORD]) ) avatar_pick_frame.selected_texcoord = avatar [CONST_INDEX_BACKGROUND_TEXCOORD] else _G.AvatarPickFrameBackgroundPreview:SetTexCoord ( 0.129609375, 1, 1, 0 ) @@ -1069,10 +1069,10 @@ do end if (avatar [CONST_INDEX_BACKGROUND_COLOR]) then - _G.AvatarPickFrameBackgroundPreview:SetVertexColor( unpack(avatar [CONST_INDEX_BACKGROUND_COLOR]) ) + _G.AvatarPickFrameBackgroundPreview:SetVertexColor ( unpack (avatar [CONST_INDEX_BACKGROUND_COLOR]) ) avatar_pick_frame.selected_color = avatar [CONST_INDEX_BACKGROUND_COLOR] else - _G.AvatarPickFrameBackgroundPreview:SetVertexColor( 1, 1, 1 ) + _G.AvatarPickFrameBackgroundPreview:SetVertexColor ( 1, 1, 1 ) avatar_pick_frame.selected_color = {1, 1, 1} end else @@ -1085,9 +1085,9 @@ do if (background) then _G.AvatarPickFrameBackgroundPreview:SetTexture( background [1] ) avatar_pick_frame.selected_background = background [1] - _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack(background [3])) + _G.AvatarPickFrameBackgroundPreview:SetTexCoord (unpack (background [3])) avatar_pick_frame.selected_texcoord = background [3] - _G.AvatarPickFrameBackgroundPreview:SetVertexColor(unpack(avatar_pick_frame.selected_color)) + _G.AvatarPickFrameBackgroundPreview:SetVertexColor (unpack (avatar_pick_frame.selected_color)) avatar_pick_frame.selected_color = avatar_pick_frame.selected_color end diff --git a/boot.lua b/boot.lua index 1e918f24..30fd71b5 100644 --- a/boot.lua +++ b/boot.lua @@ -230,7 +230,7 @@ do "Arena enemy deaths now are shown in the Deaths display.", "Guild statistics data has been wiped, this system had a major improvement overall.", "Fixed 'Clear Overall Data' on Logout which wasn't clearing.", - + {"v9.0.2.8192.144", "January 27th, 2021"}, "If you get issues with nicknames, disable any weakaura which modifies this feature.", "Advanced Death Logs plugin got some fixes and should work properly.", @@ -243,7 +243,7 @@ do "Fixed 'Always Show player' on ascending sort direction.", "Added more foods into the Ready Check plugin.", "Fixed some issues with the coach fearure.", - + {"v9.0.2.8154.144", "January 14th, 2021"}, "Added total damage bars into the player list in the Breakdown window.", "Added 'Square' or 'Roll' mode to Details! Streamer plugin, to change the statusbar mode to Squares, visit the options panel for the plugin.", @@ -303,7 +303,7 @@ do "Added a new plugin: 'Cast Timeline' available at the Player Breakdown Window.", "Added macro '/Details me' to open your Breakdown Window.", } - + local newsString = "|cFFF1F1F1" for i = 1, #news do @@ -334,15 +334,15 @@ do --store functions to create options frame Details.optionsSection = {} - + --containers - --armazenas as fun��es do parser - All parse functions + --armazenas as fun��es do parser - All parse functions _detalhes.parser = {} _detalhes.parser_functions = {} _detalhes.parser_frame = CreateFrame("Frame") _detalhes.pvp_parser_frame = CreateFrame("Frame") _detalhes.parser_frame:Hide() - + _detalhes.MacroList = { {Name = "Click on Your Own Bar", Desc = "To open the player details window on your character, like if you click on your bar in the damage window. The number '1' is the window number where it'll click.", MacroText = "/script Details:OpenPlayerDetails(1)"}, {Name = "Open Encounter Breakdown", Desc = "Open the encounter breakdown plugin. Details! Encounter Breakdown (plugin) must be enabled.", MacroText = "/script Details:OpenPlugin ('Encounter Breakdown')"}, @@ -392,7 +392,7 @@ do --armazena os estilos salvos _detalhes.savedStyles = {} --armazena quais atributos possue janela de atributos - contain attributes and sub attributos wich have a detailed window (left click on a row) - _detalhes.row_singleclick_overwrite = {} + _detalhes.row_singleclick_overwrite = {} --report _detalhes.ReportOptions = {} --armazena os buffs registrados - store buffs ids and functions @@ -436,9 +436,9 @@ do [1134] = {file = "LoadingScreen_Shadowpan_bg", coords = {0, 1, 0.29296875, 0.857421875}}, -- Tiger's Peak --legion, thanks @pas06 on curse forge for the mapIds [1552] = {file = "LoadingScreen_ArenaValSharah_wide", coords = {0, 1, 0.29296875, 0.857421875}}, -- Ashmane's Fall - [1504] = {file = "LoadingScreen_BlackrookHoldArena_wide", coords = {0, 1, 0.29296875, 0.857421875}}, --Black Rook Hold - - --"LoadScreenOrgrimmarArena", --Ring of Valor + [1504] = {file = "LoadingScreen_BlackrookHoldArena_wide", coords = {0, 1, 0.29296875, 0.857421875}}, --Black Rook Hold + + --"LoadScreenOrgrimmarArena", --Ring of Valor } function _detalhes:GetArenaInfo (mapid) @@ -462,13 +462,13 @@ do [628] = {file = "LOADSCREENISLEOFCONQUEST", coords = {0, 1, 297/1024, 878/1024}}, --isle of conquest --[] = {file = "", coords = {0, 1, 0, 0}}, -- } - function _detalhes:GetBattlegroundInfo (mapid) - local t = _detalhes.battleground_info [mapid] - if (t) then - return t.file, t.coords + function _detalhes:GetBattlegroundInfo(mapid) + local battlegroundInfo = _detalhes.battleground_info[mapid] + if (battlegroundInfo) then + return battlegroundInfo.file, battlegroundInfo.coords end end - + --tokenid _detalhes.TokenID = { ["SPELL_PERIODIC_DAMAGE"] = 1, @@ -506,7 +506,7 @@ do ["UNIT_DIED"] = 33, ["UNIT_DESTROYED"] = 34, } - + --armazena instancias inativas _detalhes.unused_instances = {} _detalhes.default_skin_to_use = "Minimalistic" @@ -544,11 +544,11 @@ do --tooltip _detalhes.tooltip_backdrop = { - bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], - edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], + bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], + edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], tile = true, - edgeSize = 16, - tileSize = 16, + edgeSize = 16, + tileSize = 16, insets = {left = 3, right = 3, top = 4, bottom = 4} } _detalhes.tooltip_border_color = {1, 1, 1, 1} @@ -560,18 +560,18 @@ do function _detalhes:GetAttributeIcon (attribute) return _detalhes.attribute_icons, 0.125 * (attribute - 1), 0.125 * attribute, 0, 1 end - + --colors _detalhes.default_backdropcolor = {.094117, .094117, .094117, .8} _detalhes.default_backdropbordercolor = {0, 0, 0, 1} - + --Plugins - + --plugin templates - + _detalhes.gump:NewColor("DETAILS_PLUGIN_BUTTONTEXT_COLOR", 0.9999, 0.8196, 0, 1) - - _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE", + + _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGINPANEL_BUTTON_TEMPLATE", { backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdropcolor = {0, 0, 0, .5}, @@ -579,7 +579,7 @@ do onentercolor = {0.3, 0.3, 0.3, .5}, } ) - _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGINPANEL_BUTTONSELECTED_TEMPLATE", + _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGINPANEL_BUTTONSELECTED_TEMPLATE", { backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdropcolor = {0, 0, 0, .5}, @@ -587,8 +587,8 @@ do onentercolor = {0.3, 0.3, 0.3, .5}, } ) - - _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE", + + _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGIN_BUTTON_TEMPLATE", { backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdropcolor = {1, 1, 1, .5}, @@ -600,7 +600,7 @@ do height = 20, } ) - _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE", + _detalhes.gump:InstallTemplate ("button", "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE", { backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, backdropcolor = {1, 1, 1, .5}, @@ -612,48 +612,48 @@ do height = 20, } ) - - _detalhes.gump:InstallTemplate ("button", "DETAILS_TAB_BUTTON_TEMPLATE", + + _detalhes.gump:InstallTemplate ("button", "DETAILS_TAB_BUTTON_TEMPLATE", { width = 100, height = 20, }, "DETAILS_PLUGIN_BUTTON_TEMPLATE" ) - _detalhes.gump:InstallTemplate ("button","DETAILS_TAB_BUTTONSELECTED_TEMPLATE", + _detalhes.gump:InstallTemplate ("button","DETAILS_TAB_BUTTONSELECTED_TEMPLATE", { width = 100, height = 20, }, "DETAILS_PLUGIN_BUTTONSELECTED_TEMPLATE" ) - + _detalhes.PluginsGlobalNames = {} _detalhes.PluginsLocalizedNames = {} - + --raid ------------------------------------------------------------------- --general function for raid mode plugins - _detalhes.RaidTables = {} + _detalhes.RaidTables = {} --menu for raid modes - _detalhes.RaidTables.Menu = {} + _detalhes.RaidTables.Menu = {} --plugin objects for raid mode - _detalhes.RaidTables.Plugins = {} + _detalhes.RaidTables.Plugins = {} --name to plugin object - _detalhes.RaidTables.NameTable = {} + _detalhes.RaidTables.NameTable = {} --using by - _detalhes.RaidTables.InstancesInUse = {} - _detalhes.RaidTables.PluginsInUse = {} + _detalhes.RaidTables.InstancesInUse = {} + _detalhes.RaidTables.PluginsInUse = {} --solo ------------------------------------------------------------------- --general functions for solo mode plugins - _detalhes.SoloTables = {} + _detalhes.SoloTables = {} --maintain plugin menu - _detalhes.SoloTables.Menu = {} + _detalhes.SoloTables.Menu = {} --plugins objects for solo mode - _detalhes.SoloTables.Plugins = {} + _detalhes.SoloTables.Plugins = {} --name to plugin object - _detalhes.SoloTables.NameTable = {} - + _detalhes.SoloTables.NameTable = {} + --toolbar ------------------------------------------------------------------- --plugins container _detalhes.ToolBar = {} @@ -688,7 +688,7 @@ do --[[global]] DETAILS_HEALTHSTONE_ID = 47875 --Warlock's Healthstone --[[global]] DETAILS_HEALTHSTONE2_ID = 47876 --Warlock's Healthstone (1/2 Talent) --[[global]] DETAILS_HEALTHSTONE3_ID = 47877 --Warlock's Healthstone (2/2 Talent) - + --[[global]] DETAILS_INT_POTION_ID = 40212 --Potion of Wild Magic --[[global]] DETAILS_AGI_POTION_ID = 40211 --Potion of Speed --[[global]] DETAILS_STR_POTION_ID = 307164 @@ -704,7 +704,7 @@ do [DETAILS_MANA_POTION_ID] = true, -- Runic Mana Potion [DETAILS_MANA_POTION2_ID] = true, -- Runic Mana Injector } - + else --[[global]] DETAILS_HEALTH_POTION_ID = 307192 -- spiritual healing potion --[[global]] DETAILS_HEALTH_POTION2_ID = 359867 --cosmic healing potion @@ -751,21 +751,21 @@ do fecha = ")", --close colocacao = ". " --dot } - + _detalhes.role_texcoord = { DAMAGER = "72:130:69:127", HEALER = "72:130:2:60", TANK = "5:63:69:127", NONE = "139:196:69:127", } - + _detalhes.role_texcoord_normalized = { DAMAGER = {72/256, 130/256, 69/256, 127/256}, HEALER = {72/256, 130/256, 2/256, 60/256}, TANK = {5/256, 63/256, 69/256, 127/256}, NONE = {139/256, 196/256, 69/256, 127/256}, } - + _detalhes.player_class = { ["HUNTER"] = true, ["WARRIOR"] = true, @@ -808,30 +808,30 @@ do [11] = "DRUID", [12] = "DEMONHUNTER", } - + local Loc = LibStub("AceLocale-3.0"):GetLocale ("Details") - + _detalhes.segmentos = { - label = Loc ["STRING_SEGMENT"]..": ", - overall = Loc ["STRING_TOTAL"], + label = Loc ["STRING_SEGMENT"]..": ", + overall = Loc ["STRING_TOTAL"], overall_standard = Loc ["STRING_OVERALL"], - current = Loc ["STRING_CURRENT"], + current = Loc ["STRING_CURRENT"], current_standard = Loc ["STRING_CURRENTFIGHT"], - past = Loc ["STRING_FIGHTNUMBER"] + past = Loc ["STRING_FIGHTNUMBER"] } - + _detalhes._detalhes_props["modo_nome"] = { - [_detalhes._detalhes_props["MODO_ALONE"]] = Loc ["STRING_MODE_SELF"], - [_detalhes._detalhes_props["MODO_GROUP"]] = Loc ["STRING_MODE_GROUP"], + [_detalhes._detalhes_props["MODO_ALONE"]] = Loc ["STRING_MODE_SELF"], + [_detalhes._detalhes_props["MODO_GROUP"]] = Loc ["STRING_MODE_GROUP"], [_detalhes._detalhes_props["MODO_ALL"]] = Loc ["STRING_MODE_ALL"], [_detalhes._detalhes_props["MODO_RAID"]] = Loc ["STRING_MODE_RAID"] } - + --[[global]] DETAILS_MODE_SOLO = 1 --[[global]] DETAILS_MODE_RAID = 4 --[[global]] DETAILS_MODE_GROUP = 2 --[[global]] DETAILS_MODE_ALL = 3 - + _detalhes.icones = { --report window report = { @@ -841,7 +841,7 @@ do highlight = nil } } - + _detalhes.missTypes = {"ABSORB", "BLOCK", "DEFLECT", "DODGE", "EVADE", "IMMUNE", "MISS", "PARRY", "REFLECT", "RESIST"} --do not localize-me @@ -857,39 +857,39 @@ do ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --frames - + local _CreateFrame = CreateFrame --api locals local UIParent = UIParent --api locals - + --Info Window _detalhes.playerDetailWindow = _CreateFrame ("Frame", "DetailsPlayerDetailsWindow", UIParent, "BackdropTemplate") _detalhes.PlayerDetailsWindow = _detalhes.playerDetailWindow - + --Event Frame _detalhes.listener = _CreateFrame ("Frame", nil, UIParent) _detalhes.listener:RegisterEvent ("ADDON_LOADED") _detalhes.listener:SetFrameStrata("LOW") _detalhes.listener:SetFrameLevel(9) _detalhes.listener.FrameTime = 0 - + _detalhes.overlay_frame = _CreateFrame ("Frame", nil, UIParent) _detalhes.overlay_frame:SetFrameStrata("TOOLTIP") - + --Pet Owner Finder _CreateFrame ("GameTooltip", "DetailsPetOwnerFinder", nil, "GameTooltipTemplate") - - + + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --plugin defaults --backdrop _detalhes.PluginDefaults = {} - + _detalhes.PluginDefaults.Backdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, insets = {left = 1, right = 1, top = 1, bottom = 1}} _detalhes.PluginDefaults.BackdropColor = {0, 0, 0, .6} _detalhes.PluginDefaults.BackdropBorderColor = {0, 0, 0, 1} - + function _detalhes.GetPluginDefaultBackdrop() return _detalhes.PluginDefaults.Backdrop, _detalhes.PluginDefaults.BackdropColor, _detalhes.PluginDefaults.BackdropBorderColor end @@ -899,14 +899,14 @@ do -- welcome panel function _detalhes:CreateWelcomePanel (name, parent, width, height, make_movable) local f = CreateFrame("frame", name, parent or UIParent, "BackdropTemplate") - + --f:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 128, insets = {left=3, right=3, top=3, bottom=3}, edgeFile = [[Interface\AddOns\Details\images\border_welcome]], edgeSize = 16}) f:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 128, insets = {left=0, right=0, top=0, bottom=0}, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) f:SetBackdropColor(1, 1, 1, 0.75) f:SetBackdropBorderColor(0, 0, 0, 1) f:SetSize(width or 1, height or 1) - + if (make_movable) then f:SetScript("OnMouseDown", function(self, button) if (self.isMoving) then @@ -915,11 +915,11 @@ do if (button == "RightButton") then self:Hide() else - self:StartMoving() + self:StartMoving() self.isMoving = true end end) - f:SetScript("OnMouseUp", function(self, button) + f:SetScript("OnMouseUp", function(self, button) if (self.isMoving and button == "LeftButton") then self:StopMovingOrSizing() self.isMoving = nil @@ -928,16 +928,16 @@ do f:SetToplevel (true) f:SetMovable(true) end - + return f end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --functions - + _detalhes.empty_function = function() end _detalhes.empty_table = {} - + --register textures and fonts for shared media local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") --default bars @@ -981,9 +981,9 @@ do SharedMedia:Register("sound", "Details Threat Warning Volume 3", [[Interface\Addons\Details\sounds\threat_warning_3.ogg]]) SharedMedia:Register("sound", "Details Threat Warning Volume 4", [[Interface\Addons\Details\sounds\threat_warning_4.ogg]]) - - + + --dump table contents over chat panel function Details.VarDump(t) if (type(t) ~= "table") then @@ -1013,7 +1013,7 @@ do end return copy end - + --delay messages function _detalhes:DelayMsg (msg) _detalhes.delaymsgs = _detalhes.delaymsgs or {} @@ -1021,13 +1021,13 @@ do end function _detalhes:ShowDelayMsg() if (_detalhes.delaymsgs and #_detalhes.delaymsgs > 0) then - for _, msg in ipairs(_detalhes.delaymsgs) do + for _, msg in ipairs(_detalhes.delaymsgs) do print(msg) end end _detalhes.delaymsgs = {} end - + --print messages function _detalhes:Msg(_string, arg1, arg2, arg3, arg4) if (self.__name) then @@ -1037,7 +1037,7 @@ do print(Loc ["STRING_DETAILS1"] .. (_string or ""), arg1 or "", arg2 or "", arg3 or "", arg4 or "") end end - + --welcome function _detalhes:WelcomeMsgLogon() _detalhes:Msg("you can always reset the addon running the command |cFFFFFF00'/details reinstall'|r if it does fail to load after being updated.") @@ -1070,33 +1070,33 @@ do _G ["BINDING_HEADER_DETAILS_KEYBIND_REPORT"] = Loc ["STRING_KEYBIND_WINDOW_REPORT_HEADER"] --keys - + _G ["BINDING_NAME_DETAILS_TOGGLE_ALL"] = Loc ["STRING_KEYBIND_TOGGLE_WINDOWS"] - + _G ["BINDING_NAME_DETAILS_RESET_SEGMENTS"] = Loc ["STRING_KEYBIND_RESET_SEGMENTS"] _G ["BINDING_NAME_DETAILS_SCROLL_UP"] = Loc ["STRING_KEYBIND_SCROLL_UP"] _G ["BINDING_NAME_DETAILS_SCROLL_DOWN"] = Loc ["STRING_KEYBIND_SCROLL_DOWN"] - - _G ["BINDING_NAME_DETAILS_REPORT_WINDOW1"] = format (Loc ["STRING_KEYBIND_WINDOW_REPORT"], 1) - _G ["BINDING_NAME_DETAILS_REPORT_WINDOW2"] = format (Loc ["STRING_KEYBIND_WINDOW_REPORT"], 2) - - _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW1"] = format (Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 1) - _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW2"] = format (Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 2) - _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW3"] = format (Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 3) - _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW4"] = format (Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 4) - _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW5"] = format (Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 5) - - _G ["BINDING_NAME_DETAILS_BOOKMARK1"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 1) - _G ["BINDING_NAME_DETAILS_BOOKMARK2"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 2) - _G ["BINDING_NAME_DETAILS_BOOKMARK3"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 3) - _G ["BINDING_NAME_DETAILS_BOOKMARK4"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 4) - _G ["BINDING_NAME_DETAILS_BOOKMARK5"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 5) - _G ["BINDING_NAME_DETAILS_BOOKMARK6"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 6) - _G ["BINDING_NAME_DETAILS_BOOKMARK7"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 7) - _G ["BINDING_NAME_DETAILS_BOOKMARK8"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 8) - _G ["BINDING_NAME_DETAILS_BOOKMARK9"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 9) - _G ["BINDING_NAME_DETAILS_BOOKMARK10"] = format (Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 10) - + + _G ["BINDING_NAME_DETAILS_REPORT_WINDOW1"] = format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 1) + _G ["BINDING_NAME_DETAILS_REPORT_WINDOW2"] = format(Loc ["STRING_KEYBIND_WINDOW_REPORT"], 2) + + _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW1"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 1) + _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW2"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 2) + _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW3"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 3) + _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW4"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 4) + _G ["BINDING_NAME_DETAILS_TOOGGLE_WINDOW5"] = format(Loc ["STRING_KEYBIND_TOGGLE_WINDOW"], 5) + + _G ["BINDING_NAME_DETAILS_BOOKMARK1"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 1) + _G ["BINDING_NAME_DETAILS_BOOKMARK2"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 2) + _G ["BINDING_NAME_DETAILS_BOOKMARK3"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 3) + _G ["BINDING_NAME_DETAILS_BOOKMARK4"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 4) + _G ["BINDING_NAME_DETAILS_BOOKMARK5"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 5) + _G ["BINDING_NAME_DETAILS_BOOKMARK6"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 6) + _G ["BINDING_NAME_DETAILS_BOOKMARK7"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 7) + _G ["BINDING_NAME_DETAILS_BOOKMARK8"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 8) + _G ["BINDING_NAME_DETAILS_BOOKMARK9"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 9) + _G ["BINDING_NAME_DETAILS_BOOKMARK10"] = format(Loc ["STRING_KEYBIND_BOOKMARK_NUMBER"], 10) + end if (select(4, GetBuildInfo()) >= 100000) then diff --git a/classes/class_combat.lua b/classes/class_combat.lua index 65803100..0223a661 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -74,11 +74,11 @@ end function combate:InstanceType() - return rawget (self, "instance_type") + return rawget(self, "instance_type") end function combate:IsTrash() - return rawget (self, "is_trash") + return rawget(self, "is_trash") end function combate:GetDifficulty() @@ -161,7 +161,7 @@ elseif (self.is_mythic_dungeon_trash) then return self.is_mythic_dungeon_trash.ZoneName .. " (" .. Loc ["STRING_SEGMENTS_LIST_TRASH"] .. ")" - elseif (rawget (self, "is_trash")) then + elseif (rawget(self, "is_trash")) then return Loc ["STRING_SEGMENT_TRASH"] else diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 4bbd3bc6..cf448bd1 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -1,74 +1,53 @@ ---customized display script local _detalhes = _G._detalhes - local gump = _detalhes.gump local _ - _detalhes.custom_function_cache = {} ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers + local format = string.format + local floor = math.floor + local sort = table.sort + local tinsert = table.insert + local ipairs = ipairs + local unpack = table.unpack or unpack + local _GetSpellInfo = _detalhes.getspellinfo + local IsInRaid = IsInRaid + local IsInGroup = IsInGroup + local stringReplace = _detalhes.string.replace - local _cstr = string.format --lua local - local _math_floor = math.floor --lua local - local _table_sort = table.sort --lua local - local tinsert = table.insert --lua local - local _table_size = table.getn --lua local - local _setmetatable = setmetatable --lua local - local ipairs = ipairs --lua local - local pairs = pairs --lua local - local _rawget= rawget --lua local - local _math_min = math.min --lua local - local _math_max = math.max --lua local - local _bit_band = bit.band --lua local - local _unpack = unpack --lua local - local type = type --lua local - local _pcall = pcall -- lua local - - local _GetSpellInfo = _detalhes.getspellinfo -- api local - local IsInRaid = IsInRaid -- api local - local IsInGroup = IsInGroup -- api local - local GetNumGroupMembers = GetNumGroupMembers -- api local - local _GetNumPartyMembers = GetNumPartyMembers or GetNumSubgroupMembers -- api local - local _GetNumRaidMembers = GetNumRaidMembers or GetNumGroupMembers -- api local - local _GetUnitName = GetUnitName -- api local - - local _string_replace = _detalhes.string.replace --details api - local Loc = LibStub("AceLocale-3.0"):GetLocale ( "Details" ) + local Loc = LibStub("AceLocale-3.0"):GetLocale("Details") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --constants - local atributo_custom = _detalhes.atributo_custom - atributo_custom.mt = {__index = atributo_custom} + local classCustom = _detalhes.atributo_custom + classCustom.mt = {__index = classCustom} - local combat_containers = { + local combatContainers = { ["damagedone"] = 1, ["healdone"] = 2, } --hold the mini custom objects - atributo_custom._InstanceActorContainer = {} - atributo_custom._InstanceLastCustomShown = {} - atributo_custom._InstanceLastCombatShown = {} - atributo_custom._TargetActorsProcessed = {} + classCustom._InstanceActorContainer = {} + classCustom._InstanceLastCustomShown = {} + classCustom._InstanceLastCombatShown = {} + classCustom._TargetActorsProcessed = {} local ToKFunctions = _detalhes.ToKFunctions - local SelectedToKFunction = ToKFunctions [1] - local FormatTooltipNumber = ToKFunctions [8] - local TooltipMaximizedMethod = 1 + local SelectedToKFunction = ToKFunctions[1] local UsingCustomRightText = false local UsingCustomLeftText = false ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --core - function atributo_custom:GetCombatContainerIndex (attribute) - return combat_containers [attribute] + function classCustom:GetCombatContainerIndex (attribute) + return combatContainers [attribute] end - function atributo_custom:RefreshWindow (instance, combat, force, export) - + function classCustom:RefreshWindow (instance, combat, force, export) --get the custom object local custom_object = instance:GetCustomObject() @@ -80,19 +59,19 @@ instance.customName = custom_object:GetName() --get the container holding the custom actor objects for this instance - local instance_container = atributo_custom:GetInstanceCustomActorContainer (instance) + local instance_container = classCustom:GetInstanceCustomActorContainer (instance) - local last_shown = atributo_custom._InstanceLastCustomShown [instance:GetId()] + local last_shown = classCustom._InstanceLastCustomShown [instance:GetId()] if (last_shown and last_shown ~= custom_object:GetName()) then instance_container:WipeCustomActorContainer() end - atributo_custom._InstanceLastCustomShown [instance:GetId()] = custom_object:GetName() + classCustom._InstanceLastCustomShown [instance:GetId()] = custom_object:GetName() - local last_combat_shown = atributo_custom._InstanceLastCombatShown [instance:GetId()] + local last_combat_shown = classCustom._InstanceLastCombatShown [instance:GetId()] if (last_combat_shown and last_combat_shown ~= combat) then instance_container:WipeCustomActorContainer() end - atributo_custom._InstanceLastCombatShown [instance:GetId()] = combat + classCustom._InstanceLastCombatShown [instance:GetId()] = combat --declare the main locals local total = 0 @@ -128,7 +107,7 @@ _detalhes:Msg("|cFFFF9900error compiling tooltip code for custom display " .. (instance.customName or "") .. " |r:", errortext) end end - + if (custom_object.total_script) then local total_script, errortext = loadstring (custom_object.total_script) if (total_script) then @@ -138,7 +117,7 @@ _detalhes:Msg("|cFFFF9900error compiling total code for custom display " .. (instance.customName or "") .. " |r:", errortext) end end - + if (custom_object.percent_script) then local percent_script, errortext = loadstring (custom_object.percent_script) if (percent_script) then @@ -149,41 +128,41 @@ end end end - + if (not func) then _detalhes:Msg(Loc ["STRING_CUSTOM_FUNC_INVALID"], func) _detalhes:EndRefresh (instance, 0, combat, combat [1]) end - - local okey, _total, _top, _amount = _pcall (func, combat, instance_container, instance) + + local okey, _total, _top, _amount = pcall (func, combat, instance_container, instance) if (not okey) then _detalhes:Msg("|cFFFF9900error on custom display function|r:", _total) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) end - + total = _total or 0 top = _top or 0 amount = _amount or 0 - + else --does not have a .script --get the attribute local attribute = custom_object:GetAttribute() --"damagedone" --get the custom function(actor, source, target, spellid) - local func = atributo_custom [attribute] - + local func = classCustom [attribute] + --get the combat container local container_index = self:GetCombatContainerIndex (attribute) local combat_container = combat [container_index]._ActorTable --build container - total, top, amount = atributo_custom:BuildActorList (func, custom_object.source, custom_object.target, custom_object.spellid, combat, combat_container, container_index, instance_container, instance, custom_object) + total, top, amount = classCustom:BuildActorList (func, custom_object.source, custom_object.target, custom_object.spellid, combat, combat_container, container_index, instance_container, instance, custom_object) end if (custom_object:IsSpellTarget()) then - amount = atributo_custom._TargetActorsProcessedAmt - total = atributo_custom._TargetActorsProcessedTotal - top = atributo_custom._TargetActorsProcessedTop + amount = classCustom._TargetActorsProcessedAmt + total = classCustom._TargetActorsProcessedTotal + top = classCustom._TargetActorsProcessedTop end if (amount == 0) then @@ -197,56 +176,56 @@ instance:EsconderScrollBar() return _detalhes:EndRefresh (instance, total, combat, nil) end - + if (amount > #instance_container._ActorTable) then amount = #instance_container._ActorTable end combat.totals [custom_object:GetName()] = total - + instance_container:Sort() instance_container:Remap() - + if (export) then - + -- key name value need to be formated if (custom_object) then - + local percent_script = _detalhes.custom_function_cache [instance.customName .. "Percent"] local total_script = _detalhes.custom_function_cache [instance.customName .. "Total"] local okey - + for index, actor in ipairs(instance_container._ActorTable) do - + local percent, ptotal - + if (percent_script) then - okey, percent = _pcall (percent_script, _math_floor(actor.value), top, total, combat, instance, actor) + okey, percent = pcall (percent_script, floor(actor.value), top, total, combat, instance, actor) if (not okey) then _detalhes:Msg("|cFFFF9900percent script error|r:", percent) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) end else - percent = _cstr ("%.1f", _math_floor(actor.value) / total * 100) + percent = format ("%.1f", floor(actor.value) / total * 100) end - + if (total_script) then - local okey, value = _pcall (total_script, _math_floor(actor.value), top, total, combat, instance, actor) + local okey, value = pcall (total_script, floor(actor.value), top, total, combat, instance, actor) if (not okey) then _detalhes:Msg("|cFFFF9900total script error|r:", value) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) end - + if (type(value) == "number") then value = SelectedToKFunction (_, value) end ptotal = value else - ptotal = SelectedToKFunction (_, _math_floor(actor.value)) + ptotal = SelectedToKFunction (_, floor(actor.value)) end - + actor.report_value = ptotal .. " (" .. percent .. "%)" - + if (actor.id) then if (actor.id == 1) then actor.report_name = GetSpellLink(6603) @@ -261,53 +240,50 @@ end end - + return total, instance_container._ActorTable, top, amount, "report_name" end - + instance:RefreshScrollBar (amount) - atributo_custom:Refresh (instance, instance_container, combat, force, total, top, custom_object) - + classCustom:Refresh (instance, instance_container, combat, force, total, top, custom_object) + return _detalhes:EndRefresh (instance, total, combat, combat [container_index]) end - function atributo_custom:BuildActorList (func, source, target, spellid, combat, combat_container, container_index, instance_container, instance, custom_object) - - --do the loop - + function classCustom:BuildActorList (func, source, target, spellid, combat, combat_container, container_index, instance_container, instance, custom_object) local total = 0 local top = 0 local amount = 0 - + --check if is a spell target custom if (custom_object:IsSpellTarget()) then - table.wipe (atributo_custom._TargetActorsProcessed) - atributo_custom._TargetActorsProcessedAmt = 0 - atributo_custom._TargetActorsProcessedTotal = 0 - atributo_custom._TargetActorsProcessedTop = 0 + table.wipe(classCustom._TargetActorsProcessed) + classCustom._TargetActorsProcessedAmt = 0 + classCustom._TargetActorsProcessedTotal = 0 + classCustom._TargetActorsProcessedTop = 0 instance_container:ResetCustomActorContainer() end - + if (source == "[all]") then - - for _, actor in ipairs(combat_container) do + + for _, actor in ipairs(combat_container) do local actortotal = func (_, actor, source, target, spellid, combat, instance_container) if (actortotal > 0) then total = total + actortotal amount = amount + 1 - + if (actortotal > top) then top = actortotal end - + instance_container:SetValue(actor, actortotal) end end - + elseif (source == "[raid]") then - + if (_detalhes.in_combat and instance.segmento == 0 and not export) then if (container_index == 1) then combat_container = _detalhes.cache_damage_group @@ -327,31 +303,31 @@ if (actortotal > 0) then total = total + actortotal amount = amount + 1 - + if (actortotal > top) then top = actortotal end - + instance_container:SetValue(actor, actortotal) end - + end end - + elseif (source == "[player]") then local pindex = combat [container_index]._NameIndexTable [_detalhes.playername] if (pindex) then local actor = combat [container_index]._ActorTable [pindex] local actortotal = func (_, actor, source, target, spellid, combat, instance_container) - + if (actortotal > 0) then total = total + actortotal amount = amount + 1 - + if (actortotal > top) then top = actortotal end - + instance_container:SetValue(actor, actortotal) end end @@ -361,35 +337,35 @@ if (pindex) then local actor = combat [container_index]._ActorTable [pindex] local actortotal = func (_, actor, source, target, spellid, combat, instance_container) - + if (actortotal > 0) then total = total + actortotal amount = amount + 1 - + if (actortotal > top) then top = actortotal end - + instance_container:SetValue(actor, actortotal) end end end - + return total, top, amount end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --refresh functions - function atributo_custom:Refresh (instance, instance_container, combat, force, total, top, custom_object) + function classCustom:Refresh (instance, instance_container, combat, force, total, top, custom_object) local whichRowLine = 1 local barras_container = instance.barras local percentage_type = instance.row_info.percent_type - + local combat_time = combat:GetCombatTime() UsingCustomLeftText = instance.row_info.textL_enable_custom_text UsingCustomRightText = instance.row_info.textR_enable_custom_text - + --total bar local use_total_bar = false if (instance.total_bar.enabled) then @@ -401,85 +377,85 @@ local percent_script = _detalhes.custom_function_cache [instance.customName .. "Percent"] local total_script = _detalhes.custom_function_cache [instance.customName .. "Total"] - + local bars_show_data = instance.row_info.textR_show_data local bars_brackets = instance:GetBarBracket() local bars_separator = instance:GetBarSeparator() if (instance.bars_sort_direction == 1) then --top to bottom - + if (use_total_bar and instance.barraS[1] == 1) then - + whichRowLine = 2 local iter_last = instance.barraS[2] if (iter_last == instance.rows_fit_in_window) then iter_last = iter_last - 1 end - + local row1 = barras_container [1] row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") - + row1:SetValue(100) local r, g, b = unpack(instance.total_bar.color) row1.textura:SetVertexColor(r, g, b) - + row1.icone_classe:SetTexture(instance.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) + Details.FadeHandler.Fader(row1, "out") - + for i = instance.barraS[1], iter_last, 1 do instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end - + else for i = instance.barraS[1], instance.barraS[2], 1 do instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end end - + elseif (instance.bars_sort_direction == 2) then --bottom to top - + if (use_total_bar and instance.barraS[1] == 1) then - + whichRowLine = 2 local iter_last = instance.barraS[2] if (iter_last == instance.rows_fit_in_window) then iter_last = iter_last - 1 end - + local row1 = barras_container [1] row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") - + row1:SetValue(100) local r, g, b = unpack(instance.total_bar.color) row1.textura:SetVertexColor(r, g, b) - + row1.icone_classe:SetTexture(instance.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) - + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) + Details.FadeHandler.Fader(row1, "out") - + for i = iter_last, instance.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end - + else for i = instance.barraS[2], instance.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end end - - end - + + end + if (force) then if (instance:IsGroupMode()) then for i = whichRowLine, instance.rows_fit_in_window do @@ -487,16 +463,16 @@ end end end - + end + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --custom object functions - - local actor_class_color_r, actor_class_color_g, actor_class_color_b - - function atributo_custom:UpdateBar (row_container, index, percentage_type, rank, total, top, instance, is_forced, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) - local row = row_container [index] + local actor_class_color_r, actor_class_color_g, actor_class_color_b + + function classCustom:UpdateBar (row_container, index, percentage_type, rank, total, top, instance, is_forced, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) + local row = row_container[index] local previous_table = row.minha_tabela row.colocacao = rank @@ -509,7 +485,7 @@ --percent if (percent_script) then --local value, top, total, combat, instance = ... - okey, percent = _pcall (percent_script, self.value, top, total, combat, instance, self) + okey, percent = pcall (percent_script, self.value, top, total, combat, instance, self) if (not okey) then _detalhes:Msg("|cFFFF9900error on custom display function|r:", percent) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) @@ -528,7 +504,7 @@ --total done if (total_script) then - local okey, value = _pcall (total_script, self.value, top, total, combat, instance, self) + local okey, value = pcall (total_script, self.value, top, total, combat, instance, self) if (not okey) then _detalhes:Msg("|cFFFF9900error on custom display function|r:", value) return _detalhes:EndRefresh (instance, 0, combat, combat [1]) @@ -555,7 +531,7 @@ local rightText = formated_value .. bars_brackets[1] .. percent .. bars_brackets[2] if (UsingCustomRightText) then - row.lineText4:SetText(_string_replace (instance.row_info.textR_custom_text, formated_value, "", percent, self, combat, instance, rightText)) + row.lineText4:SetText(stringReplace (instance.row_info.textR_custom_text, formated_value, "", percent, self, combat, instance, rightText)) else if (instance.use_multi_fontstrings) then instance:SetInLineTexts(row, "", formated_value, percent) @@ -566,8 +542,8 @@ end end end - - local row_value = _math_floor((self.value / top) * 100) + + local row_value = floor((self.value / top) * 100) -- update tooltip function -- @@ -578,69 +554,68 @@ if (not school_color) then school_color = _detalhes.school_colors ["unknown"] end - actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack(school_color) + actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(school_color) else local color = _detalhes.school_colors ["unknown"] - actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack(color) + actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(color) end else actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() end - + self:RefreshBarra2 (row, instance, previous_table, is_forced, row_value, index, row_container) - + end - - function atributo_custom:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container) - + + function classCustom:RefreshBarra2 (esta_barra, instancia, tabela_anterior, forcar, esta_porcentagem, whichRowLine, barras_container) --primeiro colocado if (esta_barra.colocacao == 1) then if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then esta_barra:SetValue(100) - + if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then Details.FadeHandler.Fader(esta_barra, "out") end - - return self:RefreshBarra (esta_barra, instancia) + + return self:RefreshBarra(esta_barra, instancia) else return end else if (esta_barra.hidden or esta_barra.fading_in or esta_barra.faded) then - + esta_barra:SetValue(esta_porcentagem) Details.FadeHandler.Fader(esta_barra, "out") - + if (instancia.row_info.texture_class_colors) then esta_barra.textura:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) end if (instancia.row_info.texture_background_class_color) then esta_barra.background:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) end - - return self:RefreshBarra (esta_barra, instancia) - + + return self:RefreshBarra(esta_barra, instancia) + else --agora esta comparando se a tabela da barra � diferente da tabela na atualiza��o anterior if (not tabela_anterior or tabela_anterior ~= esta_barra.minha_tabela or forcar) then --aqui diz se a barra do jogador mudou de posi��o ou se ela apenas ser� atualizada - + esta_barra:SetValue(esta_porcentagem) - + esta_barra.last_value = esta_porcentagem --reseta o ultimo valor da barra - + if (_detalhes.is_using_row_animations and forcar) then esta_barra.tem_animacao = 0 esta_barra:SetScript("OnUpdate", nil) end - - return self:RefreshBarra (esta_barra, instancia) - + + return self:RefreshBarra(esta_barra, instancia) + elseif (esta_porcentagem ~= esta_barra.last_value) then --continua mostrando a mesma tabela ent�o compara a porcentagem --apenas atualizar if (_detalhes.is_using_row_animations) then - + local upRow = barras_container [whichRowLine-1] if (upRow) then if (upRow.statusbar:GetValue() < esta_barra.statusbar:GetValue()) then @@ -657,15 +632,12 @@ esta_barra.last_value = esta_porcentagem end end - end - end - - function atributo_custom:RefreshBarra (esta_barra, instancia, from_resize) - + + function classCustom:RefreshBarra(esta_barra, instancia, from_resize) local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally - + if (from_resize) then if (self.id) then local school = _detalhes.spell_school_cache [self.nome] @@ -674,65 +646,65 @@ if (not school_color) then school_color = _detalhes.school_colors ["unknown"] end - actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack(school_color) + actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(school_color) else local color = _detalhes.school_colors ["unknown"] - actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack(color) + actor_class_color_r, actor_class_color_g, actor_class_color_b = unpack(color) end else actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() end end - _detalhes:SetBarColors (esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) + _detalhes:SetBarColors(esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) --we need a customized icon settings for custom displays. if (self.classe == "UNKNOW") then esta_barra.icone_classe:SetTexture("Interface\\LFGFRAME\\LFGROLE_BW") - esta_barra.icone_classe:SetTexCoord (.25, .5, 0, 1) + esta_barra.icone_classe:SetTexCoord(.25, .5, 0, 1) esta_barra.icone_classe:SetVertexColor(1, 1, 1) elseif (self.classe == "UNGROUPPLAYER") then if (self.enemy) then if (_detalhes.faction_against == "Horde") then esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male") - esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) else esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male") - esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) end else if (_detalhes.faction_against == "Horde") then esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Human_Male") - esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) else esta_barra.icone_classe:SetTexture("Interface\\ICONS\\Achievement_Character_Orc_Male") - esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1) + esta_barra.icone_classe:SetTexCoord(0, 1, 0, 1) end end esta_barra.icone_classe:SetVertexColor(1, 1, 1) - + elseif (self.classe == "PET") then esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) - esta_barra.icone_classe:SetTexCoord (0.25, 0.49609375, 0.75, 1) + esta_barra.icone_classe:SetTexCoord(0.25, 0.49609375, 0.75, 1) esta_barra.icone_classe:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) else if (self.id) then - esta_barra.icone_classe:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) + esta_barra.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) esta_barra.icone_classe:SetTexture(self.icon) else if (instancia.row_info.use_spec_icons) then if ((self.spec and self.spec ~= 0) or (self.my_actor.spec and self.my_actor.spec ~= 0)) then esta_barra.icone_classe:SetTexture(instancia.row_info.spec_file) - esta_barra.icone_classe:SetTexCoord (_unpack(_detalhes.class_specs_coords [self.spec or self.my_actor.spec])) + esta_barra.icone_classe:SetTexCoord(unpack(_detalhes.class_specs_coords[self.spec or self.my_actor.spec])) else esta_barra.icone_classe:SetTexture([[Interface\AddOns\Details\images\classes_small]]) - esta_barra.icone_classe:SetTexCoord (_unpack(CLASS_ICON_TCOORDS [self.classe])) + esta_barra.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe])) end else esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) - esta_barra.icone_classe:SetTexCoord (_unpack(CLASS_ICON_TCOORDS [self.classe])) + esta_barra.icone_classe:SetTexCoord(unpack(Details.class_coords[self.classe])) end end esta_barra.icone_classe:SetVertexColor(1, 1, 1) @@ -742,69 +714,70 @@ self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText) esta_barra.lineText1:SetSize(esta_barra:GetWidth() - esta_barra.lineText4:GetStringWidth() - 20, 15) - - end - function atributo_custom:CreateCustomActorContainer() - return _setmetatable({ + end + + function classCustom:CreateCustomActorContainer() + return setmetatable({ _NameIndexTable = {}, _ActorTable = {} - }, {__index = atributo_custom}) + }, {__index = classCustom}) end - - function atributo_custom:ResetCustomActorContainer() + + function classCustom:ResetCustomActorContainer() for _, actor in ipairs(self._ActorTable) do - actor.value = actor.value - _math_floor(actor.value) + actor.value = actor.value - floor(actor.value) --actor.value = _detalhes:GetOrderNumber(actor.nome) end end - - function atributo_custom:WipeCustomActorContainer() - table.wipe (self._ActorTable) - table.wipe (self._NameIndexTable) + + function classCustom:WipeCustomActorContainer() + table.wipe(self._ActorTable) + table.wipe(self._NameIndexTable) end - function atributo_custom:GetValue (actor) - local actor_table = self:GetActorTable (actor) + function classCustom:GetValue (actor) + local actor_table = self:GetActorTable(actor) return actor_table.value end + -- ~add - function atributo_custom:AddValue (actor, actortotal, checktop, name_complement) - local actor_table = self:GetActorTable (actor, name_complement) + function classCustom:AddValue (actor, actortotal, checktop, name_complement) + local actor_table = self:GetActorTable(actor, name_complement) if (not getmetatable(actor)) then - _setmetatable(actor,atributo_custom.mt) + setmetatable(actor,classCustom.mt) end actor_table.my_actor = actor actor_table.value = actor_table.value + actortotal - + if (checktop) then - if (actor_table.value > atributo_custom._TargetActorsProcessedTop) then - atributo_custom._TargetActorsProcessedTop = actor_table.value + if (actor_table.value > classCustom._TargetActorsProcessedTop) then + classCustom._TargetActorsProcessedTop = actor_table.value end end - + return actor_table.value end - - function atributo_custom:SetValue(actor, actortotal, name_complement) - local actor_table = self:GetActorTable (actor, name_complement) + + function classCustom:SetValue(actor, actortotal, name_complement) + local actor_table = self:GetActorTable(actor, name_complement) actor_table.my_actor = actor actor_table.value = actortotal end - function atributo_custom:UpdateClass(actors) + function classCustom:UpdateClass(actors) actors.new_actor.classe = actors.actor.classe end - function atributo_custom:HasActor(actor) - return self._NameIndexTable [actor.nome or actor.name] and true or false + function classCustom:HasActor(actor) + return self._NameIndexTable[actor.nome or actor.name] and true or false end - function atributo_custom:GetNumActors() + function classCustom:GetNumActors() return #self._ActorTable end - function atributo_custom:GetTotalAndHighestValue() + function classCustom:GetTotalAndHighestValue() local total, top = 0, 0 for i, actor in ipairs(self._ActorTable) do if (actor.value > top) then @@ -817,7 +790,7 @@ local icon_cache = {} - function atributo_custom:GetActorTable(actor, name_complement) + function classCustom:GetActorTable(actor, name_complement) local index = self._NameIndexTable[actor.nome or actor.name] if (index) then @@ -827,21 +800,22 @@ local class if (actor.id) then local spellname, _, icon = _GetSpellInfo(actor.id) - if (not icon_cache [spellname] and spellname) then - icon_cache [spellname] = icon + if (not icon_cache[spellname] and spellname) then + icon_cache[spellname] = icon elseif (not spellname) then spellname = "" end + actor.nome = spellname actor.name = spellname actor.classe = actor.spellschool class = actor.spellschool - - local index = self._NameIndexTable [actor.nome] + + local index = self._NameIndexTable[actor.nome] if (index) then - return self._ActorTable [index] + return self._ActorTable[index] end - + else class = actor.classe or actor.class if (not class or class == "UNKNOWN") then @@ -849,40 +823,40 @@ end if (class == "UNKNOW") then --try once again - class = _detalhes:GetClass (actor.nome or actor.name) + class = _detalhes:GetClass(actor.nome or actor.name) if (class and class ~= "UNKNOW") then actor.classe = class end end end - - local newActor = _setmetatable({ + + local newActor = setmetatable({ nome = actor.nome or actor.name, classe = class, value = _detalhes:GetOrderNumber(), is_custom = true, color = actor.color, - }, atributo_custom.mt) - + }, classCustom.mt) + newActor.name_complement = name_complement newActor.displayName = actor.displayName or (_detalhes:GetOnlyName(newActor.nome) .. (name_complement or "")) newActor.spec = actor.spec - + newActor.enemy = actor.enemy newActor.role = actor.role newActor.arena_enemy = actor.arena_enemy newActor.arena_ally = actor.arena_ally newActor.arena_team = actor.arena_team - + if (actor.id) then newActor.id = actor.id --icon - if (icon_cache [actor.nome]) then - newActor.icon = icon_cache [actor.nome] + if (icon_cache[actor.nome]) then + newActor.icon = icon_cache[actor.nome] else local _, _, icon = _GetSpellInfo(actor.id) if (icon) then - icon_cache [actor.nome] = icon + icon_cache[actor.nome] = icon newActor.icon = icon end end @@ -892,7 +866,7 @@ end if (newActor.classe == "UNGROUPPLAYER") then --atributo_custom:ScheduleTimer("UpdateClass", 5, {newActor = newActor, actor = actor}) - Details.Schedules.NewTimer(5, atributo_custom.UpdateClass, self, {new_actor = newActor, actor = actor}) + Details.Schedules.NewTimer(5, classCustom.UpdateClass, self, {new_actor = newActor, actor = actor}) end end @@ -904,15 +878,15 @@ end end - function atributo_custom:GetInstanceCustomActorContainer (instance) - if (not atributo_custom._InstanceActorContainer [instance:GetId()]) then - atributo_custom._InstanceActorContainer [instance:GetId()] = self:CreateCustomActorContainer() + function classCustom:GetInstanceCustomActorContainer (instance) + if (not classCustom._InstanceActorContainer [instance:GetId()]) then + classCustom._InstanceActorContainer [instance:GetId()] = self:CreateCustomActorContainer() end - return atributo_custom._InstanceActorContainer [instance:GetId()] + return classCustom._InstanceActorContainer [instance:GetId()] end - function atributo_custom:CreateCustomDisplayObject() - return _setmetatable({ + function classCustom:CreateCustomDisplayObject() + return setmetatable({ name = "new custom", icon = [[Interface\ICONS\TEMP]], author = "unknown", @@ -921,18 +895,18 @@ target = "[all]", spellid = false, script = false, - }, {__index = atributo_custom}) + }, {__index = classCustom}) end local custom_sort = function(t1, t2) return t1.value > t2.value end - function atributo_custom:Sort (container) + function classCustom:Sort (container) container = container or self - _table_sort (container._ActorTable, custom_sort) + sort (container._ActorTable, custom_sort) end - - function atributo_custom:Remap() + + function classCustom:Remap() local map = self._NameIndexTable local actors = self._ActorTable for i = 1, #actors do @@ -940,29 +914,28 @@ end end - function atributo_custom:ToolTip (instance, bar_number, row_object, keydown) - + function classCustom:ToolTip (instance, bar_number, row_object, keydown) --get the custom object local custom_object = instance:GetCustomObject() - + if (custom_object.notooltip) then return end - + --get the actor local actor = self.my_actor - + local r, g, b if (actor.id) then local school_color = _detalhes.school_colors [actor.classe] if (not school_color) then school_color = _detalhes.school_colors ["unknown"] end - r, g, b = _unpack(school_color) + r, g, b = unpack(school_color) else r, g, b = actor:GetClassColor() end - + if (actor.id) then _detalhes:AddTooltipSpellHeaderText (select(1, _GetSpellInfo(actor.id)), "yellow", 1, select(3, _GetSpellInfo(actor.id)), 0.90625, 0.109375, 0.15625, 0.875) else @@ -971,14 +944,14 @@ --GameCooltip:AddStatusBar (100, 1, r, g, b, 1) _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.6) - + if (custom_object:IsScripted()) then if (custom_object.tooltip) then local func = _detalhes.custom_function_cache [instance.customName .. "Tooltip"] if (func) then - + end - local okey, errortext = _pcall (func, actor, instance.showing, instance, keydown) + local okey, errortext = pcall (func, actor, instance.showing, instance, keydown) if (not okey) then _detalhes:Msg("|cFFFF9900error on custom display tooltip function|r:", errortext) return false @@ -987,105 +960,105 @@ else --get the attribute local attribute = custom_object:GetAttribute() - local container_index = atributo_custom:GetCombatContainerIndex (attribute) - + local container_index = classCustom:GetCombatContainerIndex (attribute) + --get the tooltip function - local func = atributo_custom [attribute .. "Tooltip"] - + local func = classCustom [attribute .. "Tooltip"] + --build the tooltip func (_, actor, custom_object.target, custom_object.spellid, instance.showing, instance) end - + return true end - - function atributo_custom:GetName() + + function classCustom:GetName() return self.name end - function atributo_custom:GetIcon() + function classCustom:GetIcon() return self.icon end - function atributo_custom:GetAuthor() + function classCustom:GetAuthor() return self.author end - function atributo_custom:GetDesc() + function classCustom:GetDesc() return self.desc end - function atributo_custom:GetAttribute() + function classCustom:GetAttribute() return self.attribute end - function atributo_custom:GetSource() + function classCustom:GetSource() return self.source end - function atributo_custom:GetTarget() + function classCustom:GetTarget() return self.target end - function atributo_custom:GetSpellId() + function classCustom:GetSpellId() return self.spellid end - function atributo_custom:GetScript() + function classCustom:GetScript() return self.script end - function atributo_custom:GetScriptToolip() + function classCustom:GetScriptToolip() return self.tooltip end - function atributo_custom:GetScriptTotal() + function classCustom:GetScriptTotal() return self.total_script end - function atributo_custom:GetScriptPercent() + function classCustom:GetScriptPercent() return self.percent_script end - function atributo_custom:SetName (name) + function classCustom:SetName (name) self.name = name end - function atributo_custom:SetIcon (path) + function classCustom:SetIcon (path) self.icon = path end - function atributo_custom:SetAuthor (author) + function classCustom:SetAuthor (author) self.author = author end - function atributo_custom:SetDesc (desc) + function classCustom:SetDesc (desc) self.desc = desc end - function atributo_custom:SetAttribute (newattribute) + function classCustom:SetAttribute (newattribute) self.attribute = newattribute end - function atributo_custom:SetSource (source) + function classCustom:SetSource (source) self.source = source end - function atributo_custom:SetTarget (target) + function classCustom:SetTarget (target) self.target = target end - function atributo_custom:SetSpellId (spellid) + function classCustom:SetSpellId (spellid) self.spellid = spellid end - function atributo_custom:SetScript(code) + function classCustom:SetScript(code) self.script = code end - function atributo_custom:SetScriptToolip (code) + function classCustom:SetScriptToolip (code) self.tooltip = code end - function atributo_custom:IsScripted() + function classCustom:IsScripted() return self.script and true or false end - - function atributo_custom:IsSpellTarget() + + function classCustom:IsSpellTarget() return self.spellid and self.target and true end - - function atributo_custom:RemoveCustom (index) - + + function classCustom:RemoveCustom (index) + if (not _detalhes.tabela_instancias) then --do not remove customs while the addon is loading. return end - + table.remove (_detalhes.custom, index) - - for _, instance in ipairs(_detalhes.tabela_instancias) do - if (instance.atributo == 5 and instance.sub_atributo == index) then + + for _, instance in ipairs(_detalhes.tabela_instancias) do + if (instance.atributo == 5 and instance.sub_atributo == index) then instance:ResetAttribute() elseif (instance.atributo == 5 and instance.sub_atributo > index) then instance.sub_atributo = instance.sub_atributo - 1 @@ -1094,23 +1067,23 @@ instance.sub_atributo_last [5] = 1 end end - + _detalhes.switch:OnRemoveCustom (index) end - + --export for plugins function _detalhes:RemoveCustomObject (object_name) for index, object in ipairs(_detalhes.custom) do if (object.name == object_name) then - return atributo_custom:RemoveCustom (index) + return classCustom:RemoveCustom (index) end end end - + function _detalhes:ResetCustomFunctionsCache() - table.wipe (_detalhes.custom_function_cache) + table.wipe(_detalhes.custom_function_cache) end - + function _detalhes.refresh:r_atributo_custom() --check for non used temp displays if (_detalhes.tabela_instancias) then @@ -1120,24 +1093,24 @@ if (custom_object.temp) then --check if there is a instance showing this custom local showing = false - + for index, instance in ipairs(_detalhes.tabela_instancias) do - if (instance.atributo == 5 and instance.sub_atributo == i) then + if (instance.atributo == 5 and instance.sub_atributo == i) then showing = true end end - + if (not showing) then - atributo_custom:RemoveCustom (i) + classCustom:RemoveCustom (i) end end end end - + --restore metatable and indexes for index, custom_object in ipairs(_detalhes.custom) do - _setmetatable(custom_object, atributo_custom) - custom_object.__index = atributo_custom + setmetatable(custom_object, classCustom) + custom_object.__index = classCustom end end @@ -1147,14 +1120,14 @@ end end - function atributo_custom:UpdateSelectedToKFunction() + function classCustom:UpdateSelectedToKFunction() SelectedToKFunction = ToKFunctions [_detalhes.ps_abbreviation] FormatTooltipNumber = ToKFunctions [_detalhes.tooltip.abbreviation] TooltipMaximizedMethod = _detalhes.tooltip.maximize_method - atributo_custom:UpdateDamageDoneBracket() - atributo_custom:UpdateHealingDoneBracket() + classCustom:UpdateDamageDoneBracket() + classCustom:UpdateHealingDoneBracket() end - + function _detalhes:InstallCustomObject (object) local have = false if (object.script_version) then @@ -1172,7 +1145,7 @@ end end end - + if (not have) then for i, custom in ipairs(_detalhes.custom) do if (custom.name == object.name) then @@ -1187,7 +1160,7 @@ end function _detalhes:AddDefaultCustomDisplays() - + local PotionUsed = { name = Loc ["STRING_CUSTOM_POT_DEFAULT"], icon = [[Interface\ICONS\INV_Potion_03]], @@ -1202,41 +1175,41 @@ --init: local combat, instance_container, instance = ... local total, top, amount = 0, 0, 0 - + --get the misc actor container local misc_container = combat:GetActorList ( DETAILS_ATTRIBUTE_MISC ) - + --do the loop: - for _, player in ipairs( misc_container ) do - + for _, player in ipairs( misc_container ) do + --only player in group if (player:IsGroupPlayer()) then - + local found_potion = false - + --get the spell debuff uptime container local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spells and player.debuff_uptime_spells._ActorTable if (debuff_uptime_container) then --potion of focus (can't use as pre-potion, so, its amount is always 1 local focus_potion = debuff_uptime_container [DETAILS_FOCUS_POTION_ID] - + if (focus_potion) then total = total + 1 found_potion = true if (top < 1) then top = 1 end - --add amount to the player + --add amount to the player instance_container:AddValue (player, 1) end end - + --get the spell buff uptime container local buff_uptime_container = player.buff_uptime and player.buff_uptime_spells and player.buff_uptime_spells._ActorTable if (buff_uptime_container) then for spellId, _ in pairs(DetailsFramework.PotionIDs) do local potionUsed = buff_uptime_container [spellId] - + if (potionUsed) then local used = potionUsed.activedamt if (used and used > 0) then @@ -1245,20 +1218,20 @@ if (used > top) then top = used end - - --add amount to the player + + --add amount to the player instance_container:AddValue (player, used) end end end end - + if (found_potion) then amount = amount + 1 - end + end end end - + --return: return total, top, amount ]], @@ -1266,7 +1239,7 @@ tooltip = [[ --init: local player, combat, instance = ... - + --get the debuff container for potion of focus local debuff_uptime_container = player.debuff_uptime and player.debuff_uptime_spells and player.debuff_uptime_spells._ActorTable if (debuff_uptime_container) then @@ -1278,13 +1251,13 @@ GameCooltip:AddIcon (icon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) end end - + --get the misc actor container local buff_uptime_container = player.buff_uptime and player.buff_uptime_spells and player.buff_uptime_spells._ActorTable if (buff_uptime_container) then for spellId, _ in pairs(DetailsFramework.PotionIDs) do local potionUsed = buff_uptime_container [spellId] - + if (potionUsed) then local name, _, icon = GetSpellInfo(spellId) GameCooltip:AddLine(name, potionUsed.activedamt) @@ -1295,7 +1268,7 @@ end ]] } - + local have = false for _, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_POT_DEFAULT"] and (custom.script_version and custom.script_version >= PotionUsed.script_version) ) then @@ -1321,7 +1294,7 @@ name = Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT"], icon = [[Interface\ICONS\INV_Stone_04]], attribute = false, - spellid = false, + spellid = false, author = "Details! Team", desc = Loc ["STRING_CUSTOM_HEALTHSTONE_DEFAULT_DESC"], source = false, @@ -1331,7 +1304,7 @@ local combat, instance_container, instance = ... --declade the values to return local total, top, amount = 0, 0, 0 - + --do the loop local AllHealCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_HEAL) for index, character in ipairs(AllHealCharacters) do @@ -1347,7 +1320,7 @@ found = true end end - + if (found) then amount = amount + 1 end @@ -1359,39 +1332,39 @@ tooltip = [[ --get the parameters passed local actor, combat, instance = ... - + --get the cooltip object (we dont use the convencional GameTooltip here) local GameCooltip = GameCooltip local R, G, B, A = 0, 0, 0, 0.75 - + local hs = actor:GetSpell (6262) if (hs) then GameCooltip:AddLine(select(1, GetSpellInfo(6262)), _detalhes:ToK(hs.total)) GameCooltip:AddIcon (select(3, GetSpellInfo(6262)), 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) GameCooltip:AddStatusBar (100, 1, R, G, B, A) end - + local pot = actor:GetSpell (DETAILS_HEALTH_POTION_ID) if (pot) then GameCooltip:AddLine(select(1, GetSpellInfo(DETAILS_HEALTH_POTION_ID)), _detalhes:ToK(pot.total)) GameCooltip:AddIcon (select(3, GetSpellInfo(DETAILS_HEALTH_POTION_ID)), 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) GameCooltip:AddStatusBar (100, 1, R, G, B, A) end - + local pot = actor:GetSpell (DETAILS_HEALTH_POTION2_ID) if (pot) then GameCooltip:AddLine(select(1, GetSpellInfo(DETAILS_HEALTH_POTION2_ID)), _detalhes:ToK(pot.total)) GameCooltip:AddIcon (select(3, GetSpellInfo(DETAILS_HEALTH_POTION2_ID)), 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) GameCooltip:AddStatusBar (100, 1, R, G, B, A) end - + local pot = actor:GetSpell (DETAILS_REJU_POTION_ID) if (pot) then GameCooltip:AddLine(select(1, GetSpellInfo(DETAILS_REJU_POTION_ID)), _detalhes:ToK(pot.total)) GameCooltip:AddIcon (select(3, GetSpellInfo(DETAILS_REJU_POTION_ID)), 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) GameCooltip:AddStatusBar (100, 1, R, G, B, A) end - + --Cooltip code ]], percent_script = false, @@ -1418,7 +1391,7 @@ end --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - + local DamageActivityTime = { name = Loc ["STRING_CUSTOM_ACTIVITY_DPS"], icon = [[Interface\Buttons\UI-MicroStream-Red]], @@ -1445,23 +1418,23 @@ --get the misc actor container local damage_container = combat:GetActorList ( DETAILS_ATTRIBUTE_DAMAGE ) - + --do the loop: - for _, player in ipairs( damage_container ) do + for _, player in ipairs( damage_container ) do if (player.grupo) then local activity = player:Tempo() total = total + activity amount = amount + 1 - --add amount to the player + --add amount to the player instance_container:AddValue (player, activity) end end - + --return: return total, combat:GetCombatTime(), amount ]], tooltip = [[ - + ]], } @@ -1479,7 +1452,7 @@ end end setmetatable(DamageActivityTime, _detalhes.atributo_custom) - DamageActivityTime.__index = _detalhes.atributo_custom + DamageActivityTime.__index = _detalhes.atributo_custom self.custom [#self.custom+1] = DamageActivityTime end @@ -1509,23 +1482,23 @@ --get the misc actor container local damage_container = combat:GetActorList ( DETAILS_ATTRIBUTE_HEAL ) - + --do the loop: - for _, player in ipairs( damage_container ) do + for _, player in ipairs( damage_container ) do if (player.grupo) then local activity = player:Tempo() total = total + activity amount = amount + 1 - --add amount to the player + --add amount to the player instance_container:AddValue (player, activity) end end - + --return: return total, combat:GetCombatTime(), amount ]], tooltip = [[ - + ]], } @@ -1546,9 +1519,9 @@ HealActivityTime.__index = _detalhes.atributo_custom self.custom [#self.custom+1] = HealActivityTime end - + --------------------------------------- - + ---------------------------------------------------------------------------------------------------------------------------------------------------- --doas local CC_Done = { @@ -1605,14 +1578,14 @@ table.sort (targets, _detalhes.Sort2) _detalhes:AddTooltipSpellHeaderText ("Targets", "yellow", #targets) - local class, _, _, _, _, r, g, b = _detalhes:GetClass (actor.nome) + local class, _, _, _, _, r, g, b = _detalhes:GetClass(actor.nome) _detalhes:AddTooltipHeaderStatusbar (1, 1, 1, 0.6) for index, target in ipairs(targets) do GameCooltip:AddLine(target[1], target [2]) _detalhes:AddTooltipBackgroundStatusbar() - - local class, _, _, _, _, r, g, b = _detalhes:GetClass (target [1]) + + local class, _, _, _, _, r, g, b = _detalhes:GetClass(target [1]) if (class and class ~= "UNKNOW") then local texture, l, r, t, b = _detalhes:GetClassIcon (class) GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height, l, r, t, b) @@ -1627,9 +1600,9 @@ return floor(value) ]], } - + -- /run _detalhes:AddDefaultCustomDisplays() - + local have = false for _, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_CC_DONE"] and (custom.script_version and custom.script_version >= CC_Done.script_version) ) then @@ -1640,7 +1613,7 @@ if (not have) then setmetatable(CC_Done, _detalhes.atributo_custom) CC_Done.__index = _detalhes.atributo_custom - + for i, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_CC_DONE"]) then table.remove (self.custom, i) @@ -1651,10 +1624,10 @@ if (not have) then self.custom [#self.custom+1] = CC_Done end - end - + end + ---------------------------------------------------------------------------------------------------------------------------------------------------- - + local CC_Received = { name = Loc ["STRING_CUSTOM_CC_RECEIVED"], icon = [[Interface\ICONS\Spell_Frost_ChainsOfIce]], @@ -1675,7 +1648,7 @@ for index, character in ipairs(misc_actors) do if (character.cc_done and character:IsPlayer()) then - + for player_name, amount in pairs(character.cc_done_targets) do local target = combat (1, player_name) or combat (2, player_name) if (target and target:IsPlayer()) then @@ -1690,7 +1663,7 @@ end end end - + end end @@ -1707,9 +1680,9 @@ local on_actor = character.cc_done_targets [name] if (on_actor) then tinsert(from, {character:name(), on_actor}) - + for spellid, spell in pairs(character.cc_done_spells._ActorTable) do - + local spell_on_actor = spell.targets [name] if (spell_on_actor) then local has_spell @@ -1720,11 +1693,11 @@ end end if (not has_spell) then - tinsert(spells, {spellid, spell_on_actor}) + tinsert(spells, {spellid, spell_on_actor}) end end - - end + + end end end end @@ -1736,7 +1709,7 @@ local name, _, icon = GetSpellInfo(spell [1]) GameCooltip:AddLine(name, spell [2]) _detalhes:AddTooltipBackgroundStatusbar() - GameCooltip:AddIcon (icon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) + GameCooltip:AddIcon (icon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) end _detalhes:AddTooltipSpellHeaderText ("From", "yellow", #from) @@ -1745,15 +1718,15 @@ for index, t in ipairs(from) do GameCooltip:AddLine(t[1], t[2]) _detalhes:AddTooltipBackgroundStatusbar() - - local class, _, _, _, _, r, g, b = _detalhes:GetClass (t [1]) + + local class, _, _, _, _, r, g, b = _detalhes:GetClass(t [1]) if (class and class ~= "UNKNOW") then local texture, l, r, t, b = _detalhes:GetClassIcon (class) GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height, l, r, t, b) else GameCooltip:AddIcon ("Interface\\GossipFrame\\IncompleteQuestIcon", 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height) - end - + end + end ]], total_script = [[ @@ -1761,9 +1734,9 @@ return floor(value) ]], } - + -- /run _detalhes:AddDefaultCustomDisplays() - + local have = false for _, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_CC_RECEIVED"] and (custom.script_version and custom.script_version >= CC_Received.script_version) ) then @@ -1774,7 +1747,7 @@ if (not have) then setmetatable(CC_Received, _detalhes.atributo_custom) CC_Received.__index = _detalhes.atributo_custom - + for i, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_CC_RECEIVED"]) then table.remove (self.custom, i) @@ -1785,10 +1758,10 @@ if (not have) then self.custom [#self.custom+1] = CC_Received end - end - + end + ---------------------------------------------------------------------------------------------------------------------------------------------------- - + local MySpells = { name = Loc ["STRING_CUSTOM_MYSPELLS"], icon = [[Interface\CHATFRAME\UI-ChatIcon-Battlenet]], @@ -1807,7 +1780,7 @@ local player local pet_attribute - + local role = DetailsFramework.UnitGroupRolesAssigned("player") local spec = DetailsFramework.GetSpecialization() role = spec and DetailsFramework.GetSpecializationRole (spec) or role @@ -1815,7 +1788,7 @@ if (role == "DAMAGER") then player = combat (DETAILS_ATTRIBUTE_DAMAGE, _detalhes.playername) pet_attribute = DETAILS_ATTRIBUTE_DAMAGE - elseif (role == "HEALER") then + elseif (role == "HEALER") then player = combat (DETAILS_ATTRIBUTE_HEAL, _detalhes.playername) pet_attribute = DETAILS_ATTRIBUTE_HEAL else @@ -1835,12 +1808,12 @@ end amount = amount + 1 end - + for _, PetName in ipairs(player.pets) do local pet = combat (pet_attribute, PetName) if (pet) then for spellid, spell in pairs(pet:GetSpellList()) do - instance_container:AddValue (spell, spell.total, nil, " (" .. PetName:gsub ((" <.*"), "") .. ")") + instance_container:AddValue (spell, spell.total, nil, " (" .. PetName:gsub((" <.*"), "") .. ")") total = total + spell.total if (top < spell.total) then top = spell.total @@ -1854,7 +1827,7 @@ --return the values return total, top, amount ]], - + tooltip = [[ --config: --Background RBG and Alpha: @@ -1871,7 +1844,7 @@ local role = DetailsFramework.UnitGroupRolesAssigned("player") if (spell.n_dmg) then - + local spellschool, schooltext = spell.spellschool, "" if (spellschool) then local t = _detalhes.spells_school [spellschool] @@ -1879,10 +1852,10 @@ schooltext = t.formated end end - + local total_hits = spell.counter local combat_time = instance.showing:GetCombatTime() - + local debuff_uptime_total, cast_string = "", "" local misc_actor = instance.showing (4, _detalhes.playername) if (misc_actor) then @@ -1890,9 +1863,9 @@ if (debuff_uptime) then debuff_uptime_total = floor(debuff_uptime / instance.showing:GetCombatTime() * 100) end - + local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spell.id] - + if (not spell_cast and misc_actor.spell_cast) then local spellname = GetSpellInfo(spell.id) for casted_spellid, amount in pairs(misc_actor.spell_cast) do @@ -1907,64 +1880,64 @@ end cast_string = cast_string .. spell_cast end - + --Cooltip code GC:AddLine("Casts:", cast_string or "?") GC:AddStatusBar (100, 1, R, G, B, A) - + if (debuff_uptime_total ~= "") then GC:AddLine("Uptime:", (debuff_uptime_total or "?") .. "%") GC:AddStatusBar (100, 1, R, G, B, A) end - + GC:AddLine("Hits:", spell.counter) GC:AddStatusBar (100, 1, R, G, B, A) - + local average = spell.total / total_hits GC:AddLine("Average:", _detalhes:ToK (average)) GC:AddStatusBar (100, 1, R, G, B, A) - + GC:AddLine("E-Dps:", _detalhes:ToK (spell.total / combat_time)) GC:AddStatusBar (100, 1, R, G, B, A) - + GC:AddLine("School:", schooltext) GC:AddStatusBar (100, 1, R, G, B, A) - + --GC:AddLine(" ") - + GC:AddLine("Normal Hits: ", spell.n_amt .. " (" ..floor( spell.n_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - + local n_average = spell.n_dmg / spell.n_amt local T = (combat_time*spell.n_dmg)/spell.total local P = average/n_average*100 T = P*T/100 - - GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format ("%.1f",spell.n_dmg / T )) + + GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_dmg / T )) GC:AddStatusBar (100, 1, R, G, B, A) - + --GC:AddLine(" ") - + GC:AddLine("Critical Hits: ", spell.c_amt .. " (" ..floor( spell.c_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - + if (spell.c_amt > 0) then local c_average = spell.c_dmg/spell.c_amt local T = (combat_time*spell.c_dmg)/spell.total local P = average/c_average*100 T = P*T/100 local crit_dps = spell.c_dmg / T - + GC:AddLine("Average / E-Dps: ", _detalhes:ToK (c_average) .. " / " .. _detalhes:comma_value (crit_dps)) else - GC:AddLine("Average / E-Dps: ", "0 / 0") + GC:AddLine("Average / E-Dps: ", "0 / 0") end - + GC:AddStatusBar (100, 1, R, G, B, A) - + elseif (spell.n_curado) then - + local spellschool, schooltext = spell.spellschool, "" if (spellschool) then local t = _detalhes.spells_school [spellschool] @@ -1972,58 +1945,58 @@ schooltext = t.formated end end - + local total_hits = spell.counter local combat_time = instance.showing:GetCombatTime() - + --Cooltip code GC:AddLine("Hits:", spell.counter) GC:AddStatusBar (100, 1, R, G, B, A) - + local average = spell.total / total_hits GC:AddLine("Average:", _detalhes:ToK (average)) GC:AddStatusBar (100, 1, R, G, B, A) - + GC:AddLine("E-Hps:", _detalhes:ToK (spell.total / combat_time)) GC:AddStatusBar (100, 1, R, G, B, A) - + GC:AddLine("School:", schooltext) GC:AddStatusBar (100, 1, R, G, B, A) - + --GC:AddLine(" ") - + GC:AddLine("Normal Hits: ", spell.n_amt .. " (" ..floor( spell.n_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - + local n_average = spell.n_curado / spell.n_amt local T = (combat_time*spell.n_curado)/spell.total local P = average/n_average*100 T = P*T/100 - - GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format ("%.1f",spell.n_curado / T )) + + GC:AddLine("Average / E-Dps: ", _detalhes:ToK (n_average) .. " / " .. format("%.1f",spell.n_curado / T )) GC:AddStatusBar (100, 1, R, G, B, A) - + --GC:AddLine(" ") - + GC:AddLine("Critical Hits: ", spell.c_amt .. " (" ..floor( spell.c_amt/total_hits*100) .. "%)") GC:AddStatusBar (100, 1, R, G, B, A) - + if (spell.c_amt > 0) then local c_average = spell.c_curado/spell.c_amt local T = (combat_time*spell.c_curado)/spell.total local P = average/c_average*100 T = P*T/100 local crit_dps = spell.c_curado / T - + GC:AddLine("Average / E-Hps: ", _detalhes:ToK (c_average) .. " / " .. _detalhes:comma_value (crit_dps)) else - GC:AddLine("Average / E-Hps: ", "0 / 0") + GC:AddLine("Average / E-Hps: ", "0 / 0") end - + GC:AddStatusBar (100, 1, R, G, B, A) end ]], - + percent_script = [[ local value, top, total, combat, instance = ... local dps = _detalhes:ToK (floor(value) / combat:GetCombatTime()) @@ -2042,7 +2015,7 @@ if (not have) then setmetatable(MySpells, _detalhes.atributo_custom) MySpells.__index = _detalhes.atributo_custom - + for i, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_MYSPELLS"]) then table.remove (self.custom, i) @@ -2053,10 +2026,10 @@ if (not have) then self.custom [#self.custom+1] = MySpells end - end - + end + ---------------------------------------------------------------------------------------------------------------------------------------------------- - + local DamageOnSkullTarget = { name = Loc ["STRING_CUSTOM_DAMAGEONSKULL"], icon = [[Interface\TARGETINGFRAME\UI-RaidTargetingIcon_8]], @@ -2072,9 +2045,9 @@ local Combat, CustomContainer, Instance = ... --declade the values to return local total, top, amount = 0, 0, 0 - - --raid target flags: - -- 128: skull + + --raid target flags: + -- 128: skull -- 64: cross -- 32: square -- 16: moon @@ -2082,13 +2055,13 @@ -- 4: diamond -- 2: circle -- 1: star - + --do the loop for _, actor in ipairs(Combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE)) do if (actor:IsPlayer()) then if (actor.raid_targets [128]) then CustomContainer:AddValue (actor, actor.raid_targets [128]) - end + end end end @@ -2121,9 +2094,9 @@ end ]], } - + -- /run _detalhes:AddDefaultCustomDisplays() - + local have = false for _, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONSKULL"] and (custom.script_version and custom.script_version >= DamageOnSkullTarget.script_version) ) then @@ -2134,7 +2107,7 @@ if (not have) then setmetatable(DamageOnSkullTarget, _detalhes.atributo_custom) DamageOnSkullTarget.__index = _detalhes.atributo_custom - + for i, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONSKULL"]) then table.remove (self.custom, i) @@ -2145,10 +2118,10 @@ if (not have) then self.custom [#self.custom+1] = DamageOnSkullTarget end - end - + end + ---------------------------------------------------------------------------------------------------------------------------------------------------- - + local DamageOnAnyTarget = { name = Loc ["STRING_CUSTOM_DAMAGEONANYMARKEDTARGET"], icon = [[Interface\TARGETINGFRAME\UI-RaidTargetingIcon_5]], @@ -2175,7 +2148,7 @@ total = total + (actor.raid_targets [16] or 0) --moon total = total + (actor.raid_targets [32] or 0) --square total = total + (actor.raid_targets [64] or 0) --cross - + if (total > 0) then CustomContainer:AddValue (actor, total) end @@ -2251,9 +2224,9 @@ end ]], } - + -- /run _detalhes:AddDefaultCustomDisplays() - + local have = false for _, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONANYMARKEDTARGET"] and (custom.script_version and custom.script_version >= DamageOnAnyTarget.script_version) ) then @@ -2264,7 +2237,7 @@ if (not have) then setmetatable(DamageOnAnyTarget, _detalhes.atributo_custom) DamageOnAnyTarget.__index = _detalhes.atributo_custom - + for i, custom in ipairs(self.custom) do if (custom.name == Loc ["STRING_CUSTOM_DAMAGEONANYMARKEDTARGET"]) then table.remove (self.custom, i) @@ -2275,13 +2248,13 @@ if (not have) then self.custom [#self.custom+1] = DamageOnAnyTarget end - end - + end + ---------------------------------------------------------------------------------------------------------------------------------------------------- - - + + --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - + local DynamicOverallDamage = { name = Loc ["STRING_CUSTOM_DYNAMICOVERAL"], --"Dynamic Overall Damage", icon = [[Interface\Buttons\Spell-Reset]], @@ -2296,41 +2269,41 @@ --init: local combat, instance_container, instance = ... local total, top, amount = 0, 0, 0 - + --get the overall combat local OverallCombat = Details:GetCombat(-1) --get the current combat local CurrentCombat = Details:GetCombat(0) - + if (not OverallCombat.GetActorList or not CurrentCombat.GetActorList) then return 0, 0, 0 end - + --get the damage actor container for overall local damage_container_overall = OverallCombat:GetActorList ( DETAILS_ATTRIBUTE_DAMAGE ) --get the damage actor container for current local damage_container_current = CurrentCombat:GetActorList ( DETAILS_ATTRIBUTE_DAMAGE ) - + --do the loop: - for _, player in ipairs( damage_container_overall ) do + for _, player in ipairs( damage_container_overall ) do --only player in group if (player:IsGroupPlayer()) then instance_container:AddValue (player, player.total) end end - + if (Details.in_combat) then - for _, player in ipairs( damage_container_current ) do + for _, player in ipairs( damage_container_current ) do --only player in group if (player:IsGroupPlayer()) then - instance_container:AddValue (player, player.total) + instance_container:AddValue (player, player.total) end end end - + total, top = instance_container:GetTotalAndHighestValue() amount = instance_container:GetNumActors() - + --return: return total, top, amount ]], @@ -2389,23 +2362,23 @@ local spellID, total = unpack(t) if (total > 1) then local spellName, _, spellIcon = Details.GetSpellInfo(spellID) - + local spellPercent = total / playerTotal * 100 local formatedSpellPercent = format("%.1f", spellPercent) - + if (string.len(formatedSpellPercent) < 4) then formatedSpellPercent = formatedSpellPercent .. "0" end - + GameCooltip:AddLine(spellName, format_func (_, total) .. " " .. formatedSpellPercent .. "%") - + Details:AddTooltipBackgroundStatusbar(false, total / topSpellTotal * 100) GameCooltip:AddIcon (spellIcon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height, 0.078125, 0.921875, 0.078125, 0.921875) - + end end ]], - + total_script = [[ local value, top, total, combat, instance = ... return value @@ -2416,20 +2389,20 @@ --get the time of overall combat local OverallCombatTime = Details:GetCombat(-1):GetCombatTime() - + --get the time of current combat if the player is in combat if (Details.in_combat) then local CurrentCombatTime = Details:GetCombat(0):GetCombatTime() OverallCombatTime = OverallCombatTime + CurrentCombatTime end - + --calculate the DPS and return it as percent local totalValue = value - + --build the string local ToK = Details:GetCurrentToKFunction() local s = ToK (_, value / OverallCombatTime) - + return s ]], } @@ -2448,12 +2421,12 @@ end end setmetatable(DynamicOverallDamage, _detalhes.atributo_custom) - DynamicOverallDamage.__index = _detalhes.atributo_custom + DynamicOverallDamage.__index = _detalhes.atributo_custom self.custom [#self.custom+1] = DynamicOverallDamage end - + --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - + local DamageOnShields = { name = Loc ["STRING_CUSTOM_DAMAGEONSHIELDS"], icon = [[Interface\ICONS\Spell_Holy_PowerWordShield]], @@ -2473,10 +2446,10 @@ --do the loop for index, actor in ipairs(Combat:GetActorList(1)) do if (actor:IsPlayer()) then - + --get the actor total damage absorbed local totalAbsorb = actor.totalabsorbed - + --get the damage absorbed by all the actor pets for petIndex, petName in ipairs(actor.pets) do local pet = Combat :GetActor(1, petName) @@ -2484,10 +2457,10 @@ totalAbsorb = totalAbsorb + pet.totalabsorbed end end - + --add the value to the actor on the custom container - CustomContainer:AddValue (actor, totalAbsorb) - + CustomContainer:AddValue (actor, totalAbsorb) + end end --loop end @@ -2526,10 +2499,10 @@ local pet = Combat :GetActor(1, petName) if (pet) then totalAbsorb = totalAbsorb + pet.totalabsorbed - + GameCooltip:AddLine(petName, format_func (_, pet.totalabsorbed)) - Details:AddTooltipBackgroundStatusbar() - + Details:AddTooltipBackgroundStatusbar() + end end ]], @@ -2549,12 +2522,12 @@ end end setmetatable(DamageOnShields, _detalhes.atributo_custom) - DamageOnShields.__index = _detalhes.atributo_custom + DamageOnShields.__index = _detalhes.atributo_custom self.custom [#self.custom+1] = DamageOnShields - end - ---------------------------------------- - + end + +--------------------------------------- + _detalhes:ResetCustomFunctionsCache() - + end diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 3a419c14..87251459 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -454,7 +454,7 @@ end local total = 0 - if (Details.time_type == 2 or not Details:CaptureGet ("damage")) then + if (Details.time_type == 2 or not Details:CaptureGet("damage")) then for _, actor in ipairs(container) do if (actor.grupo) then actor.last_dps = actor.total / combat_time @@ -661,8 +661,8 @@ end local lineHeight = Details.tooltip.line_height for index, t in ipairs(Targets) do - GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. " (" .. format ("%.1f", t[2]/total*100) .. "%)") - local class, _, _, _, _, r, g, b = Details:GetClass (t[1]) + GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. " (" .. format("%.1f", t[2]/total*100) .. "%)") + local class, _, _, _, _, r, g, b = Details:GetClass(t[1]) GameCooltip:AddStatusBar (t[2]/top*100, 1, r, g, b, 0.8, false, byspell_tooltip_background) @@ -903,7 +903,7 @@ end } local new_code = DTBS_search_code - new_code = new_code:gsub ("@SPELLID@", spell [1]) + new_code = new_code:gsub("@SPELLID@", spell [1]) new_custom_object.script = new_code tinsert(Details.custom, new_custom_object) @@ -914,7 +914,7 @@ end end local DTBS_format_name = function(player_name) return Details:GetOnlyName(player_name) end - local DTBS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format ("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end + local DTBS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end function atributo_damage:ReportSingleDTBSLine (spell, instance, ShiftKeyDown, ControlKeyDown) if (ControlKeyDown) then @@ -927,12 +927,12 @@ end local spelllink = Details:GetSpellLink(spell [1]) local report_table = {"Details!: " .. Loc ["STRING_CUSTOM_DTBS"] .. " " .. spelllink} - Details:FormatReportLines (report_table, bs_tooltip_table, DTBS_format_name, DTBS_format_amount) + Details:FormatReportLines(report_table, bs_tooltip_table, DTBS_format_name, DTBS_format_amount) - return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) + return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true}) end - function atributo_damage:AtualizarBySpell (tabela, whichRowLine, colocacao, instance) + function atributo_damage:AtualizarBySpell(tabela, whichRowLine, colocacao, instance) tabela ["byspell"] = true --marca que esta tabela � uma tabela de frags, usado no controla na hora de montar o tooltip local thisLine = instance.barras [whichRowLine] --pega a refer�ncia da barra na janela @@ -943,9 +943,9 @@ end thisLine.minha_tabela = tabela - local spellname, _, spellicon = _GetSpellInfo(tabela [1]) + local spellName, _, spellIcon = _GetSpellInfo(tabela[1]) - tabela.nome = spellname --evita dar erro ao redimencionar a janela + tabela.nome = spellName --evita dar erro ao redimencionar a janela tabela.minha_barra = whichRowLine thisLine.colocacao = colocacao @@ -958,27 +958,29 @@ end local porcentagem if (instance.row_info.percent_type == 1) then - porcentagem = format ("%.1f", tabela [2] / total * 100) + porcentagem = format("%.1f", tabela [2] / total * 100) + elseif (instance.row_info.percent_type == 2) then - porcentagem = format ("%.1f", tabela [2] / instance.top * 100) + porcentagem = format("%.1f", tabela [2] / instance.top * 100) end - thisLine.lineText1:SetText(colocacao .. ". " .. spellname) + thisLine.lineText1:SetText(colocacao .. ". " .. spellName) local bars_show_data = instance.row_info.textR_show_data - local spell_damage = tabela [2] -- spell_damage passar por uma ToK function, precisa ser number + local spell_damage = tabela[2] -- spell_damage passar por uma ToK function, precisa ser number if (not bars_show_data [1]) then - spell_damage = tabela [2] --damage taken by spell n�o tem PS, ent�o � obrigado a passar o dano total + spell_damage = tabela[2] --damage taken by spell n�o tem PS, ent�o � obrigado a passar o dano total end - if (not bars_show_data [3]) then + + if (not bars_show_data[3]) then porcentagem = "" else porcentagem = porcentagem .. "%" end local bars_brackets = instance:GetBarBracket() - -- + if (instance.use_multi_fontstrings) then instance:SetInLineTexts(thisLine, "", (spell_damage and SelectedToKFunction(_, spell_damage) or ""), porcentagem) else @@ -995,7 +997,7 @@ end if (colocacao == 1) then thisLine:SetValue(100) else - thisLine:SetValue(tabela [2] / instance.top * 100) + thisLine:SetValue(tabela[2] / instance.top * 100) end if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then @@ -1004,15 +1006,15 @@ end if (instance.row_info.texture_class_colors) then if (tabela [3] > 1) then - local r, g, b = Details:GetSpellSchoolColor (tabela [3]) + local r, g, b = Details:GetSpellSchoolColor(tabela[3]) thisLine.textura:SetVertexColor(r, g, b) else - local r, g, b = Details:GetSpellSchoolColor (0) + local r, g, b = Details:GetSpellSchoolColor(0) thisLine.textura:SetVertexColor(r, g, b) end end - thisLine.icone_classe:SetTexture(spellicon) + thisLine.icone_classe:SetTexture(spellIcon) thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) thisLine.icone_classe:SetVertexColor(1, 1, 1) end @@ -1081,7 +1083,7 @@ end for i = 1, math.min (min, #damage_taken_table) do local t = damage_taken_table [i] - GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, t[2]) .. " (" .. format ("%.1f", t[2] / total * 100) .. "%)") + GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, t[2]) .. " (" .. format("%.1f", t[2] / total * 100) .. "%)") local classe = t[3] if (not classe) then classe = "UNKNOW" @@ -1100,7 +1102,7 @@ end end end - local _, _, _, _, _, r, g, b = Details:GetClass (t[1]) + local _, _, _, _, _, r, g, b = Details:GetClass(t[1]) GameCooltip:AddStatusBar (t[2] / top * 100, 1, r, g, b, 1, false, enemies_background) end else @@ -1147,9 +1149,9 @@ end local porcentagem if (instancia.row_info.percent_type == 1) then - porcentagem = format ("%.1f", tabela [2] / total * 100) + porcentagem = format("%.1f", tabela [2] / total * 100) elseif (instancia.row_info.percent_type == 2) then - porcentagem = format ("%.1f", tabela [2] / instancia.top * 100) + porcentagem = format("%.1f", tabela [2] / instancia.top * 100) end thisLine.lineText1:SetText(colocacao .. ". " .. tabela [1]) @@ -1189,7 +1191,7 @@ end Details.FadeHandler.Fader(thisLine, "out") end - Details:SetBarColors (thisLine, instancia, unpack(Details.class_colors [tabela [3]])) + Details:SetBarColors(thisLine, instancia, unpack(Details.class_colors [tabela [3]])) if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then thisLine.icone_classe:SetTexture([[Interface\AddOns\Details\images\classes_plus]]) @@ -1278,7 +1280,7 @@ end for index, t in ipairs(tooltip_void_zone_temp) do instance_container:AddValue (t[4], t[2]) - local custom_actor = instance_container:GetActorTable (t[4]) + local custom_actor = instance_container:GetActorTable(t[4]) custom_actor.uptime = t[3].uptime total = total + t[2] @@ -1340,12 +1342,12 @@ end } local new_code = AVZ_search_code - new_code = new_code:gsub ("@ACTORNAME@", actor.nome) + new_code = new_code:gsub("@ACTORNAME@", actor.nome) new_custom_object.script = new_code local new_total_code = AVZ_total_code - new_total_code = new_total_code:gsub ("@ACTORNAME@", actor.nome) - new_total_code = new_total_code:gsub ("@SPELLID@", spellid) + new_total_code = new_total_code:gsub("@ACTORNAME@", actor.nome) + new_total_code = new_total_code:gsub("@SPELLID@", spellid) new_custom_object.total_script = new_total_code tinsert(Details.custom, new_custom_object) @@ -1495,7 +1497,7 @@ end GameCooltip:AddLine(Details:GetOnlyName(t[1]), FormatTooltipNumber (_, debuff_table.damage) .. " (" .. segundos .. "s" .. ")") end - local classe = Details:GetClass (t[1]) + local classe = Details:GetClass(t[1]) if (classe) then local specID = Details:GetSpec (t[1]) if (specID) then @@ -1508,7 +1510,7 @@ end GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, lineHeight, lineHeight, .25, .5, 0, 1) end - local _, _, _, _, _, r, g, b = Details:GetClass (t[1]) + local _, _, _, _, _, r, g, b = Details:GetClass(t[1]) if (first == 0) then first = 0.0000000001 end @@ -1531,9 +1533,8 @@ end end function atributo_misc:AtualizarVoidZone (whichRowLine, colocacao, instancia) - --pega a refer�ncia da barra na janela - local thisLine = instancia.barras [whichRowLine] + local thisLine = instancia.barras[whichRowLine] if (not thisLine) then print("DEBUG: problema com "..whichRowLine.." "..rank) @@ -1561,10 +1562,11 @@ end if (instancia.row_info.percent_type == 1) then total = max(total, 0.0001) - porcentagem = format ("%.1f", self.damage / total * 100) + porcentagem = format("%.1f", self.damage / total * 100) + elseif (instancia.row_info.percent_type == 2) then local top = max(instancia.top, 0.0001) - porcentagem = format ("%.1f", self.damage / top * 100) + porcentagem = format("%.1f", self.damage / top * 100) end local bars_show_data = instancia.row_info.textR_show_data @@ -1574,9 +1576,11 @@ end if (not bars_show_data [1]) then formated_damage = "" end + if (not bars_show_data [2]) then formated_dps = "" end + if (not bars_show_data [3]) then porcentagem = "" else @@ -1612,7 +1616,7 @@ end school_color = Details.school_colors ["unknown"] end - Details:SetBarColors (thisLine, instancia, unpack(school_color)) + Details:SetBarColors(thisLine, instancia, unpack(school_color)) thisLine.icone_classe:SetTexture(icon) thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) @@ -1621,7 +1625,6 @@ end if (thisLine.mouse_over and not instancia.baseframe.isMoving) then --need call a refresh function end - end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1850,7 +1853,7 @@ function atributo_damage:RefreshWindow (instancia, combatObject, forcar, exporta this_spell [2] = this_spell [2] + on_player total = total + on_player else - error ("error - no spell id for DTBS " .. spellid) + error("error - no spell id for DTBS " .. spellid) end end end @@ -1885,7 +1888,7 @@ function atributo_damage:RefreshWindow (instancia, combatObject, forcar, exporta this_spell [2] = this_spell [2] + on_player total = total + on_player else - error ("error - no spell id for DTBS friendly fire " .. spellid) + error("error - no spell id for DTBS friendly fire " .. spellid) end end end @@ -1986,7 +1989,7 @@ function atributo_damage:RefreshWindow (instancia, combatObject, forcar, exporta local found = false for spellid, spelltable in pairs(twin_damage_actor.spells._ActorTable) do local name = _GetSpellInfo(spellid) - if (actor.damage_twin:find (name)) then + if (actor.damage_twin:find(name)) then actor.damage = spelltable.total voidzone_damage_total = voidzone_damage_total + spelltable.total actor.damage_spellid = spellid @@ -2317,9 +2320,7 @@ function atributo_damage:RefreshWindow (instancia, combatObject, forcar, exporta end elseif (instancia.bars_sort_direction == 2) then --bottom to top - if (useTotalBar and instancia.barraS[1] == 1) then - whichRowLine = 2 local iter_last = instancia.barraS[2] if (iter_last == instancia.rows_fit_in_window) then @@ -2600,19 +2601,19 @@ function atributo_damage:RefreshLine(instance, lineContainer, whichRowLine, rank --calc the percent amount base on the percent type if (percentage_type == 1) then - percentString = format ("%.1f", self [keyName] / total * 100) + percentString = format("%.1f", self[keyName] / total * 100) elseif (percentage_type == 2) then - percentString = format ("%.1f", self [keyName] / instance.top * 100) + percentString = format("%.1f", self[keyName] / instance.top * 100) end --calculate the actor dps - if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet ("damage") or instance.segmento == -1) then + if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instance.segmento == -1) then if (instance.segmento == -1 and combat_time == 0) then - local p = Details.tabela_vigente (1, self.nome) - if (p) then - local t = p:Tempo() - dps = damageTotal / t + local actor = Details.tabela_vigente(1, self.nome) + if (actor) then + local combatTime = actor:Tempo() + dps = damageTotal / combatTime self.last_dps = dps else dps = damageTotal / combat_time @@ -2646,9 +2647,11 @@ function atributo_damage:RefreshLine(instance, lineContainer, whichRowLine, rank if (not bars_show_data [1]) then formated_damage = "" end + if (not bars_show_data [2]) then formated_dps = "" end + if (not bars_show_data [3]) then percentString = "" else @@ -3198,7 +3201,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) local petActor = instancia.showing[class_type]:PegarCombatente (nil, petName) if (petActor) then for _spellid, _skill in pairs(petActor:GetActorSpells()) do - ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo, petName:gsub ((" <.*"), "")} + ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo, petName:gsub((" <.*"), "")} end end end @@ -3366,7 +3369,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) for spellid, tabela in pairs(tabela) do local nome, rank, icone = _GetSpellInfo(spellid) - tinsert (meus_danos, {spellid, tabela.total, tabela.total/meu_total*100, {nome, rank, icone}}) + tinsert(meus_danos, {spellid, tabela.total, tabela.total/meu_total*100, {nome, rank, icone}}) end _table_sort(meus_danos, Details.Sort2) danos [nome] = meus_danos @@ -3374,7 +3377,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) local meus_inimigos = {} tabela = my_self.targets for target_name, amount in pairs(tabela) do - tinsert (meus_inimigos, {target_name, amount, amount/meu_total*100}) + tinsert(meus_inimigos, {target_name, amount, amount/meu_total*100}) end _table_sort(meus_inimigos,Details.Sort2) alvos [nome] = meus_inimigos @@ -3418,7 +3421,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) end - local n = _table [1]:gsub (("%s%<.*"), "") + local n = _table [1]:gsub(("%s%<.*"), "") if (instancia.sub_atributo == 1) then GameCooltip:AddLine(n, FormatTooltipNumber (_, _table [2]) .. " (" .. _math_floor(_table [2]/self.total*100) .. "%)") else @@ -3474,7 +3477,7 @@ function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown) for i = 1, #playerPhases do --[1] Phase Number [2] Amount Done [3] Rank [4] Percent - GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], FormatTooltipNumber (_, playerPhases [i][2]) .. " (|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format ("%.1f", playerPhases [i][4]) .. "%)") + GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], FormatTooltipNumber (_, playerPhases [i][2]) .. " (|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)") GameCooltip:AddIcon ([[Interface\Garrison\orderhall-missions-mechanic9]], 1, 1, 14, 14, 11/64, 53/64, 11/64, 53/64) Details:AddTooltipBackgroundStatusbar() end @@ -3496,7 +3499,7 @@ local on_switch_show_frags = function(instance) end local ENEMIES_format_name = function(player) if (player == 0) then return false end return Details:GetOnlyName(player.nome) end -local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. " (" .. format ("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end +local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. " (" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end function atributo_damage:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags) if (ShiftKeyDown) then @@ -3544,7 +3547,7 @@ function atributo_damage:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, end local FRAGS_format_name = function(player_name) return Details:GetOnlyName(player_name) end -local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format ("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end +local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end function atributo_damage:ReportSingleFragsLine (frag, instance, ShiftKeyDown, ControlKeyDown) @@ -3614,7 +3617,7 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown) local total = tooltip_temp_table [o][2] local player_name = Details:GetOnlyName(player:name()) - GameCooltip:AddLine(player_name .. " ", FormatTooltipNumber (_, total) .." (" .. format ("%.1f", (total / damage_taken) * 100) .. "%)") + GameCooltip:AddLine(player_name .. " ", FormatTooltipNumber (_, total) .." (" .. format("%.1f", (total / damage_taken) * 100) .. "%)") local classe = player:class() if (not classe) then @@ -3792,14 +3795,14 @@ function atributo_damage:ToolTip_DamageTaken (instancia, numero, barra, keydown) for _, spell in ipairs(all_spells) do local spellname, _, spellicon = _GetSpellInfo(spell [1]) - GameCooltip:AddLine(spellname .. " (|cFFFFFF00" .. spell [3] .. "|r)", FormatTooltipNumber (_, spell [2]).." (" .. format ("%.1f", (spell [2] / damage_taken) * 100).."%)") + GameCooltip:AddLine(spellname .. " (|cFFFFFF00" .. spell [3] .. "|r)", FormatTooltipNumber (_, spell [2]).." (" .. format("%.1f", (spell [2] / damage_taken) * 100).."%)") GameCooltip:AddIcon (spellicon, 1, 1, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B) Details:AddTooltipBackgroundStatusbar() end else local aggressorName = Details:GetOnlyName(meus_agressores[i][1]) - if (ismaximized and meus_agressores[i][1]:find (Details.playername)) then + if (ismaximized and meus_agressores[i][1]:find(Details.playername)) then GameCooltip:AddLine(aggressorName, FormatTooltipNumber (_, meus_agressores[i][2]).." ("..format("%.1f", (meus_agressores[i][2]/damage_taken) * 100).."%)", nil, "yellow") else GameCooltip:AddLine(aggressorName, FormatTooltipNumber (_, meus_agressores[i][2]).." ("..format("%.1f", (meus_agressores[i][2]/damage_taken) * 100).."%)") @@ -3971,16 +3974,18 @@ end function atributo_damage:MontaDetalhes (spellid, barra, instancia) if (info.sub_atributo == 1 or info.sub_atributo == 2) then return self:MontaDetalhesDamageDone (spellid, barra, instancia) + elseif (info.sub_atributo == 3) then return self:MontaDetalhesDamageTaken (spellid, barra, instancia) + elseif (info.sub_atributo == 4) then return self:MontaDetalhesFriendlyFire (spellid, barra, instancia) + elseif (info.sub_atributo == 6) then if (bitBand(self.flag_original, 0x00000400) ~= 0) then --� um jogador return self:MontaDetalhesDamageDone (spellid, barra, instancia) end return self:MontaDetalhesEnemy (spellid, barra, instancia) - --return self:MontaDetalhesDamageDone (spellid, barra) end end @@ -4003,7 +4008,7 @@ function atributo_damage:MontaInfoFriendlyFire() local actor = combat (1, target_name) if (actor) then - tinsert (DamagedPlayers, {target_name, ff_table.total, ff_table.total / FriendlyFireTotal * 100, actor.classe}) + tinsert(DamagedPlayers, {target_name, ff_table.total, ff_table.total / FriendlyFireTotal * 100, actor.classe}) for spellid, amount in pairs(ff_table.spells) do Skills [spellid] = (Skills [spellid] or 0) + amount @@ -4023,14 +4028,14 @@ function atributo_damage:MontaInfoFriendlyFire() if (not barra) then barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.on_focus = false end if (not info.mostrando_mouse_over) then if (tabela[1] == self.detalhes) then --tabela [1] = NOME = NOME que esta na caixa da direita if (not barra.on_focus) then --se a barra n�o tiver no foco - barra.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + barra.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) barra.on_focus = true if (not info.mostrando) then info.mostrando = barra @@ -4038,7 +4043,7 @@ function atributo_damage:MontaInfoFriendlyFire() end else if (barra.on_focus) then - barra.textura:SetStatusBarColor (1, 1, 1, 1) --volta a cor antiga + barra.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga barra:SetAlpha(.9) --volta a alfa antiga barra.on_focus = false end @@ -4052,7 +4057,7 @@ function atributo_damage:MontaInfoFriendlyFire() end barra.lineText1:SetText(index .. instancia.divisores.colocacao .. Details:GetOnlyName(tabela[1])) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " (" .. format ("%.1f", tabela[3]) .."%)") --seta o texto da direita + barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " (" .. format("%.1f", tabela[3]) .."%)") --seta o texto da direita local classe = tabela[4] if (not classe) then @@ -4069,9 +4074,9 @@ function atributo_damage:MontaInfoFriendlyFire() local color = Details.class_colors [classe] if (color) then - barra.textura:SetStatusBarColor (unpack(color)) + barra.textura:SetStatusBarColor(unpack(color)) else - barra.textura:SetStatusBarColor (1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1) end barra.minha_tabela = self @@ -4105,7 +4110,7 @@ function atributo_damage:MontaInfoFriendlyFire() if (not barra) then barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -4168,7 +4173,7 @@ function atributo_damage:MontaInfoDamageTaken() barra = gump:CriaNovaBarraInfo1 (instancia, index) end - self:FocusLock (barra, tabela[1]) + self:FocusLock(barra, tabela[1]) local texCoords = Details.class_coords [tabela[4]] if (not texCoords) then @@ -4176,23 +4181,22 @@ function atributo_damage:MontaInfoDamageTaken() end local formated_value = SelectedToKFunction(_, _math_floor(tabela[2])) - self:UpdadeInfoBar (barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small_alpha", true, texCoords, nil, tabela[4]) + self:UpdadeInfoBar(barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small_alpha", true, texCoords, nil, tabela[4]) end end ---[[exported]] function Details:UpdadeInfoBar (row, index, spellid, name, value, value_formated, max, percent, icon, detalhes, texCoords, spellschool, class) - --seta o tamanho da barra +--[[exported]] function Details:UpdadeInfoBar(row, index, spellId, name, value, formattedValue, max, percent, icon, detalhes, texCoords, spellSchool, class) if (index == 1) then row.textura:SetValue(100) else max = math.max(max, 0.001) - row.textura:SetValue(value/max*100) + row.textura:SetValue(value / max * 100) end if (type(index) == "number") then if (debugmode) then - row.lineText1:SetText(index .. ". " .. name .. " (" .. spellid .. ")") + row.lineText1:SetText(index .. ". " .. name .. " (" .. spellId .. ")") else row.lineText1:SetText(index .. ". " .. name) end @@ -4202,13 +4206,12 @@ end row.lineText1.text = row.lineText1:GetText() - if (value_formated) then - row.lineText4:SetText(value_formated .. " (" .. format ("%.1f", percent) .."%)") + if (formattedValue) then + row.lineText4:SetText(formattedValue .. " (" .. format("%.1f", percent) .."%)") end row.lineText1:SetSize(row:GetWidth() - row.lineText4:GetStringWidth() - 40, 15) - --seta o icone if (icon) then row.icone:SetTexture(icon) if (icon == "Interface\\AddOns\\Details\\images\\classes_small") then @@ -4230,48 +4233,48 @@ end if (texCoords) then row.icone:SetTexCoord(unpack(texCoords)) else - local icon_border = Details.tooltip.icon_border_texcoord - row.icone:SetTexCoord(icon_border.L, icon_border.R, icon_border.T, icon_border.B) + local iconBorder = Details.tooltip.icon_border_texcoord + row.icone:SetTexCoord(iconBorder.L, iconBorder.R, iconBorder.T, iconBorder.B) end row.minha_tabela = self - row.show = spellid - row:Show() --mostra a barra + row.show = spellId + row:Show() - if (spellschool) then - local t = Details.spells_school [spellschool] - if (t and t.decimals) then - row.textura:SetStatusBarColor (t.decimals[1], t.decimals[2], t.decimals[3]) + if (spellSchool) then + local schoolColor = Details.spells_school[spellSchool] + if (schoolColor and schoolColor.decimals) then + row.textura:SetStatusBarColor(schoolColor.decimals[1], schoolColor.decimals[2], schoolColor.decimals[3]) else - row.textura:SetStatusBarColor (1, 1, 1) + row.textura:SetStatusBarColor(1, 1, 1) end elseif (class) then - local color = Details.class_colors [class] + local color = Details.class_colors[class] if (color) then - row.textura:SetStatusBarColor (unpack(color)) + row.textura:SetStatusBarColor(unpack(color)) else - row.textura:SetStatusBarColor (1, 1, 1) + row.textura:SetStatusBarColor(1, 1, 1) end else - if (spellid == 98021) then --spirit linkl - row.textura:SetStatusBarColor (1, 0.4, 0.4) + if (spellId == 98021) then --spirit linkl + row.textura:SetStatusBarColor(1, 0.4, 0.4) else - row.textura:SetStatusBarColor (1, 1, 1) + row.textura:SetStatusBarColor(1, 1, 1) end end - if (detalhes and self.detalhes and self.detalhes == spellid and info.showing == index) then - --self:MontaDetalhes (spellid, row) --poderia deixar isso pro final e montar uma tail call?? - self:MontaDetalhes (row.show, row, info.instancia) --poderia deixar isso pro final e montar uma tail call?? + if (detalhes and self.detalhes and self.detalhes == spellId and info.showing == index) then + self:MontaDetalhes(row.show, row, info.instancia) end end ---[[exported]] function Details:FocusLock (row, spellid) +--lock into a line after clicking on it +--[[exported]] function Details:FocusLock(row, spellId) if (not info.mostrando_mouse_over) then - if (spellid == self.detalhes) then --tabela [1] = spellid = spellid que esta na caixa da direita + if (spellId == self.detalhes) then --tabela [1] = spellid = spellid que esta na caixa da direita if (not row.on_focus) then --se a barra n�o tiver no foco - row.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + row.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) row.on_focus = true if (not info.mostrando) then info.mostrando = row @@ -4279,7 +4282,7 @@ end end else if (row.on_focus) then - row.textura:SetStatusBarColor (1, 1, 1, 1) --volta a cor antiga + row.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga row:SetAlpha(.9) --volta a alfa antiga row.on_focus = false end @@ -4289,34 +4292,34 @@ end ------ Damage Done & Dps function atributo_damage:MontaInfoDamageDone() + local allLines = info.barras1 + local instance = info.instancia + local totalDamageWithoutPet = self.total_without_pet --total de dano aplicado por este jogador - local barras = info.barras1 - local instancia = info.instancia - local total = self.total_without_pet --total de dano aplicado por este jogador - - local ActorTotalDamage = self.total - local ActorSkillsSortTable = {} - local ActorSkillsContainer = self.spells._ActorTable + local actorTotalDamage = self.total + local actorSkillsSortTable = {} + local actorSkillsContainer = self.spells._ActorTable --get time type - local meu_tempo + local actorCombatTime if (Details.time_type == 1 or not self.grupo) then - meu_tempo = self:Tempo() + actorCombatTime = self:Tempo() + elseif (Details.time_type == 2) then - meu_tempo = info.instancia.showing:GetCombatTime() + actorCombatTime = info.instancia.showing:GetCombatTime() end - for _spellid, _skill in pairs(ActorSkillsContainer) do --da foreach em cada spellid do container - local nome, _, icone = _GetSpellInfo(_spellid) + for spellId, spellTable in pairs(actorSkillsContainer) do --da foreach em cada spellid do container + local nome, _, icone = _GetSpellInfo(spellId) if (nome) then - tinsert (ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome, icone, nil, _skill.spellschool}) + tinsert(actorSkillsSortTable, {spellId, spellTable.total, spellTable.total/actorTotalDamage*100, nome, icone, nil, spellTable.spellschool}) end end --damage rank - local combat = instancia:GetShowingCombat() + local combat = instance:GetShowingCombat() local diff = combat:GetDifficulty() - local attribute, subattribute = instancia:GetDisplay() + local attribute, subAttribute = instance:GetDisplay() --check if is a raid encounter and if is heroic or mythic if (diff and (diff == 15 or diff == 16)) then @@ -4326,7 +4329,7 @@ function atributo_damage:MontaInfoDamageDone() if (bestRank) then --discover which are the player position in the guild rank local playerTable, onEncounter, rankPosition = Details.storage:GetPlayerGuildRank (diff, combat:GetBossInfo().id, "damage", self.nome, true) - local text1 = self.nome .. " Guild Rank on " .. (combat:GetBossInfo().name or "") .. ": |cFFFFFF00" .. (rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank[1] or 0) / encounterTable.elapsed) .. "|r (" .. encounterTable.date:gsub (".*%s", "") .. ")" + local text1 = self.nome .. " Guild Rank on " .. (combat:GetBossInfo().name or "") .. ": |cFFFFFF00" .. (rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank[1] or 0) / encounterTable.elapsed) .. "|r (" .. encounterTable.date:gsub(".*%s", "") .. ")" info:SetStatusbarText (text1, 10, "gray") else info:SetStatusbarText() @@ -4344,45 +4347,45 @@ function atributo_damage:MontaInfoDamageDone() local class_color = "FFCCBBBB" --local class_color = "FFDDDD44" for _, PetName in ipairs(ActorPets) do - local PetActor = instancia.showing (class_type, PetName) + local PetActor = instance.showing (class_type, PetName) if (PetActor) then local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in pairs(PetSkillsContainer) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(_spellid) - --tinsert (ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " |TInterface\\AddOns\\Details\\images\\classes_small_alpha:12:12:0:0:128:128:33:64:96:128|t|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r", icone, PetActor, _skill.spellschool}) + --tinsert(ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " |TInterface\\AddOns\\Details\\images\\classes_small_alpha:12:12:0:0:128:128:33:64:96:128|t|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r", icone, PetActor, _skill.spellschool}) if (nome) then - tinsert (ActorSkillsSortTable, {_spellid, _skill.total, _skill.total/ActorTotalDamage*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor, _skill.spellschool}) + tinsert(actorSkillsSortTable, {_spellid, _skill.total, _skill.total/actorTotalDamage*100, nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor, _skill.spellschool}) end end end end - _table_sort(ActorSkillsSortTable, Details.Sort2) + _table_sort(actorSkillsSortTable, Details.Sort2) - gump:JI_AtualizaContainerBarras (#ActorSkillsSortTable + 1) + gump:JI_AtualizaContainerBarras (#actorSkillsSortTable + 1) - local max_ = ActorSkillsSortTable[1] and ActorSkillsSortTable[1][2] or 0 --dano que a primeiro magia vez + local max_ = actorSkillsSortTable[1] and actorSkillsSortTable[1][2] or 0 --dano que a primeiro magia vez local barra --aura bar if (false) then --disabled for now - barra = barras [1] + barra = allLines [1] if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instancia, 1) + barra = gump:CriaNovaBarraInfo1 (instance, 1) end - self:UpdadeInfoBar (barra, "", -51, "Auras", max_, false, max_, 100, [[Interface\BUTTONS\UI-GroupLoot-DE-Up]], true, nil, nil) - barra.textura:SetStatusBarColor (Details.gump:ParseColors("purple")) + self:UpdadeInfoBar(barra, "", -51, "Auras", max_, false, max_, 100, [[Interface\BUTTONS\UI-GroupLoot-DE-Up]], true, nil, nil) + barra.textura:SetStatusBarColor(Details.gump:ParseColors("purple")) end --spell bars - for index, tabela in ipairs(ActorSkillsSortTable) do + for index, tabela in ipairs(actorSkillsSortTable) do --index = index + 1 --with the aura bar index = index - barra = barras [index] + barra = allLines [index] if (not barra) then - barra = gump:CriaNovaBarraInfo1 (instancia, index) + barra = gump:CriaNovaBarraInfo1 (instance, index) end barra.other_actor = tabela [6] @@ -4390,22 +4393,22 @@ function atributo_damage:MontaInfoDamageDone() local name = tabela[4] if (info.sub_atributo == 2) then - local formated_value = SelectedToKFunction(_, _math_floor(tabela[2]/meu_tempo)) - self:UpdadeInfoBar (barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) + local formated_value = SelectedToKFunction(_, _math_floor(tabela[2]/actorCombatTime)) + self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) else local formated_value = SelectedToKFunction(_, _math_floor(tabela[2])) - self:UpdadeInfoBar (barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) + self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7]) end - self:FocusLock (barra, tabela[1]) + self:FocusLock(barra, tabela[1]) end --TOP INIMIGOS - if (instancia.sub_atributo == 6) then + if (instance.sub_atributo == 6) then local damage_taken = self.damage_taken local agressores = self.damage_from - local tabela_do_combate = instancia.showing + local tabela_do_combate = instance.showing local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable local barras = info.barras2 local meus_agressores = {} @@ -4439,8 +4442,8 @@ function atributo_damage:MontaInfoDamageDone() barra = barras [index] if (not barra) then --se a barra n�o existir, criar ela ent�o - barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra = gump:CriaNovaBarraInfo2 (instance, index) + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then @@ -4450,7 +4453,7 @@ function atributo_damage:MontaInfoDamageDone() end barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela[1])) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " (" .. format ("%.1f", tabela[3]) .. "%)") --seta o texto da direita + barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " (" .. format("%.1f", tabela[3]) .. "%)") --seta o texto da direita barra.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --CLASSE @@ -4462,9 +4465,9 @@ function atributo_damage:MontaInfoDamageDone() local color = Details.class_colors [tabela[4]] if (color) then - barra.textura:SetStatusBarColor (unpack(color)) + barra.textura:SetStatusBarColor(unpack(color)) else - barra.textura:SetStatusBarColor (1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1) end Details:name_space_info (barra) @@ -4494,7 +4497,7 @@ function atributo_damage:MontaInfoDamageDone() --my target container conteudo = self.targets for target_name, amount in pairs(conteudo) do - tinsert (meus_inimigos, {target_name, amount, amount/total*100}) + tinsert(meus_inimigos, {target_name, amount, amount/totalDamageWithoutPet*100}) end --sort @@ -4515,8 +4518,8 @@ function atributo_damage:MontaInfoDamageDone() barra = info.barras2 [index] if (not barra) then - barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra = gump:CriaNovaBarraInfo2 (instance, index) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -4525,31 +4528,31 @@ function atributo_damage:MontaInfoDamageDone() barra.textura:SetValue(tabela[2]/max_inimigos*100) end - local target_actor = instancia.showing (1, tabela[1]) + local target_actor = instance.showing (1, tabela[1]) if (target_actor) then - target_actor:SetClassIcon(barra.icone, instancia, target_actor.classe) + target_actor:SetClassIcon(barra.icone, instance, target_actor.classe) else barra.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --CLASSE local texCoords = Details.class_coords ["ENEMY"] barra.icone:SetTexCoord(unpack(texCoords)) end - barra.textura:SetStatusBarColor (1, 0.8, 0.8) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 0.8, 0.8) + barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela[1])) if (info.sub_atributo == 2) then - barra.lineText4:SetText(Details:comma_value ( _math_floor(tabela[2]/meu_tempo)) .. " (" .. format ("%.1f", tabela[3]) .. "%)") + barra.lineText4:SetText(Details:comma_value ( _math_floor(tabela[2]/actorCombatTime)) .. " (" .. format("%.1f", tabela[3]) .. "%)") else - barra.lineText4:SetText(SelectedToKFunction(_, tabela[2]) .." (" .. format ("%.1f", tabela[3]) .. "%)") + barra.lineText4:SetText(SelectedToKFunction(_, tabela[2]) .." (" .. format("%.1f", tabela[3]) .. "%)") end if (barra.mouse_over) then --atualizar o tooltip if (barra.isAlvo) then --GameTooltip:Hide() --GameTooltip:SetOwner(barra, "ANCHOR_TOPRIGHT") - if (not barra.minha_tabela:MontaTooltipAlvos (barra, index, instancia)) then + if (not barra.minha_tabela:MontaTooltipAlvos (barra, index, instance)) then return end --GameTooltip:Show() @@ -4592,7 +4595,7 @@ function atributo_damage:MontaDetalhesFriendlyFire (nome, barra) for spellid, amount in pairs(ff_table.spells) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(spellid) - tinsert (minhas_magias, {spellid, amount, amount / total * 100, nome, icone}) + tinsert(minhas_magias, {spellid, amount, amount / total * 100, nome, icone}) end _table_sort(minhas_magias, Details.Sort2) @@ -4605,7 +4608,7 @@ function atributo_damage:MontaDetalhesFriendlyFire (nome, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then @@ -4615,7 +4618,7 @@ function atributo_damage:MontaDetalhesFriendlyFire (nome, barra) end barra.lineText1:SetText(index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda - barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " " .. instancia.divisores.abre .. format ("%.1f", tabela[3]) .. "%" .. instancia.divisores.fecha) --seta o texto da direita + barra.lineText4:SetText(Details:comma_value (tabela[2]) .. " " .. instancia.divisores.abre .. format("%.1f", tabela[3]) .. "%" .. instancia.divisores.fecha) --seta o texto da direita barra.icone:SetTexture(tabela[5]) barra.icone:SetTexCoord(0, 1, 0, 1) @@ -4680,7 +4683,7 @@ function atributo_damage:MontaDetalhesEnemy (spellid, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then @@ -4705,9 +4708,9 @@ function atributo_damage:MontaDetalhesEnemy (spellid, barra) local color = Details.class_colors [tabela[3]] if (color) then - barra.textura:SetStatusBarColor (unpack(color)) + barra.textura:SetStatusBarColor(unpack(color)) else - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end barra.icone:SetTexture("Interface\\AddOns\\Details\\images\\classes_small_alpha") @@ -4753,7 +4756,7 @@ function atributo_damage:MontaDetalhesDamageTaken (nome, barra) local este_alvo = tabela.targets [actor] if (este_alvo) then --esta magia deu dano no actor local spell_nome, rank, icone = _GetSpellInfo(spellid) - tinsert (minhas_magias, {spellid, este_alvo, este_alvo/total*100, spell_nome, icone}) + tinsert(minhas_magias, {spellid, este_alvo, este_alvo/total*100, spell_nome, icone}) end end @@ -4770,7 +4773,7 @@ function atributo_damage:MontaDetalhesDamageTaken (nome, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then @@ -4893,11 +4896,11 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) local index = 1 local data = data_table - table.wipe (t1) - table.wipe (t2) - table.wipe (t3) - table.wipe (t4) - table.wipe (data) + table.wipe(t1) + table.wipe(t2) + table.wipe(t3) + table.wipe(t4) + table.wipe(data) --GERAL local media = 0 @@ -4982,7 +4985,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) t1[5] = Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:comma_value (esta_magia.n_max) t1[6] = Loc ["STRING_AVERAGE"] .. ": " .. Details:comma_value (media_normal) t1[7] = Loc ["STRING_DPS"] .. ": " .. Details:comma_value (normal_dmg/T) - t1[8] = normal_hits .. " [|cFFC0C0C0" .. format ("%.1f", normal_hits/max(total_hits, 0.0001)*100) .. "%|r]" + t1[8] = normal_hits .. " [|cFFC0C0C0" .. format("%.1f", normal_hits/max(total_hits, 0.0001)*100) .. "%|r]" end @@ -5008,7 +5011,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) t2[5] = Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:comma_value (esta_magia.c_max) t2[6] = Loc ["STRING_AVERAGE"] .. ": " .. Details:comma_value (media_critico) t2[7] = Loc ["STRING_DPS"] .. ": " .. Details:comma_value (crit_dps) - t2[8] = esta_magia.c_amt .. " [|cFFC0C0C0" .. format ("%.1f", esta_magia.c_amt/total_hits*100) .. "%|r]" + t2[8] = esta_magia.c_amt .. " [|cFFC0C0C0" .. format("%.1f", esta_magia.c_amt/total_hits*100) .. "%|r]" end @@ -5032,7 +5035,7 @@ function atributo_damage:MontaDetalhesDamageDone (spellid, barra, instancia) t3[5] = Loc ["STRING_PARRY"] .. ": " .. parry t3[6] = Loc ["STRING_DODGE"] .. ": " .. dodge t3[7] = Loc ["STRING_BLOCKED"] .. ": " .. _math_floor(esta_magia.b_amt/esta_magia.counter*100) - t3[8] = (outros_desvios+erros) .. " / " .. format ("%.1f", porcentagem_defesas) .. "%" + t3[8] = (outros_desvios+erros) .. " / " .. format("%.1f", porcentagem_defesas) .. "%" end @@ -5065,7 +5068,7 @@ function Details:BuildPlayerDetailsSpellChart() for i = 1, 200 do local texture = playerDetailSmallChart:CreateTexture(nil, "artwork") - texture:SetColorTexture (1, 1, 1, 1) + texture:SetColorTexture(1, 1, 1, 1) tinsert(playerDetailSmallChart.Lines, texture) end @@ -5238,7 +5241,7 @@ function atributo_damage:MontaTooltipAlvos (thisLine, index, instancia) end local nome, _, icone = _GetSpellInfo(_spellid) - t[1], t[2], t[3] = nome .. " (" .. PetName:gsub ((" <.*"), "") .. ")", amount, icone + t[1], t[2], t[3] = nome .. " (" .. PetName:gsub((" <.*"), "") .. ")", amount, icone i = i + 1 end @@ -5932,7 +5935,7 @@ end local total = tooltip_temp_table [o][2] local player_name = player:name() - if (player_name:find (Details.playername)) then + if (player_name:find(Details.playername)) then GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber (_, total) .. " (" .. _cstr ("%.1f", (total / damage_done) * 100) .. "%)", 2, "yellow") else GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber (_, total) .." (" .. _cstr ("%.1f", (total / damage_done) * 100) .. "%)", 2) diff --git a/classes/class_error.lua b/classes/class_error.lua index 2fde29d7..241e62c2 100644 --- a/classes/class_error.lua +++ b/classes/class_error.lua @@ -7,7 +7,7 @@ do } _error.__index = _error _error.__newindex = function() - assert (false, "Attempt to modify an read-only object.\nUse object() or object.errortext\n"..debugstack (2, 1 , 0)) + assert(false, "Attempt to modify an read-only object.\nUse object() or object.errortext\n"..debugstack (2, 1 , 0)) return end _error.__tostring = function() diff --git a/classes/class_heal.lua b/classes/class_heal.lua index fb9ba522..83249d8f 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -180,7 +180,7 @@ function atributo_heal:ContainerRefreshHps (container, combat_time) local total = 0 - if (_detalhes.time_type == 2 or not _detalhes:CaptureGet ("heal")) then + if (_detalhes.time_type == 2 or not _detalhes:CaptureGet("heal")) then for _, actor in ipairs(container) do if (actor.grupo) then actor.last_hps = actor.total / combat_time @@ -206,7 +206,7 @@ function atributo_heal:ReportSingleDamagePreventedLine (actor, instancia) for i = 2, GameCooltip:GetNumLines()-2 do local texto_left, texto_right = GameCooltip:GetText (i) if (texto_left and texto_right) then - texto_left = texto_left:gsub (("|T(.*)|t "), "") + texto_left = texto_left:gsub(("|T(.*)|t "), "") reportar [#reportar+1] = ""..texto_left.." "..texto_right.."" end end @@ -448,7 +448,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo row1.textura:SetVertexColor(r, g, b) row1.icone_classe:SetTexture(instancia.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") @@ -518,7 +518,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo row1.textura:SetVertexColor(r, g, b) row1.icone_classe:SetTexture(instancia.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") @@ -626,7 +626,7 @@ function atributo_heal:RefreshLine(instancia, barras_container, whichRowLine, lu porcentagem = _cstr ("%.1f", self [keyName] / instancia.top * 100) end - if ((_detalhes.time_type == 2 and self.grupo) or (not _detalhes:CaptureGet ("heal") and not _detalhes:CaptureGet ("aura")) or instancia.segmento == -1) then + if ((_detalhes.time_type == 2 and self.grupo) or (not _detalhes:CaptureGet("heal") and not _detalhes:CaptureGet("aura")) or instancia.segmento == -1) then if (instancia.segmento == -1 and combat_time == 0) then local p = _detalhes.tabela_vigente(2, self.nome) if (p) then @@ -886,7 +886,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc Details.FadeHandler.Fader(thisLine, "out") end - return self:RefreshBarra (thisLine, instancia) + return self:RefreshBarra(thisLine, instancia) else return end @@ -910,7 +910,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc thisLine.background:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) end - return self:RefreshBarra (thisLine, instancia) + return self:RefreshBarra(thisLine, instancia) else --agora esta comparando se a tabela da barra � diferente da tabela na atualiza��o anterior @@ -925,7 +925,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc thisLine.last_value = esta_porcentagem --reseta o ultimo valor da barra - return self:RefreshBarra (thisLine, instancia) + return self:RefreshBarra(thisLine, instancia) elseif (esta_porcentagem ~= thisLine.last_value) then --continua mostrando a mesma tabela ent�o compara a porcentagem --apenas atualizar @@ -936,7 +936,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc end thisLine.last_value = esta_porcentagem - return self:RefreshBarra (thisLine, instancia) + return self:RefreshBarra(thisLine, instancia) end end @@ -944,7 +944,7 @@ function atributo_heal:RefreshBarra2 (thisLine, instancia, tabela_anterior, forc end -function atributo_heal:RefreshBarra (thisLine, instancia, from_resize) +function atributo_heal:RefreshBarra(thisLine, instancia, from_resize) local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally @@ -955,7 +955,7 @@ function atributo_heal:RefreshBarra (thisLine, instancia, from_resize) --icon self:SetClassIcon (thisLine.icone_classe, instancia, class) --texture color - self:SetBarColors (thisLine, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) + self:SetBarColors(thisLine, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) --left text self:SetBarLeftText (thisLine, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText) @@ -1340,7 +1340,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) for _spellid, _skill in pairs(ActorSkillsContainer) do local SkillName, _, SkillIcon = _GetSpellInfo(_spellid) if (_skill [skill_key] > 0 or _skill.anti_heal) then - tinsert (ActorHealingTable, { + tinsert(ActorHealingTable, { _spellid, _skill [skill_key], _skill [skill_key]/ActorTotal*100, @@ -1360,7 +1360,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) for _spellid, _skill in pairs(petActor:GetActorSpells()) do if (_skill [skill_key] > 0) then local SkillName, _, SkillIcon = _GetSpellInfo(_spellid) - local petName = petName:gsub ((" <.*"), "") + local petName = petName:gsub((" <.*"), "") ActorHealingTable [#ActorHealingTable+1] = { _spellid, _skill [skill_key], @@ -1387,7 +1387,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) target_name = Translit:Transliterate(target_name, "!") end - tinsert (ActorHealingTargets, {target_name, amount, amount / ActorTotal * 100}) + tinsert(ActorHealingTargets, {target_name, amount, amount / ActorTotal * 100}) end end _table_sort (ActorHealingTargets, _detalhes.Sort2) @@ -1506,7 +1506,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) break end - if (ismaximized and ActorHealingTargets[i][1]:find (_detalhes.playername)) then + if (ismaximized and ActorHealingTargets[i][1]:find(_detalhes.playername)) then GameCooltip:AddLine(ActorHealingTargets[i][1], FormatTooltipNumber (_, ActorHealingTargets[i][2]) .." (".._cstr ("%.1f", ActorHealingTargets[i][3]).."%)", nil, "yellow") GameCooltip:AddStatusBar (100, 1, .5, .5, .5, .7) else @@ -1593,7 +1593,7 @@ function atributo_heal:ToolTip_HealingDone (instancia, numero, barra, keydown) end - local n = _table [1]:gsub (("%s%<.*"), "") + local n = _table [1]:gsub(("%s%<.*"), "") if (instancia.sub_atributo == 3) then --overheal GameCooltip:AddLine(n .. " (|cFFFF3333" .. _math_floor( (_table [2] / (_table [2] + _table [3])) * 100) .. "%|r):", FormatTooltipNumber (_, _math_floor(_table [2])) .. " (" .. _math_floor( (_table [2] / (_table [2] + _table [3])) * 100) .. "%)") @@ -1713,9 +1713,9 @@ function atributo_heal:MontaInfoHealTaken() barra = gump:CriaNovaBarraInfo1 (instancia, index) end - self:FocusLock (barra, tabela[1]) + self:FocusLock(barra, tabela[1]) - --hes:UpdadeInfoBar (row, index, spellid, name, value, max, percent, icon, detalhes) + --hes:UpdadeInfoBar(row, index, spellid, name, value, max, percent, icon, detalhes) local texCoords = CLASS_ICON_TCOORDS [tabela[4]] if (not texCoords) then @@ -1723,7 +1723,7 @@ function atributo_heal:MontaInfoHealTaken() end local formated_value = SelectedToKFunction (_, _math_floor(tabela[2])) - self:UpdadeInfoBar (barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small", true, texCoords) + self:UpdadeInfoBar(barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small", true, texCoords) end end @@ -1739,7 +1739,7 @@ function atributo_heal:MontaInfoOverHealing() for spellid, tabela in pairs(tabela) do local nome, _, icone = _GetSpellInfo(spellid) - tinsert (minhas_curas, {spellid, tabela.overheal, tabela.overheal/total*100, nome, icone}) + tinsert(minhas_curas, {spellid, tabela.overheal, tabela.overheal/total*100, nome, icone}) end --add pets @@ -1751,7 +1751,7 @@ function atributo_heal:MontaInfoOverHealing() local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in pairs(PetSkillsContainer) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(_spellid) - tinsert (minhas_curas, {_spellid, _skill.overheal, _skill.overheal/total*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor}) + tinsert(minhas_curas, {_spellid, _skill.overheal, _skill.overheal/total*100, nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor}) end end end @@ -1769,14 +1769,14 @@ function atributo_heal:MontaInfoOverHealing() if (not barra) then barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.on_focus = false end if (not info.mostrando_mouse_over) then if (tabela[1] == self.detalhes) then --tabela [1] = spellid = spellid que esta na caixa da direita if (not barra.on_focus) then --se a barra n�o tiver no foco - barra.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + barra.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) barra.on_focus = true if (not info.mostrando) then info.mostrando = barra @@ -1784,7 +1784,7 @@ function atributo_heal:MontaInfoOverHealing() end else if (barra.on_focus) then - barra.textura:SetStatusBarColor (1, 1, 1, 1) --volta a cor antiga + barra.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga barra:SetAlpha(.9) --volta a alfa antiga barra.on_focus = false end @@ -1824,7 +1824,7 @@ function atributo_heal:MontaInfoOverHealing() if (actor_object) then classe = actor_object.classe end - tinsert (jogadores_overhealed, {target_name, amount, amount/total*100, classe}) + tinsert(jogadores_overhealed, {target_name, amount, amount/total*100, classe}) end _table_sort (jogadores_overhealed, _detalhes.Sort2) @@ -1839,7 +1839,7 @@ function atributo_heal:MontaInfoOverHealing() if (not barra) then barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -1859,7 +1859,7 @@ function atributo_heal:MontaInfoOverHealing() if (not texCoords) then texCoords = _detalhes.class_coords ["UNKNOW"] end - barra.icone:SetTexCoord (_unpack(texCoords)) + barra.icone:SetTexCoord(_unpack(texCoords)) barra.minha_tabela = self barra.nome_inimigo = tabela [1] @@ -1888,7 +1888,7 @@ function atributo_heal:MontaInfoHealingDone() for spellid, tabela in pairs(tabela) do local nome, rank, icone = _GetSpellInfo(spellid) - tinsert (minhas_curas, { + tinsert(minhas_curas, { spellid, tabela.total, tabela.total/total*100, @@ -1911,11 +1911,11 @@ function atributo_heal:MontaInfoHealingDone() local PetSkillsContainer = PetActor.spells._ActorTable for _spellid, _skill in pairs(PetSkillsContainer) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(_spellid) - tinsert (minhas_curas, { + tinsert(minhas_curas, { _spellid, _skill.total, _skill.total/total*100, - nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", + nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor }) @@ -1937,7 +1937,7 @@ function atributo_heal:MontaInfoHealingDone() if (not barra) then barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.on_focus = false end @@ -1947,13 +1947,13 @@ function atributo_heal:MontaInfoHealingDone() if (info.sub_atributo == 2) then local formated_value = SelectedToKFunction (_, _math_floor(tabela[2]/meu_tempo)) - self:UpdadeInfoBar (barra, index, tabela[1], tabela[4], tabela[2], formated_value, max_, tabela[3], tabela[5], true) + self:UpdadeInfoBar(barra, index, tabela[1], tabela[4], tabela[2], formated_value, max_, tabela[3], tabela[5], true) else local formated_value = SelectedToKFunction (_, _math_floor(tabela[2])) if (tabela [7]) then formated_value = formated_value .. " [|cFFFF5500" .. SelectedToKFunction (_, _math_floor(tabela [7])) .." " .. Loc ["STRING_DAMAGE"] .."|r] " end - self:UpdadeInfoBar (barra, index, tabela[1], tabela[4], tabela[2], formated_value, max_, tabela[3], tabela[5], true) + self:UpdadeInfoBar(barra, index, tabela[1], tabela[4], tabela[2], formated_value, max_, tabela[3], tabela[5], true) end barra.minha_tabela = self @@ -1971,7 +1971,7 @@ function atributo_heal:MontaInfoHealingDone() local healedTargets = {} tabela = self.targets for target_name, amount in pairs(tabela) do - tinsert (healedTargets, {target_name, amount, amount / total*100}) + tinsert(healedTargets, {target_name, amount, amount / total*100}) end _table_sort(healedTargets, _detalhes.Sort2) @@ -1984,7 +1984,7 @@ function atributo_heal:MontaInfoHealingDone() if (not barra) then barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end local healingDone = tabela[2] @@ -2001,7 +2001,7 @@ function atributo_heal:MontaInfoHealingDone() else barra.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --CLASSE local texCoords = _detalhes.class_coords ["ENEMY"] - barra.icone:SetTexCoord (_unpack(texCoords)) + barra.icone:SetTexCoord(_unpack(texCoords)) end barra.lineText1:SetText(index .. ". " .. _detalhes:GetOnlyName(tabela[1])) @@ -2161,7 +2161,7 @@ function atributo_heal:MontaDetalhesHealingTaken (nome, barra) for spellid, tabela in pairs(conteudo) do --da foreach em cada spellid do container if (tabela.targets [actor]) then local spell_nome, _, icone = _GetSpellInfo(spellid) - tinsert (minhas_magias, {spellid, tabela.targets [actor], tabela.targets [actor] / total*100, spell_nome, icone}) + tinsert(minhas_magias, {spellid, tabela.targets [actor], tabela.targets [actor] / total*100, spell_nome, icone}) end end @@ -2175,7 +2175,7 @@ function atributo_heal:MontaDetalhesHealingTaken (nome, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then @@ -2239,11 +2239,11 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra) local index = 1 local data = data_table - table.wipe (t1) - table.wipe (t2) - table.wipe (t3) - table.wipe (t4) - table.wipe (data) + table.wipe(t1) + table.wipe(t2) + table.wipe(t3) + table.wipe(t4) + table.wipe(data) if (esta_magia.total > 0) then diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 410f6e9d..50053499 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -1302,7 +1302,7 @@ end --copy values from a previous skin saved if (skin_table) then --copy from skin_table to new_instance - _detalhes.table.copy (new_instance, skin_table) + _detalhes.table.copy(new_instance, skin_table) end return new_instance @@ -1362,7 +1362,7 @@ end --copy values from a previous skin saved if (skin_table) then --copy from skin_table to new_instance - _detalhes.table.copy (new_instance, skin_table) + _detalhes.table.copy(new_instance, skin_table) end --setup default wallpaper @@ -2427,19 +2427,19 @@ function _detalhes:TrocaTabela(instancia, segmento, atributo, sub_atributo, inic local atributo = instancia.atributo local time_left = (_detalhes.last_data_requested+7) - _detalhes._tempo - if (atributo == 1 and _detalhes.in_combat and not _detalhes:CaptureGet ("damage") and _detalhes.host_by) then + if (atributo == 1 and _detalhes.in_combat and not _detalhes:CaptureGet("damage") and _detalhes.host_by) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia need damage cloud.") end - elseif (atributo == 2 and _detalhes.in_combat and (not _detalhes:CaptureGet ("heal") or _detalhes:CaptureGet ("aura")) and _detalhes.host_by) then + elseif (atributo == 2 and _detalhes.in_combat and (not _detalhes:CaptureGet("heal") or _detalhes:CaptureGet("aura")) and _detalhes.host_by) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia need heal cloud.") end - elseif (atributo == 3 and _detalhes.in_combat and not _detalhes:CaptureGet ("energy") and _detalhes.host_by) then + elseif (atributo == 3 and _detalhes.in_combat and not _detalhes:CaptureGet("energy") and _detalhes.host_by) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia need energy cloud.") end - elseif (atributo == 4 and _detalhes.in_combat and not _detalhes:CaptureGet ("miscdata") and _detalhes.host_by) then + elseif (atributo == 4 and _detalhes.in_combat and not _detalhes:CaptureGet("miscdata") and _detalhes.host_by) then if (_detalhes.debug) then _detalhes:Msg("(debug) instancia need misc cloud.") end @@ -2750,7 +2750,7 @@ function _detalhes:ChangeIcon(icon) if (icon) then --plugin chamou uma troca de icone self.baseframe.cabecalho.atributo_icon:SetTexture(icon) - self.baseframe.cabecalho.atributo_icon:SetTexCoord (5/64, 60/64, 3/64, 62/64) + self.baseframe.cabecalho.atributo_icon:SetTexCoord(5/64, 60/64, 3/64, 62/64) local icon_size = skin.icon_plugins_size self.baseframe.cabecalho.atributo_icon:SetWidth(icon_size[1]) @@ -2770,7 +2770,7 @@ function _detalhes:ChangeIcon(icon) if (_detalhes.custom [self.sub_atributo]) then local icon = _detalhes.custom [self.sub_atributo].icon self.baseframe.cabecalho.atributo_icon:SetTexture(icon) - self.baseframe.cabecalho.atributo_icon:SetTexCoord (5/64, 60/64, 3/64, 62/64) + self.baseframe.cabecalho.atributo_icon:SetTexCoord(5/64, 60/64, 3/64, 62/64) local icon_size = skin.icon_plugins_size self.baseframe.cabecalho.atributo_icon:SetWidth(icon_size[1]) @@ -2791,7 +2791,7 @@ function _detalhes:ChangeIcon(icon) end local p = 0.125 --32/256 - self.baseframe.cabecalho.atributo_icon:SetTexCoord (p * (self.sub_atributo-1), p * (self.sub_atributo), 0, 1) + self.baseframe.cabecalho.atributo_icon:SetTexCoord(p * (self.sub_atributo-1), p * (self.sub_atributo), 0, 1) self.baseframe.cabecalho.atributo_icon:SetSize(16, 16) self.baseframe.cabecalho.atributo_icon:ClearAllPoints() @@ -2967,7 +2967,7 @@ local function GetDpsHps (_thisActor, key) if (_thisActor [keyname]) then return _thisActor [keyname] else - if ((_detalhes.time_type == 2 and _thisActor.grupo) or not _detalhes:CaptureGet ("damage")) then + if ((_detalhes.time_type == 2 and _thisActor.grupo) or not _detalhes:CaptureGet("damage")) then local dps = _thisActor.total / _thisActor:GetCombatTime() _thisActor [keyname] = dps return dps @@ -3051,8 +3051,8 @@ end local report_name_function = function(name) local name, index = unpack(name) - if (_detalhes.remove_realm_from_name and name:find ("-")) then - return index .. ". " .. name:gsub (("%-.*"), "") + if (_detalhes.remove_realm_from_name and name:find("-")) then + return index .. ". " .. name:gsub(("%-.*"), "") else return index .. ". " .. name end @@ -3161,7 +3161,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom) local reportarFrags = {} for name, amount in pairs(frags) do --string para imprimir direto sem calculos - reportarFrags [#reportarFrags+1] = {frag = tostring (amount), nome = name} + reportarFrags [#reportarFrags+1] = {frag = tostring(amount), nome = name} end container = reportarFrags container_amount = #reportarFrags @@ -3204,7 +3204,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom) local mortes = self.showing.last_events_tables local reportarMortes = {} for index, morte in ipairs(mortes) do - reportarMortes [#reportarMortes+1] = {dead = morte [6], nome = morte [3]:gsub (("%-.*"), "")} + reportarMortes [#reportarMortes+1] = {dead = morte [6], nome = morte [3]:gsub(("%-.*"), "")} end container = reportarMortes container_amount = #reportarMortes @@ -3515,8 +3515,8 @@ function _detalhes:envia_relatorio (linhas, custom) local to_who = _detalhes.report_where - local channel = to_who:find ("CHANNEL") - local is_btag = to_who:find ("REALID") + local channel = to_who:find("CHANNEL") + local is_btag = to_who:find("REALID") local send_report_channel = function(timerObject) _SendChatMessage (timerObject.Arg1, timerObject.Arg2, timerObject.Arg3, timerObject.Arg4) @@ -3530,7 +3530,7 @@ function _detalhes:envia_relatorio (linhas, custom) if (channel) then - channel = to_who:gsub ((".*|"), "") + channel = to_who:gsub((".*|"), "") for i = 1, #linhas do if (channel == "Trade") then @@ -3548,7 +3548,7 @@ function _detalhes:envia_relatorio (linhas, custom) return elseif (is_btag) then - local bnetAccountID = to_who:gsub ((".*|"), "") + local bnetAccountID = to_who:gsub((".*|"), "") bnetAccountID = tonumber(bnetAccountID) for i = 1, #linhas do diff --git a/classes/class_resources.lua b/classes/class_resources.lua index 16bf3097..126969a6 100644 --- a/classes/class_resources.lua +++ b/classes/class_resources.lua @@ -265,7 +265,7 @@ function atributo_energy:AtualizarResources (whichRowLine, colocacao, instancia) --texture color actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor() - self:SetBarColors (esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) + self:SetBarColors(esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) --icon self:SetClassIcon (esta_barra.icone_classe, instancia, self.classe) @@ -536,7 +536,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.textura:SetVertexColor(r, g, b) row1.icone_classe:SetTexture(instancia.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") @@ -597,7 +597,7 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex row1.textura:SetVertexColor(r, g, b) row1.icone_classe:SetTexture(instancia.total_bar.icon) - row1.icone_classe:SetTexCoord (0.0625, 0.9375, 0.0625, 0.9375) + row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375) Details.FadeHandler.Fader(row1, "out") @@ -719,7 +719,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, Details.FadeHandler.Fader(esta_barra, "out") end - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) else return end @@ -743,7 +743,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, esta_barra.background:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) end - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) else --agora esta comparando se a tabela da barra � diferente da tabela na atualiza��o anterior @@ -758,7 +758,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, esta_barra.last_value = esta_porcentagem --reseta o ultimo valor da barra - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) elseif (esta_porcentagem ~= esta_barra.last_value) then --continua mostrando a mesma tabela ent�o compara a porcentagem --apenas atualizar @@ -769,7 +769,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, end esta_barra.last_value = esta_porcentagem - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) end end @@ -777,7 +777,7 @@ function atributo_energy:RefreshBarra2 (esta_barra, instancia, tabela_anterior, end -function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) +function atributo_energy:RefreshBarra(esta_barra, instancia, from_resize) local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally @@ -788,7 +788,7 @@ function atributo_energy:RefreshBarra (esta_barra, instancia, from_resize) --icon self:SetClassIcon (esta_barra.icone_classe, instancia, class) --texture color - self:SetBarColors (esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) + self:SetBarColors(esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) --left text self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText) @@ -1116,16 +1116,16 @@ function atributo_energy:MontaInfoRegenRecebido() if (not barra) then barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) barra.on_focus = false end - self:FocusLock (barra, tabela[1]) + self:FocusLock(barra, tabela[1]) local spellname, _, spellicon = _GetSpellInfo(tabela [1]) local percent = tabela [2] / total_regenerado * 100 - self:UpdadeInfoBar (barra, index, tabela[1], spellname, tabela[2], _detalhes:comma_value (tabela[2]), max_, percent, spellicon, true) + self:UpdadeInfoBar(barra, index, tabela[1], spellname, tabela[2], _detalhes:comma_value (tabela[2]), max_, percent, spellicon, true) barra.minha_tabela = self barra.show = tabela[1] @@ -1178,7 +1178,7 @@ function atributo_energy:MontaInfoRegenRecebido() if (not barra) then barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -1274,7 +1274,7 @@ function atributo_energy:MontaDetalhesRegenRecebido (nome, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -1286,10 +1286,10 @@ function atributo_energy:MontaDetalhesRegenRecebido (nome, barra) barra.lineText1:SetText(index .. "." .. tabela [1]) barra.lineText4:SetText(_detalhes:comma_value (tabela[2]) .." (" .. _cstr("%.1f", tabela[2] / total_regenerado * 100) .."%)") - barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [tabela[3]])) + barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [tabela[3]])) barra.icone:SetTexture("Interface\\AddOns\\Details\\images\\classes_small") - barra.icone:SetTexCoord (_unpack(_detalhes.class_coords [tabela[3]])) + barra.icone:SetTexCoord(_unpack(_detalhes.class_coords [tabela[3]])) barra:Show() --mostra a barra diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 54dc90a2..8d472c05 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -591,12 +591,12 @@ function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, insta morte.minha_barra = whichRowLine esta_barra.colocacao = colocacao - if (not getmetatable (morte)) then + if (not getmetatable(morte)) then setmetatable(morte, {__call = RefreshBarraMorte}) morte._custom = true end - esta_barra.lineText1:SetText(colocacao .. ". " .. morte [3]:gsub (("%-.*"), "")) + esta_barra.lineText1:SetText(colocacao .. ". " .. morte [3]:gsub(("%-.*"), "")) esta_barra.lineText2:SetText("") esta_barra.lineText3:SetText("") esta_barra.lineText4:SetText(morte [6]) @@ -608,18 +608,18 @@ function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, insta --seta a cor da barra e a cor do texto caso eles esteja mostrando com a cor da classe local r, g, b, a = unpack(_detalhes.class_colors [morte[4]]) - _detalhes:SetBarColors (esta_barra, instancia, r, g, b, a) + _detalhes:SetBarColors(esta_barra, instancia, r, g, b, a) if (instancia.row_info.use_spec_icons) then local nome = morte[3] local spec = instancia.showing (1, nome) and instancia.showing (1, nome).spec or (instancia.showing (2, nome) and instancia.showing (2, nome).spec) if (spec and spec ~= 0) then esta_barra.icone_classe:SetTexture(instancia.row_info.spec_file) - esta_barra.icone_classe:SetTexCoord (unpack(_detalhes.class_specs_coords[spec])) + esta_barra.icone_classe:SetTexCoord(unpack(_detalhes.class_specs_coords[spec])) else if (CLASS_ICON_TCOORDS [morte[4]]) then esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) - esta_barra.icone_classe:SetTexCoord (unpack(CLASS_ICON_TCOORDS [morte[4]])) + esta_barra.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [morte[4]])) else local texture, l, r, t, b = Details:GetUnknownClassIcon() esta_barra.icone_classe:SetTexture(texture) @@ -629,7 +629,7 @@ function atributo_misc:DeadAtualizarBarra (morte, whichRowLine, colocacao, insta else if (CLASS_ICON_TCOORDS [morte[4]]) then esta_barra.icone_classe:SetTexture(instancia.row_info.icon_file) - esta_barra.icone_classe:SetTexCoord (unpack(CLASS_ICON_TCOORDS [morte[4]])) + esta_barra.icone_classe:SetTexCoord(unpack(CLASS_ICON_TCOORDS [morte[4]])) else local texture, l, r, t, b = Details:GetUnknownClassIcon() esta_barra.icone_classe:SetTexture(texture) @@ -957,7 +957,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo Details.FadeHandler.Fader(esta_barra, "out") end - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) else return end @@ -981,7 +981,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo esta_barra.background:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b) end - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) else --agora esta comparando se a tabela da barra � diferente da tabela na atualiza��o anterior @@ -996,7 +996,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo esta_barra.last_value = esta_porcentagem --reseta o ultimo valor da barra - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) elseif (esta_porcentagem ~= esta_barra.last_value) then --continua mostrando a mesma tabela ent�o compara a porcentagem --apenas atualizar @@ -1007,7 +1007,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo end esta_barra.last_value = esta_porcentagem - return self:RefreshBarra (esta_barra, instancia) + return self:RefreshBarra(esta_barra, instancia) end end @@ -1015,7 +1015,7 @@ function atributo_misc:RefreshBarra2 (esta_barra, instancia, tabela_anterior, fo end -function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) +function atributo_misc:RefreshBarra(esta_barra, instancia, from_resize) local class, enemy, arena_enemy, arena_ally = self.classe, self.enemy, self.arena_enemy, self.arena_ally if (from_resize) then @@ -1025,7 +1025,7 @@ function atributo_misc:RefreshBarra (esta_barra, instancia, from_resize) --icon self:SetClassIcon (esta_barra.icone_classe, instancia, class) --texture color - self:SetBarColors (esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) + self:SetBarColors(esta_barra, instancia, actor_class_color_r, actor_class_color_g, actor_class_color_b) --left text self:SetBarLeftText (esta_barra, instancia, enemy, arena_enemy, arena_ally, UsingCustomLeftText) @@ -1115,7 +1115,7 @@ function atributo_misc:ToolTipCC (instancia, numero, barra) for target_name, amount in pairs(_tabela.targets) do GameCooltip:AddLine(target_name .. ": ", amount .. " ") - local classe = _detalhes:GetClass (target_name) + local classe = _detalhes:GetClass(target_name) GameCooltip:AddIcon ([[Interface\AddOns\Details\images\espadas]], nil, 1, lineHeight, lineHeight) if (classe) then GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], nil, 2, lineHeight, lineHeight, unpack(_detalhes.class_coords [classe])) @@ -1269,7 +1269,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end - local n = _table [1]:gsub (("%s%<.*"), "") + local n = _table [1]:gsub(("%s%<.*"), "") GameCooltip:AddLine(n, _table [2] .. " (" .. _math_floor(_table [2]/self.dispell*100) .. "%)") _detalhes:AddTooltipBackgroundStatusbar() GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) @@ -1462,7 +1462,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura (RaidIndex, buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists (unitCaster) and UnitExists (RaidIndex) and UnitIsUnit (unitCaster, RaidIndex)) then + if (name and unitCaster and UnitExists(unitCaster) and UnitExists(RaidIndex) and UnitIsUnit(unitCaster, RaidIndex)) then _detalhes.parser:add_buff_uptime (nil, cacheGetTime, playerGUID, playerName, 0x00000514, playerGUID, playerName, 0x00000514, 0x0, spellid, name, in_or_out) if (in_or_out == "BUFF_UPTIME_IN") then @@ -1483,7 +1483,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for playername, potspellid in pairs(pot_usage) do local name, _, icon = _GetSpellInfo(potspellid) - local _, class = UnitClass (playername) + local _, class = UnitClass(playername) local class_color = "" if (class and RAID_CLASS_COLORS [class]) then class_color = RAID_CLASS_COLORS [class].colorStr @@ -1505,7 +1505,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for groupIndex = 1, GetNumGroupMembers() - 1 do for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("party"..groupIndex, buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists (unitCaster) and UnitExists ("party" .. groupIndex) and UnitIsUnit (unitCaster, "party" .. groupIndex)) then + if (name and unitCaster and UnitExists(unitCaster) and UnitExists("party" .. groupIndex) and UnitIsUnit(unitCaster, "party" .. groupIndex)) then local playerName, realmName = _UnitName ("party"..groupIndex) local playerGUID = UnitGUID("party"..groupIndex) @@ -1533,7 +1533,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) --player it self for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists (unitCaster) and UnitIsUnit (unitCaster, "player")) then + if (name and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then local playerName = _UnitName ("player") local playerGUID = UnitGUID("player") if (playerGUID) then @@ -1555,7 +1555,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for playername, potspellid in pairs(pot_usage) do local name, _, icon = _GetSpellInfo(potspellid) - local _, class = UnitClass (playername) + local _, class = UnitClass(playername) local class_color = "" if (class and RAID_CLASS_COLORS [class]) then class_color = RAID_CLASS_COLORS [class].colorStr @@ -1574,7 +1574,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) for buffIndex = 1, 41 do local name, _, _, _, _, _, unitCaster, _, _, spellid = _UnitAura ("player", buffIndex, nil, "HELPFUL") - if (name and unitCaster and UnitExists (unitCaster) and UnitIsUnit (unitCaster, "player")) then + if (name and unitCaster and UnitExists(unitCaster) and UnitIsUnit(unitCaster, "player")) then local playerName = _UnitName ("player") local playerGUID = UnitGUID("player") @@ -1596,7 +1596,7 @@ function _detalhes:CatchRaidBuffUptime (in_or_out) local string_output = "pre-potion: " for playername, potspellid in pairs(pot_usage) do local name, _, icon = _GetSpellInfo(potspellid) - local _, class = UnitClass (playername) + local _, class = UnitClass(playername) local class_color = "" if (class and RAID_CLASS_COLORS [class]) then class_color = RAID_CLASS_COLORS [class].colorStr @@ -1999,7 +1999,7 @@ function atributo_misc:ToolTipInterrupt (instancia, numero, barra) _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end - local n = _table [1]:gsub (("%s%<.*"), "") + local n = _table [1]:gsub(("%s%<.*"), "") GameCooltip:AddLine(n, _table [2] .. " (" .. _math_floor(_table [2]/self.interrupt*100) .. "%)") _detalhes:AddTooltipBackgroundStatusbar() GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 14, 14, 0.25, 0.49609375, 0.75, 1) @@ -2048,7 +2048,7 @@ function atributo_misc:MontaInfoInterrupt() --player for _spellid, _tabela in pairs(minha_tabela) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(_spellid) - tinsert (meus_interrupts, {_spellid, _tabela.counter, _tabela.counter/meu_total*100, nome, icone}) + tinsert(meus_interrupts, {_spellid, _tabela.counter, _tabela.counter/meu_total*100, nome, icone}) end --pet local ActorPets = self.pets @@ -2059,7 +2059,7 @@ function atributo_misc:MontaInfoInterrupt() local PetSkillsContainer = PetActor.interrupt_spells._ActorTable for _spellid, _skill in pairs(PetSkillsContainer) do --da foreach em cada spellid do container local nome, _, icone = _GetSpellInfo(_spellid) - tinsert (meus_interrupts, {_spellid, _skill.counter, _skill.counter/meu_total*100, nome .. " (|c" .. class_color .. PetName:gsub ((" <.*"), "") .. "|r)", icone, PetActor}) + tinsert(meus_interrupts, {_spellid, _skill.counter, _skill.counter/meu_total*100, nome .. " (|c" .. class_color .. PetName:gsub((" <.*"), "") .. "|r)", icone, PetActor}) end end end @@ -2079,7 +2079,7 @@ function atributo_misc:MontaInfoInterrupt() if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo1 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o barra.on_focus = false --isso aqui � a parte da sele��o e descele��o end @@ -2088,7 +2088,7 @@ function atributo_misc:MontaInfoInterrupt() if (not info.mostrando_mouse_over) then if (tabela[1] == self.detalhes) then --tabela [1] = spellid = spellid que esta na caixa da direita if (not barra.on_focus) then --se a barra n�o tiver no foco - barra.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + barra.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) barra.on_focus = true if (not info.mostrando) then info.mostrando = barra @@ -2096,7 +2096,7 @@ function atributo_misc:MontaInfoInterrupt() end else if (barra.on_focus) then - barra.textura:SetStatusBarColor (1, 1, 1, 1) --volta a cor antiga + barra.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga barra:SetAlpha(.9) --volta a alfa antiga barra.on_focus = false end @@ -2145,7 +2145,7 @@ function atributo_misc:MontaInfoInterrupt() if (not barra) then barra = gump:CriaNovaBarraInfo2 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) + barra.textura:SetStatusBarColor(1, 1, 1, 1) end if (index == 1) then @@ -2218,7 +2218,7 @@ function atributo_misc:MontaDetalhesInterrupt (spellid, barra) if (not barra) then --se a barra n�o existir, criar ela ent�o barra = gump:CriaNovaBarraInfo3 (instancia, index) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o + barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o end if (index == 1) then diff --git a/classes/container_actors.lua b/classes/container_actors.lua index 7f450991..ea654411 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -382,7 +382,7 @@ actorObject.ownerName = dono_do_pet.nome if (_IsInInstance() and _detalhes.remove_realm_from_name) then - actorObject.displayName = nome:gsub (("%-.*"), ">") + actorObject.displayName = nome:gsub(("%-.*"), ">") else actorObject.displayName = nome end @@ -485,7 +485,7 @@ --for _, playerName in ipairs(Details.tabela_vigente.raid_roster_indexed) do for playerName, _ in pairs(_detalhes.tabela_vigente.raid_roster) do local pName = playerName - playerName = playerName:gsub ("%-.*", "") --remove realm name + playerName = playerName:gsub("%-.*", "") --remove realm name --if the user client is in russian language --make an attempt to remove declensions from the character's name @@ -495,12 +495,12 @@ return find_pet_found_owner (pName, serial, nome, flag, self) else --print("not found declension (1):", pName, nome) - if (text1:find (playerName)) then + if (text1:find(playerName)) then return find_pet_found_owner (pName, serial, nome, flag, self) end end else - if (text1:find (playerName)) then + if (text1:find(playerName)) then return find_pet_found_owner (pName, serial, nome, flag, self) end end @@ -513,19 +513,19 @@ for playerName, _ in pairs(_detalhes.tabela_vigente.raid_roster) do --for _, playerName in ipairs(Details.tabela_vigente.raid_roster_indexed) do local pName = playerName - playerName = playerName:gsub ("%-.*", "") --remove realm name + playerName = playerName:gsub("%-.*", "") --remove realm name if (CONST_CLIENT_LANGUAGE == "ruRU") then if (find_name_declension (text2, playerName)) then return find_pet_found_owner (pName, serial, nome, flag, self) else --print("not found declension (2):", pName, nome) - if (text2:find (playerName)) then + if (text2:find(playerName)) then return find_pet_found_owner (pName, serial, nome, flag, self) end end else - if (text2:find (playerName)) then + if (text2:find(playerName)) then return find_pet_found_owner (pName, serial, nome, flag, self) end end @@ -542,7 +542,7 @@ --[[statistics]]-- _detalhes.statistics.container_calls = _detalhes.statistics.container_calls + 1 - --if (flag and nome:find ("Kastfall") and bit.band(flag, 0x2000) ~= 0) then + --if (flag and nome:find("Kastfall") and bit.band(flag, 0x2000) ~= 0) then --print("PET:", nome, _detalhes.tabela_pets.pets [serial], container_pets [serial]) --else --print(nome, flag) @@ -767,9 +767,9 @@ end if (_detalhes.debug) then - if (_detalhes.debug_chr and nome:find (_detalhes.debug_chr) and self.tipo == 1) then + if (_detalhes.debug_chr and nome:find(_detalhes.debug_chr) and self.tipo == 1) then local logLine = "" - local when = "[" .. date ("%H:%M:%S") .. format (".%4f", GetTime()-floor(GetTime())) .. "]" + local when = "[" .. date ("%H:%M:%S") .. format(".%4f", GetTime()-floor(GetTime())) .. "]" local log = "actor created - class: " .. (novo_objeto.classe or "noclass") local from = debugstack (2, 1, 0) logLine = logLine .. when .. " " .. log .. " " .. from .. "\n" @@ -809,7 +809,7 @@ _detalhes:UpdatePetsOnParser() end function _detalhes:ClearCCPetsBlackList() - table.wipe (pet_blacklist) + table.wipe(pet_blacklist) end function container_combatentes:FuncaoDeCriacao (tipo) @@ -856,7 +856,7 @@ end function container_combatentes:SortByKey (key) - assert (type(key) == "string", "Container:SortByKey() expects a keyname on parameter 1.") + assert(type(key) == "string", "Container:SortByKey() expects a keyname on parameter 1.") bykey = key _table_sort (self._ActorTable, sort) self:remapear() diff --git a/classes/container_pets.lua b/classes/container_pets.lua index deec220b..c9a87c2e 100644 --- a/classes/container_pets.lua +++ b/classes/container_pets.lua @@ -45,7 +45,7 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) --in merging operations, make sure to not add the owner name a second time in the name --check if the pet name already has the owner name in, if not, add it - if (not pet_nome:find ("<")) then + if (not pet_nome:find("<")) then --get the owner name local ownerName = busca[1] --add the owner name to the pet name @@ -104,7 +104,7 @@ function container_pets:PegaDono (pet_serial, pet_nome, pet_flags) if (dono_nome) then self.pets [pet_serial] = {dono_nome, dono_serial, dono_flags, _detalhes._tempo, true, pet_nome, pet_serial} --adicionada a flag emulada - if (not pet_nome:find ("<")) then + if (not pet_nome:find("<")) then pet_nome = pet_nome .. " <".. dono_nome ..">" end @@ -209,7 +209,7 @@ end function container_pets:Remover (pet_serial) if (_detalhes.tabela_pets.pets [pet_serial]) then - table.wipe (_detalhes.tabela_pets.pets [pet_serial]) + table.wipe(_detalhes.tabela_pets.pets [pet_serial]) end _detalhes.tabela_pets.pets [pet_serial] = nil end diff --git a/classes/container_segments.lua b/classes/container_segments.lua index b9453eda..68502f8b 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -519,7 +519,7 @@ function segmentClass:resetar() local cleargarbage = function() collectgarbage() end - local successful, errortext = pcall (cleargarbage) + local successful, errortext = pcall(cleargarbage) if (not successful) then Details:Msg("couldn't call collectgarbage()") end diff --git a/core/control.lua b/core/control.lua index 7064855c..bc688a65 100644 --- a/core/control.lua +++ b/core/control.lua @@ -59,7 +59,7 @@ for _, actor in ipairs(Details.tabela_vigente[class_type_dano]._ActorTable) do - if (not actor.grupo and not actor.owner and not actor.nome:find ("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction + if (not actor.grupo and not actor.owner and not actor.nome:find("[*]") and bitBand(actor.flag_original, 0x00000060) ~= 0) then --0x20+0x40 neutral + enemy reaction for name, _ in pairs(actor.targets) do if (name == Details.playername) then return actor.nome @@ -218,7 +218,7 @@ end for index = 1, 5, 1 do - if (UnitExists ("boss"..index)) then + if (UnitExists("boss"..index)) then local guid = UnitGUID("boss"..index) if (guid) then local serial = Details:GetNpcIdFromGuid (guid) @@ -645,7 +645,7 @@ --add to storage if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then - local successful, errortext = pcall (Details.Database.StoreEncounter) + local successful, errortext = pcall(Details.Database.StoreEncounter) if (not successful) then Details:Msg("error occurred on Details.Database.StoreEncounter():", errortext) end @@ -661,7 +661,7 @@ --add to storage if (not InCombatLockdown() and not UnitAffectingCombat("player") and not Details.logoff_saving_data) then - local successful, errortext = pcall (Details.Database.StoreWipe) + local successful, errortext = pcall(Details.Database.StoreWipe) if (not successful) then Details:Msg("error occurred on Details.Database.StoreWipe():", errortext) end @@ -704,7 +704,7 @@ if (bossFunction) then if (bitBand(bossFunctionType, 0x2) ~= 0) then --end of combat if (not Details.logoff_saving_data) then - local successful, errortext = pcall (bossFunction, Details.tabela_vigente) + local successful, errortext = pcall(bossFunction, Details.tabela_vigente) if (not successful) then Details:Msg("error occurred on Encounter Boss Function:", errortext) end @@ -1095,11 +1095,11 @@ if (not IsInRaid() and not IsInGroup()) then return end - local _, playerClass = UnitClass ("player") + local _, playerClass = UnitClass("player") local specIndex = DetailsFramework.GetSpecialization() local playerSpecID if (specIndex) then - playerSpecID = DetailsFramework.GetSpecializationInfo (specIndex) + playerSpecID = DetailsFramework.GetSpecializationInfo(specIndex) end if (playerSpecID and playerClass) then @@ -1527,7 +1527,7 @@ end function Details:SetTrashSuppression (n) - assert (type(n) == "number", "SetTrashSuppression expects a number on index 1.") + assert(type(n) == "number", "SetTrashSuppression expects a number on index 1.") if (n < 0) then n = 0 end @@ -1703,7 +1703,7 @@ GameCooltip:SetBannerText (1, (not Details.ignore_nicktag and avatar [1]) or objeto.nome, textPoint, avatarTextColor, 14, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname end else - --if (Details.remove_realm_from_name and objeto.displayName:find ("%*")) then + --if (Details.remove_realm_from_name and objeto.displayName:find("%*")) then -- GameCooltip:SetBannerImage (1, [[Interface\AddOns\Details\images\background]], 20, 30, avatarPoint, avatarTexCoord, {0, 0, 0, 0}) --overlay [2] avatar path -- GameCooltip:SetBannerImage (2, [[Interface\PetBattles\Weather-BurntEarth]], 160, 30, {{"bottomleft", "topleft", 0, -5}, {"bottomright", "topright", 0, -5}}, {0.12, 0.88, 1, 0}, {0, 0, 0, 0.1}) --overlay [2] avatar path {0, 0, 0, 0} -- GameCooltip:SetBannerText (1, objeto.nome, {"left", "left", 11, -8}, {1, 1, 1, 0.7}, 10, SharedMedia:Fetch ("font", Details.tooltip.fontface)) --text [1] nickname diff --git a/core/gears.lua b/core/gears.lua index 04868dd4..63f7e0eb 100644 --- a/core/gears.lua +++ b/core/gears.lua @@ -222,7 +222,7 @@ end local statusbar_enabled1 = window1.show_statusbar local statusbar_enabled2 = window2.show_statusbar - table.wipe (window1.snap); table.wipe (window2.snap) + table.wipe(window1.snap); table.wipe(window2.snap) window1.snap [3] = 2; window2.snap [1] = 1; window1.horizontalSnap = true; window2.horizontalSnap = true @@ -425,12 +425,12 @@ function _detalhes:ResetSpecCache (forced) local isininstance = IsInInstance() if (forced or (not isininstance and not _detalhes.in_group)) then - table.wipe (_detalhes.cached_specs) + table.wipe(_detalhes.cached_specs) if (_detalhes.track_specs) then local my_spec = DetailsFramework.GetSpecialization() if (type(my_spec) == "number") then - local spec_number = DetailsFramework.GetSpecializationInfo (my_spec) + local spec_number = DetailsFramework.GetSpecializationInfo(my_spec) if (type(spec_number) == "number") then local pguid = UnitGUID(_detalhes.playername) if (pguid) then @@ -441,7 +441,7 @@ function _detalhes:ResetSpecCache (forced) end elseif (_detalhes.in_group and not isininstance) then - table.wipe (_detalhes.cached_specs) + table.wipe(_detalhes.cached_specs) if (_detalhes.track_specs) then if (IsInRaid()) then @@ -635,12 +635,12 @@ local task_timers = { function _detalhes:RegisterBackgroundTask (name, func, priority, ...) - assert (type(self) == "table", "RegisterBackgroundTask 'self' must be a table.") - assert (type(name) == "string", "RegisterBackgroundTask param #1 must be a string.") + assert(type(self) == "table", "RegisterBackgroundTask 'self' must be a table.") + assert(type(name) == "string", "RegisterBackgroundTask param #1 must be a string.") if (type(func) == "string") then - assert (type(self [func]) == "function", "RegisterBackgroundTask param #2 function not found on main object.") + assert(type(self [func]) == "function", "RegisterBackgroundTask param #2 function not found on main object.") else - assert (type(func) == "function", "RegisterBackgroundTask param #2 expect a function or function name.") + assert(type(func) == "function", "RegisterBackgroundTask param #2 expect a function or function name.") end priority = priority or "LOW" @@ -775,7 +775,7 @@ function _detalhes.storage:GetBestFromGuild (diff, encounter_id, role, dps, guil if (not role) then role = "damage" end - role = string.lower (role) + role = string.lower(role) if (role == "damager") then role = "damage" elseif (role == "healer") then @@ -839,7 +839,7 @@ function _detalhes.storage:GetPlayerGuildRank (diff, encounter_id, role, playern if (not role) then role = "damage" end - role = string.lower (role) + role = string.lower(role) if (role == "damager") then role = "damage" elseif (role == "healer") then @@ -920,7 +920,7 @@ function _detalhes.storage:GetBestFromPlayer (diff, encounter_id, role, playerna if (not role) then role = "damage" end - role = string.lower (role) + role = string.lower(role) if (role == "damager") then role = "damage" elseif (role == "healer") then @@ -1266,7 +1266,7 @@ function _detalhes.storage:GetPlayerData (diff, encounter_id, playername) end local t = {} - assert (type(playername) == "string", "PlayerName must be a string.") + assert(type(playername) == "string", "PlayerName must be a string.") if (not diff) then @@ -1334,8 +1334,8 @@ function _detalhes.storage:GetEncounterData (diff, encounter_id, guild) local data = db [diff] - assert (data, "Difficulty not found. Use: 14, 15 or 16.") - assert (type(encounter_id) == "number", "EncounterId must be a number.") + assert(data, "Difficulty not found. Use: 14, 15 or 16.") + assert(type(encounter_id) == "number", "EncounterId must be a number.") data = data [encounter_id] @@ -1723,7 +1723,7 @@ function Details.Database.StoreEncounter(combat) player_name = player_name .. "-" .. player_realm end - local _, _, class = UnitClass (player_name) + local _, _, class = UnitClass(player_name) local damage_actor = damage_container_pool [damage_container_hash [player_name]] if (damage_actor) then @@ -1736,7 +1736,7 @@ function Details.Database.StoreEncounter(combat) player_name = player_name .. "-" .. player_realm end - local _, _, class = UnitClass (player_name) + local _, _, class = UnitClass(player_name) local heal_actor = healing_container_pool [healing_container_hash [player_name]] if (heal_actor) then @@ -1769,11 +1769,11 @@ function Details.Database.StoreEncounter(combat) if (myBestDps > d_one) then if (not _detalhes.deny_score_messages) then - print(Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_NOTBEST"], _detalhes:ToK2 (d_one), _detalhes:ToK2 (myBestDps), onencounter.date, mybest[2])) + print(Loc ["STRING_DETAILS1"] .. format(Loc ["STRING_SCORE_NOTBEST"], _detalhes:ToK2 (d_one), _detalhes:ToK2 (myBestDps), onencounter.date, mybest[2])) end else if (not _detalhes.deny_score_messages) then - print(Loc ["STRING_DETAILS1"] .. format (Loc ["STRING_SCORE_BEST"], _detalhes:ToK2 (d_one))) + print(Loc ["STRING_DETAILS1"] .. format(Loc ["STRING_SCORE_BEST"], _detalhes:ToK2 (d_one))) end end end @@ -1978,7 +1978,7 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout) if (ilvl_core.forced_inspects [guid]) then if (type(ilvl_core.forced_inspects [guid].callback) == "function") then - local okey, errortext = pcall (ilvl_core.forced_inspects[guid].callback, guid, unitid, ilvl_core.forced_inspects[guid].param1, ilvl_core.forced_inspects[guid].param2) + local okey, errortext = pcall(ilvl_core.forced_inspects[guid].callback, guid, unitid, ilvl_core.forced_inspects[guid].param1, ilvl_core.forced_inspects[guid].param2) if (not okey) then _detalhes:Msg("Error on QueryInspect callback: " .. errortext) end @@ -2069,7 +2069,7 @@ function ilvl_core:GetItemLevel (unitid, guid, is_forced, try_number) end local NotifyInspectHook = function(unitid) - local unit = unitid:gsub ("%d+", "") + local unit = unitid:gsub("%d+", "") if ((IsInRaid() or IsInGroup()) and (_detalhes:GetZoneType() == "raid" or _detalhes:GetZoneType() == "party")) then local guid = UnitGUID(unitid) diff --git a/core/meta.lua b/core/meta.lua index 1a80f4d3..046bc65d 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -77,9 +77,9 @@ local nome = esta_classe.nome if (is_in_instance and _detalhes.remove_realm_from_name) then - esta_classe.displayName = nome:gsub (("%-.*"), "") + esta_classe.displayName = nome:gsub(("%-.*"), "") elseif (_detalhes.remove_realm_from_name) then - esta_classe.displayName = nome:gsub (("%-.*"), "") --"%*" + esta_classe.displayName = nome:gsub(("%-.*"), "") --"%*" else esta_classe.displayName = nome end @@ -205,9 +205,9 @@ local nome = esta_classe.nome if (is_in_instance and _detalhes.remove_realm_from_name) then - esta_classe.displayName = nome:gsub (("%-.*"), "") + esta_classe.displayName = nome:gsub(("%-.*"), "") elseif (_detalhes.remove_realm_from_name) then - esta_classe.displayName = nome:gsub (("%-.*"), "") --%* + esta_classe.displayName = nome:gsub(("%-.*"), "") --%* else esta_classe.displayName = nome end diff --git a/core/parser.lua b/core/parser.lua index 335a97f1..271096eb 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -241,7 +241,7 @@ [66992] = 49921, --offhand --Seal of Command - [20424] = 69403, + [20424] = 69403, --53739 and 53733 } else --retail @@ -577,7 +577,7 @@ local targetLine = "" for i = 1, 5 do - local boss = UnitExists ("boss" .. i) + local boss = UnitExists("boss" .. i) if (boss) then local target = UnitName ("boss" .. i .. "target") if (target and type(target) == "string") then @@ -1002,7 +1002,7 @@ if (who_serial ~= "") then damage_cache [who_serial] = este_jogador else - if (who_name:find ("%[")) then + if (who_name:find("%[")) then damage_cache [who_name] = este_jogador local _, _, icon = _GetSpellInfo(spellid or 1) este_jogador.spellicon = icon @@ -1284,7 +1284,7 @@ else if ( (bitBand(alvo_flags, REACTION_FRIENDLY) ~= 0 and bitBand(who_flags, REACTION_FRIENDLY) ~= 0) or --ajdt d' brx - (raid_members_cache [alvo_serial] and raid_members_cache [who_serial] and alvo_serial:find ("Player") and who_serial:find ("Player")) --amrl + (raid_members_cache [alvo_serial] and raid_members_cache [who_serial] and alvo_serial:find("Player") and who_serial:find("Player")) --amrl ) then is_friendly_fire = true end @@ -1431,7 +1431,7 @@ if (who_serial ~= "") then damage_cache [who_serial] = este_jogador else - if (who_name:find ("%[")) then + if (who_name:find("%[")) then damage_cache [who_name] = este_jogador local _, _, icon = _GetSpellInfo(spellid or 1) este_jogador.spellicon = icon @@ -1636,7 +1636,7 @@ if (who_serial ~= "") then damage_cache [who_serial] = este_jogador else - if (who_name:find ("%[")) then + if (who_name:find("%[")) then damage_cache [who_name] = este_jogador local _, _, icon = _GetSpellInfo(spellid or 1) este_jogador.spellicon = icon @@ -4175,7 +4175,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end if (not jaTem) then - tinsert (_current_combat.last_events_tables [i] [1], 1, { + tinsert(_current_combat.last_events_tables [i] [1], 1, { 2, spellid, 1, @@ -4412,18 +4412,18 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (last_index < _death_event_amt+1 and not t[last_index][4]) then for i = 1, last_index-1 do if (t[i][4] and t[i][4]+_death_event_amt > time) then - tinsert (esta_morte, t[i]) + tinsert(esta_morte, t[i]) end end else for i = last_index, _death_event_amt do --next index to 16 if (t[i][4] and t[i][4]+_death_event_amt > time) then - tinsert (esta_morte, t[i]) + tinsert(esta_morte, t[i]) end end for i = 1, last_index-1 do --1 to latest index if (t[i][4] and t[i][4]+_death_event_amt > time) then - tinsert (esta_morte, t[i]) + tinsert(esta_morte, t[i]) end end end @@ -4470,7 +4470,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end local t = {esta_morte, time, thisPlayer.nome, thisPlayer.classe, maxHealth, minutos.."m "..segundos.."s", ["dead"] = true, ["last_cooldown"] = thisPlayer.last_cooldown, ["dead_at"] = decorrido} - tinsert (_current_combat.last_events_tables, #_current_combat.last_events_tables+1, t) + tinsert(_current_combat.last_events_tables, #_current_combat.last_events_tables+1, t) if (_hook_deaths) then --send event to registred functions @@ -4583,7 +4583,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end - function _detalhes:CaptureGet (capture_type) + function _detalhes:CaptureGet(capture_type) return _detalhes.capture_real [capture_type] end @@ -4634,7 +4634,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function _detalhes:CaptureDisable (capture_type) - capture_type = string.lower (capture_type) + capture_type = string.lower(capture_type) if (capture_type == "damage") then token_list ["SPELL_PERIODIC_DAMAGE"] = nil @@ -4701,7 +4701,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function _detalhes:CaptureEnable (capture_type) - capture_type = string.lower (capture_type) + capture_type = string.lower(capture_type) --retail if (capture_type == "damage") then token_list ["SPELL_PERIODIC_DAMAGE"] = parser.spell_dmg @@ -5235,7 +5235,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes:EntrarEmCombate() end - if (not _detalhes:CaptureGet ("damage")) then + if (not _detalhes:CaptureGet("damage")) then _detalhes:EntrarEmCombate() end @@ -5316,7 +5316,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 --store a boss encounter when out of combat since it might need to load the storage if (_detalhes.schedule_store_boss_encounter) then if (not _detalhes.logoff_saving_data) then - local successful, errortext = pcall (Details.Database.StoreEncounter) + local successful, errortext = pcall(Details.Database.StoreEncounter) if (not successful) then _detalhes:Msg("error occurred on Details.Database.StoreEncounter():", errortext) end @@ -5326,7 +5326,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (Details.schedule_store_boss_encounter_wipe) then if (not _detalhes.logoff_saving_data) then - local successful, errortext = pcall (Details.Database.StoreWipe) + local successful, errortext = pcall(Details.Database.StoreWipe) if (not successful) then _detalhes:Msg("error occurred on Details.Database.StoreWipe():", errortext) end @@ -5523,7 +5523,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 local specIndex = DetailsFramework.GetSpecialization() if (specIndex) then - local specID = DetailsFramework.GetSpecializationInfo (specIndex) + local specID = DetailsFramework.GetSpecializationInfo(specIndex) if (specID and specID ~= 0) then local guid = UnitGUID("player") if (guid) then @@ -5555,7 +5555,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (_detalhes.zone_type == "none" and unit) then local serial = UnitGUID(unit) --the serial is valid and isn't THE player and the serial is from a player? - if (serial and serial ~= UnitGUID("player") and serial:find ("Player")) then + if (serial and serial ~= UnitGUID("player") and serial:find("Player")) then _detalhes.duel_candidates[serial] = GetTime() local playerName = _detalhes:GetCLName(unit) @@ -5885,7 +5885,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 _detalhes.can_panic_mode = true end - if (_detalhes.CheckSwitchOnLogon and _detalhes.tabela_instancias[1] and _detalhes.tabela_instancias and getmetatable (_detalhes.tabela_instancias[1])) then + if (_detalhes.CheckSwitchOnLogon and _detalhes.tabela_instancias[1] and _detalhes.tabela_instancias and getmetatable(_detalhes.tabela_instancias[1])) then tinsert(_detalhes_global.exit_log, "4 - Reversing switches.") currentStep = "Check Switch on Logon" xpcall (_detalhes.CheckSwitchOnLogon, saver_error) diff --git a/core/plugins.lua b/core/plugins.lua index d0cc79d4..0e605c0b 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -29,7 +29,7 @@ local instance = self:GetPluginInstance() if (instance) then self.row_info = self.row_info or {} - _detalhes.table.copy (self.row_info, instance.row_info) + _detalhes.table.copy(self.row_info, instance.row_info) self.bars_grow_direction = instance.bars_grow_direction self.row_height = instance.row_height self:SetBarGrowDirection() @@ -412,7 +412,7 @@ Details.gump:ApplyStandardBackdrop(options_frame) Details.gump:CreateTitleBar (options_frame, title) - local bigdog = _detalhes.gump:NewImage (options_frame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 110, 120, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") + local bigdog = _detalhes.gump:NewImage(options_frame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 110, 120, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") bigdog:SetPoint("bottomright", options_frame, "bottomright", -3, 0) bigdog:SetAlpha(.25) @@ -486,7 +486,7 @@ menuBackground:SetPoint("bottomright", f, "bottomleft", -2, 0) menuBackground:SetWidth(f.MenuButtonWidth + 6) - local bigdog = _detalhes.gump:NewImage (menuBackground, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.7, 200*0.7, "overlay", {0, 1, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") + local bigdog = _detalhes.gump:NewImage(menuBackground, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.7, 200*0.7, "overlay", {0, 1, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") bigdog:SetPoint("bottomleft", custom_window, "bottomleft", 0, 1) bigdog:SetAlpha(0.3) @@ -497,22 +497,22 @@ bigdogRow:SetPoint("bottomleft", menuBackground, "bottomleft", 1, 1) bigdogRow:SetPoint("bottomright", menuBackground, "bottomright", -1, 1) bigdogRow:SetHeight(20) - bigdogRow:SetColorTexture (.5, .5, .5, .1) + bigdogRow:SetColorTexture(.5, .5, .5, .1) bigdogRow:Hide() -- --plugins menu title bar local titlebar_plugins = CreateFrame("frame", nil, menuBackground,"BackdropTemplate") - PixelUtil.SetPoint (titlebar_plugins, "topleft", menuBackground, "topleft", 2, -3) - PixelUtil.SetPoint (titlebar_plugins, "topright", menuBackground, "topright", -2, -3) + PixelUtil.SetPoint(titlebar_plugins, "topleft", menuBackground, "topleft", 2, -3) + PixelUtil.SetPoint(titlebar_plugins, "topright", menuBackground, "topright", -2, -3) titlebar_plugins:SetHeight(f.TitleHeight) titlebar_plugins:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]], tileSize = 64, tile = true}) titlebar_plugins:SetBackdropColor(.5, .5, .5, 1) titlebar_plugins:SetBackdropBorderColor(0, 0, 0, 1) --title local titleLabel = _detalhes.gump:NewLabel(titlebar_plugins, titlebar_plugins, nil, "titulo", "Plugins", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) - PixelUtil.SetPoint (titleLabel, "center", titlebar_plugins , "center", 0, 0) - PixelUtil.SetPoint (titleLabel, "top", titlebar_plugins , "top", 0, -5) + PixelUtil.SetPoint(titleLabel, "center", titlebar_plugins , "center", 0, 0) + PixelUtil.SetPoint(titleLabel, "top", titlebar_plugins , "top", 0, -5) --plugins menu title bar local titlebar_tools = CreateFrame("frame", nil, menuBackground,"BackdropTemplate") @@ -522,8 +522,8 @@ titlebar_tools:SetBackdropBorderColor(0, 0, 0, 1) --title local titleLabel = _detalhes.gump:NewLabel(titlebar_tools, titlebar_tools, nil, "titulo", "Tools", "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255}) - PixelUtil.SetPoint (titleLabel, "center", titlebar_tools , "center", 0, 0) - PixelUtil.SetPoint (titleLabel, "top", titlebar_tools , "top", 0, -5) + PixelUtil.SetPoint(titleLabel, "center", titlebar_tools , "center", 0, 0) + PixelUtil.SetPoint(titleLabel, "top", titlebar_tools , "top", 0, -5) --scripts f:SetScript("OnShow", function() @@ -648,7 +648,7 @@ --frame:SetScript("OnHide", on_hide) frame:HookScript ("OnHide", on_hide) frame:ClearAllPoints() - PixelUtil.SetPoint (frame, "topleft", f, "topleft", 0, 0) + PixelUtil.SetPoint(frame, "topleft", f, "topleft", 0, 0) frame:Show() end @@ -695,13 +695,13 @@ if (not addingTools) then --add the header addingTools = true - PixelUtil.SetPoint (titlebar_tools, "topleft", menuBackground, "topleft", 2, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 20) - PixelUtil.SetPoint (titlebar_tools, "topright", menuBackground, "topright", -2, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 20) + PixelUtil.SetPoint(titlebar_tools, "topleft", menuBackground, "topleft", 2, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 20) + PixelUtil.SetPoint(titlebar_tools, "topright", menuBackground, "topright", -2, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 20) end - PixelUtil.SetPoint (button, "top", menuBackground, "top", 0, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 40) + PixelUtil.SetPoint(button, "top", menuBackground, "top", 0, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index - 40) else - PixelUtil.SetPoint (button, "top", menuBackground, "top", 0, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index) + PixelUtil.SetPoint(button, "top", menuBackground, "top", 0, f.MenuY + ( (index-1) * -f.MenuButtonHeight ) - index) end end @@ -750,13 +750,13 @@ end --check if passed a plugin name, remove spaces and make it lower case - wildcard = string.lower (wildcard) - wildcard = wildcard:gsub ("%s", "") + wildcard = string.lower(wildcard) + wildcard = wildcard:gsub("%s", "") for index, pluginInfoTable in ipairs(_detalhes.ToolBar.Menu) do local pluginName = pluginInfoTable [1] - pluginName = string.lower (pluginName) - pluginName = pluginName:gsub ("%s", "") + pluginName = string.lower(pluginName) + pluginName = pluginName:gsub("%s", "") if (pluginName == wildcard) then local pluginObject = pluginInfoTable [3] diff --git a/core/plugins_raid.lua b/core/plugins_raid.lua index 9dc688cb..e10a20eb 100644 --- a/core/plugins_raid.lua +++ b/core/plugins_raid.lua @@ -323,9 +323,9 @@ end if (custom ~= "") then - custom = custom:gsub ("{spell}", spellname) - custom = custom:gsub ("{target}", alvo_name or "") - custom = custom:gsub ("{next}", next) + custom = custom:gsub("{spell}", spellname) + custom = custom:gsub("{target}", alvo_name or "") + custom = custom:gsub("{next}", next) _detalhes:SendMsgToChannel (custom, channel, _detalhes.announce_interrupts.whisper) else local msg = _cstr (Loc ["STRING_OPTIONS_RT_INTERRUPT"], spellname) @@ -348,9 +348,9 @@ end if (custom ~= "") then - custom = custom:gsub ("{spell}", spellname) - custom = custom:gsub ("{next}", who_name) - custom = custom:gsub ("{target}", alvo_name or "") + custom = custom:gsub("{spell}", spellname) + custom = custom:gsub("{next}", who_name) + custom = custom:gsub("{target}", alvo_name or "") _detalhes:SendMsgToChannel (custom, "PRINT") else local minute, second = _detalhes:GetCombat():GetFormatedCombatTime() @@ -424,8 +424,8 @@ local custom = _detalhes.announce_cooldowns.custom if (custom ~= "") then - custom = custom:gsub ("{spell}", spellname) - custom = custom:gsub ("{target}", alvo_name or "") + custom = custom:gsub("{spell}", spellname) + custom = custom:gsub("{target}", alvo_name or "") _detalhes:SendMsgToChannel (custom, channel, _detalhes.announce_interrupts.whisper) else local msg diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index 41ed41ec..aeeb700b 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -276,12 +276,12 @@ function _detalhes.StatusBar:SetPlugin (instance, absolute_name, anchor) if (absolute_name == -1) then --none - anchor = string.lower (anchor) + anchor = string.lower(anchor) ChoosePlugin (nil, nil, -1, instance.StatusBar [anchor], anchor) else local index = _detalhes.StatusBar:GetIndexFromAbsoluteName (absolute_name) if (index and anchor) then - anchor = string.lower (anchor) + anchor = string.lower(anchor) ChoosePlugin (nil, nil, index, instance.StatusBar [anchor], anchor) end end @@ -530,7 +530,7 @@ function _detalhes.StatusBar:ApplyOptions (child, option, value) - option = string.lower (option) + option = string.lower(option) if (option == "textxmod") then @@ -558,7 +558,7 @@ child.options.textColor = value local r, g, b, a = _detalhes.gump:ParseColors(child.options.textColor) - child.text:SetTextColor (r, g, b, a) + child.text:SetTextColor(r, g, b, a) elseif (option == "textsize") then @@ -1115,17 +1115,17 @@ do if (threatpct) then child.text:SetText(_math_floor(threatpct).."%") if (Threat.isTank) then - child.text:SetTextColor (abs(threatpct-100)*0.01, threatpct*0.01, 0, 1) + child.text:SetTextColor(abs(threatpct-100)*0.01, threatpct*0.01, 0, 1) else - child.text:SetTextColor (threatpct*0.01, abs(threatpct-100)*0.01, 0, 1) + child.text:SetTextColor(threatpct*0.01, abs(threatpct-100)*0.01, 0, 1) end else child.text:SetText("0%") - child.text:SetTextColor (1, 1, 1, 1) + child.text:SetTextColor(1, 1, 1, 1) end else child.text:SetText("0%") - child.text:SetTextColor (1, 1, 1, 1) + child.text:SetTextColor(1, 1, 1, 1) end end end @@ -1298,7 +1298,7 @@ do texture:SetPoint("right", myframe.text.widget, "left", -2, -1) texture:SetWidth(10) texture:SetHeight(10) - texture:SetTexCoord (0.216796875, 0.26171875, 0.0078125, 0.052734375) + texture:SetTexCoord(0.216796875, 0.26171875, 0.0078125, 0.052734375) myframe.texture = texture myframe.widget:SetScript("OnEvent", function() @@ -1548,7 +1548,7 @@ end) ColorPickerFrame:Show() end - _detalhes.gump:NewImage (window, nil, 160, 16, nil, nil, "textcolortexture", "$parentTextColorTexture") + _detalhes.gump:NewImage(window, nil, 160, 16, nil, nil, "textcolortexture", "$parentTextColorTexture") window.textcolortexture:SetPoint("left", window.textcolor, "right", 2) window.textcolortexture:SetTexture(1, 1, 1) @@ -1632,7 +1632,7 @@ end) _G.DetailsStatusBarOptionsTextStyleDropdown.MyObject:Select(child.options.textStyle, true) - _G.DetailsStatusBarOptionsTextColorTexture:SetColorTexture (child.options.textColor[1], child.options.textColor[2], child.options.textColor[3], child.options.textColor[4]) + _G.DetailsStatusBarOptionsTextColorTexture:SetColorTexture(child.options.textColor[1], child.options.textColor[2], child.options.textColor[3], child.options.textColor[4]) _G.DetailsStatusBarOptionsSliderFontSize.MyObject:SetFixedParameter(child) _G.DetailsStatusBarOptionsSliderFontSize.MyObject:SetValue(child.options.textSize) diff --git a/core/plugins_toolbar.lua b/core/plugins_toolbar.lua index 733e1067..f2ae5637 100644 --- a/core/plugins_toolbar.lua +++ b/core/plugins_toolbar.lua @@ -203,7 +203,7 @@ end _detalhes:SetFontFace (f.desc, _detalhes.font_faces.menus) --f.background:SetTexture(_detalhes.tooltip.menus_bg_texture) - f.background:SetTexCoord (unpack(_detalhes.tooltip.menus_bg_coords)) + f.background:SetTexCoord(unpack(_detalhes.tooltip.menus_bg_coords)) f.background:SetVertexColor(unpack(_detalhes.tooltip.menus_bg_color)) --f.background:SetDesaturated(true) diff --git a/core/timemachine.lua b/core/timemachine.lua index 71081b44..ec7c5f47 100644 --- a/core/timemachine.lua +++ b/core/timemachine.lua @@ -99,8 +99,8 @@ end function timeMachine:Reiniciar() - table.wipe (self.tabelas[1]) - table.wipe (self.tabelas[2]) + table.wipe(self.tabelas[1]) + table.wipe(self.tabelas[2]) self.tabelas = {{}, {}} --1 dano 2 cura end @@ -125,7 +125,7 @@ end local esta_tabela = timeMachine.tabelas [self.tipo] - tinsert (esta_tabela, self) + tinsert(esta_tabela, self) self.timeMachine = #esta_tabela end diff --git a/core/util.lua b/core/util.lua index 65371096..22908c47 100644 --- a/core/util.lua +++ b/core/util.lua @@ -293,7 +293,7 @@ function _detalhes:GetNpcIdFromGuid (guid) local NpcId = select( 6, strsplit( "-", guid ) ) if (NpcId) then - return tonumber ( NpcId ) + return tonumber( NpcId ) end return 0 end @@ -344,15 +344,15 @@ return _math_random (1000, 9000) / 1000000 end - --/script print(tonumber (4/1000000)) - 4e-006 + --/script print(tonumber(4/1000000)) - 4e-006 --0.000004 --set all table keys to lower local temptable = {} function _detalhes:LowerizeKeys (_table) for key, value in pairs(_table) do - temptable [string.lower (key)] = value + temptable [string.lower(key)] = value end - temptable, _table = table.wipe (_table), temptable + temptable, _table = table.wipe(_table), temptable return _table end @@ -381,7 +381,7 @@ --do the override if (_detalhes.numerical_system_symbols ~= "auto") then - local locale = string.lower (_detalhes.numerical_system_symbols) + local locale = string.lower(_detalhes.numerical_system_symbols) if (locale == "kr") then symbol_1K, symbol_10K, symbol_1B = "천", "만", "억" @@ -540,7 +540,7 @@ --short numbers function _detalhes:ToK (numero) if (numero > 999999999) then - return format ("%.2f", numero/1000000000) .. "B" + return format("%.2f", numero/1000000000) .. "B" elseif (numero > 1000000) then return _string_format ("%.2f", numero/1000000) .. "M" elseif (numero > 999) then @@ -552,7 +552,7 @@ function _detalhes:ToK2 (numero) if (numero > 999999999) then - return format ("%.2f", numero/1000000000) .. "B" + return format("%.2f", numero/1000000000) .. "B" elseif (numero > 999999) then return _string_format ("%.2f", numero/1000000) .. "M" elseif (numero > 99999) then @@ -567,7 +567,7 @@ --short numbers no numbers after comma function _detalhes:ToK0 (numero) if (numero > 999999999) then - return format ("%.2f", numero/1000000000) .. "B" + return format("%.2f", numero/1000000000) .. "B" elseif (numero > 1000000) then return _string_format ("%.0f", numero/1000000) .. "M" elseif (numero > 1000) then @@ -761,7 +761,7 @@ parameters_cache [3] = v6 parameters_cache [4] = v7 - return (str:gsub ("{data(%d+)}", replace_arg):gsub ("{func(.-)}", run_function)) + return (str:gsub("{data(%d+)}", replace_arg):gsub("{func(.-)}", run_function)) end --remove a index from a hash table @@ -809,7 +809,7 @@ end --yah, i know - function _detalhes.table.copy (t1, t2) + function _detalhes.table.copy(t1, t2) for key, value in pairs(t2) do if (type(value) == "table") then t1 [key] = Details.CopyTable(value) @@ -1020,7 +1020,7 @@ end --font color function _detalhes:SetFontColor(fontString, r, g, b, a) r, g, b, a = gump:ParseColors(r, g, b, a) - fontString:SetTextColor (r, g, b, a) + fontString:SetTextColor(r, g, b, a) end --font size @@ -1085,7 +1085,7 @@ end --internal functions function _detalhes:HealthTick() - if (UnitExists ("boss1") and IsInRaid() and IsInInstance()) then + if (UnitExists("boss1") and IsInRaid() and IsInInstance()) then local health = (UnitHealth ("boss1") or 0) / (UnitHealthMax ("boss1") or 0) if (_detalhes.boss1_health_percent) then if (_detalhes.boss1_health_percent < health) then @@ -1304,7 +1304,7 @@ end GradientFrameControl.gradientes [#GradientFrameControl.gradientes+1] = { Object = Object, - ObjectType = string.lower (ObjectType), + ObjectType = string.lower(ObjectType), Func = EndFunction, FuncParam = FuncParam, TimeStart = GetTime(), diff --git a/core/windows.lua b/core/windows.lua index e79e6fea..99e219bd 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -834,7 +834,7 @@ elseif (tabela._refresh_window) then tabela:_refresh_window (esta_barra, self) else - tabela:RefreshBarra (esta_barra, self, true) + tabela:RefreshBarra(esta_barra, self, true) end end @@ -1112,9 +1112,9 @@ local label = gump:CreateLabel(panel, Loc ["STRING_FEEDBACK_PREFERED_SITE"]) label:SetPoint("topleft", panel, "topleft", 15, -60) - local wowi = gump:NewImage (panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 163/512, 200/512}) - local curse = gump:NewImage (panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 201/512, 242/512}) - local mmoc = gump:NewImage (panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 243/512, 285/512}) + local wowi = gump:NewImage(panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 163/512, 200/512}) + local curse = gump:NewImage(panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 201/512, 242/512}) + local mmoc = gump:NewImage(panel, [[Interface\AddOns\Details\images\icons2]], 101, 34, "artwork", {0/512, 101/512, 243/512, 285/512}) wowi:SetDesaturated(true) curse:SetDesaturated(true) mmoc:SetDesaturated(true) @@ -1259,11 +1259,11 @@ updatewindow_frame.gnoma:SetPoint("topright", updatewindow_frame, "topright", -3, -59) updatewindow_frame.gnoma:SetTexture("Interface\\AddOns\\Details\\images\\icons2") updatewindow_frame.gnoma:SetSize(105*1.05, 107*1.05) - updatewindow_frame.gnoma:SetTexCoord (0.2021484375, 0, 0.7919921875, 1) + updatewindow_frame.gnoma:SetTexCoord(0.2021484375, 0, 0.7919921875, 1) local editbox = Details.gump:NewTextEntry(updatewindow_frame, nil, "$parentTextEntry", "text", 387, 14) editbox:SetPoint(20, -136) - editbox:SetAutoFocus (false) + editbox:SetAutoFocus(false) editbox:SetHook("OnEditFocusGained", function() editbox.text = "http://www.curse.com/addons/wow/details" editbox:HighlightText() diff --git a/frames/anime.lua b/frames/anime.lua index 5c5240a4..505948af 100644 --- a/frames/anime.lua +++ b/frames/anime.lua @@ -100,7 +100,7 @@ function _detalhes.PlayBestDamageOnGuild (damage) local BaseTexture = DetailsNewDamageRecord:CreateTexture("BaseTextureTexture", "ARTWORK") BaseTexture:SetTexture([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Background-Mini]]) - BaseTexture:SetDrawLayer ("ARTWORK", -5) + BaseTexture:SetDrawLayer("ARTWORK", -5) BaseTexture:SetPoint("center", DetailsNewDamageRecord, "center", 0, 0) BaseTexture:SetSize(256, 64) BaseTexture:SetVertexColor(0.99999779462814, 0.99999779462814, 0.99999779462814, 0.99999779462814) @@ -128,11 +128,11 @@ function _detalhes.PlayBestDamageOnGuild (damage) local BigFlash = DetailsNewDamageRecord:CreateTexture("BigFlashTexture", "OVERLAY") BigFlash:SetTexture([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]]) - BigFlash:SetDrawLayer ("OVERLAY", 0) + BigFlash:SetDrawLayer("OVERLAY", 0) BigFlash:SetPoint("center", DetailsNewDamageRecord, "center", -2, 2) BigFlash:SetSize(314, 100) BigFlash:SetDesaturated(false) - BigFlash:SetTexCoord (0.0010000000149012, 0.77400001525879, 0.0010000000149012, 0.65800003051758) + BigFlash:SetTexCoord(0.0010000000149012, 0.77400001525879, 0.0010000000149012, 0.65800003051758) if (0 ~= 0) then BigFlash:SetRotation (0) end @@ -163,11 +163,11 @@ function _detalhes.PlayBestDamageOnGuild (damage) local FlashSwipe = DetailsNewDamageRecord:CreateTexture("FlashSwipeTexture", "OVERLAY") FlashSwipe:SetTexture([[Interface\ACHIEVEMENTFRAME\UI-Achievement-Alert-Glow]]) - FlashSwipe:SetDrawLayer ("OVERLAY", 7) + FlashSwipe:SetDrawLayer("OVERLAY", 7) FlashSwipe:SetPoint("center", DetailsNewDamageRecord, "center", -99, 0) FlashSwipe:SetSize(100, 57) FlashSwipe:SetDesaturated(false) - FlashSwipe:SetTexCoord (0.78199996948242, 0.91900001525879, 0.0010000000149012, 0.2760000038147) + FlashSwipe:SetTexCoord(0.78199996948242, 0.91900001525879, 0.0010000000149012, 0.2760000038147) if (0 ~= 0) then FlashSwipe:SetRotation (0) end @@ -205,11 +205,11 @@ function _detalhes.PlayBestDamageOnGuild (damage) local Portrait = DetailsNewDamageRecord:CreateTexture("PortraitTexture", "OVERLAY") Portrait:SetTexture([[Interface\ARCHEOLOGY\ARCH-FLAREEFFECT]]) - Portrait:SetDrawLayer ("OVERLAY", -5) + Portrait:SetDrawLayer("OVERLAY", -5) Portrait:SetPoint("center", DetailsNewDamageRecord, "center", 3, 0) Portrait:SetSize(246, 44) Portrait:SetDesaturated(false) - Portrait:SetTexCoord (0.051753740310669, 0.81701484680176, 0.086334381103516, 0.25102617263794) + Portrait:SetTexCoord(0.051753740310669, 0.81701484680176, 0.086334381103516, 0.25102617263794) if (0 ~= 0) then Portrait:SetRotation (0) end @@ -256,11 +256,11 @@ function _detalhes.PlayBestDamageOnGuild (damage) local DamageIcon = DetailsNewDamageRecord:CreateTexture("DamageIconTexture", "OVERLAY") DamageIcon:SetTexture([[Interface\LFGFRAME\UI-LFG-ICON-ROLES]]) - DamageIcon:SetDrawLayer ("OVERLAY", 2) + DamageIcon:SetDrawLayer("OVERLAY", 2) DamageIcon:SetPoint("center", DetailsNewDamageRecord, "center", -97, 1) DamageIcon:SetSize(32, 32) DamageIcon:SetDesaturated(false) - DamageIcon:SetTexCoord (0.27200000762939, 0.51899997711182, 0.25837841033936, 0.51399997711182) + DamageIcon:SetTexCoord(0.27200000762939, 0.51899997711182, 0.25837841033936, 0.51399997711182) if (0 ~= 0) then DamageIcon:SetRotation (0) end @@ -292,10 +292,10 @@ function _detalhes.PlayBestDamageOnGuild (damage) local NewDamageRecord = DetailsNewDamageRecord:CreateFontString("NewDamageRecordFontString", "OVERLAY") NewDamageRecord:SetFont ([=[Fonts\FRIZQT__.TTF]=], 12, "OUTLINE") NewDamageRecord:SetText("Damage Record!") - NewDamageRecord:SetDrawLayer ("OVERLAY", 0) + NewDamageRecord:SetDrawLayer("OVERLAY", 0) NewDamageRecord:SetPoint("center", DetailsNewDamageRecord, "center", 18, 7) NewDamageRecord:SetSize(181, 20) - NewDamageRecord:SetTextColor (1, 1, 1) + NewDamageRecord:SetTextColor(1, 1, 1) NewDamageRecord:SetAlpha(1) NewDamageRecord:SetJustifyH("CENTER") @@ -331,10 +331,10 @@ function _detalhes.PlayBestDamageOnGuild (damage) local DamageAmount = DetailsNewDamageRecord:CreateFontString("DamageAmountFontString", "OVERLAY") DamageAmount:SetFont ([=[Fonts\FRIZQT__.TTF]=], 12, "THICKOUTLINE") DamageAmount:SetText(_detalhes:comma_value (damage)) - DamageAmount:SetDrawLayer ("OVERLAY", 0) + DamageAmount:SetDrawLayer("OVERLAY", 0) DamageAmount:SetPoint("center", DetailsNewDamageRecord, "center", 18, -7) DamageAmount:SetSize(100, 20) - DamageAmount:SetTextColor (1, 1, 1) + DamageAmount:SetTextColor(1, 1, 1) DamageAmount:SetAlpha(1) DamageAmount:SetJustifyH("CENTER") diff --git a/frames/fw_mods.lua b/frames/fw_mods.lua index 2d0e2927..7c5c9331 100644 --- a/frames/fw_mods.lua +++ b/frames/fw_mods.lua @@ -28,7 +28,7 @@ function gump:NewLabel2 (parent, container, member, text, font, size, color) end if (color) then - newFontString:SetTextColor (unpack(color)) + newFontString:SetTextColor(unpack(color)) end newFontString:SetJustifyH("LEFT") @@ -124,7 +124,7 @@ function gump:NewDetailsButton (parent, container, instancia, func, param1, para end if (new_button.texture) then - new_button.texture:SetTexCoord (0, 1, 0.5, 0.74609375) + new_button.texture:SetTexCoord(0, 1, 0.5, 0.74609375) end if (options.OnGrab and options.OnGrab == "PassClick") then @@ -157,9 +157,9 @@ function gump:NewDetailsButton (parent, container, instancia, func, param1, para if (new_button.texture) then if (new_button.enter) then - new_button.texture:SetTexCoord (0, 1, 0.25, 0.49609375) + new_button.texture:SetTexCoord(0, 1, 0.25, 0.49609375) else - new_button.texture:SetTexCoord (0, 1, 0, 0.24609375) + new_button.texture:SetTexCoord(0, 1, 0, 0.24609375) end end @@ -195,7 +195,7 @@ function gump:NewDetailsButton (parent, container, instancia, func, param1, para end if (new_button.texture) then - new_button.texture:SetTexCoord (0, 1, 0.25+(0.0078125/2), 0.5+(0.0078125/2)) + new_button.texture:SetTexCoord(0, 1, 0.25+(0.0078125/2), 0.5+(0.0078125/2)) end if (new_button.MouseOnEnterHook) then @@ -212,7 +212,7 @@ function gump:NewDetailsButton (parent, container, instancia, func, param1, para end if (new_button.texture) then - new_button.texture:SetTexCoord (0, 1, 0, 0.24609375) + new_button.texture:SetTexCoord(0, 1, 0, 0.24609375) end if (new_button.MouseOnLeaveHook) then @@ -242,7 +242,7 @@ function gump:NewDetailsButton (parent, container, instancia, func, param1, para new_button.texture:SetPoint("bottomright", new_button, "bottomright", rect.x2, rect.y2) end - new_button.texture:SetTexCoord (0, 1, 0, 0.24609375) + new_button.texture:SetTexCoord(0, 1, 0, 0.24609375) new_button.texture:SetTexture(texture) end @@ -264,8 +264,8 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, container [member] = editbox options = options or {} - editbox:SetAutoFocus (false) - editbox:SetFontObject (GameFontHighlightSmall) + editbox:SetAutoFocus(false) + editbox:SetFontObject(GameFontHighlightSmall) editbox:SetWidth(w) editbox:SetHeight(h) @@ -286,7 +286,7 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, gump:NewLabel(editbox, editbox, nil, "label", "", "GameFontHighlightSmall") editbox ["label"]: SetPoint ("right", editbox, "left", -2, 0) - editbox.label:SetTextColor (.8, .8, .8, 1) + editbox.label:SetTextColor(.8, .8, .8, 1) function editbox:SetPointAndSpace (MyAnchor, SnapTo, HisAnchor, x, y, Width) @@ -348,7 +348,7 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, end end - function editbox:PressEnter (byScript) + function editbox:PressEnter(byScript) EnterPress (byScript) end @@ -410,7 +410,7 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, editbox:SetScript("OnEditFocusGained", function() if (editbox.label) then - editbox.label:SetTextColor (1, 1, 1, 1) + editbox.label:SetTextColor(1, 1, 1, 1) end if (editbox.OnFocusGainedHook) then editbox.OnFocusGainedHook() @@ -435,7 +435,7 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, end if (editbox.label) then - editbox.label:SetTextColor (.8, .8, .8, 1) + editbox.label:SetTextColor(.8, .8, .8, 1) end if (editbox.OnFocusLostHook) then @@ -472,12 +472,12 @@ function gump:NewTextBox (parent, container, member, func, param1, param2, w, h, editbox.SetLabel = function(_, Label) if (Label) then editbox.label = Label - editbox.label:SetTextColor (.8, .8, .8, 1) + editbox.label:SetTextColor(.8, .8, .8, 1) end end function editbox:Blink() - editbox.label:SetTextColor (1, .2, .2, 1) + editbox.label:SetTextColor(1, .2, .2, 1) end if (options.Label) then diff --git a/frames/window_api.lua b/frames/window_api.lua index ca73c8f3..1117d305 100644 --- a/frames/window_api.lua +++ b/frames/window_api.lua @@ -67,13 +67,13 @@ function Details:CreateAPI2Frame() parameters = parameters .. parameterInfo.name .. ", " end end - parameters = parameters:gsub (", $", "") + parameters = parameters:gsub(", $", "") local returnValues = "local " for returnIndex, returnInfo in ipairs(apiInfo.returnValues) do returnValues = returnValues .. returnInfo.name .. ", " end - returnValues = returnValues:gsub (", $", "") + returnValues = returnValues:gsub(", $", "") returnValues = returnValues .. " = " if (parameters ~= "") then @@ -82,7 +82,7 @@ function Details:CreateAPI2Frame() Api2Frame.ApiCopy.text = returnValues .. "Details." .. apiName .. "()" end - Api2Frame.ApiCopy:SetFocus (true) + Api2Frame.ApiCopy:SetFocus(true) Api2Frame.ApiCopy:HighlightText() --parameters @@ -219,7 +219,7 @@ function Details:CreateAPI2Frame() --api func to copy local apiCopyString = DetailsFramework:CreateLabel(Api2Frame, "Copy String", 12, "orange") apiCopyString:SetPoint("topleft", Api2Frame.ApiFunctionDesc, "bottomleft", 0, -20) - Api2Frame.ApiCopy = DetailsFramework:CreateTextEntry (Api2Frame, function() end, infoWidth, 20) + Api2Frame.ApiCopy = DetailsFramework:CreateTextEntry(Api2Frame, function() end, infoWidth, 20) Api2Frame.ApiCopy:SetPoint("topleft", apiCopyString, "bottomleft", 0, -2) Api2Frame.ApiCopy:SetTemplate(DetailsFramework:GetTemplate("button", "DETAILS_CUSTOMDISPLAY_CODE_BOX")) diff --git a/frames/window_benchmark.lua b/frames/window_benchmark.lua index c849e857..c10ae79a 100644 --- a/frames/window_benchmark.lua +++ b/frames/window_benchmark.lua @@ -49,16 +49,16 @@ local libwindow = LibStub("LibWindow-1.1") f.Close:SetNormalTexture(_detalhes.gump.folder .. "icons") f.Close:SetHighlightTexture(_detalhes.gump.folder .. "icons") f.Close:SetPushedTexture(_detalhes.gump.folder .. "icons") - f.Close:GetNormalTexture():SetTexCoord (0, 16/128, 0, 1) - f.Close:GetHighlightTexture():SetTexCoord (0, 16/128, 0, 1) - f.Close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1) + f.Close:GetNormalTexture():SetTexCoord(0, 16/128, 0, 1) + f.Close:GetHighlightTexture():SetTexCoord(0, 16/128, 0, 1) + f.Close:GetPushedTexture():SetTexCoord(0, 16/128, 0, 1) f.Close:SetAlpha(0.7) f.Close:SetScript("OnClick", function() f:Hide() end) --title f.Title = f.TitleBar:CreateFontString("$parentTitle", "overlay", "GameFontNormal") f.Title:SetPoint("center", f.TitleBar, "center") - f.Title:SetTextColor (.8, .8, .8, 1) + f.Title:SetTextColor(.8, .8, .8, 1) f.Title:SetText("Details! Benchmark") DF:InstallTemplate ("font", "DETAILS_BENCHMARK_NORMAL", {color = "white", size = 10, font = "Friz Quadrata TT"}) @@ -151,7 +151,7 @@ local libwindow = LibStub("LibWindow-1.1") --description string and text entry summaryFrame.DescriptionLabel = DF:CreateLabel(summaryFrame, "Description", normal_text_template) - summaryFrame.DescriptionEntry = DF:CreateTextEntry (summaryFrame, function()end, 120, 20, nil, _, nil, options_dropdown_template) + summaryFrame.DescriptionEntry = DF:CreateTextEntry(summaryFrame, function()end, 120, 20, nil, _, nil, options_dropdown_template) --DPS Amount string summaryFrame.DPSLabel = DF:CreateLabel(summaryFrame, "100K", normal_text_template) diff --git a/frames/window_brokertexteditor.lua b/frames/window_brokertexteditor.lua index 0aaec0a8..4fe62e40 100644 --- a/frames/window_brokertexteditor.lua +++ b/frames/window_brokertexteditor.lua @@ -213,7 +213,7 @@ function Details:OpenBrokerTextEditor() local panel = DetailsWindowOptionsBrokerTextEditor - local text = Details.data_broker_text:gsub ("||", "|") + local text = Details.data_broker_text:gsub("||", "|") panel.default_text = text panel.editbox:SetText(text) diff --git a/frames/window_copy.lua b/frames/window_copy.lua index e77688ca..a1ca2acf 100644 --- a/frames/window_copy.lua +++ b/frames/window_copy.lua @@ -33,7 +33,7 @@ do end end) - DetailsFrameWork:NewImage (panel, "Interface\\AddOns\\Details\\images\\copy", 512, 128, "overlay", nil, "background", "$parentBackGround") + DetailsFrameWork:NewImage(panel, "Interface\\AddOns\\Details\\images\\copy", 512, 128, "overlay", nil, "background", "$parentBackGround") panel.background:SetPoint(0, -25) --title diff --git a/frames/window_currentdps.lua b/frames/window_currentdps.lua index 4009f047..15232d2d 100644 --- a/frames/window_currentdps.lua +++ b/frames/window_currentdps.lua @@ -489,11 +489,11 @@ function Details:CreateCurrentDpsFrame(parent, name) yellow_team_color = Details.class_colors.ARENA_YELLOW if (f.PlayerTeam == 0) then - labelPlayerTeam:SetTextColor (unpack(yellow_team_color)) - labelYellowTeam:SetTextColor (unpack(green_team_color)) + labelPlayerTeam:SetTextColor(unpack(yellow_team_color)) + labelYellowTeam:SetTextColor(unpack(green_team_color)) else - labelPlayerTeam:SetTextColor (unpack(green_team_color)) - labelYellowTeam:SetTextColor (unpack(yellow_team_color)) + labelPlayerTeam:SetTextColor(unpack(green_team_color)) + labelYellowTeam:SetTextColor(unpack(yellow_team_color)) end end diff --git a/frames/window_custom.lua b/frames/window_custom.lua index 3494d61b..285e5db2 100644 --- a/frames/window_custom.lua +++ b/frames/window_custom.lua @@ -475,7 +475,7 @@ object.attribute = DetailsCustomPanel.current_attribute object.source = source object.target = target - object.spellid = tonumber (spellid) + object.spellid = tonumber(spellid) object.script = false object.tooltip = false @@ -502,7 +502,7 @@ ["attribute"] = DetailsCustomPanel.current_attribute, ["source"] = source, ["target"] = target, - ["spellid"] = tonumber (spellid), + ["spellid"] = tonumber(spellid), ["script"] = false, ["tooltip"] = false, } @@ -826,7 +826,7 @@ if (not custom_window.ExportBox) then local editbox = _detalhes.gump:NewTextEntry(custom_window, nil, "$parentExportBox", "ExportBox", CONST_EDITBOX_WIDTH, 20) editbox:SetPoint("bottomleft", custom_window, "bottomleft", 10, 6) - editbox:SetAutoFocus (false) + editbox:SetAutoFocus(false) editbox:SetTemplate(CONST_TEXTENTRY_TEMPLATE) editbox:SetHook("OnEditFocusLost", function() editbox:Hide() @@ -836,7 +836,7 @@ end) local flashTexture = editbox:CreateTexture(nil, "overlay") - flashTexture:SetColorTexture (1, 1, 1) + flashTexture:SetColorTexture(1, 1, 1) flashTexture:SetAllPoints() flashTexture:SetAlpha(0) @@ -873,7 +873,7 @@ local editbox = _detalhes.gump:NewTextEntry(custom_window, nil, "$parentImportBox", "ImportBox", CONST_EDITBOX_WIDTH - export_string.width - CONST_EDITBOX_BUTTON_WIDTH - 4, 20) editbox:SetPoint("left", export_string, "right", 2, 0) - editbox:SetAutoFocus (false) + editbox:SetAutoFocus(false) editbox:SetTemplate(CONST_TEXTENTRY_TEMPLATE) local import = function() @@ -964,21 +964,21 @@ selected_left:SetTexture([[Interface\Store\Store-Main]]) selected_left:SetSize(50, 20) selected_left:SetVertexColor(1, .8, 0, 1) - selected_left:SetTexCoord (960/1024, 1020/1024, 68/1024, 101/1024) + selected_left:SetTexCoord(960/1024, 1020/1024, 68/1024, 101/1024) custom_window.selected_left = selected_left local selected_right = attribute_box:CreateTexture(nil, "overlay") selected_right:SetTexture([[Interface\Store\Store-Main]]) selected_right:SetSize(31, 20) selected_right:SetVertexColor(1, .8, 0, 1) - selected_right:SetTexCoord (270/1024, 311/1024, 873/1024, 906/1024) + selected_right:SetTexCoord(270/1024, 311/1024, 873/1024, 906/1024) custom_window.selected_right = selected_right local selected_center = attribute_box:CreateTexture(nil, "overlay") selected_center:SetTexture([[Interface\Store\Store-Main]]) selected_center:SetSize(49, 20) selected_center:SetVertexColor(1, .8, 0, 1) - selected_center:SetTexCoord (956/1024, 1004/1024, 164/1024, 197/1024) + selected_center:SetTexCoord(956/1024, 1004/1024, 164/1024, 197/1024) selected_center:SetPoint("left", selected_left, "right") selected_center:SetPoint("right", selected_right, "left") @@ -1012,12 +1012,12 @@ button.icon:SetPoint("left", button, "left", 6, 0) button.icon:SetSize(22, 22) button.icon:SetTexture([[Interface\AddOns\Details\images\custom_icones]]) - button.icon:SetTexCoord (p*(i-1), p*(i), 0, 1) + button.icon:SetTexCoord(p*(i-1), p*(i), 0, 1) button.text = button:CreateFontString(nil, "overlay", "GameFontHighlightSmall") button.text:SetPoint("left", button.icon, "right", 4, 0) button.text:SetText(attributes [i] and attributes [i].label or "") - button.text:SetTextColor (.9, .9, .9, 1) + button.text:SetTextColor(.9, .9, .9, 1) end end @@ -1071,7 +1071,7 @@ local pickicon = function() gump:IconPick (pickicon_callback, true) end - local icon_image = gump:NewImage (box0, [[Interface\ICONS\TEMP]], 20, 20, nil, nil, "icontexture", "$parentIconTexture") + local icon_image = gump:NewImage(box0, [[Interface\ICONS\TEMP]], 20, 20, nil, nil, "icontexture", "$parentIconTexture") local icon_button = gump:NewButton(box0, nil, "$parentIconButton", "IconButton", 20, 20, pickicon) icon_button:InstallCustomTexture() icon_button:SetPoint("left", icon_label, "left", 64, 0) @@ -1108,7 +1108,7 @@ end local enable_source_field = function() box1.sourceentry:Enable() - box1.sourceentry:SetFocus (true) + box1.sourceentry:SetFocus(true) end local source_icon = [[Interface\COMMON\Indicator-Yellow]] @@ -1137,7 +1137,7 @@ local adds_boss_image = adds_boss:CreateTexture(nil, "overlay") adds_boss_image:SetPoint("center", adds_boss) adds_boss_image:SetTexture("Interface\\Buttons\\UI-MicroButton-Raid-Up") - adds_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + adds_boss_image:SetTexCoord(0.046875, 0.90625, 0.40625, 0.953125) adds_boss_image:SetWidth(20) adds_boss_image:SetHeight(16) @@ -1179,7 +1179,7 @@ local buttonMouseOver = function(button) button.MyObject.image:SetBlendMode("ADD") button.MyObject.line:SetBlendMode("ADD") - button.MyObject.label:SetTextColor (1, 1, 1, 1) + button.MyObject.label:SetTextColor(1, 1, 1, 1) GameTooltip:SetOwner(button, "ANCHOR_TOPLEFT") GameTooltip:AddLine(button.MyObject.actor) GameTooltip:Show() @@ -1187,7 +1187,7 @@ local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (button.MyObject.ej_id) modelFrameTexture:SetTexture(bgImage) - modelFrameTexture:SetTexCoord (3/512, 370/512, 5/512, 429/512) + modelFrameTexture:SetTexCoord(3/512, 370/512, 5/512, 429/512) modelFrame:Show() modelFrame:SetDisplayInfo (button.MyObject.model) @@ -1195,7 +1195,7 @@ local buttonMouseOut = function(button) button.MyObject.image:SetBlendMode("BLEND") button.MyObject.line:SetBlendMode("BLEND") - button.MyObject.label:SetTextColor (.8, .8, .8, .8) + button.MyObject.label:SetTextColor(.8, .8, .8, .8) GameTooltip:Hide() modelFrame:Hide() end @@ -1226,7 +1226,7 @@ thisButton:SetHook("OnEnter", buttonMouseOver) thisButton:SetHook("OnLeave", buttonMouseOut) - local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActors2EncounterImageButton"..i) + local t = gump:NewImage(thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActors2EncounterImageButton"..i) t:SetPoint("left", thisButton) t:SetTexture([[Interface\MINIMAP\TRACKING\Target]]) t:SetDesaturated(true) @@ -1238,14 +1238,14 @@ text:SetWidth(123) text:SetHeight(10) - local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActors2EncounterBorderButton"..i) - border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) - border:SetDrawLayer ("background") + local border = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActors2EncounterBorderButton"..i) + border:SetTexCoord(0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer("background") border:SetPoint("topleft", thisButton.button, "topleft", -9, 9) - local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 134, 25, nil, nil, "line", "DetailsCustomActors2EncounterLineButton"..i) - line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - line:SetDrawLayer ("background") + local line = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 134, 25, nil, nil, "line", "DetailsCustomActors2EncounterLineButton"..i) + line:SetTexCoord(0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer("background") line:SetPoint("left", thisButton.button, "right", -110, -3) table.insert (actorsFrameButtons, #actorsFrameButtons+1, thisButton) @@ -1328,7 +1328,7 @@ end local enable_target_field = function() box1.targetentry:Enable() - box1.targetentry:SetFocus (true) + box1.targetentry:SetFocus(true) end local target_icon = [[Interface\COMMON\Indicator-Yellow]] @@ -1359,7 +1359,7 @@ local adds_boss_image = adds_boss:CreateTexture(nil, "overlay") adds_boss_image:SetPoint("center", adds_boss) adds_boss_image:SetTexture("Interface\\Buttons\\UI-MicroButton-Raid-Up") - adds_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + adds_boss_image:SetTexCoord(0.046875, 0.90625, 0.40625, 0.953125) adds_boss_image:SetWidth(20) adds_boss_image:SetHeight(16) @@ -1387,7 +1387,7 @@ local buttonMouseOver = function(button) button.MyObject.image:SetBlendMode("ADD") button.MyObject.line:SetBlendMode("ADD") - button.MyObject.label:SetTextColor (1, 1, 1, 1) + button.MyObject.label:SetTextColor(1, 1, 1, 1) GameTooltip:SetOwner(button, "ANCHOR_TOPLEFT") GameTooltip:AddLine(button.MyObject.actor) GameTooltip:Show() @@ -1395,7 +1395,7 @@ local name, description, bgImage, buttonImage, loreImage, dungeonAreaMapID, link = DetailsFramework.EncounterJournal.EJ_GetInstanceInfo (button.MyObject.ej_id) modelFrameTexture:SetTexture(bgImage) - modelFrameTexture:SetTexCoord (3/512, 370/512, 5/512, 429/512) + modelFrameTexture:SetTexCoord(3/512, 370/512, 5/512, 429/512) modelFrame:Show() modelFrame:SetDisplayInfo (button.MyObject.model) @@ -1403,7 +1403,7 @@ local buttonMouseOut = function(button) button.MyObject.image:SetBlendMode("BLEND") button.MyObject.line:SetBlendMode("BLEND") - button.MyObject.label:SetTextColor (.8, .8, .8, .8) + button.MyObject.label:SetTextColor(.8, .8, .8, .8) GameTooltip:Hide() modelFrame:Hide() @@ -1434,7 +1434,7 @@ thisButton:SetHook("OnEnter", buttonMouseOver) thisButton:SetHook("OnLeave", buttonMouseOut) - local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActorsEncounterImageButton"..i) + local t = gump:NewImage(thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomActorsEncounterImageButton"..i) t:SetPoint("left", thisButton) t:SetTexture([[Interface\MINIMAP\TRACKING\Target]]) t:SetDesaturated(true) @@ -1446,14 +1446,14 @@ text:SetWidth(123) text:SetHeight(10) - local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActorsEncounterBorderButton"..i) - border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) - border:SetDrawLayer ("background") + local border = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomActorsEncounterBorderButton"..i) + border:SetTexCoord(0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer("background") border:SetPoint("topleft", thisButton.button, "topleft", -9, 9) - local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomActorsEncounterLineButton"..i) - line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - line:SetDrawLayer ("background") + local line = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomActorsEncounterLineButton"..i) + line:SetTexCoord(0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer("background") line:SetPoint("left", thisButton.button, "right", -110, -3) table.insert (actorsFrameButtons, #actorsFrameButtons+1, thisButton) @@ -1541,7 +1541,7 @@ local spell_id_boss_image = spell_id_boss:CreateTexture(nil, "overlay") spell_id_boss_image:SetPoint("center", spell_id_boss) spell_id_boss_image:SetTexture("Interface\\Buttons\\UI-MicroButton-Raid-Up") - spell_id_boss_image:SetTexCoord (0.046875, 0.90625, 0.40625, 0.953125) + spell_id_boss_image:SetTexCoord(0.046875, 0.90625, 0.40625, 0.953125) spell_id_boss_image:SetWidth(20) spell_id_boss_image:SetHeight(16) @@ -1562,7 +1562,7 @@ local buttonMouseOver = function(button) button.MyObject.image:SetBlendMode("ADD") button.MyObject.line:SetBlendMode("ADD") - button.MyObject.label:SetTextColor (1, 1, 1, 1) + button.MyObject.label:SetTextColor(1, 1, 1, 1) GameTooltip:SetOwner(button, "ANCHOR_TOPLEFT") _detalhes:GameTooltipSetSpellByID (button.MyObject.spellid) @@ -1571,7 +1571,7 @@ local buttonMouseOut = function(button) button.MyObject.image:SetBlendMode("BLEND") button.MyObject.line:SetBlendMode("BLEND") - button.MyObject.label:SetTextColor (.8, .8, .8, .8) + button.MyObject.label:SetTextColor(.8, .8, .8, .8) GameTooltip:Hide() end @@ -1599,7 +1599,7 @@ thisButton:SetHook("OnEnter", buttonMouseOver) thisButton:SetHook("OnLeave", buttonMouseOut) - local t = gump:NewImage (thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomEncounterImageButton"..i) + local t = gump:NewImage(thisButton, nil, 20, 20, nil, nil, "image", "DetailsCustomEncounterImageButton"..i) t:SetPoint("left", thisButton) local text = gump:NewLabel(thisButton, nil, "DetailsCustomSpellsFrameButton"..i.."Label", "label", "Spell", nil, 9.5, {.8, .8, .8, .8}) @@ -1607,14 +1607,14 @@ text:SetWidth(73) text:SetHeight(10) - local border = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomEncounterBorderButton"..i) - border:SetTexCoord (0.00390625, 0.27734375, 0.44140625,0.69531250) - border:SetDrawLayer ("background") + local border = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 40, 38, nil, nil, "border", "DetailsCustomEncounterBorderButton"..i) + border:SetTexCoord(0.00390625, 0.27734375, 0.44140625,0.69531250) + border:SetDrawLayer("background") border:SetPoint("topleft", thisButton.button, "topleft", -9, 9) - local line = gump:NewImage (thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomEncounterLineButton"..i) - line:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) - line:SetDrawLayer ("background") + local line = gump:NewImage(thisButton, "Interface\\SPELLBOOK\\Spellbook-Parts", 84, 25, nil, nil, "line", "DetailsCustomEncounterLineButton"..i) + line:SetTexCoord(0.31250000, 0.96484375, 0.37109375, 0.52343750) + line:SetDrawLayer("background") line:SetPoint("left", thisButton.button, "right", -60, -3) table.insert (spellsFrameButtons, #spellsFrameButtons+1, thisButton) @@ -1734,9 +1734,9 @@ local func, errortext = loadstring (script) if (not func) then local firstLine = strsplit("\n", script, 2) - errortext = errortext:gsub (firstLine, "") - errortext = errortext:gsub ("%[string \"", "") - errortext = errortext:gsub ("...\"]:", "") + errortext = errortext:gsub(firstLine, "") + errortext = errortext:gsub("%[string \"", "") + errortext = errortext:gsub("...\"]:", "") errortext = "Line " .. errortext DetailsCustomPanel.ErrorString.text = errortext else diff --git a/frames/window_dump.lua b/frames/window_dump.lua index 0d994d1e..ebc3a8c7 100644 --- a/frames/window_dump.lua +++ b/frames/window_dump.lua @@ -39,7 +39,7 @@ function Details:Dump (...) text_editor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) text_editor:SetBackdropBorderColor(0, 0, 0, 1) - text_editor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647) + text_editor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647) text_editor.__background:SetVertexColor(0.27, 0.27, 0.27) text_editor.__background:SetAlpha(0.8) text_editor.__background:SetVertTile(true) @@ -104,7 +104,7 @@ function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText) importTextEditor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) importTextEditor:SetBackdropBorderColor(0, 0, 0, 1) - importTextEditor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647) + importTextEditor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647) importTextEditor.__background:SetVertexColor(0.27, 0.27, 0.27) importTextEditor.__background:SetAlpha(0.8) importTextEditor.__background:SetVertTile(true) @@ -139,7 +139,7 @@ function _detalhes:ShowImportWindow (defaultText, confirmFunc, titleText) _G.DetailsExportWindow.Title:SetText(titleText) C_Timer.After(.2, function() - _G.DetailsExportWindow.ImportEditor:SetFocus (true) + _G.DetailsExportWindow.ImportEditor:SetFocus(true) _G.DetailsExportWindow.ImportEditor.editbox:HighlightText (0) end) end diff --git a/frames/window_eventtracker.lua b/frames/window_eventtracker.lua index 9246b62a..9b03a0ec 100644 --- a/frames/window_eventtracker.lua +++ b/frames/window_eventtracker.lua @@ -416,7 +416,7 @@ function Details:CreateEventTrackerFrame(parent, name) local class local spec = _detalhes.cached_specs [serial] if (not spec) then - local _, engClass = UnitClass (name) + local _, engClass = UnitClass(name) if (engClass) then class = engClass else @@ -519,7 +519,7 @@ function Details:CreateEventTrackerFrame(parent, name) local spec, class = get_spec_or_class (ability [ABILITYTABLE_CASTERSERIAL], ability [ABILITYTABLE_CASTERNAME]) local texture, L, R, T, B = get_player_icon (spec, class) line.LeftIcon:SetTexture(texture) - line.LeftIcon:SetTexCoord (L, R, T, B) + line.LeftIcon:SetTexCoord(L, R, T, B) line.LeftText:SetText(_detalhes:GetOnlyName(ability [ABILITYTABLE_CASTERNAME])) if (ability [ABILITYTABLE_ISENEMY]) then @@ -531,7 +531,7 @@ function Details:CreateEventTrackerFrame(parent, name) if (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_COOLDOWN) then local spellName, _, spellIcon = GetSpellInfo(ability [ABILITYTABLE_SPELLID]) line.RightIcon:SetTexture(spellIcon) - line.RightIcon:SetTexCoord (.06, .94, .06, .94) + line.RightIcon:SetTexCoord(.06, .94, .06, .94) local targetName = ability [ABILITYTABLE_TARGETNAME] if (targetName) then @@ -542,30 +542,30 @@ function Details:CreateEventTrackerFrame(parent, name) line.RightText:SetText(targetName or spellName) line.ActionIcon:SetTexture([[Interface\AddOns\Details\images\event_tracker_icons]]) - line.ActionIcon:SetTexCoord (0, 0.125, 0, 1) + line.ActionIcon:SetTexCoord(0, 0.125, 0, 1) elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_OFFENSIVE) then local spellName, _, spellIcon = GetSpellInfo(ability [ABILITYTABLE_SPELLID]) line.RightIcon:SetTexture(spellIcon) - line.RightIcon:SetTexCoord (.06, .94, .06, .94) + line.RightIcon:SetTexCoord(.06, .94, .06, .94) line.RightText:SetText(spellName) line.ActionIcon:SetTexture([[Interface\AddOns\Details\images\event_tracker_icons]]) - line.ActionIcon:SetTexCoord (0.127, 0.25, 0, 1) + line.ActionIcon:SetTexCoord(0.127, 0.25, 0, 1) elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_INTERRUPT) then local spellNameInterrupted, _, spellIconInterrupted = GetSpellInfo(ability [ABILITYTABLE_EXTRASPELLID]) line.RightIcon:SetTexture(spellIconInterrupted) - line.RightIcon:SetTexCoord (.06, .94, .06, .94) + line.RightIcon:SetTexCoord(.06, .94, .06, .94) line.RightText:SetText(spellNameInterrupted) line.ActionIcon:SetTexture([[Interface\AddOns\Details\images\event_tracker_icons]]) - line.ActionIcon:SetTexCoord (0.251, 0.375, 0, 1) + line.ActionIcon:SetTexCoord(0.251, 0.375, 0, 1) elseif (ability [ABILITYTABLE_SPELLTYPE] == SPELLTYPE_CROWDCONTROL) then local spellName, _, spellIcon = GetSpellInfo(ability [ABILITYTABLE_SPELLID]) line.RightIcon:SetTexture(spellIcon) - line.RightIcon:SetTexCoord (.06, .94, .06, .94) + line.RightIcon:SetTexCoord(.06, .94, .06, .94) local targetName = ability [ABILITYTABLE_TARGETNAME] if (targetName) then @@ -576,7 +576,7 @@ function Details:CreateEventTrackerFrame(parent, name) line.RightText:SetText(targetName or "unknown target") line.ActionIcon:SetTexture([[Interface\AddOns\Details\images\event_tracker_icons]]) - line.ActionIcon:SetTexCoord (0.376, 0.5, 0, 1) + line.ActionIcon:SetTexCoord(0.376, 0.5, 0, 1) end diff --git a/frames/window_forge.lua b/frames/window_forge.lua index 11df86c0..40d33807 100644 --- a/frames/window_forge.lua +++ b/frames/window_forge.lua @@ -49,7 +49,7 @@ function Details:OpenForge() f:SetFrameStrata("HIGH") f:SetToplevel (true) f:SetMovable(true) - f.Title:SetTextColor (1, .8, .2) + f.Title:SetTextColor(1, .8, .2) local have_plugins_enabled @@ -88,7 +88,7 @@ function Details:OpenForge() tutorialFrame.Desc:SetPoint("topleft", tutorialFrame, "topleft", 10, -45) tutorialFrame.Example:SetPoint("topleft", tutorialFrame, "topleft", 10, -110) - local editBox = Details.gump:CreateTextEntry (tutorialFrame, function()end, 375, 20, nil, nil, nil, entry_template, label_template) + local editBox = Details.gump:CreateTextEntry(tutorialFrame, function()end, 375, 20, nil, nil, nil, entry_template, label_template) editBox:SetPoint("topleft", tutorialFrame.Example, "bottomleft", 0, -10) editBox:SetText([[https://www.youtube.com/watch?v=om0k1Yj2pEw]]) editBox:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -167,7 +167,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_PLAYERNAME"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllPlayersNameFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllPlayersNameFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -182,7 +182,7 @@ function Details:OpenForge() if (filter ~= "") then filter = lower (filter) local actor_name = lower (actor:name()) - if (actor_name:find (filter)) then + if (actor_name:find(filter)) then t [#t+1] = actor end else @@ -231,7 +231,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_PETNAME"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllPetsNameFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllPetsNameFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -239,7 +239,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_OWNERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllPetsOwnerFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllPetsOwnerFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -256,14 +256,14 @@ function Details:OpenForge() if (filter_petname ~= "") then filter_petname = lower (filter_petname) local actor_name = lower (actor:name()) - if (not actor_name:find (filter_petname)) then + if (not actor_name:find(filter_petname)) then can_add = false end end if (filter_ownername ~= "") then filter_ownername = lower (filter_ownername) local actor_name = lower (actor.ownerName) - if (not actor_name:find (filter_ownername)) then + if (not actor_name:find(filter_ownername)) then can_add = false end end @@ -289,7 +289,7 @@ function Details:OpenForge() if (data) then return { index, - data:name():gsub ("(<).*(>)", "") or "", + data:name():gsub("(<).*(>)", "") or "", data.ownerName or "", Details:GetNpcIdFromGuid (data.serial), data.serial or "", @@ -318,7 +318,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_ENEMYNAME"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllEnemiesNameFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllEnemiesNameFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -333,7 +333,7 @@ function Details:OpenForge() if (filter ~= "") then filter = lower (filter) local actor_name = lower (actor:name()) - if (actor_name:find (filter)) then + if (actor_name:find(filter)) then t [#t+1] = actor end else @@ -415,7 +415,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_SPELLNAME"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllSpellsNameFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllSpellsNameFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -423,7 +423,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_CASTERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeAllSpellsCasterFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeAllSpellsCasterFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -455,7 +455,7 @@ function Details:OpenForge() className = lower (className) end - if (not className:find (lower_FilterCaster)) then + if (not className:find(lower_FilterCaster)) then can_add = false else className = classNameOriginal @@ -467,7 +467,7 @@ function Details:OpenForge() local spellName = GetSpellInfo(spellID) if (spellName) then spellName = lower (spellName) - if (not spellName:find (lower_FilterSpellName)) then + if (not spellName:find(lower_FilterSpellName)) then can_add = false end else @@ -504,7 +504,7 @@ function Details:OpenForge() local events = "" if (EncounterSpellEvents and EncounterSpellEvents [data[1]]) then for token, _ in pairs(EncounterSpellEvents [data[1]].token) do - token = token:gsub ("SPELL_", "") + token = token:gsub("SPELL_", "") events = events .. token .. ", " end events = events:sub (1, #events - 3) @@ -545,7 +545,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_SPELLNAME"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsNameFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsNameFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -553,7 +553,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_CASTERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsCasterFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsCasterFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -561,7 +561,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_ENCOUNTERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsEncounterFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeEncounterSpellsEncounterFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -592,7 +592,7 @@ function Details:OpenForge() local can_add = true if (lower_FilterCaster ~= "") then - if (not lower (enemyName):find (lower_FilterCaster)) then + if (not lower (enemyName):find(lower_FilterCaster)) then can_add = false end end @@ -602,7 +602,7 @@ function Details:OpenForge() local spellName = GetSpellInfo(spellID) if (spellName) then spellName = lower (spellName) - if (not spellName:find (lower_FilterSpellName)) then + if (not spellName:find(lower_FilterSpellName)) then can_add = false end else @@ -615,7 +615,7 @@ function Details:OpenForge() local encounterName = bossDetails.boss if (filter_encounter ~= "" and encounterName and encounterName ~= "") then encounterName = lower (encounterName) - if (not encounterName:find (lower_FilterEncounterName)) then + if (not encounterName:find(lower_FilterEncounterName)) then can_add = false end end @@ -651,7 +651,7 @@ function Details:OpenForge() local events = "" if (EncounterSpellEvents and EncounterSpellEvents [data[1]]) then for token, _ in pairs(EncounterSpellEvents [data[1]].token) do - token = token:gsub ("SPELL_", "") + token = token:gsub("SPELL_", "") events = events .. token .. ", " end events = events:sub (1, #events - 3) @@ -776,8 +776,8 @@ function Details:OpenForge() spellname, _, spellicon = GetSpellInfo(data [7]) else if (data [7]) then - local spellid = data[7]:gsub ("ej", "") - spellid = tonumber (spellid) + local spellid = data[7]:gsub("ej", "") + spellid = tonumber(spellid) local title, description, depth, abilityIcon, displayInfo, siblingID, nextSectionID, filteredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = DetailsFramework.EncounterJournal.EJ_GetSectionInfo (spellid) spellname, spellicon = title, abilityIcon else @@ -800,7 +800,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_BARTEXT"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeDBMBarsTextFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeDBMBarsTextFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -808,7 +808,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_ENCOUNTERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeDBMBarsEncounterFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeDBMBarsEncounterFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -828,7 +828,7 @@ function Details:OpenForge() for key, timer in pairs(source) do local can_add = true if (lower_FilterBarName ~= "") then - if (not lower (timer [3]):find (lower_FilterBarName)) then + if (not lower (timer [3]):find(lower_FilterBarName)) then can_add = false end end @@ -837,7 +837,7 @@ function Details:OpenForge() local encounterName = bossDetails and bossDetails.boss if (encounterName and encounterName ~= "") then encounterName = lower (encounterName) - if (not encounterName:find (lower_FilterEncounterName)) then + if (not encounterName:find(lower_FilterEncounterName)) then can_add = false end end @@ -870,7 +870,7 @@ function Details:OpenForge() local bossDetails, bossIndex = Details:GetBossEncounterDetailsFromEncounterId (nil, data.id) local bossName = bossDetails and bossDetails.boss or "--x--x--" - local abilityID = tonumber (data [7]) + local abilityID = tonumber(data [7]) local spellName, _, spellIcon if (abilityID) then if (abilityID > 0) then @@ -885,7 +885,7 @@ function Details:OpenForge() data[2] or "", data[7] or "", data[4] or "0", - tostring (encounter_id) or "0", + tostring(encounter_id) or "0", bossName, } else @@ -902,7 +902,7 @@ function Details:OpenForge() local data = all_modules [5].data [row] local spellname, spellicon, _ - local spellid = tonumber (data [2]) + local spellid = tonumber(data [2]) if (type(spellid) == "number") then if (spellid < 0) then @@ -931,7 +931,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_BARTEXT"] .. ": ") label:SetPoint("left", w, "left", 5, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeBigWigsBarsTextFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeBigWigsBarsTextFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -939,7 +939,7 @@ function Details:OpenForge() local label = w:CreateFontString(nil, "overlay", "GameFontHighlightSmall") label:SetText(L["STRING_FORGE_FILTER_ENCOUNTERNAME"] .. ": ") label:SetPoint("left", entry.widget, "right", 20, 0) - local entry = fw:CreateTextEntry (w, nil, 120, 20, "entry", "DetailsForgeBWBarsEncounterFilter") + local entry = fw:CreateTextEntry(w, nil, 120, 20, "entry", "DetailsForgeBWBarsEncounterFilter") entry:SetHook("OnTextChanged", function() f:refresh() end) entry:SetPoint("left", label, "right", 2, 0) entry:SetTemplate(Details.gump:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) @@ -961,7 +961,7 @@ function Details:OpenForge() for key, timer in pairs(source) do local can_add = true if (lower_FilterBarName ~= "") then - if (not lower (timer [3]):find (lower_FilterBarName)) then + if (not lower (timer [3]):find(lower_FilterBarName)) then can_add = false end end @@ -970,7 +970,7 @@ function Details:OpenForge() local encounterName = bossDetails and bossDetails.boss if (encounterName and encounterName ~= "") then encounterName = lower (encounterName) - if (not encounterName:find (lower_FilterEncounterName)) then + if (not encounterName:find(lower_FilterEncounterName)) then can_add = false end end @@ -1001,7 +1001,7 @@ function Details:OpenForge() local bossDetails, bossIndex = Details:GetBossEncounterDetailsFromEncounterId (nil, data.id) local bossName = bossDetails and bossDetails.boss or "--x--x--" - local abilityID = tonumber (data[2]) + local abilityID = tonumber(data[2]) local spellName, _, spellIcon if (abilityID) then if (abilityID > 0) then @@ -1015,7 +1015,7 @@ function Details:OpenForge() {text = data[3] or "", id = abilityID and abilityID > 0 and abilityID or 0}, data[2] or "", data[4] or "", - tostring (encounter_id) or "0", + tostring(encounter_id) or "0", bossName } else @@ -1058,7 +1058,7 @@ function Details:OpenForge() local background = fillpanel:CreateTexture(nil, "background") background:SetAllPoints() - background:SetColorTexture (0, 0, 0, 0.2) + background:SetColorTexture(0, 0, 0, 0.2) module.fill_panel = fillpanel end diff --git a/frames/window_macros.lua b/frames/window_macros.lua index 1fc4b56b..5cb7b68f 100644 --- a/frames/window_macros.lua +++ b/frames/window_macros.lua @@ -102,15 +102,15 @@ function Details.OpenMacrosWindow() descLabel.textsize = 12 local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - options_dropdown_template = DF.table.copy ({}, options_dropdown_template) + options_dropdown_template = DF.table.copy({}, options_dropdown_template) options_dropdown_template.backdropcolor = {.51, .51, .51, .3} options_dropdown_template.onenterbordercolor = {.51, .51, .51, .2} - local textEntry = DF:CreateTextEntry (line, function()end, scrollbox_size[1] - 10, 40, "MacroTextEntry", _, _, options_dropdown_template) + local textEntry = DF:CreateTextEntry(line, function()end, scrollbox_size[1] - 10, 40, "MacroTextEntry", _, _, options_dropdown_template) textEntry:SetHook("OnEditFocusGained", textEntryOnFocusGained) textEntry:SetHook("OnEditFocusLost", textEntryOnFocusLost) textEntry:SetJustifyH("left") - textEntry:SetTextInsets (8, 8, 0, 0) + textEntry:SetTextInsets(8, 8, 0, 0) titleLabel:SetPoint("topleft", line, "topleft", 5, -5) descLabel:SetPoint("topleft", titleLabel, "bottomleft", 0, -2) diff --git a/frames/window_main.lua b/frames/window_main.lua index b39f1843..f9209f76 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -1973,7 +1973,7 @@ local lineScript_Onmouseup = function(self, button) if (custom and custom.on_shift_click) then local func = loadstring (custom.on_shift_click) if (func) then - local successful, errortext = pcall (func, self, self.minha_tabela, self._instance) + local successful, errortext = pcall(func, self, self.minha_tabela, self._instance) if (not successful) then Details:Msg("error occurred custom script shift+click:", errortext) end @@ -2519,7 +2519,7 @@ function Details:ReportSingleLine (instancia, barra) local GameCooltip = GameCooltip if (GameCooltipFrame1:IsShown()) then local actor_name = barra.lineText1:GetText() or "" - actor_name = actor_name:gsub ((".*%."), "") + actor_name = actor_name:gsub((".*%."), "") if (instancia.segmento == -1) then --overall reportar = {"Details!: " .. Loc["STRING_OVERALL"] .. " " .. instancia.customName .. ": " .. actor_name .. " " .. Loc["STRING_CUSTOM_REPORT"]} @@ -3081,7 +3081,7 @@ end local alert_on_click = function(self, button) if (self.func) then - local okey, errortext = pcall (self.func, unpack(self.func_param)) + local okey, errortext = pcall(self.func, unpack(self.func_param)) if (not okey) then Details:Msg("error on alert function:", errortext) end @@ -5687,7 +5687,7 @@ function Details:ToolbarMenuSetButtons(_mode, _segment, _attributes, _report, _r self.menu_icons[5] = _reset self.menu_icons[6] = _close - table.wipe (tbuttons) + table.wipe(tbuttons) tbuttons[1] = self.baseframe.cabecalho.modo_selecao tbuttons[2] = self.baseframe.cabecalho.segmento @@ -6748,7 +6748,7 @@ local buildSegmentTooltip = function(self, deltaTime) local thisCombat = Details.tabela_vigente local encounter_name = thisCombat.is_boss.encounter local instanceID = thisCombat.is_boss.ej_instance_id - instanceID = tonumber (instanceID) + instanceID = tonumber(instanceID) if (encounter_name and instanceID and instanceID ~= 0) then local index, name, description, encounterID, rootSectionID, link = Details:GetEncounterInfoFromEncounterName (instanceID, encounter_name) if (index and name and encounterID) then @@ -6950,11 +6950,11 @@ end function Details:SetUserCustomSkinFile (file) if (type(file) ~= "string") then - error ("SetUserCustomSkinFile() file must be a string.") + error("SetUserCustomSkinFile() file must be a string.") end - if (file:find ("\\") or file:find ("/")) then - error ("SetUserCustomSkinFile() file must be only the file name (with out up folders) and slashes.") + if (file:find("\\") or file:find("/")) then + error("SetUserCustomSkinFile() file must be only the file name (with out up folders) and slashes.") end self.skin_custom = file @@ -7287,7 +7287,7 @@ function Details:ChangeSkin(skin_name) local callbackFunc = this_skin.callback if (callbackFunc) then DetailsFramework:SetEnvironment(callbackFunc) - local okey, result = pcall (callbackFunc, this_skin, self, just_updating) + local okey, result = pcall(callbackFunc, this_skin, self, just_updating) if (not okey) then Details:Msg("|cFFFF9900error on skin callback function|r:", result) end @@ -7297,7 +7297,7 @@ function Details:ChangeSkin(skin_name) local onStartScript = this_skin.control_script_on_start if (onStartScript) then DetailsFramework:SetEnvironment(onStartScript) - local okey, result = pcall (onStartScript, this_skin, self) + local okey, result = pcall(onStartScript, this_skin, self) if (not okey) then Details:Msg("|cFFFF9900error on skin control on start function|r:", result) end @@ -8038,7 +8038,7 @@ function Details:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, end --protection against failed clean up framework table - if (self.menu_attribute_string and not getmetatable (self.menu_attribute_string)) then + if (self.menu_attribute_string and not getmetatable(self.menu_attribute_string)) then self.menu_attribute_string = nil end @@ -8549,7 +8549,7 @@ function Details:StretchButtonAnchor (side) side = self.stretch_button_side end - if (side == 1 or string.lower (side) == "top") then + if (side == 1 or string.lower(side) == "top") then self.baseframe.button_stretch:ClearAllPoints() local y = 0 @@ -8562,7 +8562,7 @@ function Details:StretchButtonAnchor (side) self.baseframe.button_stretch.texture:SetTexCoord(unpack(COORDS_STRETCH)) self.stretch_button_side = 1 - elseif (side == 2 or string.lower (side) == "bottom") then + elseif (side == 2 or string.lower(side) == "bottom") then self.baseframe.button_stretch:ClearAllPoints() local y = 0 diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 62196924..8a0656e0 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -755,7 +755,7 @@ do local buildSkinMenu = function() local skinOptions = {} for skin_name, skin_table in pairs(_detalhes.skins) do - local file = skin_table.file:gsub ([[Interface\AddOns\Details\images\skins\]], "") + local file = skin_table.file:gsub([[Interface\AddOns\Details\images\skins\]], "") local desc = "Author: |cFFFFFFFF" .. skin_table.author .. "|r\nVersion: |cFFFFFFFF" .. skin_table.version .. "|r\nSite: |cFFFFFFFF" .. skin_table.site .. "|r\n\nDesc: |cFFFFFFFF" .. skin_table.desc .. "|r\n\nFile: |cFFFFFFFF" .. file .. ".tga|r" skinOptions [#skinOptions+1] = {value = skin_name, label = skin_name, onclick = onSelectSkin, icon = "Interface\\GossipFrame\\TabardGossipIcon", desc = desc} end @@ -1044,7 +1044,7 @@ do {--chat tab width offset type = "range", - get = function() return tonumber (_detalhes.chat_tab_embed.x_offset) end, + get = function() return tonumber(_detalhes.chat_tab_embed.x_offset) end, set = function(self, fixedparam, value) _detalhes.chat_tab_embed.x_offset = value if (_detalhes.chat_embed.enabled) then @@ -1061,7 +1061,7 @@ do {--chat tab height offset type = "range", - get = function() return tonumber (_detalhes.chat_tab_embed.y_offset) end, + get = function() return tonumber(_detalhes.chat_tab_embed.y_offset) end, set = function(self, fixedparam, value) _detalhes.chat_tab_embed.y_offset = value if (_detalhes.chat_embed.enabled) then @@ -1220,7 +1220,7 @@ do local sectionOptions = { {--line height type = "range", - get = function() return tonumber (currentInstance.row_info.height) end, + get = function() return tonumber(currentInstance.row_info.height) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarSettings", value) afterUpdate() @@ -1234,7 +1234,7 @@ do {--padding type = "range", - get = function() return tonumber (currentInstance.row_info.space.between) end, + get = function() return tonumber(currentInstance.row_info.space.between) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarSettings", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, value) afterUpdate() @@ -1470,7 +1470,7 @@ do return default end, func = function(self, _, text) - if (text:find ("spec_")) then + if (text:find("spec_")) then editInstanceSetting(currentInstance, "SetBarSpecIconSettings", true, text, true) else if (currentInstance.row_info.use_spec_icons) then @@ -1499,7 +1499,7 @@ do {--icon size offset type = "range", - get = function() return tonumber (currentInstance.row_info.icon_size_offset) end, + get = function() return tonumber(currentInstance.row_info.icon_size_offset) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarSettings", nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, value) afterUpdate() @@ -1528,7 +1528,7 @@ do {--faction icon size offset type = "range", - get = function() return tonumber (currentInstance.row_info.faction_icon_size_offset) end, + get = function() return tonumber(currentInstance.row_info.faction_icon_size_offset) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarFactionIconSettings", nil, value) afterUpdate() @@ -1557,7 +1557,7 @@ do {--role icon size offset type = "range", - get = function() return tonumber (currentInstance.row_info.arena_role_icon_size_offset) end, + get = function() return tonumber(currentInstance.row_info.arena_role_icon_size_offset) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarArenaRoleIconSettings", nil, value) afterUpdate() @@ -1621,7 +1621,7 @@ do {--lineText2 (left, usuali is the 'done' amount) type = "range", - get = function() return tonumber (currentInstance.fontstrings_text2_anchor) end, + get = function() return tonumber(currentInstance.fontstrings_text2_anchor) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "fontstrings_text2_anchor", value) editInstanceSetting(currentInstance, "InstanceRefreshRows") @@ -1636,7 +1636,7 @@ do {--lineText3 (in the middle) type = "range", - get = function() return tonumber (currentInstance.fontstrings_text3_anchor) end, + get = function() return tonumber(currentInstance.fontstrings_text3_anchor) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "fontstrings_text3_anchor", value) editInstanceSetting(currentInstance, "InstanceRefreshRows") @@ -1651,7 +1651,7 @@ do {--lineText4 (closest to the right) type = "range", - get = function() return tonumber (currentInstance.fontstrings_text4_anchor) end, + get = function() return tonumber(currentInstance.fontstrings_text4_anchor) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "fontstrings_text4_anchor", value) editInstanceSetting(currentInstance, "InstanceRefreshRows") @@ -1766,7 +1766,7 @@ do {--border size type = "range", - get = function() return tonumber (currentInstance.row_info.backdrop.size) end, + get = function() return tonumber(currentInstance.row_info.backdrop.size) end, set = function(self, fixedparam, value) editInstanceSetting(currentInstance, "SetBarBackdropSettings", nil, value) afterUpdate() @@ -3520,7 +3520,7 @@ do bframe.plugin = pluginObject bframe.id = i - DF:NewImage (bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) + DF:NewImage(bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) bframe ["toolbarPluginsIcon"..i]:SetPoint("topleft", anchorFrame, "topleft", 10, y) DF:NewLabel(bframe, _, "$parentToolbarPluginsLabel"..i, "toolbarPluginsLabel"..i, pluginObject.__name) @@ -3552,7 +3552,7 @@ do if (pluginObject.OpenOptionsPanel) then DF:NewButton(bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 120, 20, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"], nil, options_button_template) bframe ["OptionsButton"..i]:SetPoint("topleft", anchorFrame, "topleft", 510, y-0) - bframe ["OptionsButton"..i]:SetTextColor (button_color_rgb) + bframe ["OptionsButton"..i]:SetTextColor(button_color_rgb) bframe ["OptionsButton"..i]:SetIcon ([[Interface\Buttons\UI-OptionsButton]], 14, 14, nil, {0, 1, 0, 1}, nil, 3) end @@ -3590,7 +3590,7 @@ do bframe.id = i bframe.hasDesc = allExistentToolbarPlugins [o] [4] - DF:NewImage (bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) + DF:NewImage(bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) bframe ["toolbarPluginsIcon"..i]:SetPoint("topleft", anchorFrame, "topleft", 10, y) DF:NewLabel(bframe, _, "$parentToolbarPluginsLabel"..i, "toolbarPluginsLabel"..i, pluginObject.__name) @@ -3655,7 +3655,7 @@ do bframe.plugin = pluginObject bframe.id = i - DF:NewImage (bframe, pluginObject.__icon, 18, 18, nil, nil, "raidPluginsIcon"..i, "$parentRaidPluginsIcon"..i) + DF:NewImage(bframe, pluginObject.__icon, 18, 18, nil, nil, "raidPluginsIcon"..i, "$parentRaidPluginsIcon"..i) bframe ["raidPluginsIcon"..i]:SetPoint("topleft", anchorFrame, "topleft", 10, y) DF:NewLabel(bframe, _, "$parentRaidPluginsLabel"..i, "raidPluginsLabel"..i, pluginObject.__name) @@ -3693,7 +3693,7 @@ do if (pluginObject.OpenOptionsPanel) then DF:NewButton(bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 86, 18, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"], nil, options_button_template) bframe ["OptionsButton"..i]:SetPoint("topleft", anchorFrame, "topleft", 510, y-0) - bframe ["OptionsButton"..i]:SetTextColor (button_color_rgb) + bframe ["OptionsButton"..i]:SetTextColor(button_color_rgb) bframe ["OptionsButton"..i]:SetIcon ([[Interface\Buttons\UI-OptionsButton]], 14, 14, nil, {0, 1, 0, 1}, nil, 3) end @@ -3728,7 +3728,7 @@ do bframe.id = i bframe.hasDesc = allExistentRaidPlugins [o] [4] - DF:NewImage (bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) + DF:NewImage(bframe, pluginObject.__icon, 18, 18, nil, nil, "toolbarPluginsIcon"..i, "$parentToolbarPluginsIcon"..i) bframe ["toolbarPluginsIcon"..i]:SetPoint("topleft", anchorFrame, "topleft", 10, y) DF:NewLabel(bframe, _, "$parentToolbarPluginsLabel"..i, "toolbarPluginsLabel"..i, pluginObject.__name) @@ -3793,7 +3793,7 @@ do bframe.plugin = pluginObject bframe.id = i - DF:NewImage (bframe, pluginObject.__icon, 18, 18, nil, nil, "soloPluginsIcon"..i, "$parentSoloPluginsIcon"..i) + DF:NewImage(bframe, pluginObject.__icon, 18, 18, nil, nil, "soloPluginsIcon"..i, "$parentSoloPluginsIcon"..i) bframe ["soloPluginsIcon"..i]:SetPoint("topleft", anchorFrame, "topleft", 10, y) DF:NewLabel(bframe, _, "$parentSoloPluginsLabel"..i, "soloPluginsLabel"..i, pluginObject.__name) @@ -3827,7 +3827,7 @@ do if (pluginObject.OpenOptionsPanel) then DF:NewButton(bframe, nil, "$parentOptionsButton"..i, "OptionsButton"..i, 86, 18, pluginObject.OpenOptionsPanel, nil, nil, nil, Loc ["STRING_OPTIONS_PLUGINS_OPTIONS"], nil, options_button_template) bframe ["OptionsButton"..i]:SetPoint("topleft", anchorFrame, "topleft", 510, y-0) - bframe ["OptionsButton"..i]:SetTextColor (button_color_rgb) + bframe ["OptionsButton"..i]:SetTextColor(button_color_rgb) bframe ["OptionsButton"..i]:SetIcon ([[Interface\Buttons\UI-OptionsButton]], 14, 14, nil, {0, 1, 0, 1}, nil, 3) end @@ -4632,7 +4632,7 @@ do local textureOptions = sectionFrame.wallpaperOptions local selectedTextureOption = texturePath - if (texturePath:find ("TALENTFRAME")) then + if (texturePath:find("TALENTFRAME")) then editInstanceSetting(currentInstance, "InstanceWallpaper", texturePath, nil, nil, {0, 1, 0, 0.703125}, nil, nil, {1, 1, 1, 1}) afterUpdate() @@ -4724,7 +4724,7 @@ do local previewX, previewY = 460, -60 local preview = sectionFrame:CreateTexture(nil, "overlay") - preview:SetDrawLayer ("artwork", 3) + preview:SetDrawLayer("artwork", 3) preview:SetSize(256, 128) preview:SetPoint("topleft", sectionFrame, "topleft", previewX, previewY) @@ -4736,29 +4736,29 @@ do whiteBackground:SetColorTexture(1, 1, 1, 1) --background grid - local icon1 = DF:NewImage (sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon1") + local icon1 = DF:NewImage(sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon1") icon1:SetTexture("Interface\\AddOns\\Details\\images\\icons") icon1:SetPoint("topleft", sectionFrame, "topleft", previewX, previewY) - icon1:SetDrawLayer ("artwork", 1) - icon1:SetTexCoord (0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 + icon1:SetDrawLayer("artwork", 1) + icon1:SetTexCoord(0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 - local icon2 = DF:NewImage (sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon2") + local icon2 = DF:NewImage(sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon2") icon2:SetTexture("Interface\\AddOns\\Details\\images\\icons") icon2:SetPoint("left", icon1.widget, "right", -1, 0) - icon2:SetDrawLayer ("artwork", 1) - icon2:SetTexCoord (0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 + icon2:SetDrawLayer("artwork", 1) + icon2:SetTexCoord(0.337890625, 0.5859375, 0.59375, 0.716796875-0.0009765625) --173 304 300 367 - local icon3 = DF:NewImage (sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon3") + local icon3 = DF:NewImage(sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon3") icon3:SetTexture("Interface\\AddOns\\Details\\images\\icons") icon3:SetPoint("top", icon1.widget, "bottom") - icon3:SetDrawLayer ("artwork", 1) - icon3:SetTexCoord (0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 + icon3:SetDrawLayer("artwork", 1) + icon3:SetTexCoord(0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 - local icon4 = DF:NewImage (sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon4") + local icon4 = DF:NewImage(sectionFrame, nil, 128, 64, "artwork", nil, nil, "$parentIcon4") icon4:SetTexture("Interface\\AddOns\\Details\\images\\icons") icon4:SetPoint("left", icon3.widget, "right", -1, 0) - icon4:SetDrawLayer ("artwork", 1) - icon4:SetTexCoord (0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 + icon4:SetDrawLayer("artwork", 1) + icon4:SetTexCoord(0.337890625, 0.5859375, 0.59375+0.0009765625, 0.716796875) --173 304 300 367 icon1:SetVertexColor(.15, .15, .15, 1) icon2:SetVertexColor(.15, .15, .15, 1) @@ -4771,33 +4771,33 @@ do local L1 = sectionFrame:CreateTexture(nil, "overlay") L1:SetPoint("topleft", preview, "topleft") L1:SetTexture("Interface\\AddOns\\Details\\images\\icons") - L1:SetTexCoord (0.13671875+0.0009765625, 0.234375, 0.29296875, 0.1953125+0.0009765625) + L1:SetTexCoord(0.13671875+0.0009765625, 0.234375, 0.29296875, 0.1953125+0.0009765625) L1:SetSize(w, h) - L1:SetDrawLayer ("overlay", 2) + L1:SetDrawLayer("overlay", 2) L1:SetVertexColor(1, 1, 1, .8) local L2 = sectionFrame:CreateTexture(nil, "overlay") L2:SetPoint("bottomleft", preview, "bottomleft") L2:SetTexture("Interface\\AddOns\\Details\\images\\icons") - L2:SetTexCoord (0.13671875+0.0009765625, 0.234375, 0.1953125+0.0009765625, 0.29296875) + L2:SetTexCoord(0.13671875+0.0009765625, 0.234375, 0.1953125+0.0009765625, 0.29296875) L2:SetSize(w, h) - L2:SetDrawLayer ("overlay", 2) + L2:SetDrawLayer("overlay", 2) L2:SetVertexColor(1, 1, 1, .8) local L3 = sectionFrame:CreateTexture(nil, "overlay") L3:SetPoint("bottomright", preview, "bottomright", 0, 0) L3:SetTexture("Interface\\AddOns\\Details\\images\\icons") - L3:SetTexCoord (0.234375, 0.13671875-0.0009765625, 0.1953125+0.0009765625, 0.29296875) + L3:SetTexCoord(0.234375, 0.13671875-0.0009765625, 0.1953125+0.0009765625, 0.29296875) L3:SetSize(w, h) - L3:SetDrawLayer ("overlay", 5) + L3:SetDrawLayer("overlay", 5) L3:SetVertexColor(1, 1, 1, .8) local L4 = sectionFrame:CreateTexture(nil, "overlay") L4:SetPoint("topright", preview, "topright", 0, 0) L4:SetTexture("Interface\\AddOns\\Details\\images\\icons") - L4:SetTexCoord (0.234375, 0.13671875-0.0009765625, 0.29296875, 0.1953125+0.0009765625) + L4:SetTexCoord(0.234375, 0.13671875-0.0009765625, 0.29296875, 0.1953125+0.0009765625) L4:SetSize(w, h) - L4:SetDrawLayer ("overlay", 5) + L4:SetDrawLayer("overlay", 5) L4:SetVertexColor(1, 1, 1, .8) --update preview @@ -4805,7 +4805,7 @@ do local wallpaper = currentInstance.wallpaper preview:SetTexture(wallpaper.texture) - preview:SetTexCoord (unpack(wallpaper.texcoord)) + preview:SetTexCoord(unpack(wallpaper.texcoord)) preview:SetVertexColor(unpack(wallpaper.overlay)) preview:SetAlpha(wallpaper.alpha) end @@ -4841,7 +4841,7 @@ do local wallpaper = currentInstance.wallpaper - if (wallpaper.texture:find ("TALENTFRAME")) then + if (wallpaper.texture:find("TALENTFRAME")) then if (wallpaper.anchor == "all") then DF:ImageEditor (callmeback, wallpaper.texture, wallpaper.texcoord, wallpaper.overlay, currentInstance.baseframe.wallpaper:GetWidth(), currentInstance.baseframe.wallpaper:GetHeight(), nil, wallpaper.alpha, true) else @@ -6305,7 +6305,7 @@ do addframe.spellIconButton.icon.texture = texture end local icon_button = DF:NewButton(addframe, nil, "$parentSpellIconButton", "spellIconButton", 20, 20, function() DF:IconPick (icon_button_func, true) end) - local icon_button_icon = DF:NewImage (icon_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentSpellIcon") + local icon_button_icon = DF:NewImage(icon_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentSpellIcon") icon_button_icon:SetPoint(0, 0) icon_button:InstallCustomTexture() icon_button:SetPoint("left", spellicon, "right", 2, 0) @@ -6325,7 +6325,7 @@ do end local icon = addframe.spellIconButton.icon.texture - id = tonumber (id) + id = tonumber(id) if (not id) then return _detalhes:Msg(Loc ["STRING_OPTIONS_SPELL_IDERROR"]) end @@ -6404,7 +6404,7 @@ do --warning if (not _detalhes:GetPlugin ("DETAILS_PLUGIN_CHART_VIEWER")) then local label = DF:NewLabel(sectionFrame, _, "$parentPluginWarningLabel", "PluginWarningLabel", Loc ["STRING_OPTIONS_CHART_PLUGINWARNING"], "GameFontNormal") - local image = DF:NewImage (sectionFrame, [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]]) + local image = DF:NewImage(sectionFrame, [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]]) label:SetPoint("topright", sectionFrame, "topright", -42, -10) label:SetJustifyH("left") label:SetWidth(160) @@ -6517,7 +6517,7 @@ do big_code_editor2:Show() big_code_editor2.editbox:HighlightText() - big_code_editor2.editbox:SetFocus (true) + big_code_editor2.editbox:SetFocus(true) else Details:Msg("error exporting the time capture.") --localize-me end @@ -6716,7 +6716,7 @@ do local import = function() importframe:Show() importframe:SetText("") - importframe:SetFocus (true) + importframe:SetFocus(true) addframe:Hide() big_code_editor:ClearFocus() big_code_editor:Hide() diff --git a/frames/window_playerbreakdown.lua b/frames/window_playerbreakdown.lua index 889aec4a..914114ba 100644 --- a/frames/window_playerbreakdown.lua +++ b/frames/window_playerbreakdown.lua @@ -148,7 +148,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo if (info.barras2) then for index, barra in ipairs(info.barras2) do barra.icone:SetTexture("") - barra.icone:SetTexCoord (0, 1, 0, 1) + barra.icone:SetTexCoord(0, 1, 0, 1) end end @@ -170,8 +170,8 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo local atributo_nome = sub_atributos[info.atributo].lista [info.sub_atributo] .. " " .. Loc ["STRING_ACTORFRAME_REPORTOF"] --// nome do atributo // precisa ser o sub atributo correto??? --removendo o nome da realm do jogador - if (nome:find ("-")) then - nome = nome:gsub (("-.*"), "") + if (nome:find("-")) then + nome = nome:gsub(("-.*"), "") end if (info.instancia.atributo == 1 and info.instancia.sub_atributo == 6) then --enemy @@ -196,7 +196,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo info.avatar:SetTexture(avatar [2]) info.avatar_bg:SetTexture(avatar [4]) if (avatar [5]) then - info.avatar_bg:SetTexCoord (unpack(avatar [5])) + info.avatar_bg:SetTexCoord(unpack(avatar [5])) end if (avatar [6]) then info.avatar_bg:SetVertexColor(unpack(avatar [6])) @@ -256,7 +256,7 @@ function _detalhes:AbreJanelaInfo (jogador, from_att_change, refresh, ShiftKeyDo end if (playerName == jogador.nome) then SetPortraitTexture (info.classe_icone, "raid" .. i) - info.classe_icone:SetTexCoord (0, 1, 0, 1) + info.classe_icone:SetTexCoord(0, 1, 0, 1) break end end @@ -379,7 +379,7 @@ function gump:TrocaBackgroundInfo() elseif (info.sub_atributo == 3) then --damage taken --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture (.05, .05, .05, .4) + info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) info.bg3_sec_texture:Show() info.bg2_sec_texture:Show() info.tipo = 2 @@ -398,7 +398,7 @@ function gump:TrocaBackgroundInfo() elseif (info.sub_atributo == 4) then --friendly fire --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture (.05, .05, .05, .4) + info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) info.bg3_sec_texture:Show() info.bg2_sec_texture:Show() info.tipo = 3 @@ -415,7 +415,7 @@ function gump:TrocaBackgroundInfo() elseif (info.sub_atributo == 6) then --enemies --info.bg1_sec_texture:SetTexture([[Interface\AddOns\Details\images\info_window_damagetaken]]) - info.bg1_sec_texture:SetColorTexture (.05, .05, .05, .4) + info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) info.bg3_sec_texture:Show() info.bg2_sec_texture:Show() info.tipo = 3 @@ -444,7 +444,7 @@ function gump:TrocaBackgroundInfo() end elseif (info.sub_atributo == 4) then --Healing taken - info.bg1_sec_texture:SetColorTexture (.05, .05, .05, .4) + info.bg1_sec_texture:SetColorTexture(.05, .05, .05, .4) info.bg3_sec_texture:Show() info.bg2_sec_texture:Show() info.tipo = 2 @@ -507,7 +507,7 @@ function gump:HidaAllBarrasInfo() local barras = _detalhes.playerDetailWindow.barras1 for index = 1, #barras, 1 do barras [index]:Hide() - barras [index].textura:SetStatusBarColor (1, 1, 1, 1) + barras [index].textura:SetStatusBarColor(1, 1, 1, 1) barras [index].on_focus = false end end @@ -614,7 +614,7 @@ function gump:CriaDetalheInfo (index) info.bg = _CreateFrame ("StatusBar", "DetailsPlayerDetailsWindow_DetalheInfoBG" .. index, _detalhes.playerDetailWindow.container_detalhes, "BackdropTemplate") info.bg:SetStatusBarTexture ("Interface\\AddOns\\Details\\images\\bar_detalhes2") - info.bg:SetStatusBarColor (1, 1, 1, .84) + info.bg:SetStatusBarColor(1, 1, 1, .84) info.bg:SetMinMaxValues(0, 100) info.bg:SetValue(100) info.bg:SetSize(320, 47) @@ -749,10 +749,10 @@ function gump:SetaDetalheInfoTexto (index, p, arg1, arg2, arg3, arg4, arg5, arg6 if (p) then if (type(p) == "table") then info.bg:SetValue(p.p) - info.bg:SetStatusBarColor (p.c[1], p.c[2], p.c[3], p.c[4] or 1) + info.bg:SetStatusBarColor(p.c[1], p.c[2], p.c[3], p.c[4] or 1) else info.bg:SetValue(p) - info.bg:SetStatusBarColor (1, 1, 1, .5) + info.bg:SetStatusBarColor(1, 1, 1, .5) end info.bg_end:Show() @@ -828,9 +828,9 @@ local function cria_textos (este_gump, SWW) este_gump.avatar_bg = este_gump:CreateTexture(nil, "overlay") este_gump.avatar_attribute = este_gump:CreateFontString(nil, "overlay", "GameFontHighlightSmall") este_gump.avatar_nick = este_gump:CreateFontString(nil, "overlay", "QuestFont_Large") - este_gump.avatar:SetDrawLayer ("overlay", 3) - este_gump.avatar_bg:SetDrawLayer ("overlay", 2) - este_gump.avatar_nick:SetDrawLayer ("overlay", 4) + este_gump.avatar:SetDrawLayer("overlay", 3) + este_gump.avatar_bg:SetDrawLayer("overlay", 2) + este_gump.avatar_nick:SetDrawLayer("overlay", 4) este_gump.avatar:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 60, -10) este_gump.avatar_bg:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 60, -12) @@ -961,31 +961,31 @@ end local default_icon_change = function(jogador, classe) if (classe ~= "UNKNOW" and classe ~= "UNGROUPPLAYER") then - info.classe_icone:SetTexCoord (_detalhes.class_coords [classe][1], _detalhes.class_coords [classe][2], _detalhes.class_coords [classe][3], _detalhes.class_coords [classe][4]) + info.classe_icone:SetTexCoord(_detalhes.class_coords [classe][1], _detalhes.class_coords [classe][2], _detalhes.class_coords [classe][3], _detalhes.class_coords [classe][4]) if (jogador.enemy) then if (_detalhes.faction_against == "Horde") then - info.nome:SetTextColor (1, 91/255, 91/255, 1) + info.nome:SetTextColor(1, 91/255, 91/255, 1) else - info.nome:SetTextColor (151/255, 215/255, 1, 1) + info.nome:SetTextColor(151/255, 215/255, 1, 1) end else info.classe_iconePlus:SetTexture() - info.nome:SetTextColor (1, 1, 1, 1) + info.nome:SetTextColor(1, 1, 1, 1) end else if (jogador.enemy) then if (_detalhes.class_coords [_detalhes.faction_against]) then - info.classe_icone:SetTexCoord (_unpack(_detalhes.class_coords [_detalhes.faction_against])) + info.classe_icone:SetTexCoord(_unpack(_detalhes.class_coords [_detalhes.faction_against])) if (_detalhes.faction_against == "Horde") then - info.nome:SetTextColor (1, 91/255, 91/255, 1) + info.nome:SetTextColor(1, 91/255, 91/255, 1) else - info.nome:SetTextColor (151/255, 215/255, 1, 1) + info.nome:SetTextColor(151/255, 215/255, 1, 1) end else - info.nome:SetTextColor (1, 1, 1, 1) + info.nome:SetTextColor(1, 1, 1, 1) end else - info.classe_icone:SetTexCoord (_detalhes.class_coords ["MONSTER"][1], _detalhes.class_coords ["MONSTER"][2], _detalhes.class_coords ["MONSTER"][3], _detalhes.class_coords ["MONSTER"][4]) + info.classe_icone:SetTexCoord(_detalhes.class_coords ["MONSTER"][1], _detalhes.class_coords ["MONSTER"][2], _detalhes.class_coords ["MONSTER"][3], _detalhes.class_coords ["MONSTER"][4]) end info.classe_iconePlus:SetTexture() end @@ -1022,7 +1022,7 @@ function _detalhes:ApplyPDWSkin (skin_name) --apply default first local default_skin = _detalhes.playerdetailwindow_skins ["WoWClassic"] - pcall (default_skin.func) + pcall(default_skin.func) --than do the change if (not skin_name) then @@ -1031,11 +1031,11 @@ function _detalhes:ApplyPDWSkin (skin_name) local skin = _detalhes.playerdetailwindow_skins [skin_name] if (skin) then - local successful, errortext = pcall (skin.func) + local successful, errortext = pcall(skin.func) if (not successful) then _detalhes:Msg("error occurred on skin call():", errortext) local former_skin = _detalhes.playerdetailwindow_skins [_detalhes.player_details_window.skin] - pcall (former_skin.func) + pcall(former_skin.func) else _detalhes.player_details_window.skin = skin_name end @@ -1103,13 +1103,13 @@ local default_skin = function() window.title_string:SetPoint("center", window, "center") window.title_string:SetPoint("top", window, "top", 0, -18) window.title_string:SetParent(window) - window.title_string:SetTextColor (.890, .729, .015, 1) + window.title_string:SetTextColor(.890, .729, .015, 1) window.classe_icone:SetParent(window) window.classe_icone:SetPoint("TOPLEFT", window, "TOPLEFT", 4, 0) window.classe_icone:SetWidth(64) window.classe_icone:SetHeight(64) - window.classe_icone:SetDrawLayer ("BACKGROUND", 1) + window.classe_icone:SetDrawLayer("BACKGROUND", 1) window.classe_icone:SetAlpha(1) window.close_button:SetWidth(32) @@ -1230,7 +1230,7 @@ local default_skin = function() window.container_barras.slider:cimaPoint (0, 1) window.container_barras.slider:baixoPoint (0, -3) window.container_barras.slider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") - window.container_barras.slider.thumb:SetTexCoord (0, 1, 0, 1) + window.container_barras.slider.thumb:SetTexCoord(0, 1, 0, 1) window.container_barras.slider.thumb:SetSize(29, 30) window.container_barras.slider.thumb:SetVertexColor(1, 1, 1, 1) @@ -1266,7 +1266,7 @@ local default_skin = function() window.container_alvos.slider:baixoPoint (0, -3) window.container_alvos.slider.thumb:SetTexture("Interface\\Buttons\\UI-ScrollBar-Knob") - window.container_alvos.slider.thumb:SetTexCoord (0, 1, 0, 1) + window.container_alvos.slider.thumb:SetTexCoord(0, 1, 0, 1) window.container_alvos.slider.thumb:SetSize(29, 30) window.container_alvos.slider.thumb:SetVertexColor(1, 1, 1, 1) @@ -1319,7 +1319,7 @@ local elvui_skin = function() local name_bg_texture = window:CreateTexture(nil, "background") name_bg_texture:SetTexture([[Interface\PetBattles\_PetBattleHorizTile]], true) name_bg_texture:SetHorizTile(true) - name_bg_texture:SetTexCoord (0, 1, 126/256, 19/256) + name_bg_texture:SetTexCoord(0, 1, 126/256, 19/256) name_bg_texture:SetPoint("topleft", window, "topleft", 2, -22) --name_bg_texture:SetPoint("topright", window, "topright", -2, -22) name_bg_texture:SetPoint("bottomright", window, "bottomright") @@ -1335,10 +1335,10 @@ local elvui_skin = function() window.title_string:SetPoint("center", window, "center") window.title_string:SetPoint("top", window, "top", 0, -7) window.title_string:SetParent(titlebar) - window.title_string:SetTextColor (.8, .8, .8, 1) + window.title_string:SetTextColor(.8, .8, .8, 1) window.classe_icone:SetParent(titlebar) - window.classe_icone:SetDrawLayer ("overlay") + window.classe_icone:SetDrawLayer("overlay") window.classe_icone:SetPoint("TOPLEFT", window, "TOPLEFT", 2, -25) window.classe_icone:SetWidth(49) window.classe_icone:SetHeight(49) @@ -1498,7 +1498,7 @@ local elvui_skin = function() window.container_barras.slider:baixoPoint (0, -13) window.container_barras.slider.thumb:SetTexture([[Interface\AddOns\Details\images\icons2]]) - window.container_barras.slider.thumb:SetTexCoord (482/512, 492/512, 104/512, 120/512) + window.container_barras.slider.thumb:SetTexCoord(482/512, 492/512, 104/512, 120/512) window.container_barras.slider.thumb:SetSize(12, 12) window.container_barras.slider.thumb:SetVertexColor(0.6, 0.6, 0.6, 0.95) @@ -1572,7 +1572,7 @@ local elvui_skin = function() window.container_alvos.slider:baixoPoint (0, -13) window.container_alvos.slider.thumb:SetTexture([[Interface\AddOns\Details\images\icons2]]) - window.container_alvos.slider.thumb:SetTexCoord (482/512, 492/512, 104/512, 120/512) + window.container_alvos.slider.thumb:SetTexCoord(482/512, 492/512, 104/512, 120/512) window.container_alvos.slider.thumb:SetSize(12, 12) window.container_alvos.slider.thumb:SetVertexColor(0.6, 0.6, 0.6, 0.95) @@ -1584,19 +1584,19 @@ local elvui_skin = function() elseif (player.spec) then window.classe_icone:SetTexture([[Interface\AddOns\Details\images\spec_icons_normal_alpha]]) - window.classe_icone:SetTexCoord (_unpack(_detalhes.class_specs_coords [player.spec])) + window.classe_icone:SetTexCoord(_unpack(_detalhes.class_specs_coords [player.spec])) --esta_barra.icone_classe:SetVertexColor(1, 1, 1) else local coords = CLASS_ICON_TCOORDS [class] if (coords) then info.classe_icone:SetTexture([[Interface\Glues\CHARACTERCREATE\UI-CHARACTERCREATE-CLASSES]]) local l, r, t, b = unpack(coords) - info.classe_icone:SetTexCoord (l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125) + info.classe_icone:SetTexCoord(l+0.01953125, r-0.01953125, t+0.01953125, b-0.01953125) else local c = _detalhes.class_coords ["MONSTER"] info.classe_icone:SetTexture("Interface\\AddOns\\Details\\images\\classes") - info.classe_icone:SetTexCoord (c[1], c[2], c[3], c[4]) + info.classe_icone:SetTexCoord(c[1], c[2], c[3], c[4]) end end end @@ -1648,18 +1648,18 @@ function gump:CriaJanelaInfo() este_gump.classe_icone:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 4, 0) este_gump.classe_icone:SetWidth(64) este_gump.classe_icone:SetHeight(64) - este_gump.classe_icone:SetDrawLayer ("BACKGROUND", 1) + este_gump.classe_icone:SetDrawLayer("BACKGROUND", 1) --complemento do icone este_gump.classe_iconePlus = este_gump:CreateTexture(nil, "BACKGROUND") este_gump.classe_iconePlus:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 4, 0) este_gump.classe_iconePlus:SetWidth(64) este_gump.classe_iconePlus:SetHeight(64) - este_gump.classe_iconePlus:SetDrawLayer ("BACKGROUND", 2) + este_gump.classe_iconePlus:SetDrawLayer("BACKGROUND", 2) --top left este_gump.bg1 = este_gump:CreateTexture("DetailsPSWBackground", "BORDER") este_gump.bg1:SetPoint("TOPLEFT", este_gump, "TOPLEFT", 0, 0) - este_gump.bg1:SetDrawLayer ("BORDER", 1) + este_gump.bg1:SetDrawLayer("BORDER", 1) --bot�o de fechar este_gump.close_button = _CreateFrame ("Button", nil, este_gump, "UIPanelCloseButton") @@ -1674,7 +1674,7 @@ function gump:CriaJanelaInfo() este_gump.bg_icone_bg = este_gump:CreateTexture(nil, "ARTWORK") este_gump.bg_icone_bg:SetPoint("TOPRIGHT", este_gump, "TOPRIGHT", -15, -12) este_gump.bg_icone_bg:SetTexture("Interface\\AddOns\\Details\\images\\icone_bg_fundo") - este_gump.bg_icone_bg:SetDrawLayer ("ARTWORK", -1) + este_gump.bg_icone_bg:SetDrawLayer("ARTWORK", -1) este_gump.bg_icone_bg:Show() este_gump.bg_icone = este_gump:CreateTexture(nil, "OVERLAY") @@ -1705,9 +1705,9 @@ function gump:CriaJanelaInfo() este_gump.spell_icone:SetPoint("BOTTOMRIGHT", este_gump.bg_icone, "BOTTOMRIGHT", -19, 2) este_gump.spell_icone:SetWidth(35) este_gump.spell_icone:SetHeight(34) - este_gump.spell_icone:SetDrawLayer ("ARTWORK", 0) + este_gump.spell_icone:SetDrawLayer("ARTWORK", 0) este_gump.spell_icone:Show() - este_gump.spell_icone:SetTexCoord (4/64, 60/64, 4/64, 60/64) + este_gump.spell_icone:SetTexCoord(4/64, 60/64, 4/64, 60/64) --coisinhas do lado do icone este_gump.apoio_icone_esquerdo = este_gump:CreateTexture(nil, "ARTWORK") @@ -1716,8 +1716,8 @@ function gump:CriaJanelaInfo() este_gump.apoio_icone_direito:SetTexture("Interface\\PaperDollInfoFrame\\PaperDollSidebarTabs") local apoio_altura = 13/256 - este_gump.apoio_icone_esquerdo:SetTexCoord (0, 1, 0, apoio_altura) - este_gump.apoio_icone_direito:SetTexCoord (0, 1, apoio_altura+(1/256), apoio_altura+apoio_altura) + este_gump.apoio_icone_esquerdo:SetTexCoord(0, 1, 0, apoio_altura) + este_gump.apoio_icone_direito:SetTexCoord(0, 1, apoio_altura+(1/256), apoio_altura+apoio_altura) este_gump.apoio_icone_esquerdo:SetPoint("bottomright", este_gump.bg_icone, "bottomleft", 42, 0) este_gump.apoio_icone_direito:SetPoint("bottomleft", este_gump.bg_icone, "bottomright", -17, 0) @@ -1783,13 +1783,13 @@ function gump:CriaJanelaInfo() -- fundos especiais de friendly fire e outros este_gump.bg1_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG1_SEC_Texture", "BORDER") - este_gump.bg1_sec_texture:SetDrawLayer ("BORDER", 4) + este_gump.bg1_sec_texture:SetDrawLayer("BORDER", 4) este_gump.bg1_sec_texture:SetPoint("topleft", este_gump.bg1, "topleft", 450, -86) este_gump.bg1_sec_texture:SetHeight(462) este_gump.bg1_sec_texture:SetWidth(264) este_gump.bg2_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG2_SEC_Texture", "BORDER") - este_gump.bg2_sec_texture:SetDrawLayer ("BORDER", 3) + este_gump.bg2_sec_texture:SetDrawLayer("BORDER", 3) este_gump.bg2_sec_texture:SetPoint("topleft", este_gump.bg1_sec_texture, "topleft", 8, 0) este_gump.bg2_sec_texture:SetPoint("bottomright", este_gump.bg1_sec_texture, "bottomright", -30, 0) este_gump.bg2_sec_texture:SetTexture([[Interface\Glues\CREDITS\Warlords\Shadowmoon_Color_jlo3]]) @@ -1798,23 +1798,23 @@ function gump:CriaJanelaInfo() este_gump.bg2_sec_texture:Hide() este_gump.bg3_sec_texture = SWW:CreateTexture("DetailsPlayerDetailsWindow_BG3_SEC_Texture", "BORDER") - este_gump.bg3_sec_texture:SetDrawLayer ("BORDER", 2) + este_gump.bg3_sec_texture:SetDrawLayer("BORDER", 2) este_gump.bg3_sec_texture:SetPoint("topleft", este_gump.bg2_sec_texture, "topleft", 0, 0) este_gump.bg3_sec_texture:SetPoint("bottomright", este_gump.bg2_sec_texture, "bottomright", 0, 0) - --este_gump.bg3_sec_texture:SetColorTexture (0, 0, 0, 1) + --este_gump.bg3_sec_texture:SetColorTexture(0, 0, 0, 1) este_gump.bg3_sec_texture:Hide() este_gump.no_targets = SWW:CreateTexture("DetailsPlayerDetailsWindow_no_targets", "overlay") este_gump.no_targets:SetPoint("BOTTOMLEFT", este_gump, "BOTTOMLEFT", 20, 6) este_gump.no_targets:SetSize(301, 100) este_gump.no_targets:SetTexture([[Interface\QUESTFRAME\UI-QUESTLOG-EMPTY-TOPLEFT]]) - este_gump.no_targets:SetTexCoord (0.015625, 1, 0.01171875, 0.390625) + este_gump.no_targets:SetTexCoord(0.015625, 1, 0.01171875, 0.390625) este_gump.no_targets:SetDesaturated(true) este_gump.no_targets:SetAlpha(.7) este_gump.no_targets.text = SWW:CreateFontString(nil, "overlay", "GameFontNormal") este_gump.no_targets.text:SetPoint("center", este_gump.no_targets, "center") este_gump.no_targets.text:SetText(Loc ["STRING_NO_TARGET_BOX"]) - este_gump.no_targets.text:SetTextColor (1, 1, 1, .4) + este_gump.no_targets.text:SetTextColor(1, 1, 1, .4) este_gump.no_targets:Hide() --cria os textos da janela @@ -1962,7 +1962,7 @@ function gump:CriaJanelaInfo() local percent_desc = frame:CreateFontString(nil, "artwork", "GameFontNormal") percent_desc:SetText("Percent values are comparisons with the previous try.") percent_desc:SetPoint("bottomleft", frame, "bottomleft", 13, 13 + PLAYER_DETAILS_STATUSBAR_HEIGHT) - percent_desc:SetTextColor (.5, .5, .5, 1) + percent_desc:SetTextColor(.5, .5, .5, 1) --SUMMARY @@ -1984,7 +1984,7 @@ function gump:CriaJanelaInfo() local damagereceived = summaryBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") damagereceived:SetPoint("topleft", summaryBox, "topleft", 15, y) damagereceived:SetText("Total Damage Taken:") --localize-me - damagereceived:SetTextColor (.8, .8, .8, 1) + damagereceived:SetTextColor(.8, .8, .8, 1) local damagereceived_amt = summaryBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") damagereceived_amt:SetPoint("left", damagereceived, "right", 2, 0) @@ -2009,7 +2009,7 @@ function gump:CriaJanelaInfo() local absorbstotal = summaryBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") absorbstotal:SetPoint("topleft", summaryBox, "topleft", 15, y) absorbstotal:SetText("Total Absorbs:") --localize-me - absorbstotal:SetTextColor (.8, .8, .8, 1) + absorbstotal:SetTextColor(.8, .8, .8, 1) local absorbstotal_amt = summaryBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") absorbstotal_amt:SetPoint("left", absorbstotal, "right", 2, 0) @@ -2048,7 +2048,7 @@ function gump:CriaJanelaInfo() local dodge = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") dodge:SetPoint("topleft", meleeBox, "topleft", 15, y) dodge:SetText("Dodge:") --localize-me - dodge:SetTextColor (.8, .8, .8, 1) + dodge:SetTextColor(.8, .8, .8, 1) local dodge_amt = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") dodge_amt:SetPoint("left", dodge, "right", 2, 0) dodge_amt:SetText("0") @@ -2071,7 +2071,7 @@ function gump:CriaJanelaInfo() local parry = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") parry:SetPoint("topleft", meleeBox, "topleft", 15, y) parry:SetText("Parry:") --localize-me - parry:SetTextColor (.8, .8, .8, 1) + parry:SetTextColor(.8, .8, .8, 1) local parry_amt = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") parry_amt:SetPoint("left", parry, "right", 2, 0) parry_amt:SetText("0") @@ -2093,7 +2093,7 @@ function gump:CriaJanelaInfo() local block = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") block:SetPoint("topleft", meleeBox, "topleft", 15, y) block:SetText("Block:") --localize-me - block:SetTextColor (.8, .8, .8, 1) + block:SetTextColor(.8, .8, .8, 1) local block_amt = meleeBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") block_amt:SetPoint("left", block, "right", 2, 0) block_amt:SetText("0") @@ -2139,7 +2139,7 @@ function gump:CriaJanelaInfo() local fullsbsorbed = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") fullsbsorbed:SetPoint("topleft", absorbsBox, "topleft", 20, y) fullsbsorbed:SetText("Full Absorbs:") --localize-me - fullsbsorbed:SetTextColor (.8, .8, .8, 1) + fullsbsorbed:SetTextColor(.8, .8, .8, 1) local fullsbsorbed_amt = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") fullsbsorbed_amt:SetPoint("left", fullsbsorbed, "right", 2, 0) fullsbsorbed_amt:SetText("0") @@ -2151,7 +2151,7 @@ function gump:CriaJanelaInfo() local partiallyabsorbed = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") partiallyabsorbed:SetPoint("topleft", absorbsBox, "topleft", 20, y) partiallyabsorbed:SetText("Partially Absorbed:") --localize-me - partiallyabsorbed:SetTextColor (.8, .8, .8, 1) + partiallyabsorbed:SetTextColor(.8, .8, .8, 1) local partiallyabsorbed_amt = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") partiallyabsorbed_amt:SetPoint("left", partiallyabsorbed, "right", 2, 0) partiallyabsorbed_amt:SetText("0") @@ -2174,7 +2174,7 @@ function gump:CriaJanelaInfo() local noabsorbs = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") noabsorbs:SetPoint("topleft", absorbsBox, "topleft", 20, y) noabsorbs:SetText("No Absorption:") --localize-me - noabsorbs:SetTextColor (.8, .8, .8, 1) + noabsorbs:SetTextColor(.8, .8, .8, 1) local noabsorbs_amt = absorbsBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") noabsorbs_amt:SetPoint("left", noabsorbs, "right", 2, 0) noabsorbs_amt:SetText("0") @@ -2200,7 +2200,7 @@ function gump:CriaJanelaInfo() local selfhealing = healingBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") selfhealing:SetPoint("topleft", healingBox, "topleft", 20, y) selfhealing:SetText("Self Healing:") --localize-me - selfhealing:SetTextColor (.8, .8, .8, 1) + selfhealing:SetTextColor(.8, .8, .8, 1) local selfhealing_amt = healingBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") selfhealing_amt:SetPoint("left", selfhealing, "right", 2, 0) selfhealing_amt:SetText("0") @@ -2223,7 +2223,7 @@ function gump:CriaJanelaInfo() local healer = healingBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") healer:SetPoint("topleft", healingBox, "topleft", 20, y + ((i-1)*15)*-1) healer:SetText("healer name:") --localize-me - healer:SetTextColor (.8, .8, .8, 1) + healer:SetTextColor(.8, .8, .8, 1) local healer_amt = healingBox:CreateFontString(nil, "artwork", "GameFontHighlightSmall") healer_amt:SetPoint("left", healer, "right", 2, 0) healer_amt:SetText("0") @@ -2282,7 +2282,7 @@ function gump:CriaJanelaInfo() local spell = frame_tooltip:CreateFontString(nil, "artwork", "GameFontHighlightSmall") spell:SetPoint("left", icon, "right", 2, 0) spell:SetText("spell name:") --localize-me - spell:SetTextColor (.8, .8, .8, 1) + spell:SetTextColor(.8, .8, .8, 1) local spell_amt = frame_tooltip:CreateFontString(nil, "artwork", "GameFontHighlightSmall") spell_amt:SetPoint("left", spell, "right", 2, 0) @@ -2344,8 +2344,8 @@ function gump:CriaJanelaInfo() end local last_actor = last_combat (1, player.nome) local n = player.nome - if (n:find ("-")) then - n = n:gsub (("-.*"), "") + if (n:find("-")) then + n = n:gsub(("-.*"), "") end --damage taken @@ -2502,10 +2502,10 @@ function gump:CriaJanelaInfo() if (class) then local c = RAID_CLASS_COLORS [class] if (c) then - label1:SetTextColor (c.r, c.g, c.b) + label1:SetTextColor(c.r, c.g, c.b) end else - label1:SetTextColor (.8, .8, .8, 1) + label1:SetTextColor(.8, .8, .8, 1) end local last_actor = last_combat (2, myReceivedHeal [i][1]) @@ -2529,7 +2529,7 @@ function gump:CriaJanelaInfo() else label1:SetText("-- -- -- --") - label1:SetTextColor (.8, .8, .8, 1) + label1:SetTextColor(.8, .8, .8, 1) label2:SetText("") end end @@ -2576,7 +2576,7 @@ function gump:CriaJanelaInfo() label1:SetText(nome_magia .. ":") icon1:SetTexture(icone_magia) - icon1:SetTexCoord (0.0625, 0.953125, 0.0625, 0.953125) + icon1:SetTexCoord(0.0625, 0.953125, 0.0625, 0.953125) index_used = index_used + 1 end @@ -2617,7 +2617,7 @@ function gump:CriaJanelaInfo() label1:SetText(spellName .. ":") icon1:SetTexture(spellIcon) - icon1:SetTexCoord (0.0625, 0.953125, 0.0625, 0.953125) + icon1:SetTexCoord(0.0625, 0.953125, 0.0625, 0.953125) index_used = index_used + 1 end @@ -2791,7 +2791,7 @@ function gump:CriaJanelaInfo() line.spellID = aura.spellID line.Icon:SetTexture(aura [1]) - line.Icon:SetTexCoord (.1, .9, .1, .9) + line.Icon:SetTexCoord(.1, .9, .1, .9) line.Name:SetText(aura [2]) line.Uptime:SetText(DF:IntegerToTimer (aura [3]) .. " (|cFFBBAAAA" .. floor(aura [6]) .. "%|r)") @@ -2984,7 +2984,7 @@ function gump:CriaJanelaInfo() bar [1]:SetTexture("") bar [2].lefttext:SetText(empty_text) - bar [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar [2].lefttext:SetTextColor(.5, .5, .5, 1) bar [2].righttext:SetText("") bar [2].righttext2:SetText("") bar [2]:SetValue(0) @@ -2992,7 +2992,7 @@ function gump:CriaJanelaInfo() bar [3][4] = nil bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3000,7 +3000,7 @@ function gump:CriaJanelaInfo() bar_2 [3][4] = nil bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3067,7 +3067,7 @@ function gump:CriaJanelaInfo() bar [1]:SetAlpha(.7) bar [2].lefttext:SetText(index .. ". " .. target_name) - bar [2].lefttext:SetTextColor (1, 1, 1, 1) + bar [2].lefttext:SetTextColor(1, 1, 1, 1) bar [2].righttext:SetText(_detalhes:ToK2Min (data [2])) -- .. " (" .. _math_floor(data [2] / total * 100) .. "%)" bar [2]:SetValue(data [2] / top * 100) --bar [2]:SetValue(100) @@ -3096,7 +3096,7 @@ function gump:CriaJanelaInfo() bar_2 [1]:SetAlpha(.7) bar_2 [2].lefttext:SetText(player_2_target_index .. ". " .. target_name) - bar_2 [2].lefttext:SetTextColor (1, 1, 1, 1) + bar_2 [2].lefttext:SetTextColor(1, 1, 1, 1) if (data [2] > player_2_target_total) then local diff = data [2] - player_2_target_total @@ -3130,7 +3130,7 @@ function gump:CriaJanelaInfo() else bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3140,7 +3140,7 @@ function gump:CriaJanelaInfo() else bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3168,7 +3168,7 @@ function gump:CriaJanelaInfo() bar_3 [1]:SetAlpha(.7) bar_3 [2].lefttext:SetText(player_3_target_index .. ". " .. target_name) - bar_3 [2].lefttext:SetTextColor (1, 1, 1, 1) + bar_3 [2].lefttext:SetTextColor(1, 1, 1, 1) if (data [2] > player_3_target_total) then local diff = data [2] - player_3_target_total @@ -3201,7 +3201,7 @@ function gump:CriaJanelaInfo() else bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3211,7 +3211,7 @@ function gump:CriaJanelaInfo() else bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3222,7 +3222,7 @@ function gump:CriaJanelaInfo() else bar [1]:SetTexture("") bar [2].lefttext:SetText(empty_text) - bar [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar [2].lefttext:SetTextColor(.5, .5, .5, 1) bar [2].righttext:SetText("") bar [2].righttext2:SetText("") bar [2]:SetValue(0) @@ -3230,7 +3230,7 @@ function gump:CriaJanelaInfo() bar [3][4] = nil bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3238,7 +3238,7 @@ function gump:CriaJanelaInfo() bar_2 [3][4] = nil bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3372,16 +3372,16 @@ function gump:CriaJanelaInfo() local petName = data [3] bar [1]:SetTexture(icon) --bar[1] = spellicon bar[2] = statusbar - bar [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar [2]:SetBackdropColor(1, 1, 1, 0.1) if (petName) then - bar [2].lefttext:SetText(index .. ". " .. name .. " (|cFFCCBBBB" .. petName:gsub (" <.*", "") .. "|r)") + bar [2].lefttext:SetText(index .. ". " .. name .. " (|cFFCCBBBB" .. petName:gsub(" <.*", "") .. "|r)") else bar [2].lefttext:SetText(index .. ". " .. name) end - bar [2].lefttext:SetTextColor (1, 1, 1, 1) + bar [2].lefttext:SetTextColor(1, 1, 1, 1) bar [2].righttext:SetText(_detalhes:ToK2Min (data [2])) -- .. " (" .. _math_floor(data [2] / total * 100) .. "%)" bar [2]:SetValue(data [2] / top * 100) --bar [2]:SetValue(100) @@ -3396,10 +3396,10 @@ function gump:CriaJanelaInfo() if (not spell and petName and player_2) then for _petIndex, _petName in ipairs(player_2:Pets()) do - if (_petName:gsub (" <.*", "") == petName:gsub (" <.*", "")) then + if (_petName:gsub(" <.*", "") == petName:gsub(" <.*", "")) then local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, _petName) spell = petActor and petActor.spells._ActorTable [spellid] - name = name .. " (|cFFCCBBBB" .. _petName:gsub (" <.*", "") .. "|r)" + name = name .. " (|cFFCCBBBB" .. _petName:gsub(" <.*", "") .. "|r)" end end end @@ -3409,10 +3409,10 @@ function gump:CriaJanelaInfo() -- ~compare if (spell) then bar_2 [1]:SetTexture(icon) - bar_2 [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar_2 [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar_2 [2].lefttext:SetText(player_2_spell_info [spellid] .. ". " .. name) - bar_2 [2].lefttext:SetTextColor (1, 1, 1, 1) - bar_2 [2]:SetStatusBarColor (unpack(bar_color)) + bar_2 [2].lefttext:SetTextColor(1, 1, 1, 1) + bar_2 [2]:SetStatusBarColor(unpack(bar_color)) bar_2 [2]:SetBackdropColor(1, 1, 1, 0.1) if (spell.total == 0 and data [2] == 0) then @@ -3459,7 +3459,7 @@ function gump:CriaJanelaInfo() else bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3475,21 +3475,21 @@ function gump:CriaJanelaInfo() if (not spell and petName and player_3) then for _petIndex, _petName in ipairs(player_3:Pets()) do - if (_petName:gsub (" <.*", "") == petName:gsub (" <.*", "")) then + if (_petName:gsub(" <.*", "") == petName:gsub(" <.*", "")) then local petActor = info.instancia.showing [player.tipo]:PegarCombatente (nil, _petName) spell = petActor and petActor.spells._ActorTable [spellid] local name, _, icon = _GetSpellInfo(spellid) - name = name .. " (|cFFCCBBBB" .. _petName:gsub (" <.*", "") .. "|r)" + name = name .. " (|cFFCCBBBB" .. _petName:gsub(" <.*", "") .. "|r)" end end end if (spell) then bar_3 [1]:SetTexture(icon) - bar_3 [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar_3 [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar_3 [2].lefttext:SetText(player_3_spell_info [spellid] .. ". " .. name) - bar_3 [2].lefttext:SetTextColor (1, 1, 1, 1) - bar_3 [2]:SetStatusBarColor (unpack(bar_color)) + bar_3 [2].lefttext:SetTextColor(1, 1, 1, 1) + bar_3 [2]:SetStatusBarColor(unpack(bar_color)) bar_3 [2]:SetBackdropColor(1, 1, 1, 0.1) if (spell.total == 0 and data [2] == 0) then @@ -3534,7 +3534,7 @@ function gump:CriaJanelaInfo() else bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3543,7 +3543,7 @@ function gump:CriaJanelaInfo() else bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3552,14 +3552,14 @@ function gump:CriaJanelaInfo() else bar [1]:SetTexture("") bar [2].lefttext:SetText(empty_text) - bar [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar [2].lefttext:SetTextColor(.5, .5, .5, 1) bar [2].righttext:SetText("") bar [2]:SetValue(0) bar [2]:SetBackdropColor(1, 1, 1, 0) local bar_2 = frame2.bars [i] bar_2 [1]:SetTexture("") bar_2 [2].lefttext:SetText(empty_text) - bar_2 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_2 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_2 [2].righttext:SetText("") bar_2 [2].righttext2:SetText("") bar_2 [2]:SetValue(0) @@ -3567,7 +3567,7 @@ function gump:CriaJanelaInfo() local bar_3 = frame3.bars [i] bar_3 [1]:SetTexture("") bar_3 [2].lefttext:SetText(empty_text) - bar_3 [2].lefttext:SetTextColor (.5, .5, .5, 1) + bar_3 [2].lefttext:SetTextColor(.5, .5, .5, 1) bar_3 [2].righttext:SetText("") bar_3 [2].righttext2:SetText("") bar_3 [2]:SetValue(0) @@ -3678,7 +3678,7 @@ function gump:CriaJanelaInfo() table.sort (player_1_skills, _detalhes.Sort2) -- ~pet local player_1_top = player_1_skills [1] and player_1_skills [1][2] or 0 - bar1 [2]:SetStatusBarColor (1, 1, 1, 1) + bar1 [2]:SetStatusBarColor(1, 1, 1, 1) -- player 2 local player_2_skills = {} @@ -3693,7 +3693,7 @@ function gump:CriaJanelaInfo() end table.sort (player_2_skills, _detalhes.Sort2) player_2_top = player_2_skills [1] and player_2_skills [1][2] or 0 - bar2 [2]:SetStatusBarColor (unpack(bar_color_on_enter)) + bar2 [2]:SetStatusBarColor(unpack(bar_color_on_enter)) end -- player 3 @@ -3709,7 +3709,7 @@ function gump:CriaJanelaInfo() end table.sort (player_3_skills, _detalhes.Sort2) player_3_top = player_3_skills [1] and player_3_skills [1][2] or 0 - bar3 [2]:SetStatusBarColor (unpack(bar_color_on_enter)) + bar3 [2]:SetStatusBarColor(unpack(bar_color_on_enter)) end -- build tooltip @@ -3732,7 +3732,7 @@ function gump:CriaJanelaInfo() local name, _, icon = _GetSpellInfo(spell[1]) bar [1]:SetTexture(icon) - bar [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar [2].lefttext:SetText(index .. ". " .. name) bar [2].righttext:SetText(_detalhes:ToK2Min (spell [2])) bar [2]:SetValue(spell [2]/player_1_top*100) @@ -3751,7 +3751,7 @@ function gump:CriaJanelaInfo() end bar [1]:SetTexture(icon) - bar [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar [2].lefttext:SetText(this_index .. ". " .. name) bar [2].bg:Show() @@ -3806,7 +3806,7 @@ function gump:CriaJanelaInfo() end bar [1]:SetTexture(icon) - bar [1]:SetTexCoord (unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar + bar [1]:SetTexCoord(unpack(IconTexCoord)) --bar[1] = spellicon bar[2] = statusbar bar [2].lefttext:SetText(this_index .. ". " .. name) bar [2].bg:Show() @@ -3873,12 +3873,12 @@ function gump:CriaJanelaInfo() local bar2 = frame2.bars [self.index] local bar3 = frame3.bars [self.index] - bar1[2]:SetStatusBarColor (.5, .5, .5, 1) - bar1[2].icon:SetTexCoord (0, 1, 0, 1) - bar2[2]:SetStatusBarColor (unpack(bar_color)) - bar2[2].icon:SetTexCoord (0, 1, 0, 1) - bar3[2]:SetStatusBarColor (unpack(bar_color)) - bar3[2].icon:SetTexCoord (0, 1, 0, 1) + bar1[2]:SetStatusBarColor(.5, .5, .5, 1) + bar1[2].icon:SetTexCoord(0, 1, 0, 1) + bar2[2]:SetStatusBarColor(unpack(bar_color)) + bar2[2].icon:SetTexCoord(0, 1, 0, 1) + bar3[2]:SetStatusBarColor(unpack(bar_color)) + bar3[2].icon:SetTexCoord(0, 1, 0, 1) frame1.tooltip:Hide() frame2.tooltip:Hide() @@ -3919,8 +3919,8 @@ function gump:CriaJanelaInfo() local COMPARE_UNKNOWNDATA = "-" if (bar1[2].righttext:GetText()) then - bar1[2]:SetStatusBarColor (1, 1, 1, 1) - bar1[2].icon:SetTexCoord (.1, .9, .1, .9) + bar1[2]:SetStatusBarColor(1, 1, 1, 1) + bar1[2].icon:SetTexCoord(.1, .9, .1, .9) frame1.tooltip.hits_label3:SetText(hits) frame1.tooltip.average_label3:SetText(_detalhes:ToK2Min (average)) @@ -4008,8 +4008,8 @@ function gump:CriaJanelaInfo() if (bar2[2].righttext:GetText()) then - bar2 [2]:SetStatusBarColor (unpack(bar_color_on_enter)) - bar2[2].icon:SetTexCoord (.1, .9, .1, .9) + bar2 [2]:SetStatusBarColor(unpack(bar_color_on_enter)) + bar2[2].icon:SetTexCoord(.1, .9, .1, .9) -- hits if (hits > bar2[3][1]) then @@ -4188,8 +4188,8 @@ function gump:CriaJanelaInfo() --------------------------------------------------- if (bar3[2].righttext:GetText()) then - bar3 [2]:SetStatusBarColor (unpack(bar_color_on_enter)) - bar3[2].icon:SetTexCoord (.1, .9, .1, .9) + bar3 [2]:SetStatusBarColor(unpack(bar_color_on_enter)) + bar3[2].icon:SetTexCoord(.1, .9, .1, .9) --hits if (hits > bar3[3][1]) then @@ -4372,12 +4372,12 @@ function gump:CriaJanelaInfo() local bar2 = frame2.bars [self.index] local bar3 = frame3.bars [self.index] - bar1[2]:SetStatusBarColor (.5, .5, .5, 1) - bar1[2].icon:SetTexCoord (0, 1, 0, 1) - bar2[2]:SetStatusBarColor (unpack(bar_color)) - bar2[2].icon:SetTexCoord (0, 1, 0, 1) - bar3[2]:SetStatusBarColor (unpack(bar_color)) - bar3[2].icon:SetTexCoord (0, 1, 0, 1) + bar1[2]:SetStatusBarColor(.5, .5, .5, 1) + bar1[2].icon:SetTexCoord(0, 1, 0, 1) + bar2[2]:SetStatusBarColor(unpack(bar_color)) + bar2[2].icon:SetTexCoord(0, 1, 0, 1) + bar3[2]:SetStatusBarColor(unpack(bar_color)) + bar3[2].icon:SetTexCoord(0, 1, 0, 1) frame1.tooltip:Hide() frame2.tooltip:Hide() @@ -4399,7 +4399,7 @@ function gump:CriaJanelaInfo() bar:SetPoint("topleft", spellicon, "topright", 0, 0) bar:SetPoint("topright", parent, "topright", -4, y) bar:SetStatusBarTexture ([[Interface\AddOns\Details\images\bar_serenity]]) - bar:SetStatusBarColor (.5, .5, .5, 1) + bar:SetStatusBarColor(.5, .5, .5, 1) bar:SetAlpha(ALPHA_BLEND_AMOUNT) bar:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) @@ -4426,7 +4426,7 @@ function gump:CriaJanelaInfo() bar.lefttext:SetPoint("left", bar, "left", 4, 0) bar.lefttext:SetJustifyH("left") - bar.lefttext:SetTextColor (1, 1, 1, 1) + bar.lefttext:SetTextColor(1, 1, 1, 1) bar.lefttext:SetNonSpaceWrap (true) bar.lefttext:SetWordWrap (false) if (main) then @@ -4443,7 +4443,7 @@ function gump:CriaJanelaInfo() bar.righttext:SetPoint("right", bar, "right", -2, 0) bar.righttext:SetJustifyH("right") - bar.righttext:SetTextColor (1, 1, 1, 1) + bar.righttext:SetTextColor(1, 1, 1, 1) bar.righttext2 = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") @@ -4453,7 +4453,7 @@ function gump:CriaJanelaInfo() bar.righttext2:SetPoint("right", bar, "right", -42, 0) bar.righttext2:SetJustifyH("right") - bar.righttext2:SetTextColor (1, 1, 1, 1) + bar.righttext2:SetTextColor(1, 1, 1, 1) tinsert(parent.bars, {spellicon, bar, {0, 0, 0}}) end @@ -4474,7 +4474,7 @@ function gump:CriaJanelaInfo() local background = tooltip:CreateTexture(nil, "border") background:SetTexture([[Interface\SPELLBOOK\Spellbook-Page-1]]) - background:SetTexCoord (.6, 0.1, 0, 0.64453125) + background:SetTexCoord(.6, 0.1, 0, 0.64453125) background:SetVertexColor(0, 0, 0, 0.2) background:SetPoint("topleft", tooltip, "topleft", 0, 0) background:SetPoint("bottomright", tooltip, "bottomright", 0, 0) @@ -4611,7 +4611,7 @@ function gump:CriaJanelaInfo() bar:SetPoint("topleft", spellicon, "topright", 0, 0) bar:SetPoint("topright", parent, "topright", -1, y) bar:SetStatusBarTexture ([[Interface\AddOns\Details\images\bar_serenity]]) - bar:SetStatusBarColor (unpack(bar_color)) + bar:SetStatusBarColor(unpack(bar_color)) bar:SetMinMaxValues(0, 100) bar:SetValue(0) bar:SetHeight(14) @@ -4623,11 +4623,11 @@ function gump:CriaJanelaInfo() bar.lefttext:SetFont (font, 11) bar.lefttext:SetPoint("left", bar, "left", 2, 0) bar.lefttext:SetJustifyH("left") - bar.lefttext:SetTextColor (1, 1, 1, 1) + bar.lefttext:SetTextColor(1, 1, 1, 1) bar.lefttext:SetNonSpaceWrap (true) bar.lefttext:SetWordWrap (false) - if (name:find ("1")) then + if (name:find("1")) then bar.lefttext:SetWidth(110) else bar.lefttext:SetWidth(80) @@ -4639,7 +4639,7 @@ function gump:CriaJanelaInfo() bar.righttext:SetFont (font, 11) bar.righttext:SetPoint("right", bar, "right", -2, 0) bar.righttext:SetJustifyH("right") - bar.righttext:SetTextColor (1, 1, 1, 1) + bar.righttext:SetTextColor(1, 1, 1, 1) bar.righttext2 = bar:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") local _, size, flags = bar.righttext2:GetFont() @@ -4647,7 +4647,7 @@ function gump:CriaJanelaInfo() bar.righttext2:SetFont (font, 11) bar.righttext2:SetPoint("right", bar, "right", -46, 0) bar.righttext2:SetJustifyH("right") - bar.righttext2:SetTextColor (1, 1, 1, 1) + bar.righttext2:SetTextColor(1, 1, 1, 1) local bg_line1 = bar:CreateTexture(nil, "artwork") bg_line1:SetTexture([[Interface\AddOns\Details\images\bar_background]]) @@ -4667,7 +4667,7 @@ function gump:CriaJanelaInfo() local background = tooltip:CreateTexture(nil, "artwork") background:SetTexture([[Interface\SPELLBOOK\Spellbook-Page-1]]) - background:SetTexCoord (.6, 0.1, 0, 0.64453125) + background:SetTexCoord(.6, 0.1, 0, 0.64453125) background:SetVertexColor(0, 0, 0, 0.6) background:SetPoint("topleft", tooltip, "topleft", 2, -4) background:SetPoint("bottomright", tooltip, "bottomright", -4, 2) @@ -4753,7 +4753,7 @@ function gump:CriaJanelaInfo() local playername2_percent = frame2:CreateFontString(nil, "overlay", "GameFontHighlightSmall") playername2_percent:SetPoint("bottomright", frame2, "topright", -2, 0) playername2_percent:SetText("Player 1 %") - playername2_percent:SetTextColor (.6, .6, .6) + playername2_percent:SetTextColor(.6, .6, .6) local noPLayersToShow = frame2:CreateFontString(nil, "overlay", "GameFontHighlightSmall") noPLayersToShow:SetPoint("center") @@ -4815,7 +4815,7 @@ function gump:CriaJanelaInfo() local playername3_percent = frame3:CreateFontString(nil, "overlay", "GameFontHighlightSmall") playername3_percent:SetPoint("bottomright", frame3, "topright", -2, 0) playername3_percent:SetText("Player 1 %") - playername3_percent:SetTextColor (.6, .6, .6) + playername3_percent:SetTextColor(.6, .6, .6) frame3.name_label_percent = playername3_percent @@ -4917,7 +4917,7 @@ function gump:CriaJanelaInfo() local flashAnimation = tabOBject:CreateTexture(nil, "overlay") flashAnimation:SetPoint("topleft", tabOBject.widget, "topleft", 1, -1) flashAnimation:SetPoint("bottomright", tabOBject.widget, "bottomright", -1, 1) - flashAnimation:SetColorTexture (1, 1, 1) + flashAnimation:SetColorTexture(1, 1, 1) local flashHub = DetailsFramework:CreateAnimationHub (flashAnimation, function() flashAnimation:Show() end, function() flashAnimation:Hide() end) DetailsFramework:CreateAnimation(flashHub, "alpha", 1, 1, 0, 0.3) @@ -4991,10 +4991,10 @@ function gump:CriaJanelaInfo() if (PixelUtil) then PixelUtil.SetSize(tab, buttonTemplate.width, buttonTemplate.height) if (tabsShown >= breakLine) then --next row of icons - PixelUtil.SetPoint (tab, "bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) + PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * (secondRowIndex)), -50) secondRowIndex = secondRowIndex + 1 else - PixelUtil.SetPoint (tab, "bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) + PixelUtil.SetPoint(tab, "bottomright", info, "topright", -514 + (buttonWidth * tabsShown), -72) end else tab:SetSize(buttonTemplate.width, buttonTemplate.height) @@ -5147,7 +5147,7 @@ function _detalhes:CreatePlayerDetailsTab (tabname, localized_name, condition, f info.selectedTab = self.tabname --run onclick func - local result, errorText = pcall (self.onclick) + local result, errorText = pcall(self.onclick) if (not result) then print(errorText) end @@ -5214,9 +5214,9 @@ function _detalhes.playerDetailWindow:monta_relatorio (botao) local link = GetSpellLink(spellid) report_lines [#report_lines+1] = index .. ". " .. link .. ": " .. barra.lineText4:GetText() else - local spellname = barra.lineText1:GetText():gsub ((".*%."), "") - spellname = spellname:gsub ("|c%x%x%x%x%x%x%x%x", "") - spellname = spellname:gsub ("|r", "") + local spellname = barra.lineText1:GetText():gsub((".*%."), "") + spellname = spellname:gsub("|c%x%x%x%x%x%x%x%x", "") + spellname = spellname:gsub("|r", "") report_lines [#report_lines+1] = index .. ". " .. spellname .. ": " .. barra.lineText4:GetText() end end @@ -5374,8 +5374,8 @@ function _detalhes.playerDetailWindow:monta_relatorio (botao) end --remove a cor da school - linha = linha:gsub ("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") - linha = linha:gsub ("|r", "") + linha = linha:gsub("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") + linha = linha:gsub("|r", "") report_lines [#report_lines+1] = linha @@ -5548,7 +5548,7 @@ local row_on_mouseup = function(self, button) local barra_antiga = info.mostrando if (barra_antiga and not info.mostrando_mouse_over) then - barra_antiga.textura:SetStatusBarColor (1, 1, 1, 1) --volta a textura normal + barra_antiga.textura:SetStatusBarColor(1, 1, 1, 1) --volta a textura normal barra_antiga.on_focus = false --n�o esta mais no foco --clicou na mesma barra @@ -5567,7 +5567,7 @@ local row_on_mouseup = function(self, button) info.jogador:MontaDetalhes (self.show, self) self:SetAlpha(1) - self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + self.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) self.on_focus = true return end @@ -5576,7 +5576,7 @@ local row_on_mouseup = function(self, button) --nao tinha barras pressionadas info.mostrando_mouse_over = false self:SetAlpha(1) - self.textura:SetStatusBarColor (129/255, 125/255, 69/255, 1) + self.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1) self.on_focus = true end @@ -5744,7 +5744,7 @@ local target_on_enter = function(self) else for index, target in ipairs(ActorTargetsSortTable) do if (target [2] > 0) then - local class = _detalhes:GetClass (target [1]) + local class = _detalhes:GetClass(target [1]) if (class and _detalhes.class_coords [class]) then local cords = _detalhes.class_coords [class] if (info.target_persecond) then diff --git a/frames/window_playerbreakdown_list.lua b/frames/window_playerbreakdown_list.lua index c3e8418d..dffef26f 100644 --- a/frames/window_playerbreakdown_list.lua +++ b/frames/window_playerbreakdown_list.lua @@ -257,7 +257,7 @@ if (playerObject:IsPlayer()) then local unitClassID = classIds [playerObject:Class()] or 13 local unitName = playerObject:Name() - local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber (string.byte(unitName, 1) .. "" .. string.byte(unitName, 2)) + local playerPosition = (((unitClassID or 0) + 128) ^ 4) + tonumber(string.byte(unitName, 1) .. "" .. string.byte(unitName, 2)) tinsert(playerTable, {playerObject, playerPosition, playerObject.total}) end end diff --git a/frames/window_report.lua b/frames/window_report.lua index 2b021d15..627aaf2b 100644 --- a/frames/window_report.lua +++ b/frames/window_report.lua @@ -766,12 +766,12 @@ local createDropdown = function(thisFrame) window.recently_report_buttons = {} local historyBlockBackground = window:CreateTexture(nil, "background") - historyBlockBackground:SetColorTexture (0, 0, 0, .3) + historyBlockBackground:SetColorTexture(0, 0, 0, .3) historyBlockBackground:SetSize(160, 158) historyBlockBackground:SetPoint("topleft", window, "topleft", 3, -25) local separator = window:CreateTexture(nil, "border") - separator:SetColorTexture (0, 0, 0, .6) + separator:SetColorTexture(0, 0, 0, .6) separator:SetSize(2, 158) separator:SetPoint("topleft", historyBlockBackground, "topright", 0, 0) diff --git a/frames/window_rowtexteditor.lua b/frames/window_rowtexteditor.lua index 07f49325..d886bed7 100644 --- a/frames/window_rowtexteditor.lua +++ b/frames/window_rowtexteditor.lua @@ -22,7 +22,7 @@ function panel:Open (text, callback, host, default) panel:SetPoint("center", host, "center") end - text = text:gsub ("||", "|") + text = text:gsub("||", "|") panel.default_text = text panel.editbox:SetText(text) panel.callback = callback diff --git a/frames/window_runcode.lua b/frames/window_runcode.lua index 3f87ef2a..722c034a 100644 --- a/frames/window_runcode.lua +++ b/frames/window_runcode.lua @@ -51,7 +51,7 @@ function Details.OpenRunCodeWindow() code_editor:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) code_editor:SetBackdropBorderColor(0, 0, 0, 1) - code_editor.__background:SetColorTexture (0.2317647, 0.2317647, 0.2317647) + code_editor.__background:SetColorTexture(0.2317647, 0.2317647, 0.2317647) code_editor.__background:SetVertexColor(0.27, 0.27, 0.27) code_editor.__background:SetAlpha(0.8) code_editor.__background:SetVertTile(true) @@ -82,10 +82,10 @@ function Details.OpenRunCodeWindow() local func, errortext = loadstring (script, "Q") if (not func) then local firstLine = strsplit("\n", script, 2) - errortext = errortext:gsub (firstLine, "") - errortext = errortext:gsub ("%[string \"", "") - errortext = errortext:gsub ("...\"]:", "") - errortext = errortext:gsub ("Q\"]:", "") + errortext = errortext:gsub(firstLine, "") + errortext = errortext:gsub("%[string \"", "") + errortext = errortext:gsub("...\"]:", "") + errortext = errortext:gsub("Q\"]:", "") errortext = "Line " .. errortext errortext_label.text = errortext else diff --git a/frames/window_statistics.lua b/frames/window_statistics.lua index 809d70fd..b31b2088 100644 --- a/frames/window_statistics.lua +++ b/frames/window_statistics.lua @@ -239,7 +239,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild f.DownloadedSize = f.DownloadedSize + length local downloadSpeed = f.DownloadedSize / (time() - f.SyncStartTime) - f.SyncText:SetText("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format ("%.2f", downloadSpeed/1024) .. "Kbps]") + f.SyncText:SetText("working [downloading " .. f.DownloadedAmount .. "/" .. f.RequestedAmount .. ", " .. format("%.2f", downloadSpeed/1024) .. "Kbps]") end end end @@ -273,9 +273,9 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild for i = 1, AmtLines do if (f.LatestResourceTable[i]) then local playerName = f.LatestResourceTable[i][1] - playerName = playerName:gsub ("%|c%x%x%x%x%x%x%x%x", "") - playerName = playerName:gsub ("%|r", "") - playerName = playerName:gsub (".*%s", "") + playerName = playerName:gsub("%|c%x%x%x%x%x%x%x%x", "") + playerName = playerName:gsub("%|r", "") + playerName = playerName:gsub(".*%s", "") tinsert(result, {playerName, f.LatestResourceTable[i][2]}) else break @@ -290,7 +290,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild end end - local ReportButton = DF:CreateButton(f, f.BuildReport, 130, 20, Loc ["STRING_OPTIONS_REPORT_ANCHOR"]:gsub (":", ""), nil, nil, nil, "ReportButton", nil, nil, options_button_template, options_text_template) + local ReportButton = DF:CreateButton(f, f.BuildReport, 130, 20, Loc ["STRING_OPTIONS_REPORT_ANCHOR"]:gsub(":", ""), nil, nil, nil, "ReportButton", nil, nil, options_button_template, options_text_template) ReportButton:SetPoint("right", GuildSyncButton, "left", -2, 0) ReportButton:SetIcon ([[Interface\GLUES\CharacterSelect\RestoreButton]], 12, 12, "overlay", {0.2, .8, 0.2, .8}, nil, 4) @@ -674,7 +674,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild local roleTable = encounter [role] local date = encounter.date - date = date:gsub (".*%s", "") + date = date:gsub(".*%s", "") date = date:sub (1, -4) local player = roleTable [playerName] @@ -698,7 +698,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild GameCooltip:AddLine("Total Done:", Details:ToK2 (self.data.value), 1, "white") GameCooltip:AddLine("Dps:", Details:ToK2 (self.data.value / self.data.elapsed), 1, "white") GameCooltip:AddLine("Item Level:", floor(self.data.data [2]), 1, "white") - GameCooltip:AddLine("Date:", self.data.fulldate:gsub (".*%s", ""), 1, "white") + GameCooltip:AddLine("Date:", self.data.fulldate:gsub(".*%s", ""), 1, "white") GameCooltip:SetOwner(self.ball.tooltip_anchor) GameCooltip:Show() @@ -734,7 +734,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild local roleTable = encounter [role] local date = encounter.date - date = date:gsub (".*%s", "") + date = date:gsub(".*%s", "") date = date:sub (1, -4) for playerName, playerTable in pairs(roleTable) do @@ -821,7 +821,7 @@ function Details:OpenRaidHistoryWindow (_raid, _boss, _difficulty, _role, _guild local roleTable = encounter [role] local date = encounter.date - date = date:gsub (".*%s", "") + date = date:gsub(".*%s", "") date = date:sub (1, -4) amt_encounters = amt_encounters + 1 diff --git a/frames/window_switch.lua b/frames/window_switch.lua index 5b3a91d2..c0021091 100644 --- a/frames/window_switch.lua +++ b/frames/window_switch.lua @@ -223,7 +223,7 @@ do title_icon:SetPoint("topleft", x, y) local texture, l, r, t, b = Details:GetAttributeIcon (attribute) title_icon:SetTexture(texture) - title_icon:SetTexCoord (l, r, t, b) + title_icon:SetTexCoord(l, r, t, b) title_icon:SetSize(18, 18) local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal") title_str:SetPoint("left", title_icon, "right", 2, 0) @@ -242,7 +242,7 @@ do allDisplaysFrame.check_text_size (button.text) button.texture:SetTexture(Details.sub_atributos [attribute].icones [i] [1]) - button.texture:SetTexCoord (unpack(Details.sub_atributos [attribute].icones [i] [2])) + button.texture:SetTexCoord(unpack(Details.sub_atributos [attribute].icones [i] [2])) tinsert(allDisplaysFrame.buttons [attribute], button) y = y - 17 end @@ -280,7 +280,7 @@ do allDisplaysFrame.buttons[6] = {} local title_icon = allDisplaysFrame:CreateTexture(nil, "overlay") title_icon:SetTexture([[Interface\AddOns\Details\images\modo_icones]]) - title_icon:SetTexCoord (32/256*3, 32/256*4, 0, 1) + title_icon:SetTexCoord(32/256*3, 32/256*4, 0, 1) title_icon:SetSize(16, 16) local title_str = allDisplaysFrame:CreateFontString(nil, "overlay", "GameFontNormal") @@ -311,7 +311,7 @@ do allDisplaysFrame.check_text_size (button.text) button.texture:SetTexture(custom.icon) - button.texture:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) + button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) button:Show() button_index = button_index + 1 @@ -354,7 +354,7 @@ do allDisplaysFrame.check_text_size(button.text) button.texture:SetTexture(ptable[2]) - button.texture:SetTexCoord (0.078125, 0.921875, 0.078125, 0.921875) + button.texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875) button:Show() button_index = button_index + 1 @@ -542,7 +542,7 @@ function Details.switch:ShowMe(instancia) local background = button:CreateTexture(nil, "background") background:SetTexture("Interface\\SPELLBOOK\\Spellbook-Parts") - background:SetTexCoord (0.31250000, 0.96484375, 0.37109375, 0.52343750) + background:SetTexCoord(0.31250000, 0.96484375, 0.37109375, 0.52343750) background:SetWidth(85) background:SetPoint("topleft", s.widget, "topleft", -16, 3) background:SetPoint("bottomright", s.widget, "bottomright", -3, -5) @@ -623,12 +623,12 @@ function Details.switch:ShowMe(instancia) local block1 = Details.switch:GetSegmentBlock (1) block1:SetText(Loc["STRING_CURRENTFIGHT"]) block1.texture:SetTexture([[Interface\Scenarios\ScenariosParts]]) - block1.texture:SetTexCoord (55/512, 81/512, 368/512, 401/512) + block1.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512) local block2 = Details.switch:GetSegmentBlock (2) block2:SetText(Loc["STRING_SEGMENT_OVERALL"]) block2.texture:SetTexture([[Interface\Scenarios\ScenariosParts]]) - block2.texture:SetTexCoord (55/512, 81/512, 368/512, 401/512) + block2.texture:SetTexCoord(55/512, 81/512, 368/512, 401/512) end Details.switch:ClearSegmentBlocks() @@ -648,7 +648,7 @@ function Details.switch:ShowMe(instancia) local L, R, T, B, Texture = Details:GetBossIcon (combat.is_boss.mapid, combat.is_boss.index) if (L) then block.texture:SetTexture(Texture) - block.texture:SetTexCoord (L, R, T, B) + block.texture:SetTexCoord(L, R, T, B) else block.texture:SetTexture([[Interface\Scenarios\ScenarioIcon-Boss]]) end diff --git a/frames/window_wa.lua b/frames/window_wa.lua index 28638b82..3fac47cc 100644 --- a/frames/window_wa.lua +++ b/frames/window_wa.lua @@ -68,7 +68,7 @@ local text_dispell_prototype = { ["events"] = "COMBAT_LOG_EVENT_UNFILTERED, ENCOUNTER_START", ["use_spellName"] = false, ["use_spellId"] = false, - ["custom"] = "function(event, time, token, hidding, who_serial, who_name, who_flags, who_flags2, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool)\n if (event == \"COMBAT_LOG_EVENT_UNFILTERED\") then\n \n if ((token == \"SPELL_DISPEL\" or token == \"SPELL_STOLEN\") and extraSpellID == 159947) then\n aura_env.dispelled = aura_env.dispelled + 1\n aura_env.dispels_by [who_name] = (aura_env.dispels_by [who_name] or 0) + 1\n \n aura_env.text = aura_env.text .. \"|cffd2e8ff\" .. who_name .. \" (\" .. aura_env.dispels_by [who_name] .. \") \".. \"|r\\n\"\n \n if (select(2, aura_env.text:gsub (\"\\n\", \"\")) == 9) then\n aura_env.text = aura_env.text:gsub (\".-\\n\", \"\", 1)\n end\n return true\n end \n else\n aura_env.text = \"\"\n aura_env.success = 0\n aura_env.dispelled = 0\n wipe (aura_env.dispels_by)\n return true \n end\nend", + ["custom"] = "function(event, time, token, hidding, who_serial, who_name, who_flags, who_flags2, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool)\n if (event == \"COMBAT_LOG_EVENT_UNFILTERED\") then\n \n if ((token == \"SPELL_DISPEL\" or token == \"SPELL_STOLEN\") and extraSpellID == 159947) then\n aura_env.dispelled = aura_env.dispelled + 1\n aura_env.dispels_by [who_name] = (aura_env.dispels_by [who_name] or 0) + 1\n \n aura_env.text = aura_env.text .. \"|cffd2e8ff\" .. who_name .. \" (\" .. aura_env.dispels_by [who_name] .. \") \".. \"|r\\n\"\n \n if (select(2, aura_env.text:gsub(\"\\n\", \"\")) == 9) then\n aura_env.text = aura_env.text:gsub(\".-\\n\", \"\", 1)\n end\n return true\n end \n else\n aura_env.text = \"\"\n aura_env.success = 0\n aura_env.dispelled = 0\n wipe (aura_env.dispels_by)\n return true \n end\nend", ["spellIds"] = { }, ["use_message"] = true, @@ -827,7 +827,7 @@ local text_dbm_timerbar_prototype = { ["fontSize"] = 60, ["color"] = {0.8, 1, 0.8, 1}, ["displayText"] = "%c\n", - ["customText"] = "function()\n local at = aura_env.untrigger_at\n if (at) then\n return \"\" .. aura_env.ability_text .. \"\\n==> \" .. format (\"%.1f\", at - GetTime()) .. \" <==\"\n else\n return \"\"\n end \n \nend\n", + ["customText"] = "function()\n local at = aura_env.untrigger_at\n if (at) then\n return \"\" .. aura_env.ability_text .. \"\\n==> \" .. format(\"%.1f\", at - GetTime()) .. \" <==\"\n else\n return \"\"\n end \n \nend\n", ["yOffset"] = 157.554321289063, ["anchorPoint"] = "CENTER", ["customTextUpdate"] = "update", @@ -1429,12 +1429,12 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n --check if there is a group for our auras --[=[ if (not WeakAurasSaved.displays ["Details! Aura Group"]) then - local group = _detalhes.table.copy ({}, group_prototype) + local group = _detalhes.table.copy({}, group_prototype) WeakAuras.Add (group) end if (not WeakAurasSaved.displays ["Details! Boss Mods Group"]) then - local group = _detalhes.table.copy ({}, group_prototype_boss_mods) + local group = _detalhes.table.copy({}, group_prototype_boss_mods) WeakAuras.Add (group) end --]=] @@ -1454,7 +1454,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n icon_glow = nil group = nil - new_aura = _detalhes.table.copy ({}, text_interrupt_prototype) + new_aura = _detalhes.table.copy({}, text_interrupt_prototype) new_aura.trigger.custom = [[ function(event, time, token, hidding, who_serial, who_name, who_flags, who_flags2, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool) @@ -1466,8 +1466,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n aura_env.interrupted = aura_env.interrupted + 1 aura_env.text = aura_env.text .. "|cffc5ffc5" .. who_name .. " (" .. aura_env.interrupted .. ") ".. "|r\n" end - if (select(2, aura_env.text:gsub ("\n", "")) == 9) then - aura_env.text = aura_env.text:gsub (".-\n", "", 1) + if (select(2, aura_env.text:gsub("\n", "")) == 9) then + aura_env.text = aura_env.text:gsub(".-\n", "", 1) end return true else @@ -1479,8 +1479,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n end ]] - new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@spellid", spellid) - new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@spell_casted", icon_text) + new_aura.trigger.custom = new_aura.trigger.custom:gsub("@spellid", spellid) + new_aura.trigger.custom = new_aura.trigger.custom:gsub("@spell_casted", icon_text) --size new_aura.fontSize = min (icon_size, 24) @@ -1499,7 +1499,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n icon_glow = nil group = nil - new_aura = _detalhes.table.copy ({}, text_dispell_prototype) + new_aura = _detalhes.table.copy({}, text_dispell_prototype) new_aura.trigger.custom = [[ function(event, time, token, hidding, who_serial, who_name, who_flags, who_flags2, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, extraSpellID, extraSpellName, extraSchool) @@ -1509,8 +1509,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n aura_env.dispels_by [who_name] = (aura_env.dispels_by [who_name] or 0) + 1 aura_env.text = aura_env.text .. "|cffd2e8ff" .. who_name .. " (" .. aura_env.dispels_by [who_name] .. ") ".. "|r\n" - if (select(2, aura_env.text:gsub ("\n", "")) == 11) then - aura_env.text = aura_env.text:gsub (".-\n", "", 2) + if (select(2, aura_env.text:gsub("\n", "")) == 11) then + aura_env.text = aura_env.text:gsub(".-\n", "", 2) aura_env.text = "@title\n" .. aura_env.text end return true @@ -1525,8 +1525,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n end ]] - new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@spellid", spellid) - new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@title", icon_text) + new_aura.trigger.custom = new_aura.trigger.custom:gsub("@spellid", spellid) + new_aura.trigger.custom = new_aura.trigger.custom:gsub("@title", icon_text) --size new_aura.fontSize = min (icon_size, 24) @@ -1542,18 +1542,18 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n --create the default aura table if (aura_type == "icon") then - new_aura = _detalhes.table.copy ({}, icon_dbm_timerbar_prototype) + new_aura = _detalhes.table.copy({}, icon_dbm_timerbar_prototype) elseif (aura_type == "aurabar") then - new_aura = _detalhes.table.copy ({}, bar_dbm_timerbar_prototype) + new_aura = _detalhes.table.copy({}, bar_dbm_timerbar_prototype) elseif (aura_type == "text") then - new_aura = _detalhes.table.copy ({}, text_dbm_timerbar_prototype) + new_aura = _detalhes.table.copy({}, text_dbm_timerbar_prototype) end --text and icon if (aura_type == "aurabar") then - icon_text = icon_text:gsub ("= ", "") - icon_text = icon_text:gsub (" =", "") - icon_text = icon_text:gsub ("=", "") + icon_text = icon_text:gsub("= ", "") + icon_text = icon_text:gsub(" =", "") + icon_text = icon_text:gsub("=", "") new_aura.displayTextLeft = icon_text new_aura.displayIcon = icon_texture elseif (aura_type == "icon") then @@ -1579,25 +1579,25 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n aura_env.remaining_trigger = @countdown ]] - init_start = init_start:gsub ("@text", icon_text) - init_start = init_start:gsub ("@countdown", floor(stacksize)) - new_aura.trigger.remaining = tostring (floor(stacksize)) + init_start = init_start:gsub("@text", icon_text) + init_start = init_start:gsub("@countdown", floor(stacksize)) + new_aura.trigger.remaining = tostring(floor(stacksize)) new_aura.actions.init.custom = init_start if (other_values.dbm_timer_id) then new_aura.trigger.event = "DBM Timer" - local timerId = tostring (other_values.dbm_timer_id) + local timerId = tostring(other_values.dbm_timer_id) - --print("timerId:", other_values.dbm_timer_id, type(other_values.dbm_timer_id), timerId:find ("%s")) + --print("timerId:", other_values.dbm_timer_id, type(other_values.dbm_timer_id), timerId:find("%s")) --other_values.spellid - --if (timerId:find ("%s")) then + --if (timerId:find("%s")) then --spellid timers new_aura.trigger.id = "" new_aura.trigger.use_id = false new_aura.trigger.spellId_operator = "==" new_aura.trigger.use_spellId = true - new_aura.trigger.spellId = tostring (other_values.spellid) + new_aura.trigger.spellId = tostring(other_values.spellid) --else --ej timers -- new_aura.trigger.id = timerId @@ -1607,7 +1607,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n new_aura.trigger.use_id = false new_aura.trigger.spellId_operator = "==" new_aura.trigger.use_spellId = true - new_aura.trigger.spellId = tostring (other_values.bw_timer_id) + new_aura.trigger.spellId = tostring(other_values.bw_timer_id) new_aura.trigger.event = "BigWigs Timer" end @@ -1617,17 +1617,17 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n local init_start = [[ aura_env.reimaningTime = @countdown ]] - init_start = init_start:gsub ("@countdown", floor(stacksize)) - trigger.remaining = tostring (floor(stacksize)) + init_start = init_start:gsub("@countdown", floor(stacksize)) + trigger.remaining = tostring(floor(stacksize)) new_aura.actions.init.custom = init_start if (other_values.dbm_timer_id) then trigger.event = "DBM Timer" - trigger.spellId = tostring (other_values.spellid) + trigger.spellId = tostring(other_values.spellid) elseif (other_values.bw_timer_id) then trigger.event = "BigWigs Timer" - trigger.spellId = tostring (other_values.bw_timer_id) + trigger.spellId = tostring(other_values.bw_timer_id) trigger.spellId_operator = "==" end end @@ -1635,18 +1635,18 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n else if (aura_type == "icon") then - new_aura = _detalhes.table.copy ({}, icon_prototype) + new_aura = _detalhes.table.copy({}, icon_prototype) elseif (aura_type == "aurabar") then - new_aura = _detalhes.table.copy ({}, aurabar_prototype) + new_aura = _detalhes.table.copy({}, aurabar_prototype) elseif (aura_type == "text") then - new_aura = _detalhes.table.copy ({}, text_prototype) + new_aura = _detalhes.table.copy({}, text_prototype) new_aura.displayText = spellname end if (target) then if (target == 1) then --Debuff on Player - local add = _detalhes.table.copy ({}, debuff_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, debuff_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellIds[1] = "" --spellid add.trigger.names = nil --spellname add.trigger.auranames = {tostring(spellid)} @@ -1663,8 +1663,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 2) then --Debuff on Target - local add = _detalhes.table.copy ({}, debuff_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, debuff_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellIds[1] = "" --spellid add.trigger.names = nil --spellname add.trigger.auranames = {tostring(spellid)} @@ -1683,8 +1683,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 3) then --Debuff on Focus - local add = _detalhes.table.copy ({}, debuff_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, debuff_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellIds[1] = "" --spellid add.trigger.names = nil --spellname add.trigger.auranames = {tostring(spellid)} @@ -1700,7 +1700,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 11) then --Buff on Player - local add = _detalhes.table.copy ({}, buff_prototype) + local add = _detalhes.table.copy({}, buff_prototype) add.trigger.names = nil --spellname add.trigger.unit = "player" add.trigger.useName = true @@ -1714,8 +1714,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 12) then --Buff on Target - local add = _detalhes.table.copy ({}, buff_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, buff_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellIds[1] = "" --spellid add.trigger.names = nil --spellname add.trigger.unit = "target" @@ -1729,8 +1729,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 13) then --Buff on Focus - local add = _detalhes.table.copy ({}, buff_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, buff_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellIds[1] = "" --spellid add.trigger.names = nil --spellname add.trigger.auranames = {tostring(spellid)} @@ -1746,8 +1746,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 21) then --Spell Cast Started - local add = _detalhes.table.copy ({}, cast_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, cast_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellName = spellname add.trigger.subeventSuffix = "_CAST_START" add.trigger.duration = stacksize @@ -1758,8 +1758,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n _detalhes.table.overwrite (new_aura, add) elseif (target == 22) then --Spell Cast Successful - local add = _detalhes.table.copy ({}, cast_prototype) - add.trigger.spellId = tostring (spellid) + local add = _detalhes.table.copy({}, cast_prototype) + add.trigger.spellId = tostring(spellid) add.trigger.spellName = spellname if (not use_spellid) then add.trigger.use_spellName = true @@ -1777,7 +1777,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n end else - new_aura.trigger.spellId = tostring (spellid) + new_aura.trigger.spellId = tostring(spellid) new_aura.trigger.name = spellname tinsert(new_aura.trigger.spellIds, spellid) end @@ -1796,8 +1796,8 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n --check stack size if (stacksize and stacksize >= 1) then stacksize = floor(stacksize) - local add = _detalhes.table.copy ({}, stack_prototype) - add.trigger.count = tostring (stacksize) + local add = _detalhes.table.copy({}, stack_prototype) + add.trigger.count = tostring(stacksize) _detalhes.table.overwrite (new_aura, add) end @@ -1806,7 +1806,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n if (aura_type == "text") then new_aura.displayText = icon_text else - local add = _detalhes.table.copy ({}, widget_text_prototype) + local add = _detalhes.table.copy({}, widget_text_prototype) add.displayStacks = icon_text _detalhes.table.overwrite (new_aura, add) end @@ -1831,25 +1831,25 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n if (encounter_id) then new_aura.load = new_aura.load or {} new_aura.load.use_encounterid = true - new_aura.load.encounterid = tostring (encounter_id) + new_aura.load.encounterid = tostring(encounter_id) end --using sound if (sound and type(sound) == "table") then - local add = _detalhes.table.copy ({}, sound_prototype_custom) + local add = _detalhes.table.copy({}, sound_prototype_custom) add.actions.start.sound_path = sound.sound_path add.actions.start.sound_channel = sound.sound_channel or "Master" _detalhes.table.overwrite (new_aura, add) - elseif (sound and sound ~= "" and not sound:find ("Quiet.ogg")) then - local add = _detalhes.table.copy ({}, sound_prototype) + elseif (sound and sound ~= "" and not sound:find("Quiet.ogg")) then + local add = _detalhes.table.copy({}, sound_prototype) add.actions.start.sound = sound _detalhes.table.overwrite (new_aura, add) end --chat message if (chat and chat ~= "") then - local add = _detalhes.table.copy ({}, chat_prototype) + local add = _detalhes.table.copy({}, chat_prototype) add.actions.start.message = chat _detalhes.table.overwrite (new_aura, add) end @@ -1866,7 +1866,7 @@ function _detalhes:CreateWeakAura (aura_type, spellid, use_spellid, spellname, n --check is is using glow effect if (icon_glow) then - local add = _detalhes.table.copy ({}, glow_prototype) + local add = _detalhes.table.copy({}, glow_prototype) add.actions.start.glow_frame = "WeakAuras:" .. new_aura.id _detalhes.table.overwrite (new_aura, add) end @@ -1971,11 +1971,11 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --check if there is a group for our auras if (WeakAuras and WeakAurasSaved) then if (not WeakAurasSaved.displays ["Details! Aura Group"]) then - local group = _detalhes.table.copy ({}, group_prototype) + local group = _detalhes.table.copy({}, group_prototype) WeakAuras.Add (group) end if (not WeakAurasSaved.displays ["Details! Boss Mods Group"]) then - local group = _detalhes.table.copy ({}, group_prototype_boss_mods) + local group = _detalhes.table.copy({}, group_prototype_boss_mods) WeakAuras.Add (group) end end @@ -2053,7 +2053,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --aura name local name_label = fw:CreateLabel(f, "Aura Name: ", nil, nil, "GameFontNormal") - local name_textentry = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "AuraName", "$parentAuraName") + local name_textentry = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "AuraName", "$parentAuraName") name_textentry:SetTemplate(slider_template) name_textentry:SetPoint("left", name_label, "right", 2, 0) f.name = name_textentry @@ -2129,7 +2129,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr f.OnSelectAuraType = OnSelectAuraType local AuraTypeBackground = f:CreateTexture(nil, "border") - AuraTypeBackground:SetColorTexture (.4, .4, .4, .1) + AuraTypeBackground:SetColorTexture(.4, .4, .4, .1) AuraTypeBackground:SetHeight(64) AuraTypeBackground:SetPoint("topleft", f, "topleft", 10, -79) AuraTypeBackground:SetPoint("topright", f, "topright", -10, -79) @@ -2244,7 +2244,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --spellname local spellname_label = fw:CreateLabel(f, "Spell Name: ", nil, nil, "GameFontNormal") - local spellname_textentry = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "SpellName", "$parentSpellName") + local spellname_textentry = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "SpellName", "$parentSpellName") spellname_textentry:SetTemplate(slider_template) spellname_textentry:SetPoint("left", spellname_label, "right", 2, 0) f.spellname = spellname_textentry @@ -2252,7 +2252,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --spellid local auraid_label = fw:CreateLabel(f, "Spell Id: ", nil, nil, "GameFontNormal") - local auraid_textentry = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "AuraSpellId", "$parentAuraSpellId") + local auraid_textentry = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "AuraSpellId", "$parentAuraSpellId") auraid_textentry:SetTemplate(slider_template) auraid_textentry:Disable() auraid_textentry:SetPoint("left", auraid_label, "right", 2, 0) @@ -2280,7 +2280,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr f.IconButton.icon.texture = texture end local icon_pick_button = fw:NewButton(f, nil, "$parentIconButton", "IconButton", 20, 20, function() fw:IconPick (icon_button_func, true) end) - local icon_button_icon = fw:NewImage (icon_pick_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") + local icon_button_icon = fw:NewImage(icon_pick_button, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") icon_pick_button:InstallCustomTexture() icon_pick_button:SetPoint("left", icon_label, "right", 2, 0) @@ -2359,7 +2359,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr local already_added = {} for name, soundFile in pairs(game_sounds) do - name = name:gsub ("(%a)([%w_']*)", titlecase) + name = name:gsub("(%a)([%w_']*)", titlecase) if (not already_added [name]) then sounds [#sounds+1] = {name = name, file = soundFile, gamesound = true} already_added [name] = true @@ -2367,7 +2367,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr end for name, soundFile in pairs(LibStub:GetLibrary("LibSharedMedia-3.0"):HashTable ("sound")) do - name = name:gsub ("(%a)([%w_']*)", titlecase) + name = name:gsub("(%a)([%w_']*)", titlecase) if (not already_added [name]) then sounds [#sounds+1] = {name = name, file = soundFile} already_added [name] = true @@ -2376,7 +2376,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr if (WeakAuras and WeakAuras.sound_types) then for soundFile, name in pairs(WeakAuras.sound_types) do - name = name:gsub ("(%a)([%w_']*)", titlecase) + name = name:gsub("(%a)([%w_']*)", titlecase) if (not already_added [name]) then sounds [#sounds+1] = {name = name, file = soundFile} end @@ -2386,7 +2386,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr table.sort (sounds, sort) for _, sound in ipairs(sounds) do - if (sound.name:find ("D_")) then --details sound + if (sound.name:find("D_")) then --details sound tinsert(t, {color = "orange", label = sound.name, value = sound.file, icon = [[Interface\Buttons\UI-GuildButton-MOTD-Up]], onclick = play_sound, iconsize = iconsize}) elseif (sound.gamesound) then --game sound tinsert(t, {color = "yellow", label = sound.name, value = {sound_path = sound.file}, icon = [[Interface\Buttons\UI-GuildButton-MOTD-Up]], onclick = play_sound, iconsize = iconsize}) @@ -2404,14 +2404,14 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --say something local say_something_label = fw:CreateLabel(f, "/Say on Trigger: ", nil, nil, "GameFontNormal") - local say_something = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "SaySomething", "$parentSaySomething") + local say_something = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "SaySomething", "$parentSaySomething") say_something:SetTemplate(slider_template) say_something:SetPoint("left", say_something_label, "right", 2, 0) say_something.tooltip = "Your character /say this phrase when the aura triggers." --aura text local aura_text_label = fw:CreateLabel(f, "Aura Text: ", nil, nil, "GameFontNormal") - local aura_text = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "AuraText", "$parentAuraText") + local aura_text = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "AuraText", "$parentAuraText") aura_text:SetTemplate(slider_template) aura_text:SetPoint("left", aura_text_label, "right", 2, 0) aura_text.tooltip = "Text shown at aura's icon right side." @@ -2442,7 +2442,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr --encounter id local encounterid_label = fw:CreateLabel(f, "Encounter ID: ", nil, nil, "GameFontNormal") - local encounterid = fw:CreateTextEntry (f, _detalhes.empty_function, 150, 20, "EncounterIdText", "$parentEncounterIdText") + local encounterid = fw:CreateTextEntry(f, _detalhes.empty_function, 150, 20, "EncounterIdText", "$parentEncounterIdText") encounterid:SetTemplate(slider_template) encounterid:SetPoint("left", encounterid_label, "right", 2, 0) encounterid.tooltip = "Only load this aura for this raid encounter." @@ -2517,7 +2517,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr end --make a copy of the prototype - local newGroup = _detalhes.table.copy ({}, group_prototype) + local newGroup = _detalhes.table.copy({}, group_prototype) --set group settings newGroup.id = groupName @@ -2537,7 +2537,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr end local weakauras_newgroup_label = fw:CreateLabel(f, "New WeakAuras Group: ", nil, nil, "GameFontNormal") - local weakauras_newgroup_textentry = fw:CreateTextEntry (f, create_wa_group, 150, 20, "NewWeakaurasGroupTextEntry", "$parentNewWeakaurasGroup") + local weakauras_newgroup_textentry = fw:CreateTextEntry(f, create_wa_group, 150, 20, "NewWeakaurasGroupTextEntry", "$parentNewWeakaurasGroup") weakauras_newgroup_textentry:SetTemplate(slider_template) weakauras_newgroup_textentry:SetPoint("left", weakauras_newgroup_label, "right", 2, 0) f.weakauras_newgroup = weakauras_newgroup_textentry @@ -2710,7 +2710,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr f.AuraText:SetText("=Not Interrupted!=") aura_text_label.text = "Not Interrupted: " elseif (trigger == 42) then - f.AuraText:SetText(DetailsAuraPanel.name.text:gsub ("%(d!%)", "") .. "Dispells") + f.AuraText:SetText(DetailsAuraPanel.name.text:gsub("%(d!%)", "") .. "Dispells") aura_text_label.text = "Title Text: " end end @@ -2750,7 +2750,7 @@ function _detalhes:OpenAuraPanel (spellid, spellname, spellicon, encounterid, tr DetailsAuraPanel.name.text = spellname .. " (d!)" DetailsAuraPanel.spellname.text = spellname - DetailsAuraPanel.AuraSpellId.text = tostring (spellid) + DetailsAuraPanel.AuraSpellId.text = tostring(spellid) DetailsAuraPanel.icon.texture = spellicon DetailsAuraPanel.UseGlow.glow_test.animIn:Stop() diff --git a/frames/window_welcome.lua b/frames/window_welcome.lua index 1d7eaf5b..d9f36065 100644 --- a/frames/window_welcome.lua +++ b/frames/window_welcome.lua @@ -49,7 +49,7 @@ function _detalhes:OpenWelcomeWindow() local logotipo = window:CreateTexture(nil, "overlay") logotipo:SetPoint("topleft", window, "topleft", 16, -20) logotipo:SetTexture([[Interface\Addons\Details\images\logotipo]]) - logotipo:SetTexCoord (0.07421875, 0.73828125, 0.51953125, 0.890625) + logotipo:SetTexCoord(0.07421875, 0.73828125, 0.51953125, 0.890625) logotipo:SetWidth(186) logotipo:SetHeight(50) @@ -66,7 +66,7 @@ function _detalhes:OpenWelcomeWindow() cancel:Disable() local cancelText = cancel:CreateFontString(nil, "overlay", "GameFontNormal") - cancelText:SetTextColor (1, 1, 1) + cancelText:SetTextColor(1, 1, 1) cancelText:SetPoint("left", cancel, "right", 2, 0) cancelText:SetText(Loc ["STRING_WELCOME_69"]) @@ -238,7 +238,7 @@ local window_openned_at = time() local angel = window:CreateTexture(nil, "border") angel:SetPoint("bottomright", window, "bottomright") angel:SetTexture([[Interface\TUTORIALFRAME\UI-TUTORIALFRAME-SPIRITREZ]]) - angel:SetTexCoord (0.162109375, 0.591796875, 0, 1) + angel:SetTexCoord(0.162109375, 0.591796875, 0, 1) angel:SetWidth(442) angel:SetHeight(256) angel:SetAlpha(.2) @@ -263,7 +263,7 @@ local window_openned_at = time() bg55:SetHeight(125*3) bg55:SetWidth(89*3) bg55:SetAlpha(.05) - bg55:SetTexCoord (1, 0, 0, 1) + bg55:SetTexCoord(1, 0, 0, 1) local texto55 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto55:SetPoint("topleft", window, "topleft", 20, -80) @@ -271,7 +271,7 @@ local window_openned_at = time() local texto555 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto555:SetText(Loc ["STRING_WELCOME_45"]) - texto555:SetTextColor (1, 1, 1, 1) + texto555:SetTextColor(1, 1, 1, 1) local changemind = g:NewLabel(window, _, "$parentChangeMind55Label", "changemind55Label", Loc ["STRING_WELCOME_2"], "GameFontNormal", 9, "orange") window.changemind55Label:SetPoint("center", window, "center") @@ -285,14 +285,14 @@ local window_openned_at = time() texto_appearance:SetHeight(100) texto_appearance:SetJustifyH("left") texto_appearance:SetJustifyV ("top") - texto_appearance:SetTextColor (1, 1, 1, 1) + texto_appearance:SetTextColor(1, 1, 1, 1) local skins_image = window:CreateTexture(nil, "overlay") skins_image:SetTexture([[Interface\Addons\Details\images\icons2]]) skins_image:SetPoint("topright", window, "topright", -50, -24) skins_image:SetWidth(214*0.7) skins_image:SetHeight(133*0.7) - skins_image:SetTexCoord (0, 0.41796875, 0, 0.259765625) --0, 0, 214 133 + skins_image:SetTexCoord(0, 0.41796875, 0, 0.259765625) --0, 0, 214 133 --skin local onSelectSkin = function(_, _, skin_name) @@ -334,7 +334,7 @@ local window_openned_at = time() texto_alphabet:SetText(Loc ["STRING_WELCOME_73"]) --"Select the Alphabet or Region:" texto_alphabet:SetJustifyH("left") texto_alphabet:SetJustifyV ("top") - texto_alphabet:SetTextColor (1, 1, 1) + texto_alphabet:SetTextColor(1, 1, 1) texto_alphabet:SetPoint("topleft", skin_label.widget, "bottomleft", 0, -20) local allAlphabetCheckBoxes = {} @@ -697,7 +697,7 @@ local window_openned_at = time() numeral_image:SetHeight(125*3)--125 numeral_image:SetWidth(89*3)--82 numeral_image:SetAlpha(.05) - numeral_image:SetTexCoord (1, 0, 0, 1) + numeral_image:SetTexCoord(1, 0, 0, 1) g:NewLabel(window, _, "$parentChangeMindNumeralLabel", "changemindNumeralLabel", Loc ["STRING_WELCOME_2"], "GameFontNormal", 9, "orange") window.changemindNumeralLabel:SetPoint("center", window, "center") @@ -746,16 +746,16 @@ local window_openned_at = time() sword_icon2:SetTexture([[Interface\Addons\Details\images\icons2]]) sword_icon2:SetPoint("topright", window, "topright", -30, -10) sword_icon2:SetSize(128*1.4, 64*1.4) - sword_icon2:SetTexCoord (330/512, 509/512, 437/512, 509/512) - sword_icon2:SetDrawLayer ("overlay", 2) + sword_icon2:SetTexCoord(330/512, 509/512, 437/512, 509/512) + sword_icon2:SetDrawLayer("overlay", 2) local thedude2 = window:CreateTexture(nil, "overlay") --thedude2:SetTexture([[Interface\TUTORIALFRAME\UI-TutorialFrame-TheDude]]) thedude2:SetPoint("bottomright", sword_icon, "bottomleft", 70, 19) thedude2:SetWidth(128*1.0) thedude2:SetHeight(128*1.0) - thedude2:SetTexCoord (0, 1, 0, 1) - thedude2:SetDrawLayer ("overlay", 3) + thedude2:SetTexCoord(0, 1, 0, 1) + thedude2:SetDrawLayer("overlay", 3) local NumeralType1_text = window:CreateFontString(nil, "overlay", "GameFontNormal") NumeralType1_text:SetText("1K = 1.000 |cFFFFCC00| |r10K = 10.000 |cFFFFCC00| |r100K = 100.000 |cFFFFCC00| |r1M = 1.000.000") @@ -763,7 +763,7 @@ local window_openned_at = time() NumeralType1_text:SetHeight(40) NumeralType1_text:SetJustifyH("left") NumeralType1_text:SetJustifyV ("top") - NumeralType1_text:SetTextColor (.8, .8, .8, 1) + NumeralType1_text:SetTextColor(.8, .8, .8, 1) NumeralType1_text:SetPoint("topleft", window, "topleft", 40, -150) local NumeralType2_text = window:CreateFontString(nil, "overlay", "GameFontNormal") @@ -775,7 +775,7 @@ local window_openned_at = time() --if region is western it'll be using Korean symbols, set a font on the dropdown so it won't show ????? local clientRegion = _detalhes.gump:GetClientRegion() if (clientRegion == "western" or clientRegion == "russia") then - _detalhes.gump:SetFontFace (NumeralType2_text, _detalhes.gump:GetBestFontForLanguage ("koKR")) + _detalhes.gump:SetFontFace (NumeralType2_text, _detalhes.gump:GetBestFontForLanguage("koKR")) else _detalhes.gump:SetFontFace (NumeralType2_text, _detalhes.gump:GetBestFontForLanguage()) @@ -788,7 +788,7 @@ local window_openned_at = time() NumeralType2_text:SetHeight(80) NumeralType2_text:SetJustifyH("left") NumeralType2_text:SetJustifyV ("top") - NumeralType2_text:SetTextColor (.8, .8, .8, 1) + NumeralType2_text:SetTextColor(.8, .8, .8, 1) NumeralType2_text:SetPoint("topleft", window, "topleft", 40, -220) if (_detalhes.numerical_system == 1) then --west @@ -816,7 +816,7 @@ local window_openned_at = time() ampulheta:SetHeight(125*3)--125 ampulheta:SetWidth(89*3)--82 ampulheta:SetAlpha(.05) - ampulheta:SetTexCoord (1, 0, 0, 1) + ampulheta:SetTexCoord(1, 0, 0, 1) g:NewLabel(window, _, "$parentChangeMind2Label", "changemind2Label", Loc ["STRING_WELCOME_2"], "GameFontNormal", 9, "orange") window.changemind2Label:SetPoint("center", window, "center") @@ -865,16 +865,16 @@ local window_openned_at = time() sword_icon:SetPoint("topright", window, "topright", -15, -30) sword_icon:SetWidth(64*1.4) sword_icon:SetHeight(64*1.4) - sword_icon:SetTexCoord (1, 0, 0, 1) - sword_icon:SetDrawLayer ("overlay", 2) + sword_icon:SetTexCoord(1, 0, 0, 1) + sword_icon:SetDrawLayer("overlay", 2) local thedude = window:CreateTexture(nil, "overlay") thedude:SetTexture([[Interface\TUTORIALFRAME\UI-TutorialFrame-TheDude]]) thedude:SetPoint("bottomright", sword_icon, "bottomleft", 70, 19) thedude:SetWidth(128*1.0) thedude:SetHeight(128*1.0) - thedude:SetTexCoord (0, 1, 0, 1) - thedude:SetDrawLayer ("overlay", 3) + thedude:SetTexCoord(0, 1, 0, 1) + thedude:SetDrawLayer("overlay", 3) local chronometer_text = window:CreateFontString(nil, "overlay", "GameFontNormal") chronometer_text:SetText(Loc ["STRING_WELCOME_6"]) @@ -882,7 +882,7 @@ local window_openned_at = time() chronometer_text:SetHeight(40) chronometer_text:SetJustifyH("left") chronometer_text:SetJustifyV ("top") - chronometer_text:SetTextColor (.8, .8, .8, 1) + chronometer_text:SetTextColor(.8, .8, .8, 1) chronometer_text:SetPoint("topleft", window.ChronometerLabel.widget, "topright", 20, 0) local continuous_text = window:CreateFontString(nil, "overlay", "GameFontNormal") @@ -891,7 +891,7 @@ local window_openned_at = time() continuous_text:SetHeight(40) continuous_text:SetJustifyH("left") continuous_text:SetJustifyV ("top") - continuous_text:SetTextColor (.8, .8, .8, 1) + continuous_text:SetTextColor(.8, .8, .8, 1) continuous_text:SetPoint("topleft", window.ContinuousLabel.widget, "topright", 20, 0) if (_detalhes.time_type == 1) then --chronometer @@ -956,7 +956,7 @@ local window_openned_at = time() bg:SetHeight(125*3)--125 bg:SetWidth(89*3)--82 bg:SetAlpha(.05) - bg:SetTexCoord (1, 0, 0, 1) + bg:SetTexCoord(1, 0, 0, 1) g:NewLabel(window, _, "$parentChangeMind4Label", "changemind4Label", Loc ["STRING_WELCOME_11"], "GameFontNormal", 9, "orange") window.changemind4Label:SetPoint("center", window, "center") @@ -973,7 +973,7 @@ local window_openned_at = time() interval_text:SetHeight(40) interval_text:SetJustifyH("left") interval_text:SetJustifyV ("top") - interval_text:SetTextColor (1, 1, 1, .9) + interval_text:SetTextColor(1, 1, 1, .9) interval_text:SetPoint("topleft", window, "topleft", 30, -110) local dance_text = window:CreateFontString(nil, "overlay", "GameFontNormal") @@ -982,7 +982,7 @@ local window_openned_at = time() dance_text:SetHeight(40) dance_text:SetJustifyH("left") dance_text:SetJustifyV ("top") - dance_text:SetTextColor (1, 1, 1, 1) + dance_text:SetTextColor(1, 1, 1, 1) dance_text:SetPoint("topleft", window, "topleft", 30, -175) --------------- Update Speed @@ -997,11 +997,11 @@ local window_openned_at = time() window.updatespeedSlider.useDecimals = true local updateColor = function(slider, value) if (value < 1) then - slider.amt:SetTextColor (1, value, 0) + slider.amt:SetTextColor(1, value, 0) elseif (value > 1) then - slider.amt:SetTextColor (-(value-3), 1, 0) + slider.amt:SetTextColor(-(value-3), 1, 0) else - slider.amt:SetTextColor (1, 1, 0) + slider.amt:SetTextColor(1, 1, 0) end end @@ -1072,8 +1072,8 @@ local window_openned_at = time() mech_icon2:SetWidth(128*1.0) mech_icon2:SetHeight(128*0.6) mech_icon2:SetAlpha(0.6) - mech_icon2:SetTexCoord (0, 1, 40/128, 1) - mech_icon2:SetDrawLayer ("overlay", 2) + mech_icon2:SetTexCoord(0, 1, 40/128, 1) + mech_icon2:SetDrawLayer("overlay", 2) local update_frame_alert = CreateFrame("frame", nil, window) update_frame_alert:SetScript("OnShow", function() @@ -1123,7 +1123,7 @@ local window_openned_at = time() bg6:SetHeight(125*3)--125 bg6:SetWidth(89*3)--82 bg6:SetAlpha(.1) - bg6:SetTexCoord (1, 0, 0, 1) + bg6:SetTexCoord(1, 0, 0, 1) local texto5 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto5:SetPoint("topleft", window, "topleft", 20, -80) @@ -1136,14 +1136,14 @@ local window_openned_at = time() texto_stretch:SetHeight(100) texto_stretch:SetJustifyH("left") texto_stretch:SetJustifyV ("top") - texto_stretch:SetTextColor (1, 1, 1, 1) + texto_stretch:SetTextColor(1, 1, 1, 1) local stretch_image = window:CreateTexture(nil, "overlay") stretch_image:SetTexture([[Interface\Addons\Details\images\icons]]) stretch_image:SetPoint("right", texto_stretch, "left", -12, 0) stretch_image:SetWidth(144) stretch_image:SetHeight(61) - stretch_image:SetTexCoord (0.716796875, 1, 0.876953125, 1) + stretch_image:SetTexCoord(0.716796875, 1, 0.876953125, 1) local stretch_frame_alert = CreateFrame("frame", nil, window) stretch_frame_alert:SetScript("OnHide", function() @@ -1181,7 +1181,7 @@ local window_openned_at = time() bg6:SetHeight(125*3)--125 bg6:SetWidth(89*3)--82 bg6:SetAlpha(.1) - bg6:SetTexCoord (1, 0, 0, 1) + bg6:SetTexCoord(1, 0, 0, 1) local texto6 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto6:SetPoint("topleft", window, "topleft", 20, -80) @@ -1194,14 +1194,14 @@ local window_openned_at = time() texto_instance_button:SetHeight(100) texto_instance_button:SetJustifyH("left") texto_instance_button:SetJustifyV ("top") - texto_instance_button:SetTextColor (1, 1, 1, 1) + texto_instance_button:SetTextColor(1, 1, 1, 1) local instance_button_image = window:CreateTexture(nil, "overlay") instance_button_image:SetTexture([[Interface\Addons\Details\images\icons]]) instance_button_image:SetPoint("topright", window, "topright", -16, -70) instance_button_image:SetWidth(198) instance_button_image:SetHeight(141) - instance_button_image:SetTexCoord (0.328125, 0.71484375, 0.724609375, 1) + instance_button_image:SetTexCoord(0.328125, 0.71484375, 0.724609375, 1) local instance_frame_alert = CreateFrame("frame", nil, window) instance_frame_alert:SetScript("OnHide", function() @@ -1237,7 +1237,7 @@ local window_openned_at = time() bg7:SetHeight(125*3)--125 bg7:SetWidth(89*3)--82 bg7:SetAlpha(.1) - bg7:SetTexCoord (1, 0, 0, 1) + bg7:SetTexCoord(1, 0, 0, 1) local texto7 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto7:SetPoint("topleft", window, "topleft", 20, -80) @@ -1250,14 +1250,14 @@ local window_openned_at = time() texto_shortcut:SetHeight(160) texto_shortcut:SetJustifyH("left") texto_shortcut:SetJustifyV ("top") - texto_shortcut:SetTextColor (1, 1, 1, 1) + texto_shortcut:SetTextColor(1, 1, 1, 1) local shortcut_image2 = window:CreateTexture(nil, "overlay") shortcut_image2:SetTexture([[Interface\Addons\Details\images\icons]]) shortcut_image2:SetPoint("topright", window, "topright", -22, -87) shortcut_image2:SetWidth(165) shortcut_image2:SetHeight(119) - shortcut_image2:SetTexCoord (2/512, 167/512, 306/512, 425/512) + shortcut_image2:SetTexCoord(2/512, 167/512, 306/512, 425/512) local instance1 = _detalhes:GetInstance(1) @@ -1268,17 +1268,17 @@ local window_openned_at = time() bookmark_frame:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 64}) bookmark_frame:SetBackdropColor(0, 0, 0, 0.8) - local desc_anchor_topleft = _detalhes.gump:NewImage (bookmark_frame, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.6796875, 0.783203125}, "descAnchorBottomLeftImage", "$parentDescAnchorBottomLeftImage") --204 696 279 802 + local desc_anchor_topleft = _detalhes.gump:NewImage(bookmark_frame, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.19921875, 0.2724609375, 0.6796875, 0.783203125}, "descAnchorBottomLeftImage", "$parentDescAnchorBottomLeftImage") --204 696 279 802 desc_anchor_topleft:SetPoint("topleft", bookmark_frame, "topleft", -5, 5) - local desc_anchor_bottomleft = _detalhes.gump:NewImage (bookmark_frame, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.2724609375, 0.19921875, 0.783203125, 0.6796875}, "descAnchorTopLeftImage", "$parentDescAnchorTopLeftImage") --204 696 279 802 + local desc_anchor_bottomleft = _detalhes.gump:NewImage(bookmark_frame, [[Interface\AddOns\Details\images\options_window]], 75, 106, "artwork", {0.2724609375, 0.19921875, 0.783203125, 0.6796875}, "descAnchorTopLeftImage", "$parentDescAnchorTopLeftImage") --204 696 279 802 desc_anchor_bottomleft:SetPoint("bottomright", bookmark_frame, "bottomright", 5, -5) local bmf_string = bookmark_frame:CreateFontString("overlay", nil, "GameFontNormal") bmf_string:SetPoint("center", bookmark_frame, "center") bmf_string:SetText(Loc ["STRING_WELCOME_65"]) - local bg_string = _detalhes.gump:NewImage (bookmark_frame, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-RecentHeader]], 256, 32, "border", {0, 1, 0, 23/32}) + local bg_string = _detalhes.gump:NewImage(bookmark_frame, [[Interface\ACHIEVEMENTFRAME\UI-Achievement-RecentHeader]], 256, 32, "border", {0, 1, 0, 23/32}) bg_string:SetPoint("left", bookmark_frame, "left", 0, 0) bg_string:SetPoint("right", bookmark_frame, "right", 0, 0) bg_string:SetPoint("center", bmf_string, "center", 0, 0) @@ -1306,7 +1306,7 @@ local window_openned_at = time() bg77:SetHeight(125*3)--125 bg77:SetWidth(89*3)--82 bg77:SetAlpha(.1) - bg77:SetTexCoord (1, 0, 0, 1) + bg77:SetTexCoord(1, 0, 0, 1) local texto77 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto77:SetPoint("topleft", window, "topleft", 20, -80) @@ -1319,7 +1319,7 @@ local window_openned_at = time() texto_snap:SetHeight(110) texto_snap:SetJustifyH("left") texto_snap:SetJustifyV ("top") - texto_snap:SetTextColor (1, 1, 1, 1) + texto_snap:SetTextColor(1, 1, 1, 1) local fonte, _, flags = texto_snap:GetFont() texto_snap:SetFont (fonte, 11, flags) @@ -1328,7 +1328,7 @@ local window_openned_at = time() snap_image1:SetPoint("topright", window, "topright", -12, -95) snap_image1:SetWidth(310) snap_image1:SetHeight(102) - snap_image1:SetTexCoord (0, 0.60546875, 191/512, 293/512) + snap_image1:SetTexCoord(0, 0.60546875, 191/512, 293/512) local group_frame_alert = CreateFrame("frame", nil, window) group_frame_alert:SetScript("OnShow", function() @@ -1352,7 +1352,7 @@ local window_openned_at = time() bg88:SetHeight(125*3)--125 bg88:SetWidth(89*3)--82 bg88:SetAlpha(.1) - bg88:SetTexCoord (1, 0, 0, 1) + bg88:SetTexCoord(1, 0, 0, 1) local texto88 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto88:SetPoint("topleft", window, "topleft", 20, -80) @@ -1365,14 +1365,14 @@ local window_openned_at = time() texto_micro_display:SetHeight(110) texto_micro_display:SetJustifyH("left") texto_micro_display:SetJustifyV ("top") - texto_micro_display:SetTextColor (1, 1, 1, 1) + texto_micro_display:SetTextColor(1, 1, 1, 1) local micro_image1 = window:CreateTexture(nil, "overlay") micro_image1:SetTexture([[Interface\Addons\Details\images\icons]]) micro_image1:SetPoint("topright", window, "topright", -15, -70) micro_image1:SetWidth(186) micro_image1:SetHeight(100) - micro_image1:SetTexCoord (326/512, 1, 85/512, 185/512) + micro_image1:SetTexCoord(326/512, 1, 85/512, 185/512) local tooltip_frame = CreateFrame("frame", nil, window) tooltip_frame:SetScript("OnShow", function(self) @@ -1475,7 +1475,7 @@ local window_openned_at = time() bg11:SetHeight(125*3)--125 bg11:SetWidth(89*3)--82 bg11:SetAlpha(.1) - bg11:SetTexCoord (1, 0, 0, 1) + bg11:SetTexCoord(1, 0, 0, 1) local texto11 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto11:SetPoint("topleft", window, "topleft", 20, -80) @@ -1488,7 +1488,7 @@ local window_openned_at = time() texto_plugins:SetHeight(110) texto_plugins:SetJustifyH("left") texto_plugins:SetJustifyV ("top") - texto_plugins:SetTextColor (1, 1, 1, 1) + texto_plugins:SetTextColor(1, 1, 1, 1) --local fonte, _, flags = texto_plugins:GetFont() --texto_plugins:SetFont (fonte, 11, flags) @@ -1497,7 +1497,7 @@ local window_openned_at = time() plugins_image1:SetPoint("topright", window, "topright", -12, -90) plugins_image1:SetWidth(281) plugins_image1:SetHeight(81) - plugins_image1:SetTexCoord (216/512, 497/512, 6/512, 95/512) + plugins_image1:SetTexCoord(216/512, 497/512, 6/512, 95/512) pages [#pages+1] = {bg11, texto11, plugins_image1, texto_plugins} @@ -1514,7 +1514,7 @@ local window_openned_at = time() bg8:SetHeight(125*3)--125 bg8:SetWidth(89*3)--82 bg8:SetAlpha(.1) - bg8:SetTexCoord (1, 0, 0, 1) + bg8:SetTexCoord(1, 0, 0, 1) local texto8 = window:CreateFontString(nil, "overlay", "GameFontNormal") texto8:SetPoint("topleft", window, "topleft", 20, -80) @@ -1527,7 +1527,7 @@ local window_openned_at = time() texto:SetHeight(90) texto:SetJustifyH("left") texto:SetJustifyV ("top") - texto:SetTextColor (1, 1, 1, 1) + texto:SetTextColor(1, 1, 1, 1) local final_frame = CreateFrame("frame", nil, window) final_frame:SetSize(1, 1) diff --git a/functions/boss.lua b/functions/boss.lua index 190c33ef..8f994123 100644 --- a/functions/boss.lua +++ b/functions/boss.lua @@ -218,7 +218,7 @@ do if (not name) then return end - if (name == encountername or name:find (encountername)) then + if (name == encountername or name:find(encountername)) then return i, DetailsFramework.EncounterJournal.EJ_GetEncounterInfoByIndex (i, EJID) end end diff --git a/functions/bossmods.lua b/functions/bossmods.lua index 5a5aee37..b3c21986 100644 --- a/functions/bossmods.lua +++ b/functions/bossmods.lua @@ -143,7 +143,7 @@ function Details:CreateCallbackListeners() if (_G.DBM) then local dbm_timer_callback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) - local spell = tostring (spellId) + local spell = tostring(spellId) if (spell and not current_table_dbm [spell]) then current_table_dbm [spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid} end @@ -156,7 +156,7 @@ function Details:CreateCallbackListeners() function Details:RegisterBigWigsCallBack() if (BigWigsLoader) then function Details:BigWigs_StartBar (event, module, spellid, bar_text, time, icon, ...) - spellid = tostring (spellid) + spellid = tostring(spellid) if (not current_table_bigwigs [spellid]) then current_table_bigwigs [spellid] = {(type(module) == "string" and module) or (module and module.moduleName) or "", spellid or "", bar_text or "", time or 0, icon or ""} end diff --git a/functions/classes.lua b/functions/classes.lua index a4071cc2..e419cf4d 100644 --- a/functions/classes.lua +++ b/functions/classes.lua @@ -127,16 +127,16 @@ do function _detalhes:GetOnlyName(string) if (string) then - return string:gsub (("%-.*"), "") + return string:gsub(("%-.*"), "") end - return self.nome:gsub (("%-.*"), "") + return self.nome:gsub(("%-.*"), "") end function _detalhes:RemoveOwnerName (string) if (string) then - return string:gsub ((" <.*"), "") + return string:gsub((" <.*"), "") end - return self.nome:gsub ((" <.*"), "") + return self.nome:gsub((" <.*"), "") end function _detalhes:GetCLName(id) diff --git a/functions/deathrecap.lua b/functions/deathrecap.lua index ac1ea80d..f117e2c1 100644 --- a/functions/deathrecap.lua +++ b/functions/deathrecap.lua @@ -43,8 +43,8 @@ local create_deathrecap_line = function(parent, n) local backgroundTextureOverlay = line:CreateTexture(nil, "artwork") local spellIcon = line:CreateTexture(nil, "overlay") local spellIconBorder = line:CreateTexture(nil, "overlay") - spellIcon:SetDrawLayer ("overlay", 1) - spellIconBorder:SetDrawLayer ("overlay", 2) + spellIcon:SetDrawLayer("overlay", 1) + spellIconBorder:SetDrawLayer("overlay", 2) local sourceName = line:CreateFontString(nil, "overlay", "GameFontNormal") local amount = line:CreateFontString(nil, "overlay", "GameFontNormal") local lifePercent = line:CreateFontString(nil, "overlay", "GameFontNormal") @@ -53,14 +53,14 @@ local create_deathrecap_line = function(parent, n) --grave icon local graveIcon = line:CreateTexture(nil, "overlay") graveIcon:SetTexture([[Interface\MINIMAP\POIIcons]]) - graveIcon:SetTexCoord (146/256, 160/256, 0/512, 18/512) + graveIcon:SetTexCoord(146/256, 160/256, 0/512, 18/512) graveIcon:SetPoint("left", line, "left", 11, 0) graveIcon:SetSize(14, 18) --spell icon spellIcon:SetSize(19, 19) spellIconBorder:SetTexture([[Interface\ENCOUNTERJOURNAL\LootTab]]) - spellIconBorder:SetTexCoord (6/256, 38/256, 49/128, 81/128) + spellIconBorder:SetTexCoord(6/256, 38/256, 49/128, 81/128) spellIconBorder:SetSize(20, 20) spellIconBorder:SetPoint("topleft", spellIcon, "topleft", 0, 0) @@ -96,13 +96,13 @@ local create_deathrecap_line = function(parent, n) lifeStatusBar:SetColorTexture(0.5, 0.5, 0.5, 0.4) backgroundTexture:SetTexture([[Interface\AddOns\Details\images\deathrecap_background]]) - backgroundTexture:SetTexCoord (0, 1, 0, 1) + backgroundTexture:SetTexCoord(0, 1, 0, 1) backgroundTexture:SetVertexColor(.1, .1, .1, .3) --top border local TopFader = line:CreateTexture(nil, "border") TopFader:SetTexture([[Interface\AddOns\Details\images\deathrecap_background_top]]) - TopFader:SetTexCoord (0, 1, 0, 1) + TopFader:SetTexCoord(0, 1, 0, 1) TopFader:SetVertexColor(.1, .1, .1, .3) TopFader:SetPoint("bottomleft", backgroundTexture, "topleft", 0, -0) TopFader:SetPoint("bottomright", backgroundTexture, "topright", 0, -0) @@ -114,7 +114,7 @@ local create_deathrecap_line = function(parent, n) --bottom fader local backgroundTexture2 = line:CreateTexture(nil, "border") backgroundTexture2:SetTexture([[Interface\AddOns\Details\images\deathrecap_background_bottom]]) - backgroundTexture2:SetTexCoord (0, 1, 0, 1) + backgroundTexture2:SetTexCoord(0, 1, 0, 1) backgroundTexture2:SetVertexColor(.1, .1, .1, .3) backgroundTexture2:SetPoint("topleft", backgroundTexture, "bottomleft", 0, 0) backgroundTexture2:SetPoint("topright", backgroundTexture, "bottomright", 0, 0) @@ -129,7 +129,7 @@ local create_deathrecap_line = function(parent, n) backgroundTexture:SetPoint("bottomright", 0, -1) backgroundTexture:SetDesaturated(true) backgroundTextureOverlay:SetTexture([[Interface\AdventureMap\AdventureMap]]) - backgroundTextureOverlay:SetTexCoord (460/1024, 659/1024, 330/1024, 350/1024) + backgroundTextureOverlay:SetTexCoord(460/1024, 659/1024, 330/1024, 350/1024) backgroundTextureOverlay:SetAllPoints() backgroundTextureOverlay:SetDesaturated(true) backgroundTextureOverlay:SetAlpha(0.5) @@ -173,7 +173,7 @@ function Details.BuildDeathTableFromRecap (recapID) {}, --deathlog events (events [1] and events [1].timestamp) or (DeathRecapFrame and DeathRecapFrame.DeathTimeStamp) or 0, --time of death UnitName ("player"), - select(2, UnitClass ("player")), + select(2, UnitClass("player")), UnitHealthMax ("player"), "0m 0s", --formated fight time ["dead"] = true, @@ -215,10 +215,10 @@ function Details.GetDeathRecapFromChat() for i = numLines, 1, -1 do local text = chat1:GetMessageInfo (i) if (text) then - if (text:find ("Hdeath:%d")) then + if (text:find("Hdeath:%d")) then local recapID = text:match ("|Hdeath:(%d+)|h") if (recapID) then - recapIDFromChat = tonumber (recapID) + recapIDFromChat = tonumber(recapID) end break end @@ -487,14 +487,14 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) local line = Details.DeathRecap.Lines [lineIndex] if (line) then - line.timeAt:SetText(format ("%.1f", eventTime - timeOfDeath) .. "s") + line.timeAt:SetText(format("%.1f", eventTime - timeOfDeath) .. "s") line.spellIcon:SetTexture(spellIcon or customSpellInfo and customSpellInfo [3] or "") line.TopFader:Hide() - --line.spellIcon:SetTexCoord (.1, .9, .1, .9) + --line.spellIcon:SetTexCoord(.1, .9, .1, .9) --line.sourceName:SetText("|cFFC6B0D9" .. source .. "|r") --parse source and cut the length of the string after setting the spellname and source - local sourceClass = Details:GetClass (source) + local sourceClass = Details:GetClass(source) local sourceSpec = Details:GetSpec (source) if (not sourceClass) then @@ -520,7 +520,7 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) --remove real name or owner name source = Details:GetOnlyName(source) --remove owner name - source = source:gsub ((" <.*"), "") + source = source:gsub((" <.*"), "") --if a player? if (Details.player_class [sourceClass]) then @@ -534,19 +534,19 @@ function Details.OpenDetailsDeathRecap (segment, RecapID, fromChat) --remove the dot signal from the spell name if (not spellName) then spellName = customSpellInfo and customSpellInfo [2] or "*?*" - if (spellName:find (STRING_ENVIRONMENTAL_DAMAGE_FALLING)) then + if (spellName:find(STRING_ENVIRONMENTAL_DAMAGE_FALLING)) then if (UnitName ("player") == "Elphaba") then spellName = "Gravity Won!, Elphaba..." source = "" else source = "Gravity" end - --/run for a,b in pairs(_G) do if (type(b)=="string" and b:find ("Falling")) then print(a,b) end end + --/run for a,b in pairs(_G) do if (type(b)=="string" and b:find("Falling")) then print(a,b) end end end end - spellName = spellName:gsub (L["STRING_DOT"], "") - spellName = spellName:gsub ("[*] ", "") + spellName = spellName:gsub(L["STRING_DOT"], "") + spellName = spellName:gsub("[*] ", "") source = source or "" line.sourceName:SetText(spellName .. " (" .. "|cFFC6B0D9" .. source .. "|r" .. ")") diff --git a/functions/dungeon.lua b/functions/dungeon.lua index 5e249c37..739474be 100644 --- a/functions/dungeon.lua +++ b/functions/dungeon.lua @@ -49,7 +49,7 @@ local addPlayerDamage = function(unitName, unitRealm) playerData = { Name = unitName, ChartData = {max_value = 0}, - Class = select(2, UnitClass (CLName)), + Class = select(2, UnitClass(CLName)), --spec zero for now, need to retrive later during combat Spec = 0, @@ -167,7 +167,7 @@ function mythicDungeonCharts:OnBossDefeated() if (mythicLevel and mythicLevel > 0) then if (mythicDungeonCharts.ChartTable and mythicDungeonCharts.ChartTable.Running and bossInfo) then - local copiedBossInfo = Details:GetFramework().table.copy ({}, bossInfo) + local copiedBossInfo = Details:GetFramework().table.copy({}, bossInfo) tinsert(mythicDungeonCharts.ChartTable.BossDefeated, {time() - mythicDungeonCharts.ChartTable.StartTime, copiedBossInfo, currentCombat:GetCombatTime()}) mythicDungeonCharts:Debug("Boss defeated, time saved", currentCombat:GetCombatTime()) else @@ -177,7 +177,7 @@ function mythicDungeonCharts:OnBossDefeated() if (mythicDungeonCharts.ChartTable.EndTime + 2 >= now) then if (bossInfo) then - local copiedBossInfo = Details:GetFramework().table.copy ({}, bossInfo) + local copiedBossInfo = Details:GetFramework().table.copy({}, bossInfo) tinsert(mythicDungeonCharts.ChartTable.BossDefeated, {time() - mythicDungeonCharts.ChartTable.StartTime, copiedBossInfo, currentCombat:GetCombatTime()}) mythicDungeonCharts:Debug("Boss defeated, time saved, but used time aproximation:", mythicDungeonCharts.ChartTable.EndTime + 2, now, currentCombat:GetCombatTime()) end @@ -421,12 +421,12 @@ function mythicDungeonCharts.ShowChart() dungeonChartFrame.BossWidgetsFrame.GraphPin = dungeonChartFrame.BossWidgetsFrame:CreateTexture(nil, "overlay") dungeonChartFrame.BossWidgetsFrame.GraphPin:SetTexture([[Interface\BUTTONS\UI-RadioButton]]) - dungeonChartFrame.BossWidgetsFrame.GraphPin:SetTexCoord (17/64, 32/64, 0, 1) + dungeonChartFrame.BossWidgetsFrame.GraphPin:SetTexCoord(17/64, 32/64, 0, 1) dungeonChartFrame.BossWidgetsFrame.GraphPin:SetSize(16, 16) dungeonChartFrame.BossWidgetsFrame.GraphPinGlow = dungeonChartFrame.BossWidgetsFrame:CreateTexture(nil, "artwork") dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetTexture([[Interface\Calendar\EventNotificationGlow]]) - dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetTexCoord (0, 1, 0, 1) + dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetTexCoord(0, 1, 0, 1) dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetSize(14, 14) dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetBlendMode("ADD") dungeonChartFrame.BossWidgetsFrame.GraphPinGlow:SetPoint("center", dungeonChartFrame.BossWidgetsFrame.GraphPin, "center", 0, 0) @@ -519,12 +519,12 @@ function mythicDungeonCharts.ShowChart() local leftDivisorLine = dungeonChartFrame.BossWidgetsFrame:CreateTexture(nil, "overlay") leftDivisorLine:SetSize(2, dungeonChartFrame.ChartFrame.Graphic:GetHeight()) - leftDivisorLine:SetColorTexture (1, 1, 1, 1) + leftDivisorLine:SetColorTexture(1, 1, 1, 1) leftDivisorLine:SetPoint("bottomleft", dungeonChartFrame.ChartFrame.Graphic.TextFrame, "bottomleft", -2, 0) local bottomDivisorLine = dungeonChartFrame.BossWidgetsFrame:CreateTexture(nil, "overlay") bottomDivisorLine:SetSize(dungeonChartFrame.ChartFrame.Graphic:GetWidth(), 2) - bottomDivisorLine:SetColorTexture (1, 1, 1, 1) + bottomDivisorLine:SetColorTexture(1, 1, 1, 1) bottomDivisorLine:SetPoint("bottomleft", dungeonChartFrame.ChartFrame.Graphic.TextFrame, "bottomleft", 0, 0) dungeonChartFrame.ChartFrame.Graphic:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) @@ -547,7 +547,7 @@ function mythicDungeonCharts.ShowChart() newBossWidget.AvatarTexture = bossAvatar local verticalLine = Details:GetFramework():CreateImage(newBossWidget, "", 1, dungeonChartFrame.ChartFrame.Graphic:GetHeight(), "overlay") - verticalLine:SetColorTexture (1, 1, 1, 0.3) + verticalLine:SetColorTexture(1, 1, 1, 0.3) verticalLine:SetPoint("bottomleft", newBossWidget, "bottomright", 0, 0) local timeText = Details:GetFramework():CreateLabel(newBossWidget) @@ -555,7 +555,7 @@ function mythicDungeonCharts.ShowChart() newBossWidget.TimeText = timeText local timeBackground = Details:GetFramework():CreateImage(newBossWidget, "", 30, 12, "artwork") - timeBackground:SetColorTexture (0, 0, 0, 0.5) + timeBackground:SetColorTexture(0, 0, 0, 0.5) timeBackground:SetPoint("topleft", timeText, "topleft", -2, 2) timeBackground:SetPoint("bottomright", timeText, "bottomright", 2, 0) @@ -589,7 +589,7 @@ function mythicDungeonCharts.ShowChart() if (Details.mythic_plus.last_mythicrun_chart) then --load the last mythic dungeon run chart local t = {} - Details:GetFramework().table.copy (t, Details.mythic_plus.last_mythicrun_chart) + Details:GetFramework().table.copy(t, Details.mythic_plus.last_mythicrun_chart) mythicDungeonCharts.ChartTable = t mythicDungeonCharts:Debug("no valid data, saved data loaded") diff --git a/functions/events.lua b/functions/events.lua index ea011559..6ea4098a 100644 --- a/functions/events.lua +++ b/functions/events.lua @@ -250,7 +250,7 @@ local common_events = { return end - local okay, errortext = pcall (func, event, ...) + local okay, errortext = pcall(func, event, ...) if (not okay) then --trigger an error msg @@ -272,7 +272,7 @@ local common_events = { return end - local okay, errortext = pcall (func, context, event, ...) + local okay, errortext = pcall(func, context, event, ...) if (not okay) then --attempt to get the context name diff --git a/functions/mythicdungeon.lua b/functions/mythicdungeon.lua index 77a10b46..65f7591c 100644 --- a/functions/mythicdungeon.lua +++ b/functions/mythicdungeon.lua @@ -603,7 +603,7 @@ function DetailsMythicPlusFrame.MythicDungeonFinished (fromZoneLeft) --store data --[=[ - local expansion = tostring (select(4, GetBuildInfo())):match ("%d%d") + local expansion = tostring(select(4, GetBuildInfo())):match ("%d%d") if (expansion and type(expansion) == "string" and string.len(expansion) == 2) then local expansionDungeonData = _detalhes.dungeon_data [expansion] if (not expansionDungeonData) then diff --git a/functions/pack.lua b/functions/pack.lua index 747c2f1a..27ae1e72 100644 --- a/functions/pack.lua +++ b/functions/pack.lua @@ -401,11 +401,11 @@ function Details.packFunctions.RetriveActorInformation(combatData, index) local serialNumber = combatData[index + 2] serialNumber = unpackActorSerial(serialNumber) - --class [4] + --class[4] local class = combatData[index + 3] class = unpackActorClass(class) - --spec [5] + --spec[5] local spec = tonumber(combatData[index + 4]) --return the values diff --git a/functions/playerclass.lua b/functions/playerclass.lua index f1a1ce6b..540d5fd4 100644 --- a/functions/playerclass.lua +++ b/functions/playerclass.lua @@ -19,7 +19,7 @@ do end function _detalhes:GetIconTexture (iconType, withAlpha) - iconType = string.lower (iconType) + iconType = string.lower(iconType) if (iconType == "spec") then if (withAlpha) then @@ -38,7 +38,7 @@ do end -- try get the class from actor name - function _detalhes:GetClass (name) + function _detalhes:GetClass(name) local _, class = _UnitClass (name) if (not class) then @@ -204,7 +204,7 @@ do return end - local class = _detalhes:GetClass (Actor.nome) + local class = _detalhes:GetClass(Actor.nome) if (class and class ~= "UNKNOW") then Actor.classe = class Actor.need_refresh = true diff --git a/functions/profiles.lua b/functions/profiles.lua index 91a1decc..d9729b84 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -165,7 +165,7 @@ function _detalhes:ResetProfile (profile_name) end --reset the profile - table.wipe (profile.instances) + table.wipe(profile.instances) --export first instance local instance = _detalhes:GetInstance(1) @@ -196,7 +196,7 @@ function _detalhes:CreatePanicWarning() --tinsert(UISpecialFrames, "DetailsPanicWarningFrame") _detalhes.instance_load_failed.text = _detalhes.instance_load_failed:CreateFontString(nil, "overlay", "GameFontNormal") _detalhes.instance_load_failed.text:SetPoint("center", _detalhes.instance_load_failed, "center") - _detalhes.instance_load_failed.text:SetTextColor (1, 0.6, 0) + _detalhes.instance_load_failed.text:SetTextColor(1, 0.6, 0) _detalhes.instance_load_failed:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) _detalhes.instance_load_failed:SetBackdropColor(1, 0, 0, 0.2) _detalhes.instance_load_failed:SetPoint("topleft", UIParent, "topleft", 0, -250) @@ -204,7 +204,7 @@ function _detalhes:CreatePanicWarning() end local safe_load = function(func, param1, ...) - local okey, errortext = pcall (func, param1, ...) + local okey, errortext = pcall(func, param1, ...) if (not okey) then if (not _detalhes.instance_load_failed) then _detalhes:CreatePanicWarning() @@ -283,7 +283,7 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy) --then close all opened instances for index, instance in _detalhes:ListInstances() do - if (not getmetatable (instance)) then + if (not getmetatable(instance)) then instance.iniciada = false setmetatable(instance, _detalhes) end @@ -1511,7 +1511,7 @@ function _detalhes:SaveProfileSpecial() end --save skins - table.wipe (profile.instances) + table.wipe(profile.instances) if (_detalhes.tabela_instancias) then for index, instance in ipairs(_detalhes.tabela_instancias) do @@ -1686,7 +1686,7 @@ function Details:ExportCurrentProfile() for key, _ in pairs(defaultPlayerData) do if (not exportProfileBlacklist[key]) then if (type(Details[key]) == "table") then - playerData [key] = DetailsFramework.table.copy ({}, Details[key]) + playerData [key] = DetailsFramework.table.copy({}, Details[key]) else playerData [key] = Details[key] end @@ -1695,7 +1695,7 @@ function Details:ExportCurrentProfile() for key, _ in pairs(defaultGlobalData) do if (not exportProfileBlacklist[key]) then if (type(Details[key]) == "table") then - globaData [key] = DetailsFramework.table.copy ({}, Details[key]) + globaData [key] = DetailsFramework.table.copy({}, Details[key]) else globaData [key] = Details[key] end @@ -1754,7 +1754,7 @@ function Details:ImportProfile (profileString, newProfileName) local importedValue = playerData[key] if (importedValue ~= nil) then if (type(importedValue) == "table") then - Details [key] = DetailsFramework.table.copy ({}, importedValue) + Details [key] = DetailsFramework.table.copy({}, importedValue) else Details [key] = importedValue end @@ -1765,7 +1765,7 @@ function Details:ImportProfile (profileString, newProfileName) local importedValue = globalData[key] if (importedValue ~= nil) then if (type(importedValue) == "table") then - Details [key] = DetailsFramework.table.copy ({}, importedValue) + Details [key] = DetailsFramework.table.copy({}, importedValue) else Details [key] = importedValue end @@ -1777,7 +1777,7 @@ function Details:ImportProfile (profileString, newProfileName) local importedValue = profileData[key] if (importedValue ~= nil) then if (type(importedValue) == "table") then - profileObject [key] = DetailsFramework.table.copy ({}, importedValue) + profileObject [key] = DetailsFramework.table.copy({}, importedValue) else profileObject [key] = importedValue end @@ -1804,7 +1804,7 @@ function Details:ImportProfile (profileString, newProfileName) Details.segments_amount_to_save = 40 --transfer instance data to the new created profile - profileObject.instances = DetailsFramework.table.copy ({}, profileData.instances) + profileObject.instances = DetailsFramework.table.copy({}, profileData.instances) Details:ApplyProfile (newProfileName) diff --git a/functions/skins.lua b/functions/skins.lua index 8591e282..7d399caa 100644 --- a/functions/skins.lua +++ b/functions/skins.lua @@ -1055,7 +1055,7 @@ local _ end - table.wipe (instance1.snap); table.wipe (instance2.snap) + table.wipe(instance1.snap); table.wipe(instance2.snap) instance1.snap [3] = 2; instance2.snap [1] = 1; instance1.horizontalSnap = true; instance2.horizontalSnap = true diff --git a/functions/slash.lua b/functions/slash.lua index b921c388..a1e98010 100644 --- a/functions/slash.lua +++ b/functions/slash.lua @@ -23,7 +23,7 @@ SLASH_DETAILS1, SLASH_DETAILS2, SLASH_DETAILS3 = "/details", "/dt", "/de" function SlashCmdList.DETAILS (msg, editbox) local command, rest = msg:match("^(%S*)%s*(.-)$") - command = string.lower (command) + command = string.lower(command) if (command == Loc ["STRING_SLASH_WIPE"] or command == "wipe") then @@ -41,7 +41,7 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == Loc ["STRING_SLASH_TOGGLE"] or command == "toggle") then local instance = rest:match ("^(%S*)%s*(.-)$") - instance = tonumber (instance) + instance = tonumber(instance) if (instance) then _detalhes:ToggleWindow (instance) else @@ -51,7 +51,7 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == Loc ["STRING_SLASH_HIDE"] or command == Loc ["STRING_SLASH_HIDE_ALIAS1"] or command == "hide") then local instance = rest:match ("^(%S*)%s*(.-)$") - instance = tonumber (instance) + instance = tonumber(instance) if (instance) then local this_instance = _detalhes:GetInstance(instance) if (not this_instance) then @@ -130,7 +130,7 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes.LastShowCommand = GetTime() local instance = rest:match ("^(%S*)%s*(.-)$") - instance = tonumber (instance) + instance = tonumber(instance) if (instance) then local this_instance = _detalhes:GetInstance(instance) if (not this_instance) then @@ -173,8 +173,8 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == Loc ["STRING_SLASH_OPTIONS"] or command == "options" or command == "config") then - if (rest and tonumber (rest)) then - local instanceN = tonumber (rest) + if (rest and tonumber(rest)) then + local instanceN = tonumber(rest) if (instanceN > 0 and instanceN <= #_detalhes.tabela_instancias) then local instance = _detalhes:GetInstance(instanceN) _detalhes:OpenOptionsWindow (instance) @@ -195,7 +195,7 @@ function SlashCmdList.DETAILS (msg, editbox) local questIds = {{"Tarlna the Ageless", 81535}, {"Drov the Ruiner ", 87437}, {"Rukhmar", 87493}} for _, _table in pairs(questIds) do - print(format ("%s: \124cff%s\124r", _table [1], IsQuestFlaggedCompleted (_table [2]) and "ff0000"..Loc ["STRING_KILLED"] or "00ff00"..Loc ["STRING_ALIVE"])) + print(format("%s: \124cff%s\124r", _table [1], IsQuestFlaggedCompleted (_table [2]) and "ff0000"..Loc ["STRING_KILLED"] or "00ff00"..Loc ["STRING_ALIVE"])) end elseif (command == Loc ["STRING_SLASH_CHANGES"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS1"] or command == Loc ["STRING_SLASH_CHANGES_ALIAS2"] or command == "news" or command == "updates") then @@ -324,7 +324,7 @@ function SlashCmdList.DETAILS (msg, editbox) A:Play() C_Timer.NewTicker(1, function() - texture:SetTexCoord (math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random()) + texture:SetTexCoord(math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random(), math.random()) end) @@ -517,7 +517,7 @@ function SlashCmdList.DETAILS (msg, editbox) for i = 1, 10000 do a [i] = {math.random (50000)} end - table.wipe (a) + table.wipe(a) elseif (msg == "unitname") then @@ -631,7 +631,7 @@ function SlashCmdList.DETAILS (msg, editbox) scanTool:ClearLines() print(petName) - scanTool:SetUnit (petName) + scanTool:SetUnit(petName) local ownerText = scanText:GetText() if (not ownerText) then @@ -649,7 +649,7 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == "buffsof") then local playername, segment = rest:match("^(%S*)%s*(.-)$") - segment = tonumber (segment or 0) + segment = tonumber(segment or 0) print("dumping buffs of ", playername, segment) local c = _detalhes:GetCombat("current") @@ -727,7 +727,7 @@ function SlashCmdList.DETAILS (msg, editbox) --debug elseif (command == "barra") then - local whichRowLine = rest and tonumber (rest) or 1 + local whichRowLine = rest and tonumber(rest) or 1 local instancia = _detalhes.tabela_instancias [1] local barra = instancia.barras [whichRowLine] @@ -758,7 +758,7 @@ function SlashCmdList.DETAILS (msg, editbox) print(g) print(string.len(g)) local serial = g:sub (12, 18) - serial = tonumber ("0x"..serial) + serial = tonumber("0x"..serial) print(serial) --tonumber((UnitGUID("target")):sub(-12, -9), 16)) @@ -788,7 +788,7 @@ function SlashCmdList.DETAILS (msg, editbox) Details.id_frame.texto = CreateFrame("editbox", nil, Details.id_frame, "BackdropTemplate") Details.id_frame.texto:SetPoint("topleft", Details.id_frame, "topleft") Details.id_frame.texto:SetAutoFocus(false) - Details.id_frame.texto:SetFontObject (GameFontHighlightSmall) + Details.id_frame.texto:SetFontObject(GameFontHighlightSmall) Details.id_frame.texto:SetHeight(14) Details.id_frame.texto:SetWidth(120) Details.id_frame.texto:SetJustifyH("CENTER") @@ -844,7 +844,7 @@ function SlashCmdList.DETAILS (msg, editbox) _detalhes.id_frame.texto = CreateFrame("editbox", nil, _detalhes.id_frame) _detalhes.id_frame.texto:SetPoint("topleft", _detalhes.id_frame, "topleft") _detalhes.id_frame.texto:SetAutoFocus(false) - _detalhes.id_frame.texto:SetFontObject (GameFontHighlightSmall) + _detalhes.id_frame.texto:SetFontObject(GameFontHighlightSmall) _detalhes.id_frame.texto:SetHeight(14) _detalhes.id_frame.texto:SetWidth(120) _detalhes.id_frame.texto:SetJustifyH("CENTER") @@ -879,8 +879,8 @@ function SlashCmdList.DETAILS (msg, editbox) end else - print(pass_guid.. " -> " .. tonumber (pass_guid:sub(6, 10), 16)) - _detalhes.id_frame.texto:SetText(""..tonumber (pass_guid:sub(6, 10), 16)) + print(pass_guid.. " -> " .. tonumber(pass_guid:sub(6, 10), 16)) + _detalhes.id_frame.texto:SetText(""..tonumber(pass_guid:sub(6, 10), 16)) _detalhes.id_frame.texto:HighlightText() end @@ -931,7 +931,7 @@ function SlashCmdList.DETAILS (msg, editbox) elseif (command == "names") then local t, filter = rest:match("^(%S*)%s*(.-)$") - t = tonumber (t) + t = tonumber(t) if (not t) then return print("not T found.") end @@ -957,7 +957,7 @@ function SlashCmdList.DETAILS (msg, editbox) local t, filter = rest:match("^(%S*)%s*(.-)$") - t = tonumber (t) + t = tonumber(t) if (not t) then return print("not T found.") end @@ -1073,7 +1073,7 @@ function SlashCmdList.DETAILS (msg, editbox) local x, y = GetPlayerMapPosition ("player") if (not DetailsPosBox) then - _detalhes.gump:CreateTextEntry (UIParent, function()end, 200, 20, nil, "DetailsPosBox") + _detalhes.gump:CreateTextEntry(UIParent, function()end, 200, 20, nil, "DetailsPosBox") DetailsPosBox:SetPoint("center", UIParent, "center") end @@ -1309,7 +1309,7 @@ function SlashCmdList.DETAILS (msg, editbox) --texture:SetTexture([[Interface\Store\Store-Splash]]) --texture:SetTexture([[Interface\AddOns\Details\images\options_window]]) --texture:SetTexture([[Interface\CHARACTERFRAME\Button_BloodPresence_DeathKnight]]) - --texture:SetTexCoord (unpack(_detalhes.class_specs_coords [spec])) + --texture:SetTexCoord(unpack(_detalhes.class_specs_coords [spec])) --a:SetAlpha(abs(math.sin (time))) --a:SetValue(abs(math.sin (time))) @@ -1362,7 +1362,7 @@ function SlashCmdList.DETAILS (msg, editbox) local spec = DetailsFramework.GetSpecialization() if (spec) then - local specID = DetailsFramework.GetSpecializationInfo (spec) + local specID = DetailsFramework.GetSpecializationInfo(spec) if (specID and specID ~= 0) then print("Current SpecID: ", specID) end @@ -1612,7 +1612,7 @@ function SlashCmdList.DETAILS (msg, editbox) local keys = {} --copy from table2 to table1 overwriting values - function f.copy (t1, t2) + function f.copy(t1, t2) if (t1.Timer) then t1, t2 = t1.t1, t1.t2 end @@ -1632,7 +1632,7 @@ function SlashCmdList.DETAILS (msg, editbox) keys [key] = true - f.copy (t1 [key], t2 [key]) + f.copy(t1 [key], t2 [key]) else t1 [key] = value end @@ -1641,8 +1641,8 @@ function SlashCmdList.DETAILS (msg, editbox) return t1 end - --local copySegment = f.copy ({}, _detalhes.tabela_vigente) - local copySegment = f.copy ({}, _detalhes.tabela_historico.tabelas [2]) + --local copySegment = f.copy({}, _detalhes.tabela_vigente) + local copySegment = f.copy({}, _detalhes.tabela_historico.tabelas [2]) --the segment received is raw and does not have metatables, need to refresh them local zipData = Details:CompressData (copySegment, "print") @@ -1664,7 +1664,7 @@ function SlashCmdList.DETAILS (msg, editbox) --attempt to cast the passed value to the same value as the type in the profile if (whichType == "number") then - rest = tonumber (rest) + rest = tonumber(rest) if (rest) then _detalhes [command] = rest print(Loc ["STRING_DETAILS1"] .. "config '" .. command .. "' set to " .. rest) @@ -1673,7 +1673,7 @@ function SlashCmdList.DETAILS (msg, editbox) end elseif (whichType == "string") then - rest = tostring (rest) + rest = tostring(rest) if (rest) then _detalhes [command] = rest print(Loc ["STRING_DETAILS1"] .. "config '" .. command .. "' set to " .. rest) @@ -1727,7 +1727,7 @@ function Details.RefreshUserList (ignoreIfHidden) return end - local newList = DetailsFramework.table.copy ({}, _detalhes.users or {}) + local newList = DetailsFramework.table.copy({}, _detalhes.users or {}) table.sort (newList, function(t1, t2) return t1[3] > t2[3] @@ -1740,7 +1740,7 @@ function Details.RefreshUserList (ignoreIfHidden) local foundPlayer for o = 1, #newList do - if (newList[o][1]:find (playerName)) then + if (newList[o][1]:find(playerName)) then foundPlayer = true break end @@ -1845,7 +1845,7 @@ function Details:UpdateUserPanel (usersTable) line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) line:SetBackdropColor(unpack(backdrop_color)) - DetailsFramework:Mixin (line, DetailsFramework.HeaderFunctions) + DetailsFramework:Mixin(line, DetailsFramework.HeaderFunctions) line:SetScript("OnEnter", lineOnEnter) line:SetScript("OnLeave", lineOnLeave) @@ -1949,10 +1949,10 @@ function _detalhes:CreateListPanel() row.text:SetPoint("topleft", _detalhes.ListPanel.container, "topleft", 0, -index * 15) end - if (filter and text:find (filter)) then - row.text:SetTextColor (1, 1, 0) + if (filter and text:find(filter)) then + row.text:SetTextColor(1, 1, 0) else - row.text:SetTextColor (1, 1, 1) + row.text:SetTextColor(1, 1, 1) end row.text:SetText(text) diff --git a/functions/spells.lua b/functions/spells.lua index 887bd6ff..ab6fe8ff 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -428,10 +428,13 @@ do --Devastation Evoker: [368847] = 1467, --Firestorm + [369374] = 1467, --Firestorm [370452] = 1467, --Shattering Star [375087] = 1467, --Dragonrage [359073] = 1467, --Eternity Surge + [359077] = 1467, --Eternity Surge [357211] = 1467, --Pyre + [357212] = 1467, --Pyre --Preservation Evoker: [370960] = 1468, --Emerald Communion @@ -2960,8 +2963,34 @@ do [20243] = "WARRIOR", --devastate [115767] = "WARRIOR", --deep wounds [109128] = "WARRIOR", --charge - [109128] = "WARRIOR", --charge [12880] = "WARRIOR", --enrage + + --evoker: + [368847] = "EVOKER", --Firestorm + [370452] = "EVOKER", --Shattering Star + [375087] = "EVOKER", --Dragonrage + [359073] = "EVOKER", --Eternity Surge + [369374] = "EVOKER", --Firestorm + [357211] = "EVOKER", --Pyre + [357212] = "EVOKER", --Pyre + [370960] = "EVOKER", --Emerald Communion + [370537] = "EVOKER", --Stasis + [367226] = "EVOKER", --Spiritbloom + [361178] = "EVOKER", --Mass Return + [359816] = "EVOKER", --Dream Flight + [355936] = "EVOKER", --Dream Breath + [357170] = "EVOKER", --Time Dilation + [363534] = "EVOKER", --Rewind + [360823] = "EVOKER", --Naturalize + [373861] = "EVOKER", --Temporal Anomaly + [366155] = "EVOKER", --Reversion + [364343] = "EVOKER", --Echo + [356995] = "EVOKER", --Desintegrate + [357209] = "EVOKER", --Fire Breath + [359077] = "EVOKER", --Eternity Surge + [361500] = "EVOKER", --Living Flame + [353759] = "EVOKER", --Deep Breath + [387036] = "EVOKER", --Burning Embers } _detalhes.AbsorbSpells = { @@ -3949,11 +3978,11 @@ do return _detalhes.spells_school [school] and _detalhes.spells_school [school].formated or "" end local default_school_color = {145/255, 180/255, 228/255} - function _detalhes:GetSpellSchoolColor (school) + function _detalhes:GetSpellSchoolColor(school) return unpack(_detalhes.spells_school [school] and _detalhes.spells_school [school].decimals or default_school_color) end function _detalhes:GetCooldownList (class) - class = class or select(2, UnitClass ("player")) + class = class or select(2, UnitClass("player")) return _detalhes.DefensiveCooldownSpells [class] end end diff --git a/functions/testbars.lua b/functions/testbars.lua index dcffea14..663ba1eb 100644 --- a/functions/testbars.lua +++ b/functions/testbars.lua @@ -31,7 +31,7 @@ end function Details:CreateTestBars (alphabet, isArena) local current_combat = Details:GetCombat("current") - local pclass = select(2, UnitClass ("player")) + local pclass = select(2, UnitClass("player")) local actors_name = { {"Spiro", "EVOKER", 1467}, diff --git a/functions/timedata.lua b/functions/timedata.lua index 320784be..7f39f700 100644 --- a/functions/timedata.lua +++ b/functions/timedata.lua @@ -502,17 +502,17 @@ return end - text = text:gsub ("{dmg}", get_player_damage) - text = text:gsub ("{rdps}", get_raid_dps) - text = text:gsub ("{rhps}", get_raid_hps) - text = text:gsub ("{dps}", get_player_dps) - text = text:gsub ("{heal}", get_player_heal) - text = text:gsub ("{hps}", get_player_hps) - text = text:gsub ("{time}", get_combat_time) - text = text:gsub ("{dpos}", get_damage_position) - text = text:gsub ("{hpos}", get_heal_position) - text = text:gsub ("{ddiff}", get_damage_diff) - text = text:gsub ("{hdiff}", get_heal_diff) + text = text:gsub("{dmg}", get_player_damage) + text = text:gsub("{rdps}", get_raid_dps) + text = text:gsub("{rhps}", get_raid_hps) + text = text:gsub("{dps}", get_player_dps) + text = text:gsub("{heal}", get_player_heal) + text = text:gsub("{hps}", get_player_hps) + text = text:gsub("{time}", get_combat_time) + text = text:gsub("{dpos}", get_damage_position) + text = text:gsub("{hpos}", get_heal_position) + text = text:gsub("{ddiff}", get_damage_diff) + text = text:gsub("{hdiff}", get_heal_diff) return text end diff --git a/plugins/Details_DataStorage/Details_DataStorage.lua b/plugins/Details_DataStorage/Details_DataStorage.lua index fe9ab9bc..51c564f4 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.lua +++ b/plugins/Details_DataStorage/Details_DataStorage.lua @@ -26,7 +26,7 @@ f:SetScript("OnEvent", function(self, event, addonName) if (DetailsDataStorage.VERSION < DETAILS_STORAGE_VERSION) then --do revisions if (DetailsDataStorage.VERSION < 5) then - table.wipe (DetailsDataStorage) + table.wipe(DetailsDataStorage) DetailsDataStorage = _detalhes:CreateStorageDB() end end diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua index 23321c75..deea2e39 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.lua +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.lua @@ -227,7 +227,7 @@ local function CreatePluginFrames (data) end --wipe emotes - table.wipe (EncounterDetails.boss_emotes_table) + table.wipe(EncounterDetails.boss_emotes_table) elseif (event == "GROUP_ONENTER") then if (EncounterDetails.db.show_icon == 2) then @@ -318,7 +318,7 @@ local function CreatePluginFrames (data) if (_G.DBM) then local dbm_timer_callback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) --print(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) - local spell = tostring (spellId) + local spell = tostring(spellId) if (spell and not current_table_dbm [spell]) then current_table_dbm [spell] = {spell, id, msg, timer, icon, bartype, spellId, colorId, modid} end @@ -329,7 +329,7 @@ local function CreatePluginFrames (data) if (BigWigsLoader) then function EncounterDetails:BigWigs_StartBar (event, module, spellid, bar_text, time, icon, ...) --print(event, module, spellid, bar_text, time, icon, ...) - spellid = tostring (spellid) + spellid = tostring(spellid) if (not current_table_bigwigs [spellid]) then current_table_bigwigs [spellid] = {(type(module) == "string" and module) or (module and module.moduleName) or "", spellid or "", bar_text or "", time or 0, icon or ""} end @@ -656,8 +656,8 @@ end overkill = "" end - if (source:find ("%[")) then - source = source:gsub ("%[%*%] ", "") + if (source:find("%[")) then + source = source:gsub("%[%*%] ", "") end GameCooltip:AddLine("" .. _cstr ("%.1f", timeInSeconds - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "-" .. _detalhes:ToK (amount) .. overkill .. " (" .. hp .. "%)", 1, "white", "white") @@ -672,7 +672,7 @@ end end else --heal - local class = Details:GetClass (source) + local class = Details:GetClass(source) local spec = Details:GetSpec (source) GameCooltip:AddLine("" .. _cstr ("%.1f", timeInSeconds - hora_da_morte) .. "s " .. spellname .. " (" .. Details:GetOnlyName(Details:AddClassOrSpecIcon (source, class, spec, 16, true)) .. ")", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") @@ -697,8 +697,8 @@ end elseif (evtype == 4) then --debuff - if (source:find ("%[")) then - source = source:gsub ("%[%*%] ", "") + if (source:find("%[")) then + source = source:gsub("%[%*%] ", "") end GameCooltip:AddLine("" .. _cstr ("%.1f", timeInSeconds - hora_da_morte) .. "s [x" .. amount .. "] " .. spellname .. " (" .. source .. ")", "debuff (" .. hp .. "%)", 1, "white", "white") @@ -856,10 +856,10 @@ local function EnemySkills (habilidade, barra) for index, tabela in ipairs(tabela_jogadores) do local coords = EncounterDetails.class_coords [tabela[3]] - GameCooltip:AddLine(EncounterDetails:GetOnlyName(tabela[1]), ToK (_, tabela[2]) .. " (" .. format ("%.1f", tabela[2] / total * 100) .. "%)", 1, "white") + GameCooltip:AddLine(EncounterDetails:GetOnlyName(tabela[1]), ToK (_, tabela[2]) .. " (" .. format("%.1f", tabela[2] / total * 100) .. "%)", 1, "white") local r, g, b, a = unpack(_detalhes.tooltip.background) - local actorClass = Details:GetClass (tabela[1]) + local actorClass = Details:GetClass(tabela[1]) if (actorClass) then local r, g, b = Details:GetClassColor (actorClass) GameCooltip:AddStatusBar (tabela[2] / topValue * 100, 1, r, g, b, EncounterDetailsFrame.CooltipStatusbarAlpha, false, {value = 100, color = {.21, .21, .21, 0.5}, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) @@ -979,7 +979,7 @@ function _detalhes:BossInfoRowClick (barra, param1) local texto_left, texto_right = GameCooltip:GetText (i) if (texto_left and texto_right) then - texto_left = texto_left:gsub (("|T(.*)|t "), "") + texto_left = texto_left:gsub(("|T(.*)|t "), "") reportar [#reportar+1] = ""..texto_left.." "..texto_right.."" end end @@ -999,7 +999,7 @@ function _detalhes:BossInfoRowClick (barra, param1) texto_right = texto_right:GetText() if (texto_left and texto_right) then - texto_left = texto_left:gsub (("|T(.*)|t "), "") + texto_left = texto_left:gsub(("|T(.*)|t "), "") reportar [#reportar+1] = ""..texto_left.." "..texto_right.."" end end @@ -1254,20 +1254,20 @@ function EncounterDetails:OpenAndRefresh (_, segment) if (L) then EncounterDetailsFrame.boss_icone:SetTexture(Texture) - EncounterDetailsFrame.boss_icone:SetTexCoord (L, R, T, B) + EncounterDetailsFrame.boss_icone:SetTexCoord(L, R, T, B) else EncounterDetailsFrame.boss_icone:SetTexture([[Interface\CHARACTERFRAME\TempPortrait]]) - EncounterDetailsFrame.boss_icone:SetTexCoord (0, 1, 0, 1) + EncounterDetailsFrame.boss_icone:SetTexCoord(0, 1, 0, 1) end --[=[ local file, L, R, T, B = EncounterDetails:GetRaidBackground (_combat_object.is_boss.mapid) if (file) then EncounterDetailsFrame.raidbackground:SetTexture(file) - EncounterDetailsFrame.raidbackground:SetTexCoord (L, R, T, B) + EncounterDetailsFrame.raidbackground:SetTexCoord(L, R, T, B) else EncounterDetailsFrame.raidbackground:SetTexture([[Interface\Glues\LOADINGSCREENS\LoadScreenDungeon]]) - EncounterDetailsFrame.raidbackground:SetTexCoord (0, 1, 120/512, 408/512) + EncounterDetailsFrame.raidbackground:SetTexCoord(0, 1, 120/512, 408/512) end --]=] @@ -1306,8 +1306,8 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.report_text = Loc ["STRING_PLUGIN_NAME"].."! "..Loc ["STRING_DAMAGE_TAKEN_REPORT"] end - if (jogador.nome:find ("-")) then - barra.lineText1:SetText(jogador.nome:gsub (("-.*"), "")) + if (jogador.nome:find("-")) then + barra.lineText1:SetText(jogador.nome:gsub(("-.*"), "")) else barra.lineText1:SetText(jogador.nome) end @@ -1318,7 +1318,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = jogador - barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [jogador.classe])) + barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [jogador.classe])) if (index == 1) then barra.textura:SetValue(100) @@ -1331,11 +1331,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) if (specID) then local texture, l, r, t, b = Details:GetSpecIcon (specID, false) barra.icone:SetTexture(texture) - barra.icone:SetTexCoord (l, r, t, b) + barra.icone:SetTexCoord(l, r, t, b) else barra.icone:SetTexture("Interface\\AddOns\\Details\\images\\classes_small") if (EncounterDetails.class_coords [jogador.classe]) then - barra.icone:SetTexCoord (_unpack(EncounterDetails.class_coords [jogador.classe])) + barra.icone:SetTexCoord(_unpack(EncounterDetails.class_coords [jogador.classe])) end end @@ -1535,7 +1535,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = habilidade --barra.jogador agora tem a tabela com --[1] total dano causado [2] jogadores que foram alvos [3] jogadores que castaram essa magia [4] ID da magia local spellSchool = _detalhes.spell_school_cache [nome_magia] or 1 - local r, g, b = _detalhes:GetSpellSchoolColor (spellSchool) + local r, g, b = _detalhes:GetSpellSchoolColor(spellSchool) barra.t:SetVertexColor(r, g, b) @@ -1547,7 +1547,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) end barra.icone:SetTexture(icone_magia) - barra.icone:SetTexCoord (.1, .9, .1, .9) + barra.icone:SetTexCoord(.1, .9, .1, .9) barra:Show() quantidade = quantidade + 1 @@ -1601,7 +1601,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) local nome = jogador.nome - if (not nome:find ("%*")) then + if (not nome:find("%*")) then local tabela = {nome = nome, total = 0, dano_em = {}, dano_em_total = 0, damage_from = {}, damage_from_total = 0} --total de dano que ele causou @@ -1673,7 +1673,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, EncounterDetails.CooltipLineHeight, EncounterDetails.CooltipLineHeight, (coords[1]), (coords[2]), (coords[3]), (coords[4])) end - local actorClass = Details:GetClass (esta_tabela[1]) + local actorClass = Details:GetClass(esta_tabela[1]) if (actorClass) then local r, g, b = Details:GetClassColor (actorClass) GameCooltip:AddStatusBar (esta_tabela[2] / topDamage * 100, 1, r, g, b, EncounterDetailsFrame.CooltipStatusbarAlpha, false, {value = 100, color = {.21, .21, .21, 0.5}, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) @@ -1722,7 +1722,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, EncounterDetails.CooltipLineHeight, EncounterDetails.CooltipLineHeight, (coords[1]), (coords[2]), (coords[3]), (coords[4])) end - local actorClass = Details:GetClass (esta_tabela[1]) + local actorClass = Details:GetClass(esta_tabela[1]) if (actorClass) then local r, g, b = Details:GetClassColor (actorClass) GameCooltip:AddStatusBar (esta_tabela[2] / topDamage * 100, 1, r, g, b, EncounterDetailsFrame.CooltipStatusbarAlpha, false, {value = 100, color = {.21, .21, .21, 0.5}, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) @@ -1822,8 +1822,8 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = esta_tabela --barra.jogador agora tem a tabela com --[1] total dano causado [2] jogadores que foram alvos [3] jogadores que castaram essa magia [4] ID da magia - --barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [jogador.classe])) - barra.textura:SetStatusBarColor (1, 1, 1, 1) --a cor pode ser a spell school da magia + --barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [jogador.classe])) + barra.textura:SetStatusBarColor(1, 1, 1, 1) --a cor pode ser a spell school da magia barra.textura:SetValue(100) barra:Show() @@ -1923,7 +1923,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = tabela - --barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [jogador.classe])) + --barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [jogador.classe])) if (index == 1) then barra.textura:SetValue(100) @@ -1933,7 +1933,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) end barra.icone:SetTexture(icone_magia) - barra.icone:SetTexCoord (.1, .9, .1, .9) + barra.icone:SetTexCoord(.1, .9, .1, .9) barra:Show() @@ -2026,7 +2026,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = tabela - --barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [jogador.classe])) + --barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [jogador.classe])) if (index == 1) then barra.textura:SetValue(100) @@ -2036,7 +2036,7 @@ function EncounterDetails:OpenAndRefresh (_, segment) end barra.icone:SetTexture(icone_magia) - barra.icone:SetTexCoord (.1, .9, .1, .9) + barra.icone:SetTexCoord(.1, .9, .1, .9) barra:Show() @@ -2078,14 +2078,14 @@ function EncounterDetails:OpenAndRefresh (_, segment) local overlayTexture = barra:CreateTexture(nil, "overlay") overlayTexture:SetAllPoints() - overlayTexture:SetColorTexture (1, 1, 1) + overlayTexture:SetColorTexture(1, 1, 1) overlayTexture:SetAlpha(1) overlayTexture:Hide() barra.OverlayTexture = overlayTexture end - if (tabela [3]:find ("-")) then - barra.lineText1:SetText(index..". "..tabela [3]:gsub (("-.*"), "")) + if (tabela [3]:find("-")) then + barra.lineText1:SetText(index..". "..tabela [3]:gsub(("-.*"), "")) else barra.lineText1:SetText(index..". "..tabela [3]) end @@ -2097,11 +2097,11 @@ function EncounterDetails:OpenAndRefresh (_, segment) barra.jogador = tabela barra.extra = habilidades_info - barra.textura:SetStatusBarColor (_unpack(_detalhes.class_colors [tabela [4]])) + barra.textura:SetStatusBarColor(_unpack(_detalhes.class_colors [tabela [4]])) barra.textura:SetValue(100) barra.icone:SetTexture("Interface\\AddOns\\Details\\images\\classes_small") - barra.icone:SetTexCoord (_unpack(EncounterDetails.class_coords [tabela [4]])) + barra.icone:SetTexCoord(_unpack(EncounterDetails.class_coords [tabela [4]])) barra:Show() diff --git a/plugins/Details_EncounterDetails/frames.lua b/plugins/Details_EncounterDetails/frames.lua index 2124a65c..7d3405d4 100644 --- a/plugins/Details_EncounterDetails/frames.lua +++ b/plugins/Details_EncounterDetails/frames.lua @@ -186,18 +186,18 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) row.t = t row.textura:SetStatusBarTexture (t) - row.textura:SetStatusBarColor (.5, .5, .5, 0) + row.textura:SetStatusBarColor(.5, .5, .5, 0) row.textura:SetMinMaxValues(0,100) row.lineText1 = row.textura:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") row.lineText1:SetPoint("LEFT", row.textura, "LEFT", 22, -1) row.lineText1:SetJustifyH("LEFT") - row.lineText1:SetTextColor (1,1,1,1) + row.lineText1:SetTextColor(1,1,1,1) row.lineText4 = row.textura:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") row.lineText4:SetPoint("RIGHT", row.textura, "RIGHT", -2, 0) row.lineText4:SetJustifyH("RIGHT") - row.lineText4:SetTextColor (1,1,1,1) + row.lineText4:SetTextColor(1,1,1,1) row.textura:Show() end @@ -507,7 +507,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) --time of death and player name GameCooltip:AddLine(vRowFrame.dead[6].." "..vRowFrame.dead[3]) - local class, l, r, t, b = _detalhes:GetClass (vRowFrame.dead[3]) + local class, l, r, t, b = _detalhes:GetClass(vRowFrame.dead[3]) if (class) then GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small]], 1, 1, 12, 12, l, r, t, b) end @@ -552,7 +552,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) vRowFrame.icon = vRowFrame:CreateTexture(nil, "overlay") vRowFrame.icon:SetTexture("Interface\\WorldStateFrame\\SkullBones") - vRowFrame.icon:SetTexCoord (0.046875, 0.453125, 0.046875, 0.46875) + vRowFrame.icon:SetTexCoord(0.046875, 0.453125, 0.046875, 0.46875) vRowFrame.icon:SetWidth(16) vRowFrame.icon:SetHeight(16) vRowFrame.icon:SetPoint("center", "DetailsEncountersVerticalLine"..i, "center") @@ -762,7 +762,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) dlabel.lefttext.text = EncounterDetails:GetOnlyName(player [1]) dlabel.righttext.text = _detalhes:ToK (_math_floor(player [2])) - local class = EncounterDetails:GetClass (player [1]) + local class = EncounterDetails:GetClass(player [1]) local spec = EncounterDetails:GetSpec (player [1]) if (spec) then @@ -775,7 +775,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) else dlabel.icon.texture = [[Interface\LFGFRAME\LFGROLE_BW]] - dlabel.icon:SetTexCoord (.25, .5, 0, 1) + dlabel.icon:SetTexCoord(.25, .5, 0, 1) end dlabel.lefttext:Show() @@ -799,13 +799,13 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) hlabel.lefttext.text = EncounterDetails:GetOnlyName(player [1]) hlabel.righttext.text = _detalhes:ToK (_math_floor(player [2])) - local classe = _detalhes:GetClass (player [1]) + local classe = _detalhes:GetClass(player [1]) if (classe) then hlabel.icon:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) - hlabel.icon:SetTexCoord (unpack(_detalhes.class_coords [classe])) + hlabel.icon:SetTexCoord(unpack(_detalhes.class_coords [classe])) else hlabel.icon:SetTexture([[Interface\LFGFRAME\LFGROLE_BW]]) - hlabel.icon:SetTexCoord (.25, .5, 0, 1) + hlabel.icon:SetTexCoord(.25, .5, 0, 1) end hlabel.lefttext:Show() @@ -831,8 +831,8 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) end local phase_on_leave = function(self) - table.wipe (self.damage_actors) - table.wipe (self.heal_actors) + table.wipe(self.damage_actors) + table.wipe(self.heal_actors) for _, f in ipairs(g.PhaseTextures) do f.texture:SetBlendMode("BLEND") @@ -896,7 +896,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) local t = f:CreateTexture(nil, "artwork") t:SetAllPoints() - t:SetColorTexture (1, 1, 1, phase_alpha) + t:SetColorTexture(1, 1, 1, phase_alpha) t.original_color = {1, 1, 1} f.texture = t @@ -970,7 +970,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) --create lines for damage and time for i = 1, 8, 1 do local line = g:CreateTexture(nil, "overlay") - line:SetColorTexture (unpack(CONST_DAMAGE_LINES_COLOR)) + line:SetColorTexture(unpack(CONST_DAMAGE_LINES_COLOR)) line:SetWidth(CONST_CHART_WIDTH) line:SetHeight(1) @@ -993,7 +993,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) texture:SetWidth(9) texture:SetHeight(9) texture:SetPoint("TOPLEFT", EncounterDetails.Frame, "TOPLEFT", (i*65) + 499, -81) - texture:SetColorTexture (unpack(grafico_cores[i])) + texture:SetColorTexture(unpack(grafico_cores[i])) local text = g:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") text:SetPoint("LEFT", texture, "right", 2, 0) text:SetJustifyH("LEFT") @@ -1011,7 +1011,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) v:SetHeight(CONST_CHART_HEIGHT + 1) v:SetPoint("top", g, "top", 0, 1) v:SetPoint("left", g, "left", CONST_CHART_DAMAGELINE_X_POSITION + 30, 0) --leave 30 pixels for the damage text - v:SetColorTexture (1, 1, 1, 1) + v:SetColorTexture(1, 1, 1, 1) --horizontal line at the bottom side local h = g:CreateTexture(nil, "overlay") @@ -1019,7 +1019,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) h:SetHeight(1) h:SetPoint("top", g, "top", 0, -CONST_CHART_HEIGHT + CONST_PHASE_BAR_HEIGHT*2) h:SetPoint("left", g, "left") - h:SetColorTexture (1, 1, 1, 1) + h:SetColorTexture(1, 1, 1, 1) end -- ~start ~main ~frame ~baseframe ~bossframe @@ -1063,7 +1063,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) local name_bg_texture = BossFrame:CreateTexture(nil, "background") name_bg_texture:SetTexture([[Interface\PetBattles\_PetBattleHorizTile]], true) name_bg_texture:SetHorizTile(true) - name_bg_texture:SetTexCoord (0, 1, 126/256, 19/256) + name_bg_texture:SetTexCoord(0, 1, 126/256, 19/256) name_bg_texture:SetPoint("topleft", BossFrame, "topleft", 2, -22) name_bg_texture:SetPoint("bottomright", BossFrame, "bottomright") name_bg_texture:SetHeight(54) @@ -1126,7 +1126,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) BossFrame.raidbackground = BossFrame:CreateTexture(nil, "BORDER") BossFrame.raidbackground:SetPoint("TOPLEFT", BossFrame, "TOPLEFT", 0, -74) BossFrame.raidbackground:SetPoint("bottomright", BossFrame, "bottomright", 0, 0) - BossFrame.raidbackground:SetDrawLayer ("BORDER", 2) + BossFrame.raidbackground:SetDrawLayer("BORDER", 2) BossFrame.raidbackground:SetAlpha(0.1) --bot�o fechar @@ -1445,7 +1445,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) local i = 0 local lower = string.lower for index, data in ipairs(emote_pool) do - if (lower (data [2]):find (lower(searching))) then + if (lower (data [2]):find(lower(searching))) then i = i + 1 emote_search_table [i] = data end @@ -1485,9 +1485,9 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) local color_string = EncounterDetails.BossWhispColors [data [4]] local color_table = ChatTypeInfo [color_string] - bar.righttext:SetTextColor (color_table.r, color_table.g, color_table.b) + bar.righttext:SetTextColor(color_table.r, color_table.g, color_table.b) bar.icon:SetTexture([[Interface\CHARACTERFRAME\UI-StateIcon]]) - bar.icon:SetTexCoord (0, 0.5, 0.5, 1) + bar.icon:SetTexCoord(0, 0.5, 0.5, 1) bar.icon:SetBlendMode("ADD") else bar:Hide() @@ -1545,20 +1545,20 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) local reportFunc = function() -- remove textures - text = text:gsub ("(|T).*(|t)", "") + text = text:gsub("(|T).*(|t)", "") -- remove colors - text = text:gsub ("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") - text = text:gsub ("|r", "") + text = text:gsub("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") + text = text:gsub("|r", "") -- replace links for _, spellid in text:gmatch ("(|Hspell:)(.-)(|h)") do - local spell = tonumber (spellid) + local spell = tonumber(spellid) local link = GetSpellLink(spell) - text = text:gsub ("(|Hspell).*(|h)", link) + text = text:gsub("(|Hspell).*(|h)", link) end -- remove unit links - text = text:gsub ("(|Hunit).-(|h)", "") + text = text:gsub("(|Hunit).-(|h)", "") -- remove the left space - text = text:gsub ("^%s$", "") + text = text:gsub("^%s$", "") EncounterDetails:SendReportLines ({"Details! Encounter Emote at " .. timeString, "\"" .. text .. "\""}) end @@ -1695,20 +1695,20 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) --"|Hunit:77182:Oregorger|hOregorger prepares to cast |cFFFF0000|Hspell:156879|h[Blackrock Barrage]|h|r." -- remove textures - text = text:gsub ("(|T).*(|t)", "") + text = text:gsub("(|T).*(|t)", "") -- remove colors - text = text:gsub ("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") - text = text:gsub ("|r", "") + text = text:gsub("|c%x?%x?%x?%x?%x?%x?%x?%x?", "") + text = text:gsub("|r", "") -- replace links for _, spellid in text:gmatch ("(|Hspell:)(.-)(|h)") do - local spell = tonumber (spellid) + local spell = tonumber(spellid) local link = GetSpellLink(spell) - text = text:gsub ("(|Hspell).*(|h)", link) + text = text:gsub("(|Hspell).*(|h)", link) end -- remove unit links - text = text:gsub ("(|Hunit).-(|h)", "") + text = text:gsub("(|Hunit).-(|h)", "") -- remove the left space - text = text:gsub ("^%s$", "") + text = text:gsub("^%s$", "") tinsert(EncounterDetails.report_lines, timeString .. " " .. text) added = added + 1 @@ -1842,10 +1842,10 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) for i = 1, CONST_MAX_AURA_LINES do local anchor_frame = CreateFrame("frame", "BossFrameBossModsAnchor" .. i, BossFrame, "BackdropTemplate") - local spellicon = DetailsFrameWork:NewImage (anchor_frame, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") + local spellicon = DetailsFrameWork:NewImage(anchor_frame, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") --timerId - local spellid = DetailsFrameWork:CreateTextEntry (anchor_frame, EncounterDetails.empty_function, 80, 20, nil, "$parentSpellId") + local spellid = DetailsFrameWork:CreateTextEntry(anchor_frame, EncounterDetails.empty_function, 80, 20, nil, "$parentSpellId") spellid:SetTemplate(AurasButtonTemplate) spellid:SetHook("OnEditFocusGained", on_focus_gain) spellid:SetHook("OnEditFocusLost", on_focus_lost) @@ -1853,7 +1853,7 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) spellid:SetHook("OnLeave", on_leave_spell) --ability name - local spellname = DetailsFrameWork:CreateTextEntry (anchor_frame, EncounterDetails.empty_function, 180, 20, nil, "$parentSpellName") + local spellname = DetailsFrameWork:CreateTextEntry(anchor_frame, EncounterDetails.empty_function, 180, 20, nil, "$parentSpellName") spellname:SetTemplate(AurasButtonTemplate) spellname:SetHook("OnEditFocusGained", on_focus_gain) spellname:SetHook("OnEditFocusLost", on_focus_lost) @@ -1887,16 +1887,16 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) for i = 1, CONST_MAX_AURA_LINES do local anchor_frame = CreateFrame("frame", "BossFrameSpellAnchor" .. i, BossFrame, "BackdropTemplate") - local spellicon = DetailsFrameWork:NewImage (anchor_frame, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") + local spellicon = DetailsFrameWork:NewImage(anchor_frame, [[Interface\ICONS\TEMP]], 19, 19, "background", nil, "icon", "$parentIcon") - local spellid = DetailsFrameWork:CreateTextEntry (anchor_frame, EncounterDetails.empty_function, 80, 20) + local spellid = DetailsFrameWork:CreateTextEntry(anchor_frame, EncounterDetails.empty_function, 80, 20) spellid:SetTemplate(AurasButtonTemplate) spellid:SetHook("OnEditFocusGained", on_focus_gain) spellid:SetHook("OnEditFocusLost", on_focus_lost) spellid:SetHook("OnEnter", on_enter_spell) spellid:SetHook("OnLeave", on_leave_spell) - local spellname = DetailsFrameWork:CreateTextEntry (anchor_frame, EncounterDetails.empty_function, 160, 20) + local spellname = DetailsFrameWork:CreateTextEntry(anchor_frame, EncounterDetails.empty_function, 160, 20) spellname:SetTemplate(AurasButtonTemplate) spellname:SetHook("OnEditFocusGained", on_focus_gain) spellname:SetHook("OnEditFocusLost", on_focus_lost) @@ -2133,9 +2133,9 @@ _detalhes.EncounterDetailsTempWindow = function(EncounterDetails) if (timer_table.id == encounter_id) then local spell = timer_id if (spell and not already_added [spell]) then - local int_spell = tonumber (spell) + local int_spell = tonumber(spell) if (not int_spell) then - local spellname = timer_table [2]:gsub (" %(.%)", "") + local spellname = timer_table [2]:gsub(" %(.%)", "") tinsert(t, {label = spellname, value = {timer_table [2], spellname, timer_table [5], timer_table.id}, icon = timer_table [5], onclick = on_select_bw_bar}) elseif (int_spell < 0) then local title, description, depth, abilityIcon, displayInfo, siblingID, nextSectionID, filteredByDifficulty, link, startsOpen, flag1, flag2, flag3, flag4 = C_EncounterJournal.GetSectionInfo (abs(int_spell)) @@ -2182,8 +2182,8 @@ function PhaseFrame:ClearAll() end --update damage and healing scrolls - table.wipe (PhaseFrame.DamageTable) - table.wipe (PhaseFrame.HealingTable) + table.wipe(PhaseFrame.DamageTable) + table.wipe(PhaseFrame.HealingTable) --refresh the scroll PhaseFrame.Damage_Scroll:Refresh() @@ -2239,13 +2239,13 @@ function PhaseFrame.OnSelectPhase (phaseSelected) end --update damage and healing scrolls - table.wipe (PhaseFrame.DamageTable) + table.wipe(PhaseFrame.DamageTable) for charName, amount in pairs(phaseData.damage [phaseSelected]) do tinsert(PhaseFrame.DamageTable, {charName, amount}) end table.sort (PhaseFrame.DamageTable, function(a, b) return a[2] > b[2] end) - table.wipe (PhaseFrame.HealingTable) + table.wipe(PhaseFrame.HealingTable) for charName, amount in pairs(phaseData.heal [phaseSelected]) do tinsert(PhaseFrame.HealingTable, {charName, amount}) end @@ -2339,11 +2339,11 @@ local ScrollRefresh = function(self, data, offset, total_lines) local texture, L, R, T, B = _detalhes:GetPlayerIcon (player[1], PhaseFrame.CurrentSegment) line.icon:SetTexture(texture) - line.icon:SetTexCoord (L, R, T, B) + line.icon:SetTexCoord(L, R, T, B) line.name:SetText(index .. ". " .. removeRealm (_, player[1])) - line.done:SetText(formatToK (_, player[2]) .. " (" .. format ("%.1f", player[2] / topValue * 100) .. "%)") + line.done:SetText(formatToK (_, player[2]) .. " (" .. format("%.1f", player[2] / topValue * 100) .. "%)") line.statusbar:SetValue(player[2] / topValue * 100) - local actorClass = Details:GetClass (player[1]) + local actorClass = Details:GetClass(player[1]) if (actorClass) then line.statusbar:SetColor (actorClass) else @@ -2642,7 +2642,7 @@ end options:SetIcon ([[Interface\Buttons\UI-OptionsButton]], 14, 14, nil, {0, 1, 0, 1}, nil, 3) --macro box - BossFrame.MacroEditBox = DetailsFrameWork:CreateTextEntry (frame, function()end, 300, 20) + BossFrame.MacroEditBox = DetailsFrameWork:CreateTextEntry(frame, function()end, 300, 20) BossFrame.MacroEditBox:SetPoint("left", options, "right", 10, 0) BossFrame.MacroEditBox:SetAlpha(0.5) BossFrame.MacroEditBox:SetText("/run Details:OpenPlugin ('Encounter Breakdown')") @@ -2655,7 +2655,7 @@ end BossFrame.MacroEditBox.BackgroundLabel = DetailsFrameWork:CreateLabel(BossFrame.MacroEditBox, "macro") BossFrame.MacroEditBox.BackgroundLabel:SetPoint("left", BossFrame.MacroEditBox, "left", 6, 0) - BossFrame.MacroEditBox.BackgroundLabel:SetTextColor (.3, .3, .3, .98) + BossFrame.MacroEditBox.BackgroundLabel:SetTextColor(.3, .3, .3, .98) --Caixa do Dano total tomado pela Raid diff --git a/plugins/Details_Streamer/Details_Streamer.lua b/plugins/Details_Streamer/Details_Streamer.lua index 74ab8b87..2e74fcd3 100644 --- a/plugins/Details_Streamer/Details_Streamer.lua +++ b/plugins/Details_Streamer/Details_Streamer.lua @@ -258,9 +258,9 @@ local function CreatePluginFrames() left_resize:SetNormalTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Up]]) left_resize:SetHighlightTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Highlight]]) left_resize:SetPushedTexture([[Interface\CHATFRAME\UI-ChatIM-SizeGrabber-Down]]) - left_resize:GetNormalTexture():SetTexCoord (1, 0, 0, 1) - left_resize:GetHighlightTexture():SetTexCoord (1, 0, 0, 1) - left_resize:GetPushedTexture():SetTexCoord (1, 0, 0, 1) + left_resize:GetNormalTexture():SetTexCoord(1, 0, 0, 1) + left_resize:GetHighlightTexture():SetTexCoord(1, 0, 0, 1) + left_resize:GetPushedTexture():SetTexCoord(1, 0, 0, 1) left_resize:SetScript("OnMouseDown", function(self) if (not SOF.resizing and not StreamOverlay.db.main_frame_locked) then @@ -470,7 +470,7 @@ local function CreatePluginFrames() --left line.icon1:SetTexture(data [1]) - line.icon1:SetTexCoord (5/64, 59/64, 5/64, 59/64) + line.icon1:SetTexCoord(5/64, 59/64, 5/64, 59/64) local text = data [2] line.text1:SetText(text) @@ -500,13 +500,13 @@ local function CreatePluginFrames() end if (data[7]) then - line.text2:SetTextColor (data[7].r, data[7].g, data[7].b) + line.text2:SetTextColor(data[7].r, data[7].g, data[7].b) else - line.text2:SetTextColor (1, 1, 1) + line.text2:SetTextColor(1, 1, 1) end line.icon2:SetTexture(data [4]) - line.icon2:SetTexCoord (unpack(data [5])) + line.icon2:SetTexCoord(unpack(data [5])) if (data [4] == defaultAttackIcon) then line.icon2:SetSize(iconSize*0.8, iconSize*0.8) line.icon2:SetPoint("left", line, "center", 8, 0) @@ -584,7 +584,7 @@ local function CreatePluginFrames() local statusbar = CreateFrame("StatusBar", "StreamOverlayBar" .. index .. "StatusBar", f, "BackdropTemplate") local statusbar_texture = statusbar:CreateTexture(nil, "border") statusbar_texture:SetTexture(1, 1, 1, 0.15) - statusbar:SetStatusBarColor (0, 0, 0, 0) + statusbar:SetStatusBarColor(0, 0, 0, 0) statusbar:SetStatusBarTexture (statusbar_texture) statusbar:SetMinMaxValues(0, 100) statusbar:SetValue(0) @@ -992,7 +992,7 @@ local parse_target_icon = function(targetObject, target) end end else - local _, class = UnitClass (targetObject.nome) + local _, class = UnitClass(targetObject.nome) if (class) then icon2 = [[Interface\AddOns\Details\images\classes_small_alpha]] icon2coords = Details.class_coords [class] @@ -1003,7 +1003,7 @@ local parse_target_icon = function(targetObject, target) end end else - local _, class = UnitClass (target) + local _, class = UnitClass(target) if (class) then icon2 = [[Interface\AddOns\Details\images\classes_small_alpha]] icon2coords = Details.class_coords [class] @@ -1466,7 +1466,7 @@ eventFrame:SetScript("OnEvent", function(self, event, ...) end) -local format_time = function(v) return "-" .. format ("%.2f", v) end +local format_time = function(v) return "-" .. format("%.2f", v) end --when the player die, show the events before the death function StreamOverlay.OnDeath (_, token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, death_table, last_cooldown, death_at_combattime, max_health) @@ -1826,7 +1826,7 @@ function StreamOverlay.OpenOptionsPanel (fromOptionsPanel) local arrowIconTable = {} for _, arrow in ipairs(arrows) do - arrowIconTable[#arrowIconTable+1] = {value = arrow, label = arrow:gsub ("Interface(.*)\\", ""), onclick = setArrowTextureCallback, icon = arrow} + arrowIconTable[#arrowIconTable+1] = {value = arrow, label = arrow:gsub("Interface(.*)\\", ""), onclick = setArrowTextureCallback, icon = arrow} end -- @@ -2581,10 +2581,10 @@ editbox:SetSize(300, 700) editbox:SetPoint("topleft", UIParent, "topleft") editbox:SetBackdrop({bgFile = "Interface\\AddOns\\Details\\images\\background", tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}) editbox:SetBackdropColor(0, 0, 0, .2) -editbox:SetAutoFocus (false) +editbox:SetAutoFocus(false) editbox:ClearFocus() editbox:SetMultiLine (true) -editbox:SetFontObject (GameFontHighlightSmall) +editbox:SetFontObject(GameFontHighlightSmall) editbox:SetJustifyH("CENTER") editbox:EnableMouse(true) editbox:SetText("") @@ -2599,9 +2599,9 @@ local helpful_spells = StreamOverlay.HelpfulSpells if (not harmful_spells [spellid] and not helpful_spells [spellid]) then if (bit.band(who_flags, 0x00000400) ~= 0 and who_name) then local text = editbox:GetText() - if (not list:find (spellid) and not text:find (spellid)) then + if (not list:find(spellid) and not text:find(spellid)) then - local class = _detalhes:GetClass (who_name) or "unknow" + local class = _detalhes:GetClass(who_name) or "unknow" if (class ~= "unknow") then text = text .. "\n"..spellid .. " " .. spellname .. " " .. class diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.lua b/plugins/Details_TinyThreat/Details_TinyThreat.lua index c5d7676d..f6faaa28 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.lua +++ b/plugins/Details_TinyThreat/Details_TinyThreat.lua @@ -372,7 +372,7 @@ local function CreatePluginFrames (data) UpdateTableFromThreatSituation(threat_table, "player", unitId) --pet - if (UnitExists ("pet")) then + if (UnitExists("pet")) then local thisplayer_name = GetUnitName("pet", true) .. " *PET*" local threat_table_index = ThreatMeter.player_list_hash [thisplayer_name] local threat_table = ThreatMeter.player_list_indexes [threat_table_index] @@ -443,7 +443,7 @@ local function CreatePluginFrames (data) if needRelativePullBar then thisRow._icon:SetTexture([[Interface\PVPFrame\Icon-Combat]]) - thisRow._icon:SetTexCoord (0, 1, 0, 1) + thisRow._icon:SetTexCoord(0, 1, 0, 1) local myPullThreat = me[6]*(100/me[2]) local r,g = ThreatMeter:percent_color(me[2], true) @@ -465,7 +465,7 @@ local function CreatePluginFrames (data) if needRangedPullBar and ((not threatActor) or (threatActor[7] < 130)) then thisRow._icon:SetTexture([[Interface\PaperDoll\UI-PaperDoll-Slot-Ranged]]) - thisRow._icon:SetTexCoord (0, 1, 0, 1) + thisRow._icon:SetTexCoord(0, 1, 0, 1) thisRow:SetLeftText ("Ranged pull at") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat*1.3) .. " (130.0%)") @@ -483,7 +483,7 @@ local function CreatePluginFrames (data) if needMeleePullBar and ((not threatActor) or (threatActor[7] < 110)) then thisRow._icon:SetTexture([[Interface\PaperDoll\UI-PaperDoll-Slot-MainHand]]) - thisRow._icon:SetTexCoord (0, 1, 0, 1) + thisRow._icon:SetTexCoord(0, 1, 0, 1) thisRow:SetLeftText ("Melee pull at") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat*1.1) .. " (110.0%)") @@ -501,7 +501,7 @@ local function CreatePluginFrames (data) if needMainTankDummyBar and ((not threatActor) or (not useAbsoluteMode) or (threatActor[6] < mainTankAbsoluteThreat)) then thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord (_unpack(RoleIconCoord ["TANK"])) + thisRow._icon:SetTexCoord(_unpack(RoleIconCoord ["TANK"])) thisRow:SetLeftText ("Current Tank") thisRow:SetRightText(ThreatMeter:ToK2 (mainTankAbsoluteThreat) .. " (100.0%)") @@ -530,7 +530,7 @@ local function CreatePluginFrames (data) if gougeThreshold and ((not threatActor) or (threatActor[6] < gougeThreshold)) then local spellName, _, spellTexture = GetSpellInfo(gougeSpellId) thisRow._icon:SetTexture(spellTexture) - thisRow._icon:SetTexCoord (0, 1, 0, 1) + thisRow._icon:SetTexCoord(0, 1, 0, 1) local pct = gougeThreshold * 100 / mainTankAbsoluteThreat @@ -551,7 +551,7 @@ local function CreatePluginFrames (data) if (threatActor) then local role = threatActor[4] thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord (_unpack(RoleIconCoord [role])) + thisRow._icon:SetTexCoord(_unpack(RoleIconCoord [role])) thisRow:SetLeftText (ThreatMeter:GetOnlyName(threatActor [1])) @@ -608,10 +608,10 @@ local function CreatePluginFrames (data) if (threat_actor [2] and threat_actor [2] > 0.1) then local thisRow = ThreatMeter.ShownRows [#ThreatMeter.ShownRows] thisRow:SetLeftText (player) - --thisRow.textleft:SetTextColor (unpack(RAID_CLASS_COLORS [threat_actor [5]])) + --thisRow.textleft:SetTextColor(unpack(RAID_CLASS_COLORS [threat_actor [5]])) local role = threat_actor [4] thisRow._icon:SetTexture([[Interface\LFGFrame\UI-LFG-Icon-PortraitRoles]]) - thisRow._icon:SetTexCoord (_unpack(RoleIconCoord [role])) + thisRow._icon:SetTexCoord(_unpack(RoleIconCoord [role])) thisRow:SetRightText (ThreatMeter:ToK2 (threat_actor [6]) .. " (" .. _cstr ("%.1f", threat_actor [2]) .. "%)") thisRow:SetValue(threat_actor [2]) @@ -665,7 +665,7 @@ local function CreatePluginFrames (data) for i = 1, GetNumGroupMembers(), 1 do local thisplayer_name = GetUnitName("raid"..i, true) local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass (thisplayer_name) + local _, class = UnitClass(thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes @@ -675,14 +675,14 @@ local function CreatePluginFrames (data) for i = 1, GetNumGroupMembers()-1, 1 do local thisplayer_name = GetUnitName("party"..i, true) local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass (thisplayer_name) + local _, class = UnitClass(thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes end local thisplayer_name = GetUnitName("player", true) local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass (thisplayer_name) + local _, class = UnitClass(thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes @@ -690,12 +690,12 @@ local function CreatePluginFrames (data) else local thisplayer_name = GetUnitName("player", true) local role = _UnitGroupRolesAssigned(thisplayer_name) - local _, class = UnitClass (thisplayer_name) + local _, class = UnitClass(thisplayer_name) local t = {thisplayer_name, 0, false, role, class, 0, 0} ThreatMeter.player_list_indexes [#ThreatMeter.player_list_indexes+1] = t ThreatMeter.player_list_hash [thisplayer_name] = #ThreatMeter.player_list_indexes - if (UnitExists ("pet")) then + if (UnitExists("pet")) then local thispet_name = GetUnitName("pet", true) .. " *PET*" local role = "DAMAGER" local t = {thispet_name, 0, false, role, class, 0, 0} @@ -906,7 +906,7 @@ function ThreatMeter:OnEvent (_, event, ...) elseif (command == Loc ["STRING_SLASH_SPEED"]) then if (rest) then - local speed = tonumber (rest) + local speed = tonumber(rest) if (speed) then if (speed > 3) then speed = 3 diff --git a/plugins/Details_Vanguard/Details_Vanguard.lua b/plugins/Details_Vanguard/Details_Vanguard.lua index 0d722a85..575ef53f 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.lua +++ b/plugins/Details_Vanguard/Details_Vanguard.lua @@ -183,10 +183,10 @@ local function CreatePluginFrames (data) --search for tanks in the raid or party group function Vanguard:IdentifyTanks() - table.wipe (Vanguard.TankList) - table.wipe (Vanguard.TankHashNames) - table.wipe (Vanguard.TankIncDamage) - table.wipe (Vanguard.UnitIdCache) + table.wipe(Vanguard.TankList) + table.wipe(Vanguard.TankHashNames) + table.wipe(Vanguard.TankIncDamage) + table.wipe(Vanguard.UnitIdCache) for i = 1, CONST_MAX_TANKS do Vanguard.auraUpdateFrames[i]:UnregisterEvent("UNIT_AURA") @@ -319,16 +319,16 @@ local function CreatePluginFrames (data) local bar = self.heal_inc bar.tankname = name - local class, left, right, top, bottom, r, g, b = Vanguard:GetClass (name) + local class, left, right, top, bottom, r, g, b = Vanguard:GetClass(name) local spec = Vanguard:GetSpec (name) if (spec) then self.specicon:SetTexture(Vanguard.CurrentInstance.row_info.spec_file) - self.specicon:SetTexCoord (_unpack(Vanguard.class_specs_coords [spec])) + self.specicon:SetTexCoord(_unpack(Vanguard.class_specs_coords [spec])) else self.specicon:SetTexture(Vanguard.CurrentInstance.row_info.icon_file) - self.specicon:SetTexCoord (left, right, top, bottom) + self.specicon:SetTexCoord(left, right, top, bottom) end self.unitFrame:SetUnit(Vanguard.UnitIdCache[name]) @@ -338,7 +338,7 @@ local function CreatePluginFrames (data) self.unitFrame.healthBar:SetColor(r, g, b) bar.lefticon = Vanguard.CurrentInstance.row_info.icon_file - bar.iconleft:SetTexCoord (left, right, top, bottom) + bar.iconleft:SetTexCoord(left, right, top, bottom) bar:SetLeftText (Vanguard:GetOnlyName(name)) bar:SetLeftText (name) diff --git a/startup.lua b/startup.lua index be8244cf..46e791d3 100644 --- a/startup.lua +++ b/startup.lua @@ -107,113 +107,114 @@ function Details:StartMeUp() --I'll never stop! self.atributo_custom:UpdateSelectedToKFunction() --start instances updater - self:CheckSwitchOnLogon() + self:CheckSwitchOnLogon() - function Details:ScheduledWindowUpdate(forced) - if (not forced and Details.in_combat) then - return - end + function Details:ScheduledWindowUpdate(forced) + if (not forced and Details.in_combat) then + return + end + Details.scheduled_window_update = nil + Details:RefreshMainWindow(-1, true) + end + + function Details:ScheduleWindowUpdate(time, forced) + if (Details.scheduled_window_update) then + Details.Schedules.Cancel(Details.scheduled_window_update) Details.scheduled_window_update = nil - Details:RefreshMainWindow(-1, true) end - function Details:ScheduleWindowUpdate(time, forced) - if (Details.scheduled_window_update) then - Details.Schedules.Cancel(Details.scheduled_window_update) - Details.scheduled_window_update = nil + Details.scheduled_window_update = Details.Schedules.NewTimer(time or 1, Details.ScheduledWindowUpdate, Details, forced) + end + + self:RefreshMainWindow(-1, true) + Details:RefreshUpdater() + + for id = 1, Details:GetNumInstances() do + local instance = Details:GetInstance(id) + if (instance:IsEnabled()) then + Details.Schedules.NewTimer(1, Details.RefreshBars, Details, instance) + Details.Schedules.NewTimer(1, Details.InstanceReset, Details, instance) + Details.Schedules.NewTimer(1, Details.InstanceRefreshRows, Details, instance) + end + end + + function self:RefreshAfterStartup() + --repair nicknames as nicknames aren't saved within the actor when leaving the game + if (not Details.ignore_nicktag) then + local currentCombat = Details:GetCurrentCombat() + local containerDamage = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) + for _, actorObject in containerDamage:ListActors() do + --get the actor nickname + local nickname = Details:GetNickname(actorObject:Name(), false, true) + if (nickname and type(nickname) == "string" and nickname:len() >= 2) then + actorObject:SetDisplayName(nickname) + end end - Details.scheduled_window_update = Details.Schedules.NewTimer(time or 1, Details.ScheduledWindowUpdate, Details, forced) end - self:RefreshMainWindow(-1, true) - Details:RefreshUpdater() + local refreshAllInstances = -1 + local forceRefresh = true + self:RefreshMainWindow(refreshAllInstances, forceRefresh) + local lowerInstance = Details:GetLowerInstanceNumber() for id = 1, Details:GetNumInstances() do local instance = Details:GetInstance(id) if (instance:IsEnabled()) then - Details.Schedules.NewTimer(1, Details.RefreshBars, Details, instance) - Details.Schedules.NewTimer(1, Details.InstanceReset, Details, instance) - Details.Schedules.NewTimer(1, Details.InstanceRefreshRows, Details, instance) + --refresh wallpaper + if (instance.wallpaper.enabled) then + instance:InstanceWallpaper(true) + else + instance:InstanceWallpaper(false) + end + + --refresh desaturated icons if is lower instance because plugins shall have installed their icons at this point + if (id == lowerInstance) then + instance:DesaturateMenu() + instance:SetAutoHideMenu(nil, nil, true) + end end end - function self:RefreshAfterStartup() - --repair nicknames as nicknames aren't saved within the actor when leaving the game - if (not Details.ignore_nicktag) then - local currentCombat = Details:GetCurrentCombat() - local containerDamage = currentCombat:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) - for _, actorObject in containerDamage:ListActors() do - --get the actor nickname - local nickname = Details:GetNickname(actorObject:Name(), false, true) - if (nickname and type(nickname) == "string" and nickname:len() >= 2) then - actorObject:SetDisplayName(nickname) - end + --refresh lower instance plugin icons and skin + Details.ToolBar:ReorganizeIcons() + + --refresh skin for other windows + if (lowerInstance) then + for id = lowerInstance+1, Details:GetNumInstances() do + local instance = Details:GetInstance(id) + if (instance and instance.baseframe and instance.ativa) then + instance:ChangeSkin() end end + end - local refreshAllInstances = -1 - local forceRefresh = true - self:RefreshMainWindow(refreshAllInstances, forceRefresh) - local lowerInstance = Details:GetLowerInstanceNumber() + self.RefreshAfterStartup = nil - for id = 1, Details:GetNumInstances() do - local instance = Details:GetInstance(id) - if (instance:IsEnabled()) then - --refresh wallpaper - if (instance.wallpaper.enabled) then - instance:InstanceWallpaper(true) - else + function Details:CheckWallpaperAfterStartup() + if (not Details.profile_loaded) then + Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details) + end + + for id = 1, self.instances_amount do + local instance = self:GetInstance(id) + if (instance and instance:IsEnabled()) then + if (not instance.wallpaper.enabled) then instance:InstanceWallpaper(false) end - --refresh desaturated icons if is lower instance because plugins shall have installed their icons at this point - if (id == lowerInstance) then - instance:DesaturateMenu() - instance:SetAutoHideMenu(nil, nil, true) - end + instance.do_not_snap = true + self.move_janela_func(instance.baseframe, true, instance, true) + self.move_janela_func(instance.baseframe, false, instance, true) + instance.do_not_snap = false end end - --refresh lower instance plugin icons and skin - Details.ToolBar:ReorganizeIcons() - - --refresh skin for other windows - if (lowerInstance) then - for id = lowerInstance+1, Details:GetNumInstances() do - local instance = Details:GetInstance(id) - if (instance and instance.baseframe and instance.ativa) then - instance:ChangeSkin() - end - end - end - - self.RefreshAfterStartup = nil - - function Details:CheckWallpaperAfterStartup() - if (not Details.profile_loaded) then - Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details) - end - - for id = 1, self.instances_amount do - local instance = self:GetInstance(id) - if (instance and instance:IsEnabled()) then - if (not instance.wallpaper.enabled) then - instance:InstanceWallpaper(false) - end - - instance.do_not_snap = true - self.move_janela_func(instance.baseframe, true, instance, true) - self.move_janela_func(instance.baseframe, false, instance, true) - instance.do_not_snap = false - end - end - - self.CheckWallpaperAfterStartup = nil - Details.profile_loaded = nil - end - Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details) + self.CheckWallpaperAfterStartup = nil + Details.profile_loaded = nil end + Details.Schedules.NewTimer(5, Details.CheckWallpaperAfterStartup, Details) + end - Details.Schedules.NewTimer(5, Details.RefreshAfterStartup, Details) + Details.Schedules.NewTimer(5, Details.RefreshAfterStartup, Details) --start garbage collector self.ultima_coleta = 0 @@ -225,42 +226,41 @@ function Details:StartMeUp() --I'll never stop! --player role self.last_assigned_role = UnitGroupRolesAssigned and UnitGroupRolesAssigned("player") - --start parser - --load parser capture options - self:CaptureRefresh() + --load parser capture options + self:CaptureRefresh() - --register parser events - self.listener:RegisterEvent("PLAYER_REGEN_DISABLED") - self.listener:RegisterEvent("PLAYER_REGEN_ENABLED") - self.listener:RegisterEvent("UNIT_PET") + --register parser events + self.listener:RegisterEvent("PLAYER_REGEN_DISABLED") + self.listener:RegisterEvent("PLAYER_REGEN_ENABLED") + self.listener:RegisterEvent("UNIT_PET") - self.listener:RegisterEvent("GROUP_ROSTER_UPDATE") - self.listener:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT") + self.listener:RegisterEvent("GROUP_ROSTER_UPDATE") + self.listener:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT") - self.listener:RegisterEvent("ZONE_CHANGED_NEW_AREA") - self.listener:RegisterEvent("PLAYER_ENTERING_WORLD") + self.listener:RegisterEvent("ZONE_CHANGED_NEW_AREA") + self.listener:RegisterEvent("PLAYER_ENTERING_WORLD") - self.listener:RegisterEvent("ENCOUNTER_START") - self.listener:RegisterEvent("ENCOUNTER_END") + self.listener:RegisterEvent("ENCOUNTER_START") + self.listener:RegisterEvent("ENCOUNTER_END") - self.listener:RegisterEvent("START_TIMER") - self.listener:RegisterEvent("UNIT_NAME_UPDATE") + self.listener:RegisterEvent("START_TIMER") + self.listener:RegisterEvent("UNIT_NAME_UPDATE") - self.listener:RegisterEvent("PLAYER_ROLES_ASSIGNED") - self.listener:RegisterEvent("ROLE_CHANGED_INFORM") + self.listener:RegisterEvent("PLAYER_ROLES_ASSIGNED") + self.listener:RegisterEvent("ROLE_CHANGED_INFORM") - self.listener:RegisterEvent("UNIT_FACTION") + self.listener:RegisterEvent("UNIT_FACTION") - if (not DetailsFramework.IsTimewalkWoW()) then - self.listener:RegisterEvent("PET_BATTLE_OPENING_START") - self.listener:RegisterEvent("PET_BATTLE_CLOSE") - self.listener:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") - self.listener:RegisterEvent("PLAYER_TALENT_UPDATE") - self.listener:RegisterEvent("CHALLENGE_MODE_START") - self.listener:RegisterEvent("CHALLENGE_MODE_COMPLETED") - end + if (not DetailsFramework.IsTimewalkWoW()) then + self.listener:RegisterEvent("PET_BATTLE_OPENING_START") + self.listener:RegisterEvent("PET_BATTLE_CLOSE") + self.listener:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") + self.listener:RegisterEvent("PLAYER_TALENT_UPDATE") + self.listener:RegisterEvent("CHALLENGE_MODE_START") + self.listener:RegisterEvent("CHALLENGE_MODE_COMPLETED") + end - self.parser_frame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") + self.parser_frame:RegisterEvent ("COMBAT_LOG_EVENT_UNFILTERED") --update is in group self.details_users = {} @@ -402,6 +402,7 @@ function Details:StartMeUp() --I'll never stop! --Details:OpenCustomDisplayWindow() --Details:OpenWelcomeWindow() end + Details.Schedules.NewTimer(2, Details.OpenOptionsWindowAtStart, Details) --Details:OpenCustomDisplayWindow()