diff --git a/libs/DF/.gitignore b/libs/DF/.gitignore index f380913..df44e95 100644 --- a/libs/DF/.gitignore +++ b/libs/DF/.gitignore @@ -7,3 +7,5 @@ cooltip_background.blp feedback_sites.blp icons.blp mail.blp +*.json +CHANGES.txt diff --git a/libs/DF/auras.lua b/libs/DF/auras.lua index 9adf115..bb359db 100644 --- a/libs/DF/auras.lua +++ b/libs/DF/auras.lua @@ -50,7 +50,7 @@ function DF:LoadAllSpells (hashMap, indexTable, allSpellsSameName) --pre checking which tables to fill to avoid checking if the table exists during the gigantic loop for performance if (not DF.LoadingAuraAlertFrame) then - DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent) + DF.LoadingAuraAlertFrame = CreateFrame ("frame", "DetailsFrameworkLoadingAurasAlert", UIParent, "BackdropTemplate") DF.LoadingAuraAlertFrame:SetSize (340, 75) DF.LoadingAuraAlertFrame:SetPoint ("center") DF.LoadingAuraAlertFrame:SetFrameStrata ("TOOLTIP") @@ -130,12 +130,29 @@ do WidgetType = "aura_tracker", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["aura_tracker"]] = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["aura_tracker"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["aura_tracker"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames["aura_tracker"]] = metaPrototype + end end -local AuraTrackerMetaFunctions = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] +local AuraTrackerMetaFunctions = _G[DF.GlobalWidgetControlNames["aura_tracker"]] --create panels local on_profile_changed = function (self, newdb) @@ -193,15 +210,15 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local options_slider_template = DF:GetTemplate ("slider", "OPTIONS_SLIDER_TEMPLATE") local options_button_template = DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame ("frame", name, parent, "BackdropTemplate") f.db = db f.OnProfileChanged = on_profile_changed f.LocTexts = texts options = options or {} self.table.deploy (options, aura_panel_defaultoptions) - local f_auto = CreateFrame ("frame", "$parent_Automatic", f) - local f_manual = CreateFrame ("frame", "$parent_Manual", f) + local f_auto = CreateFrame ("frame", "$parent_Automatic", f, "BackdropTemplate") + local f_manual = CreateFrame ("frame", "$parent_Manual", f, "BackdropTemplate") f_auto:SetPoint ("topleft", f, "topleft", 0, -24) f_manual:SetPoint ("topleft", f, "topleft", 0, -24) f_auto:SetSize (600, 600) @@ -239,7 +256,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t end end - local background_method_selection = CreateFrame ("frame", nil, f) + local background_method_selection = CreateFrame ("frame", nil, f, "BackdropTemplate") background_method_selection:SetHeight (82) background_method_selection:SetPoint ("topleft", f, "topleft", 0, 0) background_method_selection:SetPoint ("topright", f, "topright", 0, 0) @@ -325,12 +342,12 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t local textEntryWidth = 120 --create the background - local background_add_blacklist = CreateFrame ("frame", nil, f_auto) + local background_add_blacklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate") background_add_blacklist:SetSize (textEntryWidth + 10, 135) DF:ApplyStandardBackdrop (background_add_blacklist) background_add_blacklist.__background:SetVertexColor (0.47, 0.27, 0.27) - local background_add_tracklist = CreateFrame ("frame", nil, f_auto) + local background_add_tracklist = CreateFrame ("frame", nil, f_auto, "BackdropTemplate") background_add_tracklist:SetSize (textEntryWidth + 10, 135) DF:ApplyStandardBackdrop (background_add_tracklist) background_add_tracklist.__background:SetVertexColor (0.27, 0.27, 0.47) @@ -634,7 +651,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t end local createLineFunc = function (self, index) - local line = CreateFrame ("button", "$parentLine" .. index, self) + local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate") line:SetPoint ("topleft", self, "topleft", 1, - ((index - 1) * (lineHeight + 1)) - 1) line:SetSize (scrollWidth - 2, lineHeight) line:SetScript ("OnEnter", autoTrackList_LineOnEnter) @@ -798,7 +815,7 @@ function DF:CreateAuraConfigPanel (parent, name, db, change_callback, options, t end local scroll_createline = function (self, index) - local line = CreateFrame ("button", "$parentLine" .. index, self) + local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate") line:SetPoint ("topleft", self, "topleft", 1, -((index-1)*(scroll_line_height+1)) - 1) line:SetSize (scroll_width - 2, scroll_line_height) line:SetScript ("OnEnter", line_onenter) diff --git a/libs/DF/button.lua b/libs/DF/button.lua index 2356f78..fb81376 100644 --- a/libs/DF/button.lua +++ b/libs/DF/button.lua @@ -21,13 +21,32 @@ do local metaPrototype = { WidgetType = "button", SetHook = DF.SetHook, + HasHook = DF.HasHook, + ClearHooks = DF.ClearHooks, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion } - _G [DF.GlobalWidgetControlNames ["button"]] = _G [DF.GlobalWidgetControlNames ["button"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["button"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["button"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["button"]] = metaPrototype + end end -local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]] +local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames ["button"]] ------------------------------------------------------------------------------------------------------------ --> metatables @@ -410,6 +429,18 @@ local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]] return self.icon:GetTexture() end end + + function ButtonMetaFunctions:SetBackdrop(...) + return self.button:SetBackdrop(...) + end + + function ButtonMetaFunctions:SetBackdropColor(...) + return self.button:SetBackdropColor(...) + end + + function ButtonMetaFunctions:SetBackdropBorderColor(...) + return self.button:SetBackdropBorderColor(...) + end function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight, short_method) if (not self.icon) then @@ -1034,7 +1065,7 @@ function DF:NewButton (parent, container, name, member, w, h, func, param1, para ButtonObject.container = container ButtonObject.options = {OnGrab = false} - ButtonObject.button = CreateFrame ("button", name, parent) + ButtonObject.button = CreateFrame ("button", name, parent,"BackdropTemplate") DF:Mixin (ButtonObject.button, DF.WidgetFunctions) build_button (ButtonObject.button) diff --git a/libs/DF/cooltip.lua b/libs/DF/cooltip.lua index 25aa890..7913290 100644 --- a/libs/DF/cooltip.lua +++ b/libs/DF/cooltip.lua @@ -272,7 +272,7 @@ function DF:CreateCoolTip() --> main frame local frame1 if (not GameCooltipFrame1) then - frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent) + frame1 = CreateFrame ("Frame", "GameCooltipFrame1", UIParent,"TooltipBackdropTemplate") tinsert (UISpecialFrames, "GameCooltipFrame1") DF:CreateFlashAnimation (frame1) @@ -299,7 +299,7 @@ function DF:CreateCoolTip() --> secondary frame local frame2 if (not GameCooltipFrame2) then - frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent) + frame2 = CreateFrame ("Frame", "GameCooltipFrame2", UIParent,"TooltipBackdropTemplate") tinsert (UISpecialFrames, "GameCooltipFrame2") DF:CreateFlashAnimation (frame2) @@ -1621,7 +1621,7 @@ function DF:CreateCoolTip() --> height if (CoolTip.OptionsTable.AlignAsBlizzTooltip) then - local height = _math_max (8, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight()) + local height = _math_max (2, menuButton.leftText:GetStringHeight(), menuButton.rightText:GetStringHeight(), menuButton.leftIcon:GetHeight(), menuButton.rightIcon:GetHeight(), CoolTip.OptionsTable.AlignAsBlizzTooltipForceHeight or 2) menuButton:SetHeight (height) menuButton:SetPoint ("top", frame1, "top", 0, temp) temp = temp + ( height * -1) diff --git a/libs/DF/dropdown.lua b/libs/DF/dropdown.lua index c19eb2b..86e7bfd 100644 --- a/libs/DF/dropdown.lua +++ b/libs/DF/dropdown.lua @@ -21,13 +21,32 @@ do local metaPrototype = { WidgetType = "dropdown", SetHook = DF.SetHook, + HasHook = DF.HasHook, + ClearHooks = DF.ClearHooks, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["dropdown"]] = _G [DF.GlobalWidgetControlNames ["dropdown"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["dropdown"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["dropdown"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["dropdown"]] = metaPrototype + end end -local DropDownMetaFunctions = _G [DF.GlobalWidgetControlNames ["dropdown"]] +local DropDownMetaFunctions = _G[DF.GlobalWidgetControlNames ["dropdown"]] ------------------------------------------------------------------------------------------------------------ --> metatables @@ -165,6 +184,19 @@ local DropDownMetaFunctions = _G [DF.GlobalWidgetControlNames ["dropdown"]] end ------------------------------------------------------------------------------------------------------------ + +function DropDownMetaFunctions:SetBackdrop(...) + return self.dropdown:SetBackdrop(...) +end + +function DropDownMetaFunctions:SetBackdropColor(...) + return self.dropdown:SetBackdropColor(...) +end + +function DropDownMetaFunctions:SetBackdropBorderColor(...) + return self.dropdown:SetBackdropBorderColor(...) +end + --> methods function DropDownMetaFunctions:IsShown() return self.dropdown:IsShown() @@ -454,8 +486,15 @@ function DropDownMetaFunctions:Selected (_table) else self.label:SetPoint ("left", self.label:GetParent(), "left", 4, 0) end - - self.statusbar:SetTexture (_table.statusbar) + + if (_table.statusbar) then + self.statusbar:SetTexture (_table.statusbar) + if (_table.statusbarcolor) then + self.statusbar:SetVertexColor (unpack(_table.statusbarcolor)) + end + else + self.statusbar:SetTexture ([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]]) + end if (_table.color) then local _value1, _value2, _value3, _value4 = DF:ParseColors (_table.color) @@ -501,7 +540,7 @@ end function DropDownMetaFunctions:Open() self.dropdown.dropdownframe:Show() self.dropdown.dropdownborder:Show() - self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") + --self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Down") self.opened = true if (last_opened) then last_opened:Close() @@ -516,7 +555,7 @@ function DropDownMetaFunctions:Close() return end self.dropdown.dropdownframe:Hide() - self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") + --self.dropdown.arrowTexture:SetTexture ("Interface\\Buttons\\UI-ScrollBar-ScrollDownButton-Up") local selectedTexture = _G [self:GetName() .. "_ScrollFrame_ScrollChild_SelectedTexture"] selectedTexture:Hide() @@ -605,8 +644,8 @@ function DetailsFrameworkDropDownOnMouseDown (button) _this_row = DF:CreateDropdownButton (parent, name) local anchor_i = i-1 - _this_row:SetPoint ("topleft", parent, "topleft", 5, (-anchor_i*20)-5) - _this_row:SetPoint ("topright", parent, "topright", -5, (-anchor_i*20)-5) + _this_row:SetPoint ("topleft", parent, "topleft", 1, (-anchor_i*20)-0) + _this_row:SetPoint ("topright", parent, "topright", 0, (-anchor_i*20)-0) _this_row.object = object object.menus [i] = _this_row end @@ -650,7 +689,23 @@ function DetailsFrameworkDropDownOnMouseDown (button) _this_row.label:SetFont ("GameFontHighlightSmall", 10.5) end - _this_row.statusbar:SetTexture (_table.statusbar) + if (_table.statusbar) then + _this_row.statusbar:SetTexture (_table.statusbar) + if (_table.statusbarcolor) then + _this_row.statusbar:SetVertexColor (unpack(_table.statusbarcolor)) + end + else + _this_row.statusbar:SetTexture ([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]]) + end + + --an extra button in the right side of the row + --run a given function passing the button in the first argument, the row on 2nd and the _table in the 3rd + if (_table.rightbutton) then + DF:Dispatch (_table.rightbutton, _this_row.rightButton, _this_row, _table) + else + _this_row.rightButton:Hide() + end + _this_row.label:SetText (_table.label) if (currentText and currentText == _table.label) then @@ -705,7 +760,7 @@ function DetailsFrameworkDropDownOnMouseDown (button) object:ShowScroll() scrollFrame:EnableMouseWheel (true) object.scroll:Altura (size-35) - object.scroll:SetMinMaxValues (0, (showing*20) - size + 20) + object.scroll:SetMinMaxValues (0, (showing*20) - size + 2) --width scrollBorder:SetWidth (frame_witdh+20) scrollFrame:SetWidth (frame_witdh+20) @@ -732,12 +787,12 @@ function DetailsFrameworkDropDownOnMouseDown (button) scrollFrame:SetWidth (frame_witdh) scrollChild:SetWidth (frame_witdh) --height - scrollBorder:SetHeight ((showing*20) + 10) - scrollFrame:SetHeight ((showing*20) + 10) + scrollBorder:SetHeight ((showing*20) + 1) + scrollFrame:SetHeight ((showing*20) + 1) --mouse over texture - mouseOverTexture:SetWidth (frame_witdh-10) + mouseOverTexture:SetWidth (frame_witdh - 1) --selected - selectedTexture:SetWidth (frame_witdh - 9) + selectedTexture:SetWidth (frame_witdh - 1) for index, row in ipairs (object.menus) do row:SetPoint ("topright", scrollChild, "topright", -5, ((-index-1)*20)-5) @@ -858,6 +913,8 @@ end ------------------------------------------------------------------------------------------------------------ function DropDownMetaFunctions:SetTemplate (template) + self.template = template + if (template.width) then self:SetWidth (template.width) end @@ -898,7 +955,41 @@ function DropDownMetaFunctions:SetTemplate (template) local r, g, b, a = DF:ParseColors (template.onleavebordercolor) self.onleave_backdrop_border_color = {r, g, b, a} end - + + self:RefreshDropIcon() +end + +function DropDownMetaFunctions:RefreshDropIcon() + local template = self.template + + if (not template) then + return + end + + if (template.dropicon) then + self.dropdown.arrowTexture:SetTexture(template.dropicon) + self.dropdown.arrowTexture2:SetTexture(template.dropicon) + + if (template.dropiconsize) then + self.dropdown.arrowTexture:SetSize(unpack(template.dropiconsize)) + self.dropdown.arrowTexture2:SetSize(unpack(template.dropiconsize)) + end + + if (template.dropiconcoords) then + self.dropdown.arrowTexture:SetTexCoord(unpack(template.dropiconcoords)) + else + self.dropdown.arrowTexture:SetTexCoord(0, 1, 0, 1) + end + + if (template.dropiconpoints) then + self.dropdown.arrowTexture:ClearAllPoints() + self.dropdown.arrowTexture2:ClearAllPoints() + self.dropdown.arrowTexture:SetPoint("right", self.dropdown, "right", unpack(template.dropiconpoints)) + self.dropdown.arrowTexture2:SetPoint("right", self.dropdown, "right", unpack(template.dropiconpoints)) + end + + + end end ------------------------------------------------------------------------------------------------------------ @@ -1031,7 +1122,7 @@ function DF:NewDropDown (parent, container, name, member, w, h, func, default, t end if (template) then - DropDownObject:SetTemplate (template) + DropDownObject:SetTemplate(template) end return DropDownObject @@ -1044,13 +1135,13 @@ local border_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1 local child_backdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 256, insets = {left = 0, right = 0, top = 0, bottom = 0}} function DF:CreateNewDropdownFrame (parent, name) - local f = CreateFrame ("button", name, parent) + local f = CreateFrame ("button", name, parent,"BackdropTemplate") f:SetBackdrop (default_backdrop) f:SetSize (150, 20) local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "BACKGROUND") - statusbar:SetPoint ("topleft", f, "topleft", 3, -3) - statusbar:SetPoint ("bottomright", f, "bottomright", -3, 3) + statusbar:SetPoint ("topleft", f, "topleft", 0, 0) + statusbar:SetPoint ("bottomright", f, "bottomright", 0, 0) f.statusbar = statusbar local icon = f:CreateTexture ("$parent_IconTexture", "ARTWORK") @@ -1093,7 +1184,7 @@ function DF:CreateNewDropdownFrame (parent, name) f.arrowTexture2:SetDrawLayer ("OVERLAY", 2) --dropdown - local border = CreateFrame ("frame", "$Parent_Border", f) + local border = CreateFrame ("frame", "$Parent_Border", f,"BackdropTemplate") border:Hide() border:SetFrameStrata ("FULLSCREEN") border:SetSize (150, 150) @@ -1104,14 +1195,14 @@ function DF:CreateNewDropdownFrame (parent, name) border:SetBackdropBorderColor (0, 0, 0, 1) f.dropdownborder = border - local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f) + local scroll = CreateFrame ("ScrollFrame", "$Parent_ScrollFrame", f,"BackdropTemplate") scroll:Hide() scroll:SetFrameStrata ("FULLSCREEN") scroll:SetSize (150, 150) scroll:SetPoint ("topleft", f, "bottomleft", 0, 0) f.dropdownframe = scroll - local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll) + local child = CreateFrame ("frame", "$Parent_ScrollChild", scroll,"BackdropTemplate") child:SetSize (150, 150) child:SetPoint ("topleft", scroll, "topleft", 0, 0) child:SetBackdrop (child_backdrop) @@ -1143,13 +1234,14 @@ end function DF:CreateDropdownButton (parent, name) - local f = CreateFrame ("button", name, parent) + local f = CreateFrame ("button", name, parent,"BackdropTemplate") f:SetSize (150, 20) local statusbar = f:CreateTexture ("$parent_StatusBarTexture", "ARTWORK") - statusbar:SetPoint ("left", f, "left", 1, 0) - statusbar:SetPoint ("right", f, "right", -10, 0) + statusbar:SetPoint ("topleft", f, "topleft", 0, 0) + statusbar:SetPoint ("bottomright", f, "bottomright", 0, 0) statusbar:SetSize (150, 20) + statusbar:SetTexture ([[Interface\Tooltips\UI-Tooltip-Background]]) f.statusbar = statusbar local icon = f:CreateTexture ("$parent_IconTexture", "OVERLAY") @@ -1164,6 +1256,10 @@ function DF:CreateDropdownButton (parent, name) DF:SetFontSize (text, 10) f.label = text + local rightButton = DF:CreateButton(f, function()end, 16, 16, "", 0, 0, "", "rightButton", "$parentRightButton", nil, DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + rightButton:SetPoint("right", f, "right", -2, 0) + rightButton:Hide() + f:SetScript ("OnMouseDown", DetailsFrameworkDropDownOptionClick) f:SetScript ("OnEnter", DetailsFrameworkDropDownOptionOnEnter) f:SetScript ("OnLeave", DetailsFrameworkDropDownOptionOnLeave) diff --git a/libs/DF/fw.lua b/libs/DF/fw.lua index b7f5b19..d61f540 100644 --- a/libs/DF/fw.lua +++ b/libs/DF/fw.lua @@ -1,12 +1,12 @@ -local dversion = 170 +local dversion = 211 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) if (not DF) then DetailsFrameworkCanLoad = false - return + return end DetailsFrameworkCanLoad = true @@ -17,6 +17,9 @@ local _type = type local _unpack = unpack local upper = string.upper local string_match = string.match +local tinsert = _G.tinsert +local abs = _G.abs +local tremove = _G.tremove local UnitPlayerControlled = UnitPlayerControlled local UnitIsTapDenied = UnitIsTapDenied @@ -24,6 +27,8 @@ local UnitIsTapDenied = UnitIsTapDenied SMALL_NUMBER = 0.000001 ALPHA_BLEND_AMOUNT = 0.8400251 +DF.dversion = dversion + DF.AuthorInfo = { Name = "Terciob", Discord = "https://discord.gg/AGSzAZX", @@ -932,9 +937,524 @@ end ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> menus - + local disable_on_combat = {} - + + local getMenuWidgetVolative = function(parent, widgetType, indexTable) + + local widget + + if (widgetType == "label") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + if (not widget) then + widget = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType], "overlay") + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "dropdown") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateDropDown (parent, function() return {} end, nil, 140, 18, nil, "$parentWidget" .. widgetType .. indexTable[widgetType]) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + + else + widget:ClearHooks() + widget.hasLabel.text = "" + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "switch") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateSwitch (parent, nil, true, 20, 20, nil, nil, nil, "$parentWidget" .. widgetType .. indexTable[widgetType]) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + else + widget:ClearHooks() + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "slider") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateSlider (parent, 140, 20, 1, 2, 1, 1, false, nil, "$parentWidget" .. widgetType .. indexTable[widgetType]) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + else + widget:ClearHooks() + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "color") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateColorPickButton (parent, "$parentWidget" .. widgetType .. indexTable[widgetType], nil, function()end, 1) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + else + widget:ClearHooks() + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "button") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateButton (parent, function()end, 120, 18, "", nil, nil, nil, nil, "$parentWidget" .. widgetType .. indexTable[widgetType]) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + else + widget:ClearHooks() + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + + elseif (widgetType == "textentry") then + widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]] + + if (not widget) then + widget = DF:CreateTextEntry (parent, function()end, 120, 18, nil, "$parentWidget" .. widgetType .. indexTable[widgetType]) + widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay") + + tinsert(parent.widget_list, widget) + tinsert(parent.widget_list_by_type[widgetType], widget) + else + widget:ClearHooks() + end + + indexTable[widgetType] = indexTable[widgetType] + 1 + end + + --if the widget is inside the no combat table, remove it + for i = 1, #disable_on_combat do + if (disable_on_combat[i] == widget) then + tremove(disable_on_combat, i) + break + end + end + + return widget + end + + --volatile menu can be called several times, each time all settings are reset and a new menu is built using the same widgets + function DF:BuildMenuVolatile (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template, value_change_hook) + + if (not parent.widget_list) then + DF:SetAsOptionsPanel (parent) + end + DF:ClearOptionsPanel(parent) + + local cur_x = x_offset + local cur_y = y_offset + local max_x = 0 + + local latestInlineWidget + + local widgetIndexes = { + label = 1, + dropdown = 1, + switch = 1, + slider = 1, + color = 1, + button = 1, + textentry = 1, + } + + height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20) + height = height*-1 + + for index, widget_table in ipairs(menu) do + + local widget_created + if (latestInlineWidget) then + if (not widget_table.inline) then + latestInlineWidget = nil + cur_y = cur_y - 20 + end + end + + if (not widget_table.novolatile) then + + --step a line + if (widget_table.type == "blank" or widget_table.type == "space") then + -- do nothing + + elseif (widget_table.type == "label" or widget_table.type == "text") then + + local label = getMenuWidgetVolative(parent, "label", widgetIndexes) + widget_created = label + + label.text = widget_table.get() or widget_table.text or "" + label.color = widget_table.color + + if (widget_table.font) then + label.fontface = widget_table.font + end + + if (widget_table.text_template or text_template) then + label:SetTemplate(widget_table.text_template or text_template) + else + label.fontsize = widget_table.size or 10 + end + + label._get = widget_table.get + label.widget_type = "label" + label:ClearAllPoints() + label:SetPoint (cur_x, cur_y) + + if (widget_table.id) then + parent.widgetids [widget_table.id] = label + end + + --dropdowns + elseif (widget_table.type == "select" or widget_table.type == "dropdown") then + + local dropdown = getMenuWidgetVolative(parent, "dropdown", widgetIndexes) + widget_created = dropdown + + dropdown:SetFunction(widget_table.values) + dropdown:Refresh() + dropdown:Select (widget_table.get()) + dropdown:SetTemplate (dropdown_template) + + dropdown.tooltip = widget_table.desc + dropdown._get = widget_table.get + dropdown.widget_type = "select" + + + dropdown.hasLabel.text = widget_table.name .. (use_two_points and ": " or "") + dropdown.hasLabel:SetTemplate(widget_table.text_template or text_template) + dropdown:ClearAllPoints() + dropdown:SetPoint ("left", dropdown.hasLabel, "right", 2) + dropdown.hasLabel:ClearAllPoints() + dropdown.hasLabel:SetPoint (cur_x, cur_y) + + --> global callback + if (value_change_hook) then + dropdown:SetHook ("OnOptionSelected", value_change_hook) + end + + --> hook list (hook list is wiped when getting the widget) + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + dropdown:SetHook (hookName, hookFunc) + end + end + + if (widget_table.id) then + parent.widgetids [widget_table.id] = dropdown + end + + local size = dropdown.hasLabel.widget:GetStringWidth() + 140 + 4 + if (size > max_x) then + max_x = size + end + + --switchs + elseif (widget_table.type == "toggle" or widget_table.type == "switch") then + + local switch = getMenuWidgetVolative(parent, "switch", widgetIndexes) + widget_created = switch + + switch:SetValue(widget_table.get()) + switch:SetTemplate(switch_template) + switch:SetAsCheckBox() --it's always a checkbox on volatile menu + + switch.tooltip = widget_table.desc + switch._get = widget_table.get + switch.widget_type = "toggle" + switch.OnSwitch = widget_table.set + + if (value_change_hook) then + switch:SetHook ("OnSwitch", value_change_hook) + end + + --> hook list + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + switch:SetHook (hookName, hookFunc) + end + end + + if (widget_table.width) then + switch:SetWidth(widget_table.width) + end + if (widget_table.height) then + switch:SetHeight(widget_table.height) + end + + switch.hasLabel.text = widget_table.name .. (use_two_points and ": " or "") + switch.hasLabel:SetTemplate(widget_table.text_template or text_template) + + switch:ClearAllPoints() + switch.hasLabel:ClearAllPoints() + + if (widget_table.boxfirst) then + switch:SetPoint (cur_x, cur_y) + switch.hasLabel:SetPoint ("left", switch, "right", 2) + else + switch.hasLabel:SetPoint (cur_x, cur_y) + switch:SetPoint ("left", switch.hasLabel, "right", 2) + end + + if (widget_table.id) then + parent.widgetids [widget_table.id] = switch + end + + local size = switch.hasLabel:GetStringWidth() + 60 + 4 + if (size > max_x) then + max_x = size + end + + --slider + elseif (widget_table.type == "range" or widget_table.type == "slider") then + + local slider = getMenuWidgetVolative(parent, "slider", widgetIndexes) + widget_created = slider + + if (widget_table.usedecimals) then + slider.slider:SetValueStep (0.01) + else + slider.slider:SetValueStep (widget_table.step) + end + slider.useDecimals = widget_table.usedecimals + + slider.slider:SetMinMaxValues (widget_table.min, widget_table.max) + slider.slider:SetValue (widget_table.get()) + slider.ivalue = slider.slider:GetValue() + + slider:SetTemplate(slider_template) + + slider.tooltip = widget_table.desc + slider._get = widget_table.get + slider.widget_type = "range" + slider:SetHook ("OnValueChange", widget_table.set) + + if (value_change_hook) then + slider:SetHook ("OnValueChange", value_change_hook) + end + + if (widget_table.thumbscale) then + slider:SetThumbSize (slider.thumb.originalWidth * widget_table.thumbscale, nil) + else + slider:SetThumbSize (slider.thumb.originalWidth * 1.3, nil) + end + + --> hook list + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + slider:SetHook (hookName, hookFunc) + end + end + + slider.hasLabel.text = widget_table.name .. (use_two_points and ": " or "") + slider.hasLabel:SetTemplate(widget_table.text_template or text_template) + + slider:SetPoint ("left", slider.hasLabel, "right", 2) + slider.hasLabel:SetPoint (cur_x, cur_y) + + if (widget_table.id) then + parent.widgetids [widget_table.id] = slider + end + + local size = slider.hasLabel:GetStringWidth() + 140 + 6 + if (size > max_x) then + max_x = size + end + + --color + elseif (widget_table.type == "color" or widget_table.type == "color") then + + local colorpick = getMenuWidgetVolative(parent, "color", widgetIndexes) + widget_created = colorpick + + colorpick.color_callback = widget_table.set --callback + colorpick:SetTemplate(button_template) + + colorpick.tooltip = widget_table.desc + colorpick._get = widget_table.get + colorpick.widget_type = "color" + + local default_value, g, b, a = widget_table.get() + if (type (default_value) == "table") then + colorpick:SetColor (unpack (default_value)) + else + colorpick:SetColor (default_value, g, b, a) + end + + if (value_change_hook) then + colorpick:SetHook ("OnColorChanged", value_change_hook) + end + + --> hook list + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + colorpick:SetHook (hookName, hookFunc) + end + end + + colorpick.hasLabel.text = widget_table.name .. (use_two_points and ": " or "") + colorpick.hasLabel:SetTemplate(widget_table.text_template or text_template) + + colorpick:SetPoint ("left", colorpick.hasLabel, "right", 2) + colorpick.hasLabel:SetPoint (cur_x, cur_y) + + if (widget_table.id) then + parent.widgetids [widget_table.id] = colorpick + end + + local size = colorpick.hasLabel:GetStringWidth() + 60 + 4 + if (size > max_x) then + max_x = size + end + + --button + elseif (widget_table.type == "execute" or widget_table.type == "button") then + + local button = getMenuWidgetVolative(parent, "button", widgetIndexes) + widget_created = button + + button:SetTemplate(button_template) + button:SetSize(widget_table.width or 120, widget_table.height or 18) + button:SetClickFunction(widget_table.func, widget_table.param1, widget_table.param2) + + local textTemplate = widget_table.text_template or text_template or DF.font_templates ["ORANGE_FONT_TEMPLATE"] + button.textcolor = textTemplate.color + button.textfont = textTemplate.font + button.textsize = textTemplate.size + button.text = widget_table.name + + if (widget_table.inline) then + if (latestInlineWidget) then + button:SetPoint ("left", latestInlineWidget, "right", 2, 0) + latestInlineWidget = button + else + button:SetPoint (cur_x, cur_y) + latestInlineWidget = button + end + else + button:SetPoint (cur_x, cur_y) + end + + button.tooltip = widget_table.desc + button.widget_type = "execute" + + --> execute doesn't trigger global callback + + --> hook list + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + button:SetHook (hookName, hookFunc) + end + end + + if (widget_table.width) then + button:SetWidth(widget_table.width) + end + if (widget_table.height) then + button:SetHeight(widget_table.height) + end + + if (widget_table.id) then + parent.widgetids [widget_table.id] = button + end + + local size = button:GetWidth() + 4 + if (size > max_x) then + max_x = size + end + + --textentry + elseif (widget_table.type == "textentry") then + + local textentry = getMenuWidgetVolative(parent, "textentry", widgetIndexes) + widget_created = textentry + + textentry:SetCommitFunction(widget_table.func or widget_table.set) + textentry:SetTemplate(widget_table.template or widget_table.button_template or button_template) + textentry:SetSize(widget_table.width or 120, widget_table.height or 18) + + textentry.tooltip = widget_table.desc + textentry.text = widget_table.get() + textentry._get = widget_table.get + textentry.widget_type = "textentry" + textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set) + textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set) + + textentry.hasLabel.text = widget_table.name .. (use_two_points and ": " or "") + textentry.hasLabel:SetTemplate(widget_table.text_template or text_template) + textentry:SetPoint ("left", textentry.hasLabel, "right", 2) + textentry.hasLabel:SetPoint (cur_x, cur_y) + + --> text entry doesn't trigger global callback + + --> hook list + if (widget_table.hooks) then + for hookName, hookFunc in pairs (widget_table.hooks) do + textentry:SetHook (hookName, hookFunc) + end + end + + if (widget_table.id) then + parent.widgetids [widget_table.id] = textentry + end + + local size = textentry.hasLabel:GetStringWidth() + 60 + 4 + if (size > max_x) then + max_x = size + end + + end --end loop + + if (widget_table.nocombat) then + tinsert (disable_on_combat, widget_created) + end + + if (not widget_table.inline) then + if (widget_table.spacement) then + cur_y = cur_y - 30 + else + cur_y = cur_y - 20 + end + end + + if (widget_table.type == "breakline" or cur_y < height) then + cur_y = y_offset + cur_x = cur_x + max_x + 30 + line_widgets_created = 0 + max_x = 0 + end + + if widget_created then + widget_created:Show() + end + end + end + + DF.RefreshUnsafeOptionsWidgets() + end + function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template, value_change_hook) if (not parent.widget_list) then @@ -946,22 +1466,34 @@ end local max_x = 0 local line_widgets_created = 0 --how many widgets has been created on this line loop pass + local latestInlineWidget + height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20) height = height*-1 - for index, widget_table in ipairs (menu) do + for index, widget_table in ipairs (menu) do local widget_created + if (latestInlineWidget) then + if (not widget_table.inline) then + latestInlineWidget = nil + cur_y = cur_y - 28 + end + end if (widget_table.type == "blank" or widget_table.type == "space") then -- do nothing - + elseif (widget_table.type == "label" or widget_table.type == "text") then local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay") label._get = widget_table.get label.widget_type = "label" label:SetPoint (cur_x, cur_y) + + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, label) + tinsert (parent.widget_list_by_type.label, label) + line_widgets_created = line_widgets_created + 1 if (widget_table.id) then @@ -973,9 +1505,11 @@ end dropdown.tooltip = widget_table.desc dropdown._get = widget_table.get dropdown.widget_type = "select" + local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) dropdown:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) + dropdown.hasLabel = label --> global callback if (value_change_hook) then @@ -998,7 +1532,10 @@ end max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, dropdown) + tinsert (parent.widget_list_by_type.dropdown, dropdown) + widget_created = dropdown line_widgets_created = line_widgets_created + 1 @@ -1023,7 +1560,14 @@ end switch:SetHook (hookName, hookFunc) end end - + + if (widget_table.width) then + switch:SetWidth(widget_table.width) + end + if (widget_table.height) then + switch:SetHeight(widget_table.height) + end + local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) if (widget_table.boxfirst) then switch:SetPoint (cur_x, cur_y) @@ -1032,6 +1576,7 @@ end label:SetPoint (cur_x, cur_y) switch:SetPoint ("left", label, "right", 2) end + switch.hasLabel = label if (widget_table.id) then parent.widgetids [widget_table.id] = switch @@ -1042,7 +1587,10 @@ end max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, switch) + tinsert (parent.widget_list_by_type.switch, switch) + widget_created = switch line_widgets_created = line_widgets_created + 1 @@ -1074,6 +1622,7 @@ end local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) slider:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) + slider.hasLabel = label if (widget_table.id) then parent.widgetids [widget_table.id] = slider @@ -1084,7 +1633,10 @@ end max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, slider) + tinsert (parent.widget_list_by_type.slider, slider) + widget_created = slider line_widgets_created = line_widgets_created + 1 @@ -1115,6 +1667,7 @@ end local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) colorpick:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) + colorpick.hasLabel = label if (widget_table.id) then parent.widgetids [widget_table.id] = colorpick @@ -1125,7 +1678,10 @@ end max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, colorpick) + tinsert (parent.widget_list_by_type.color, colorpick) + widget_created = colorpick line_widgets_created = line_widgets_created + 1 @@ -1136,44 +1692,71 @@ end button:InstallCustomTexture() end - button:SetPoint (cur_x, cur_y) + if (widget_table.inline) then + if (latestInlineWidget) then + button:SetPoint ("left", latestInlineWidget, "right", 2, 0) + latestInlineWidget = button + else + button:SetPoint (cur_x, cur_y) + latestInlineWidget = button + end + else + button:SetPoint (cur_x, cur_y) + end + button.tooltip = widget_table.desc button.widget_type = "execute" - --> execute doesn't trigger global callback + --notice: execute doesn't trigger global callback - --> hook list + --button icon + if (widget_table.icontexture) then + button:SetIcon(widget_table.icontexture, nil, nil, nil, widget_table.icontexcoords, nil, nil, 2) + end + + --hook list if (widget_table.hooks) then for hookName, hookFunc in pairs (widget_table.hooks) do button:SetHook (hookName, hookFunc) end - end + end if (widget_table.id) then parent.widgetids [widget_table.id] = button end + + if (widget_table.width) then + button:SetWidth(widget_table.width) + end + if (widget_table.height) then + button:SetHeight(widget_table.height) + end local size = button:GetWidth() + 4 if (size > max_x) then max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, button) + tinsert (parent.widget_list_by_type.button, button) + widget_created = button line_widgets_created = line_widgets_created + 1 elseif (widget_table.type == "textentry") then - local textentry = DF:CreateTextEntry (parent, widget_table.func, 120, 18, nil, "$parentWidget" .. index, nil, button_template) + local textentry = DF:CreateTextEntry (parent, widget_table.func or widget_table.set, 120, 18, nil, "$parentWidget" .. index, nil, button_template) textentry.tooltip = widget_table.desc textentry.text = widget_table.get() textentry._get = widget_table.get textentry.widget_type = "textentry" - textentry:SetHook ("OnEnterPressed", widget_table.set) - textentry:SetHook ("OnEditFocusLost", widget_table.set) + textentry:SetHook ("OnEnterPressed", widget_table.func or widget_table.set) + textentry:SetHook ("OnEditFocusLost", widget_table.func or widget_table.set) local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12) textentry:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) + textentry.hasLabel = label --> text entry doesn't trigger global callback @@ -1193,7 +1776,10 @@ end max_x = size end + --store the widget created into the overall table and the widget by type tinsert (parent.widget_list, textentry) + tinsert (parent.widget_list_by_type.textentry, textentry) + widget_created = textentry line_widgets_created = line_widgets_created + 1 @@ -1203,10 +1789,12 @@ end tinsert (disable_on_combat, widget_created) end - if (widget_table.spacement) then - cur_y = cur_y - 30 - else - cur_y = cur_y - 20 + if (not widget_table.inline) then + if (widget_table.spacement) then + cur_y = cur_y - 30 + else + cur_y = cur_y - 20 + end end if (widget_table.type == "breakline" or cur_y < height) then @@ -1354,9 +1942,29 @@ end return self.widgetids [id] end + function DF:ClearOptionsPanel(frame) + for i = 1, #frame.widget_list do + frame.widget_list[i]:Hide() + if (frame.widget_list[i].hasLabel) then + frame.widget_list[i].hasLabel:SetText("") + end + end + + table.wipe(frame.widgetids) + end + function DF:SetAsOptionsPanel (frame) frame.RefreshOptions = refresh_options frame.widget_list = {} + frame.widget_list_by_type = { + ["dropdown"] = {}, -- "select" + ["switch"] = {}, -- "toggle" + ["slider"] = {}, -- "range" + ["color"] = {}, -- + ["button"] = {}, -- "execute" + ["textentry"] = {}, -- + ["label"] = {}, --"text" + } frame.widgetids = {} frame.GetWidgetById = get_frame_by_id end @@ -1468,7 +2076,7 @@ end end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> templates +--> ~templates --fonts @@ -1526,11 +2134,22 @@ DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font DF.dropdown_templates = DF.dropdown_templates or {} DF.dropdown_templates ["OPTIONS_DROPDOWN_TEMPLATE"] = { - backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, - backdropcolor = {1, 1, 1, .5}, + backdrop = { + edgeFile = [[Interface\Buttons\WHITE8X8]], + edgeSize = 1, + bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], + tileSize = 64, + tile = true + }, + + backdropcolor = {1, 1, 1, .7}, backdropbordercolor = {0, 0, 0, 1}, - onentercolor = {1, 1, 1, .5}, + onentercolor = {1, 1, 1, .9}, onenterbordercolor = {1, 1, 1, 1}, + + dropicon = "Interface\\BUTTONS\\arrow-Down-Down", + dropiconsize = {16, 16}, + dropiconpoints = {-2, -3}, } -- switches @@ -1685,8 +2304,9 @@ function DF:SetHook (hookType, func) if (not isRemoval) then tinsert (self.HookList [hookType], func) end - else + else if (DF.debug) then + print (debugstack()) error ("Details! Framework: invalid function for widget " .. self.WidgetType .. ".") end end @@ -1697,6 +2317,24 @@ function DF:SetHook (hookType, func) 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 @@ -2144,6 +2782,7 @@ local glow_overlay_play = function (self) self.animOut:Stop() end if (not self.animIn:IsPlaying()) then + self.animIn:Stop() self.animIn:Play() end end @@ -2532,9 +3171,11 @@ function DF:ReskinSlider (slider, heightOffset) slider.cima:GetPushedTexture():SetPoint ("center", slider.cima, "center", 1, 1) slider.cima:GetDisabledTexture():SetPoint ("center", slider.cima, "center", 1, 1) slider.cima:SetSize (16, 16) + --[=[ slider.cima:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) slider.cima:SetBackdropColor (0, 0, 0, 0.3) slider.cima:SetBackdropBorderColor (0, 0, 0, 1) + ]=] slider.baixo:SetNormalTexture ([[Interface\Buttons\Arrow-Down-Up]]) slider.baixo:SetPushedTexture ([[Interface\Buttons\Arrow-Down-Down]]) @@ -2546,6 +3187,7 @@ function DF:ReskinSlider (slider, heightOffset) slider.baixo:GetPushedTexture():SetPoint ("center", slider.baixo, "center", 1, -5) slider.baixo:GetDisabledTexture():SetPoint ("center", slider.baixo, "center", 1, -5) slider.baixo:SetSize (16, 16) + --[=[ slider.baixo:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) slider.baixo:SetBackdropColor (0, 0, 0, 0.35) slider.baixo:SetBackdropBorderColor (0, 0, 0, 1) @@ -2553,6 +3195,7 @@ function DF:ReskinSlider (slider, heightOffset) slider.slider:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\AddOns\Details\images\background]]}) slider.slider:SetBackdropColor (0, 0, 0, 0.35) slider.slider:SetBackdropBorderColor (0, 0, 0, 1) + ]=] --slider.slider:Altura (164) slider.slider:cimaPoint (0, 13) @@ -2591,10 +3234,11 @@ function DF:ReskinSlider (slider, heightOffset) disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0) slider.ScrollBar.ScrollUpButton:SetSize (16, 16) + --[=[ slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"}) slider.ScrollBar.ScrollUpButton:SetBackdropColor (0, 0, 0, 0.3) slider.ScrollBar.ScrollUpButton:SetBackdropBorderColor (0, 0, 0, 1) - + ]=] --it was having problems with the texture anchor when calling ClearAllPoints() and setting new points different from the original --now it is using the same points from the original with small offsets tp align correctly end @@ -2624,9 +3268,11 @@ function DF:ReskinSlider (slider, heightOffset) disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4) slider.ScrollBar.ScrollDownButton:SetSize (16, 16) + --[=[ slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"}) slider.ScrollBar.ScrollDownButton:SetBackdropColor (0, 0, 0, 0.3) slider.ScrollBar.ScrollDownButton:SetBackdropBorderColor (0, 0, 0, 1) + ]=] -- --slider.ScrollBar.ScrollDownButton:SetPoint ("top", slider.ScrollBar, "bottom", 0, 0) @@ -2646,10 +3292,11 @@ function DF:ReskinSlider (slider, heightOffset) slider.ScrollBar.ThumbTexture:SetSize (12, 8) -- - + --[=[ slider.ScrollBar:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"}) slider.ScrollBar:SetBackdropColor (0, 0, 0, 0.35) slider.ScrollBar:SetBackdropBorderColor (0, 0, 0, 1) + ]=] end end @@ -2735,7 +3382,7 @@ function DF:CoreDispatch (context, func, ...) local okay, result1, result2, result3, result4 = pcall (func, ...) if (not okay) then - local stack = debugstack (2) + local stack = debugstack(2) local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n" error (errortext) end @@ -2759,6 +3406,22 @@ function DF_CALC_PERFORMANCE() end) end +DF.ClassIndexToFileName = { + [6] = "DEATHKNIGHT", + [1] = "WARRIOR", + [4] = "ROGUE", + [8] = "MAGE", + [5] = "PRIEST", + [3] = "HUNTER", + [9] = "WARLOCK", + [12] = "DEMONHUNTER", + [7] = "SHAMAN", + [11] = "DRUID", + [10] = "MONK", + [2] = "PALADIN", +} + + DF.ClassFileNameToIndex = { ["DEATHKNIGHT"] = 6, ["WARRIOR"] = 1, @@ -3106,6 +3769,105 @@ function DF:GetRangeCheckSpellForSpec(specId) end +--key is instanceId from GetInstanceInfo() +-- /dump GetInstanceInfo() +DF.BattlegroundSizes = { + [2245] = 15, --Deepwind Gorge + [2106] = 10, --Warsong Gulch + [2107] = 15, --Arathi Basin + [566] = 15, --Eye of the Storm + [30] = 40, --Alterac Valley + [628] = 40, --Isle of Conquest + [761] = 10, --The Battle for Gilneas + [726] = 10, --Twin Peaks + [727] = 10, --Silvershard Mines + [998] = 10, --Temple of Kotmogu + [2118] = 40, --Battle for Wintergrasp + [1191] = 25, --Ashran + [1803] = 10, --Seething Shore +} + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +--> execute range + + function DF.GetExecuteRange(unitId) + unitId = unitId or "player" + + local classLoc, class = UnitClass(unitId) + local spec = GetSpecialization() + + if (spec and class) then + --prist + if (class == "PRIEST") then + --playing as shadow? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 258) then --shadow + local _, _, _, using_SWDeath = GetTalentInfo(5, 2, 1) + if (using_SWDeath) then + return 0.20 + end + end + end + + elseif (class == "MAGE") then + --playing fire mage? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 63) then --fire + local _, _, _, using_SearingTouch = GetTalentInfo(1, 3, 1) + if (using_SearingTouch) then + return 0.30 + end + end + end + + elseif (class == "WARRIOR") then + --is playing as a Arms warrior? + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + + if (specID == 71) then --arms + local _, _, _, using_Massacre = GetTalentInfo(3, 1, 1) + if (using_Massacre) then + --if using massacre, execute can be used at 35% health in Arms spec + return 0.35 + end + end + + if (specID == 71 or specID == 72) then --arms or fury + return 0.20 + end + end + + elseif (class == "HUNTER") then + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 253) then --beast mastery + --> is using killer instinct? + local _, _, _, using_KillerInstinct = GetTalentInfo(1, 1, 1) + if (using_KillerInstinct) then + return 0.35 + end + end + end + + elseif (class == "PALADIN") then + local specID = GetSpecializationInfo(spec) + if (specID and specID ~= 0) then + if (specID == 70) then --retribution paladin + --> is using hammer of wrath? + local _, _, _, using_HammerOfWrath = GetTalentInfo(2, 3, 1) + if (using_HammerOfWrath) then + return 0.20 + end + end + end + end + end + end + + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --> delta seconds reader @@ -3222,3 +3984,212 @@ function DF:IsUnitTapDenied (unitId) end +----------------------------------------------------------------------------------------------------------------------------------------------------------- +--> pool + +do + local get = function(self) + local object = tremove(self.notUse, #self.notUse) + if (object) then + tinsert(self.inUse, object) + return object, false + + else + --need to create the new object + local newObject = self.newObjectFunc(self, unpack(self.payload)) + if (newObject) then + tinsert(self.inUse, newObject) + return newObject, true + end + end + end + + local get_all_inuse = function(self) + return self.inUse; + end + + local release = function(self, object) + for i = #self.inUse, 1, -1 do + if (self.inUse[i] == object) then + tremove(self.inUse, i) + tinsert(self.notUse, object) + break + end + end + end + + local reset = function(self) + for i = #self.inUse, 1, -1 do + local object = tremove(self.inUse, i) + tinsert(self.notUse, object) + end + end + + --only hide objects in use, do not disable them + local hide = function(self) + for i = #self.inUse, 1, -1 do + self.inUse[i]:Hide() + end + end + + --only show objects in use, do not enable them + local show = function(self) + for i = #self.inUse, 1, -1 do + self.inUse[i]:Show() + end + end + + --return the amount of objects + local getamount = function(self) + return #self.notUse + #self.inUse, #self.notUse, #self.inUse + end + + local poolMixin = { + Get = get, + GetAllInUse = get_all_inuse, + Acquire = get, + Release = release, + Reset = reset, + ReleaseAll = reset, + Hide = hide, + Show = show, + GetAmount = getamount, + } + + function DF:CreatePool(func, ...) + local t = {} + DetailsFramework:Mixin(t, poolMixin) + + t.inUse = {} + t.notUse = {} + t.newObjectFunc = func + t.payload = {...} + + return t + end + + --alias + function DF:CreateObjectPool(func, ...) + return DF:CreatePool(func, ...) + end + +end + + +----------------------------------------------------------------------------------------------------------------------------------------------------------- +--> forbidden functions on scripts + + --these are functions which scripts cannot run due to security issues + local forbiddenFunction = { + --block mail, trades, action house, banks + ["C_AuctionHouse"] = true, + ["C_Bank"] = true, + ["C_GuildBank"] = true, + ["SetSendMailMoney"] = true, + ["SendMail"] = true, + ["SetTradeMoney"] = true, + ["AddTradeMoney"] = true, + ["PickupTradeMoney"] = true, + ["PickupPlayerMoney"] = true, + ["AcceptTrade"] = true, + + --frames + ["BankFrame"] = true, + ["TradeFrame"] = true, + ["GuildBankFrame"] = true, + ["MailFrame"] = true, + ["EnumerateFrames"] = true, + + --block run code inside code + ["RunScript"] = true, + ["securecall"] = true, + ["getfenv"] = true, + ["getfenv"] = true, + ["loadstring"] = true, + ["pcall"] = true, + ["xpcall"] = true, + ["getglobal"] = true, + ["setmetatable"] = true, + ["DevTools_DumpCommand"] = true, + + --avoid creating macros + ["SetBindingMacro"] = true, + ["CreateMacro"] = true, + ["EditMacro"] = true, + ["hash_SlashCmdList"] = true, + ["SlashCmdList"] = true, + + --block guild commands + ["GuildDisband"] = true, + ["GuildUninvite"] = true, + + --other things + ["C_GMTicketInfo"] = true, + + --deny messing addons with script support + ["PlaterDB"] = true, + ["_detalhes_global"] = true, + ["WeakAurasSaved"] = true, + } + + local C_RestrictedSubFunctions = { + ["C_GuildInfo"] = { + ["RemoveFromGuild"] = true, + }, + } + + --not in use, can't find a way to check within the environment handle + local addonRestrictedFunctions = { + ["DetailsFramework"] = { + ["SetEnvironment"] = true, + }, + + ["Plater"] = { + ["ImportScriptString"] = true, + ["db"] = true, + }, + + ["WeakAuras"] = { + ["Add"] = true, + ["AddMany"] = true, + ["Delete"] = true, + ["NewAura"] = true, + }, + } + + local C_SubFunctionsTable = {} + for globalTableName, functionTable in pairs(C_RestrictedSubFunctions) do + C_SubFunctionsTable [globalTableName] = {} + for functionName, functionObject in pairs(_G[globalTableName]) do + if (not functionTable[functionName]) then + C_SubFunctionsTable [globalTableName][functionName] = functionObject + end + end + end + + DF.DefaultSecureScriptEnvironmentHandle = { + __index = function (env, key) + + if (forbiddenFunction[key]) then + return nil + + elseif (key == "_G") then + return env + + elseif (C_SubFunctionsTable[key]) then + return C_SubFunctionsTable[key] + end + + return _G[key] + end + } + + function DF:SetEnvironment(func, environmentHandle) + environmentHandle = environmentHandle or DF.DefaultSecureScriptEnvironmentHandle + + local newEnvironment = {} + + setmetatable(newEnvironment, environmentHandle) + _G.setfenv(func, newEnvironment) + end + diff --git a/libs/DF/label.lua b/libs/DF/label.lua index 4e69ee2..83830b5 100644 --- a/libs/DF/label.lua +++ b/libs/DF/label.lua @@ -21,12 +21,29 @@ do WidgetType = "label", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["label"]] = _G [DF.GlobalWidgetControlNames ["label"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["label"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["label"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["label"]] = metaPrototype + end end -local LabelMetaFunctions = _G [DF.GlobalWidgetControlNames ["label"]] +local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]] ------------------------------------------------------------------------------------------------------------ --> metatables @@ -288,7 +305,7 @@ function DF:NewLabel (parent, container, name, member, text, font, size, color, container = container.widget end - font = font or "GameFontHighlightSmall" + font = font == "" and "GameFontHighlightSmall" or font or "GameFontHighlightSmall" LabelObject.label = parent:CreateFontString (name, layer or "OVERLAY", font) LabelObject.widget = LabelObject.label diff --git a/libs/DF/math.lua b/libs/DF/math.lua index fa9f64c..91432b0 100644 --- a/libs/DF/math.lua +++ b/libs/DF/math.lua @@ -50,7 +50,7 @@ end --find the normalized percent of the value in the range. e.g range of 200-400 and a value of 250 result in 0.25 function DF:GetRangePercent (minValue, maxValue, value) - return (value - minValue) / (maxValue - minValue) + return (value - minValue) / max((maxValue - minValue), SMALL_FLOAT) end --find the value in the range given from a normalized percent. e.g range of 200-400 and a percent of 0.8 result in 360 diff --git a/libs/DF/normal_bar.lua b/libs/DF/normal_bar.lua index 83426b0..ee77536 100644 --- a/libs/DF/normal_bar.lua +++ b/libs/DF/normal_bar.lua @@ -22,12 +22,29 @@ do WidgetType = "normal_bar", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["normal_bar"]] = _G [DF.GlobalWidgetControlNames ["normal_bar"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["normal_bar"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["normal_bar"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["normal_bar"]] = metaPrototype + end end -local BarMetaFunctions = _G [DF.GlobalWidgetControlNames ["normal_bar"]] +local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]] ------------------------------------------------------------------------------------------------------------ --> metatables diff --git a/libs/DF/panel.lua b/libs/DF/panel.lua index b384ea7..40ca32d 100644 --- a/libs/DF/panel.lua +++ b/libs/DF/panel.lua @@ -24,12 +24,29 @@ do WidgetType = "panel", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["panel"]] = _G [DF.GlobalWidgetControlNames ["panel"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["panel"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["panel"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["panel"]] = metaPrototype + end end -local PanelMetaFunctions = _G [DF.GlobalWidgetControlNames ["panel"]] +local PanelMetaFunctions = _G[DF.GlobalWidgetControlNames ["panel"]] --> mixin for options functions DF.OptionsFunctions = { @@ -637,7 +654,7 @@ function DF:NewPanel (parent, container, name, member, w, h, backdrop, backdropc PanelObject.container = container PanelObject.rightButtonClose = false - PanelObject.frame = CreateFrame ("frame", name, parent) + PanelObject.frame = CreateFrame ("frame", name, parent,"BackdropTemplate") PanelObject.frame:SetSize (100, 100) PanelObject.frame.Gradient = { ["OnEnter"] = {0.3, 0.3, 0.3, 0.5}, @@ -756,7 +773,8 @@ local align_rows = function (self) end local cur_width = 0 - local row_width = self._width / rows_shown + local row_width = self._width / max (rows_shown, 0.0001) + local sindex = 1 @@ -826,6 +844,30 @@ local align_rows = function (self) entry.onleave_func = row.onleave end end + + elseif (type == "checkbox") then + for i = 1, #self.scrollframe.lines do + local line = self.scrollframe.lines [i] + local checkbox = tremove (line.checkbox_available) + if (not checkbox) then + self:CreateCheckbox (line) + checkbox = tremove (line.checkbox_available) + end + + tinsert (line.checkbox_inuse, checkbox) + + checkbox:SetPoint ("left", line, "left", self._anchors [#self._anchors] + ((row.width - 20) / 2), 0) + if (sindex == rows_shown) then + checkbox:SetWidth (20) + --checkbox:SetWidth (row.width - 25) + else + checkbox:SetWidth (20) + end + + checkbox.onenter_func = nil + checkbox.onleave_func = nil + end + elseif (type == "button") then for i = 1, #self.scrollframe.lines do local line = self.scrollframe.lines [i] @@ -976,6 +1018,13 @@ local update_rows = function (self, updated_rows) for i = 1, #row.button_available do row.button_available[i]:Hide() end + + for i = #row.checkbox_inuse, 1, -1 do + tinsert (row.checkbox_available, tremove (row.checkbox_inuse, i)) + end + 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)) @@ -1026,17 +1075,26 @@ local create_panel_entry = function (self, row) pcall (editbox.onleave_func, editbox) end end) - - editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1}) - editbox:SetBackdropColor (1, 1, 1, 0.1) - editbox:SetBackdropBorderColor (1, 1, 1, 0.1) + editbox.editbox.current_bordercolor = {1, 1, 1, 0.1} editbox:SetTemplate (DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")) + editbox:SetBackdropColor (.2, .2, .2, 0.7) tinsert (row.entry_available, editbox) end +local create_panel_checkbox = function (self, row) + --row.checkbox_available + row.checkbox_total = row.checkbox_total + 1 + + local switch = DF:NewSwitch (row, nil, "$parentCheckBox" .. row.checkbox_total, nil, 20, 20, nil, nil, false) + switch:SetAsCheckBox() + switch:SetTemplate(DF:GetTemplate ("switch", "OPTIONS_CHECKBOX_TEMPLATE")) + + tinsert (row.checkbox_available, switch) +end + local create_panel_button = function (self, row) row.button_total = row.button_total + 1 local button = DF:NewButton (row, nil, "$parentButton" .. row.button_total, "button" .. row.button_total, 120, 20) @@ -1062,7 +1120,6 @@ end local create_panel_icon = function (self, row) row.icon_total = row.icon_total + 1 local iconbutton = DF:NewButton (row, nil, "$parentIconButton" .. row.icon_total, "iconbutton", 22, 20) - iconbutton:InstallCustomTexture() iconbutton:SetHook ("OnEnter", button_on_enter) iconbutton:SetHook ("OnLeave", button_on_leave) @@ -1131,6 +1188,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro panel.CreateRowText = create_panel_text panel.CreateRowEntry = create_panel_entry panel.CreateRowButton = create_panel_button + panel.CreateCheckbox = create_panel_checkbox panel.CreateRowIcon = create_panel_icon panel.CreateRowTexture = create_panel_texture panel.SetFillFunction = set_fill_function @@ -1170,7 +1228,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro if (results and results [1]) then row:Show() - local text, entry, button, icon, texture = 1, 1, 1, 1, 1 + 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 @@ -1198,7 +1256,19 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro entrywidget:SetCursorPosition(0) entrywidget:Show() - + + elseif (t.type == "checkbox") then + local checkboxwidget = row.checkbox_inuse [button] + checkbox = checkbox + 1 + checkboxwidget.index = real_index + checkboxwidget:SetValue(results [index]) + + local func = function() + t.func (real_index, index) + panel:Refresh() + end + checkboxwidget.OnSwitch = func + elseif (t.type == "button") then local buttonwidget = row.button_inuse [button] button = button + 1 @@ -1248,13 +1318,32 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro iconwidget.line = index iconwidget.index = real_index - - --print (index, results [index]) + if (type (results [index]) == "string") then local result = results [index]:gsub (".-%\\", "") iconwidget._icon.texture = results [index] + 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)) + else + iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9) + end + + local color = results [index].color + if (color) then + local r, g, b, a = DF:ParseColors(color) + iconwidget._icon:SetVertexColor(r, g, b, a) + else + iconwidget._icon:SetVertexColor(1, 1, 1, 1) + end else iconwidget._icon:SetTexture (results [index]) + iconwidget._icon:SetTexCoord (0.1, .9, 0.1, .9) end iconwidget:Show() @@ -1269,6 +1358,25 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro if (type (results [index]) == "string") then 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)) + else + texturewidget:SetTexCoord (0, 1, 0, 1) + end + + local color = results [index].color + if (color) then + local r, g, b, a = DF:ParseColors(color) + texturewidget:SetVertexColor(r, g, b, a) + else + texturewidget:SetVertexColor(1, 1, 1, 1) + end + else texturewidget:SetTexture (results [index]) end @@ -1300,7 +1408,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro panel.scrollframe:Show() end - local scrollframe = CreateFrame ("scrollframe", name .. "Scroll", panel.widget, "FauxScrollFrameTemplate") + 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) scrollframe:SetPoint ("topright", panel.widget, "topright", -23, -21) @@ -1318,7 +1426,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro local amount = math.floor (((panel._height-21) / size)) for i = #scrollframe.lines+1, amount do - local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget) + local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget,"BackdropTemplate") row:SetSize (1, size) row.color = {1, 1, 1, .2} @@ -1346,6 +1454,10 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro row.button_inuse = {} row.button_total = 0 + row.checkbox_available = {} + row.checkbox_inuse = {} + row.checkbox_total = 0 + row.icon_available = {} row.icon_inuse = {} row.icon_total = 0 @@ -1406,7 +1518,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) local string_lower = string.lower - DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent) + DF.IconPickFrame = CreateFrame ("frame", "DetailsFrameworkIconPickFrame", UIParent, "BackdropTemplate") tinsert (UISpecialFrames, "DetailsFrameworkIconPickFrame") DF.IconPickFrame:SetFrameStrata ("TOOLTIP") @@ -1441,7 +1553,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) DF.IconPickFrame.emptyFunction = function() end DF.IconPickFrame.callback = DF.IconPickFrame.emptyFunction - DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent) + DF.IconPickFrame.preview = CreateFrame ("frame", nil, UIParent, "BackdropTemplate") DF.IconPickFrame.preview:SetFrameStrata ("tooltip") DF.IconPickFrame.preview:SetFrameLevel (6001) DF.IconPickFrame.preview:SetSize (76, 76) @@ -1500,7 +1612,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) end) --> close button - local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton") + local close_button = CreateFrame ("button", nil, DF.IconPickFrame, "UIPanelCloseButton", "BackdropTemplate") close_button:SetWidth (32) close_button:SetHeight (32) close_button:SetPoint ("TOPRIGHT", DF.IconPickFrame, "TOPRIGHT", -8, -7) @@ -1539,8 +1651,9 @@ function DF:IconPick (callback, close_when_select, param1, param2) 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") - if (spellType ~= "FUTURESPELL") then + if (spellType ~= "FLYOUT") then MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture (j, "player") or 0 + SPELLNAMES_CACHE [index] = GetSpellInfo (ID) index = index + 1 elseif (spellType == "FLYOUT") then @@ -1550,6 +1663,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) local spellID, overrideSpellID, isKnown = GetFlyoutSlotInfo (ID, k) if (isKnown) then MACRO_ICON_FILENAMES [index] = GetSpellTexture (spellID) or 0 + SPELLNAMES_CACHE [index] = GetSpellInfo (spellID) index = index + 1 end end @@ -1572,6 +1686,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) DF.IconPickFrame:SetScript ("OnHide", function() wipe (MACRO_ICON_FILENAMES) + wipe (SPELLNAMES_CACHE) DF.IconPickFrame.preview:Hide() collectgarbage() end) @@ -1602,7 +1717,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) insets = {left = 0, right = 0, top = 0, bottom = 0}, edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], edgeSize = 10} for i = 0, 9 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..(i+1), DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..(i+1).."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1619,7 +1734,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end for i = 11, 20 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1636,7 +1751,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end for i = 21, 30 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1653,7 +1768,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end for i = 31, 40 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1670,7 +1785,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end for i = 41, 50 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1687,7 +1802,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end for i = 51, 60 do - local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame) + local newcheck = CreateFrame ("Button", "DetailsFrameworkIconPickFrameButton"..i, DF.IconPickFrame, "BackdropTemplate") local image = newcheck:CreateTexture ("DetailsFrameworkIconPickFrameButton"..i.."Icon", "overlay") newcheck.icon = image image:SetPoint ("topleft", newcheck, "topleft", 2, -2) image:SetPoint ("bottomright", newcheck, "bottomright", -2, 2) @@ -1704,7 +1819,7 @@ function DF:IconPick (callback, close_when_select, param1, param2) newcheck:SetScript ("OnLeave", onleave) end - local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate") + local scroll = CreateFrame ("ScrollFrame", "DetailsFrameworkIconPickFrameScroll", DF.IconPickFrame, "ListScrollFrameTemplate", "BackdropTemplate") DF:ReskinSlider (scroll) local ChecksFrame_Update = function (self) @@ -1724,19 +1839,10 @@ function DF:IconPick (callback, close_when_select, param1, param2) local shown = 0 if (filter and filter ~= "") then - if (#SPELLNAMES_CACHE == 0) then - --build name cache - local GetSpellInfo = GetSpellInfo - for i = 1, #MACRO_ICON_FILENAMES do - local spellName = GetSpellInfo (MACRO_ICON_FILENAMES [i]) - SPELLNAMES_CACHE [i] = spellName or "NULL" - end - end - --do the filter pool = {} for i = 1, #SPELLNAMES_CACHE do - if (SPELLNAMES_CACHE [i]:find (filter)) then + if (SPELLNAMES_CACHE [i] and SPELLNAMES_CACHE [i]:lower():find (filter)) then pool [#pool+1] = MACRO_ICON_FILENAMES [i] shown = shown + 1 end @@ -1801,7 +1907,7 @@ end function DF:ShowPanicWarning (text) if (not DF.PanicWarningWindow) then - DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent) + DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent, "BackdropTemplate") DF.PanicWarningWindow:SetHeight (80) DF.PanicWarningWindow:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) DF.PanicWarningWindow:SetBackdropColor (1, 0, 0, 0.2) @@ -1899,7 +2005,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db) panel_options = panel_options or no_options - local f = CreateFrame ("frame", name, UIParent) + local f = CreateFrame ("frame", name, UIParent,"BackdropTemplate") f:SetSize (w or 400, h or 250) f:SetPoint ("center", UIParent, "center", 0, 0) f:SetFrameStrata ("FULLSCREEN") @@ -1915,7 +2021,7 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options, db) tinsert (UISpecialFrames, name) end - local title_bar = CreateFrame ("frame", name .. "TitleBar", f) + 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) title_bar:SetHeight (20) @@ -2074,7 +2180,7 @@ local Panel1PxHasPosition = function (self) end function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_special_frame) - local f = CreateFrame ("frame", name, parent or UIParent) + local f = CreateFrame ("frame", name, parent or UIParent, "BackdropTemplate") f:SetSize (w or 100, h or 75) f:SetPoint ("center", UIParent, "center") @@ -2097,7 +2203,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_ --print (config.position.x, config.position.x) Panel1PxReadConfig (f) - local close = CreateFrame ("button", name and name .. "CloseButton", f) + local close = CreateFrame ("button", name and name .. "CloseButton", f, "BackdropTemplate") close:SetSize (16, 16) close:SetNormalTexture (DF.folder .. "icons") close:SetHighlightTexture (DF.folder .. "icons") @@ -2107,7 +2213,7 @@ function DF:Create1PxPanel (parent, w, h, title, name, config, title_anchor, no_ close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1) close:SetAlpha (0.7) - local lock = CreateFrame ("button", name and name .. "LockButton", f) + local lock = CreateFrame ("button", name and name .. "LockButton", f, "BackdropTemplate") lock:SetSize (16, 16) lock:SetNormalTexture (DF.folder .. "icons") lock:SetHighlightTexture (DF.folder .. "icons") @@ -2156,7 +2262,7 @@ end function DF:ShowPromptPanel (message, func_true, func_false, no_repeated, width) if (not DetailsFrameworkPromptSimple) then - local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent) + local f = CreateFrame ("frame", "DetailsFrameworkPromptSimple", UIParent, "BackdropTemplate") f:SetSize (400, 80) f:SetFrameStrata ("DIALOG") f:SetPoint ("center", UIParent, "center", 0, 300) @@ -2257,7 +2363,7 @@ function DF:ShowTextPromptPanel (message, callback) if (not DF.text_prompt_panel) then - local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent) + local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent, "BackdropTemplate") f:SetSize (400, 120) f:SetFrameStrata ("FULLSCREEN") f:SetPoint ("center", UIParent, "center", 0, 100) @@ -2330,7 +2436,7 @@ end --> options button -- ~options function DF:CreateOptionsButton (parent, callback, name) - local b = CreateFrame ("button", name, parent) + local b = CreateFrame ("button", name, parent, "BackdropTemplate") b:SetSize (14, 14) b:SetNormalTexture (DF.folder .. "icons") b:SetHighlightTexture (DF.folder .. "icons") @@ -2358,7 +2464,7 @@ end --> feedback panel -- ~feedback function DF:CreateFeedbackButton (parent, callback, name) - local b = CreateFrame ("button", name, parent) + local b = CreateFrame ("button", name, parent, "BackdropTemplate") b:SetSize (12, 13) b:SetNormalTexture (DF.folder .. "mail") b:SetPushedTexture (DF.folder .. "mail") @@ -2427,7 +2533,7 @@ 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) + 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) @@ -2548,7 +2654,7 @@ 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) + line = CreateFrame ("frame", "AddonFeedbackPanelSA" .. self.next_addons, self, "BackdropTemplate") line:SetSize (128, 64) if (self.next_addons == 1) then @@ -2861,7 +2967,7 @@ local create_box = function (self, next_box) thisbox.check = checktexture thisbox.enabled = true - local button = CreateFrame ("button", nil, self.Graphic) + local button = CreateFrame ("button", nil, self.Graphic, "BackdropTemplate") button:SetSize (20, 20) button:SetScript ("OnClick", function() chart_panel_enable_line (self, thisbox) @@ -3359,7 +3465,7 @@ function DF:CreateChartPanel (parent, w, h, name) w = w or 800 h = h or 500 - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame ("frame", name, parent, "BackdropTemplate") f:SetSize (w or 500, h or 400) f:EnableMouse (true) f:SetMovable (true) @@ -3370,7 +3476,7 @@ function DF:CreateChartPanel (parent, w, h, name) f:SetBackdrop (chart_panel_backdrop) f:SetBackdropColor (.3, .3, .3, .3) - local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton") + local c = CreateFrame ("Button", nil, f, "UIPanelCloseButton", "BackdropTemplate") c:SetWidth (32) c:SetHeight (32) c:SetPoint ("TOPRIGHT", f, "TOPRIGHT", -3, -7) @@ -3509,7 +3615,7 @@ end local gframe_create_line = function (self) local index = #self._lines+1 - local f = CreateFrame ("frame", nil, self) + local f = CreateFrame ("frame", nil, self, "BackdropTemplate") self._lines [index] = f f.id = index f:SetScript ("OnEnter", gframe_on_enter_line) @@ -3537,7 +3643,7 @@ local gframe_create_line = function (self) b:SetTexture ([[Interface\COMMON\Indicator-Yellow]]) b:SetSize (16, 16) f.ball = b - local anchor = CreateFrame ("frame", nil, f) + local anchor = CreateFrame ("frame", nil, f, "BackdropTemplate") anchor:SetAllPoints (b) b.tooltip_anchor = anchor @@ -3644,7 +3750,7 @@ local gframe_update = function (self, lines) end function DF:CreateGFrame (parent, w, h, linewidth, onenter, onleave, member, name) - local f = CreateFrame ("frame", name, parent) + 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]] @@ -3675,7 +3781,7 @@ end -- ~buttoncontainer function DF:CreateButtonContainer (parent, name) - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame ("frame", name, parent, "BackdropTemplate") -- f. end @@ -3807,7 +3913,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t local button_anchor_y = options_table.button_y or -32 local button_text_size = options_table.button_text_size or 10 - local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent) + local mainFrame = CreateFrame ("frame", frame_name, parent.widget or parent, "BackdropTemplate") mainFrame:SetAllPoints() DF:Mixin (mainFrame, DF.TabContainerFunctions) @@ -3830,7 +3936,7 @@ function DF:CreateTabContainer (parent, title, frame_name, frame_list, options_t end for i, frame in ipairs (frame_list) do - local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame) + local f = CreateFrame ("frame", "$parent" .. frame.name, mainFrame, "BackdropTemplate") f:SetAllPoints() f:SetFrameLevel (210) f:Hide() @@ -4047,7 +4153,7 @@ local simple_list_box_SetData = function (self, t) end function DF:CreateSimpleListBox (parent, name, title, empty_text, list_table, onclick, options) - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame ("frame", name, parent, "BackdropTemplate") f.ResetWidgets = simple_list_box_ResetWidgets f.GetOrCreateWidget = simple_list_box_GetOrCreateWidget @@ -4129,7 +4235,7 @@ DF.ScrollBoxFunctions.Refresh = function (self) local offset = 0 if (self.IsFauxScroll) then - FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight+1) + FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight) offset = FauxScrollFrame_GetOffset (self) end @@ -4264,7 +4370,7 @@ DF.ScrollBoxFunctions.OnSizeChanged = function (self) end function DF:CreateScrollBox (parent, name, refresh_func, data, width, height, line_amount, line_height, create_line_func, auto_amount, no_scroll) - local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate") + local scroll = CreateFrame ("scrollframe", name, parent, "FauxScrollFrameTemplate,BackdropTemplate") DF:ApplyStandardBackdrop (scroll) @@ -4297,8 +4403,8 @@ function DF:CreateResizeGrips (parent) if (parent) then local parentName = parent:GetName() - local leftResizer = CreateFrame ("button", parentName and parentName .. "LeftResizer" or nil, parent) - local rightResizer = CreateFrame ("button", parentName and parentName .. "RightResizer" or nil, parent) + 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") @@ -4393,11 +4499,11 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_ local SCROLL_ROLL_AMOUNT = line_amount --keybind set frame - local new_keybind_frame = CreateFrame ("frame", name, parent) + 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") + local keybindScroll = CreateFrame ("scrollframe", "$parentScrollFrame", new_keybind_frame, "FauxScrollFrameTemplate, BackdropTemplate") keybindScroll:SetSize (1019, 348) keybindScroll.Frames = {} new_keybind_frame.keybindScroll = keybindScroll @@ -4491,7 +4597,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_ spec4:SetPoint ("topleft", specsTitle, "bottomleft", 0, -70) end - local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame) + local enter_the_key = CreateFrame ("frame", nil, new_keybind_frame, "BackdropTemplate") enter_the_key:SetFrameStrata ("tooltip") enter_the_key:SetSize (200, 60) enter_the_key:SetBackdrop ({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1}) @@ -4701,7 +4807,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_ local font = "GameFontHighlightSmall" for i = 1, SCROLL_ROLL_AMOUNT do - local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll) + local f = CreateFrame ("frame", "$KeyBindFrame" .. i, keybindScroll, "BackdropTemplate") f:SetSize (1009, 20) f:SetPoint ("topleft", keybindScroll, "topleft", 0, -(i-1)*29) f:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) @@ -4750,7 +4856,7 @@ function DF:CreateKeybindBox (parent, name, data, callback, width, height, line_ f.ActionText:SetAsAutoComplete ("WordList") end - local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll) + local header = CreateFrame ("frame", "$parentOptionsPanelFrameHeader", keybindScroll, "BackdropTemplate") header:SetPoint ("bottomleft", keybindScroll, "topleft", 0, 2) header:SetPoint ("bottomright", keybindScroll, "topright", 0, 2) header:SetHeight (16) @@ -4893,6 +4999,10 @@ end function DF:ApplyStandardBackdrop (f, darkTheme, alphaScale) alphaScale = alphaScale or 1.0 + if(not f.SetBackdrop)then + print(debugstack(1,2,1)) + end + if (darkTheme) then f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Cooldown\cooldown2]], tileSize = 32, tile = true}) f:SetBackdropBorderColor (0, 0, 0, 1) @@ -4942,7 +5052,7 @@ DF.TitleFunctions = { function DF:CreateTitleBar (f, titleText) - local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f) + local titleBar = CreateFrame ("frame", f:GetName() and f:GetName() .. "TitleBar" or nil, f,"BackdropTemplate") titleBar:SetPoint ("topleft", f, "topleft", 2, -3) titleBar:SetPoint ("topright", f, "topright", -2, -3) titleBar:SetHeight (20) @@ -4950,7 +5060,7 @@ function DF:CreateTitleBar (f, titleText) 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) + local closeButton = CreateFrame ("button", titleBar:GetName() and titleBar:GetName() .. "CloseButton" or nil, titleBar, "BackdropTemplate") closeButton:SetSize (16, 16) closeButton:SetNormalTexture (DF.folder .. "icons") closeButton:SetHighlightTexture (DF.folder .. "icons") @@ -4974,6 +5084,9 @@ function DF:CreateTitleBar (f, titleText) f.CloseButton = closeButton f.TitleLabel = titleLabel + titleBar.CloseButton = closeButton + titleBar.Text = titleLabel + DF:Mixin (f, DF.TitleFunctions) return titleBar @@ -4989,7 +5102,7 @@ DF.IconRowFunctions = { local iconFrame = self.IconPool [self.NextIcon] if (not iconFrame) then - local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self) + local newIconFrame = CreateFrame ("frame", "$parentIcon" .. self.NextIcon, self, "BackdropTemplate") newIconFrame.Texture = newIconFrame:CreateTexture (nil, "artwork") PixelUtil.SetPoint (newIconFrame.Texture, "topleft", newIconFrame, "topleft", 1, -1) @@ -5003,10 +5116,11 @@ DF.IconRowFunctions = { newIconFrame:SetBackdropBorderColor (0, 0, 0, 0) newIconFrame:EnableMouse (false) - local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate") + local cooldownFrame = CreateFrame ("cooldown", "$parentIconCooldown" .. self.NextIcon, newIconFrame, "CooldownFrameTemplate, BackdropTemplate") cooldownFrame:SetAllPoints() cooldownFrame:EnableMouse (false) cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1) + cooldownFrame.noCooldownCount = self.options.surpress_tulla_omni_cc newIconFrame.CountdownText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal") --newIconFrame.CountdownText:SetPoint ("center") @@ -5231,10 +5345,11 @@ local default_icon_row_options = { backdrop_border_color = {0, 0, 0, 1}, anchor = {side = 6, x = 2, y = 0}, grow_direction = 1, --1 = to right 2 = to left + surpress_tulla_omni_cc = false, } function DF:CreateIconRow (parent, name, options) - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame("frame", name, parent, "BackdropTemplate") f.IconPool = {} f.NextIcon = 1 @@ -5578,7 +5693,7 @@ DF.HeaderCoreFunctions = { if (not columnHeader) then --create a new column header - local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self) + local newHeader = CreateFrame ("button", "$parentHeaderIndex" .. nextHeader, self,"BackdropTemplate") newHeader:SetScript ("OnClick", DF.HeaderFunctions.OnClick) --header icon @@ -5646,7 +5761,7 @@ local default_header_options = { } function DF:CreateHeader (parent, headerTable, options, frameName) - local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent) + local f = CreateFrame ("frame", frameName or "$parentHeaderLine", parent,"BackdropTemplate") DF:Mixin (f, DF.OptionsFunctions) DF:Mixin (f, DF.HeaderCoreFunctions) @@ -5811,7 +5926,7 @@ DF.RadioGroupCoreFunctions = { anchorOptions: override options for default_framelayout_options table --]=] function DF:CreateRadionGroup (parent, radioOptions, name, options, anchorOptions) - local f = CreateFrame ("frame", name, parent) + local f = CreateFrame ("frame", name, parent, "BackdropTemplate") DF:Mixin (f, DF.OptionsFunctions) DF:Mixin (f, DF.RadioGroupCoreFunctions) @@ -6115,8 +6230,8 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions) pvptalent = {x2StartAt, -70}, group = {x2StartAt, -210}, affix = {x2StartAt, -270}, - encounter_ids = {x2StartAt, -360}, - map_ids = {x2StartAt, -400}, + encounter_ids = {x2StartAt, -400}, + map_ids = {x2StartAt, -440}, } local editingLabel = DF:CreateLabel (f, "Load Conditions For:") @@ -6218,7 +6333,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions) do --create a frame to show talents selected in other specs or characters - local otherTalents = CreateFrame ("frame", nil, f) + local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate") otherTalents:SetSize (26, 26) otherTalents:SetPoint ("left", talentGroup.Title.widget, "right", 10, -2) otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24) @@ -6316,7 +6431,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions) do --create a frame to show talents selected in other specs or characters - local otherTalents = CreateFrame ("frame", nil, f) + local otherTalents = CreateFrame ("frame", nil, f, "BackdropTemplate") otherTalents:SetSize (26, 26) otherTalents:SetPoint ("left", pvpTalentGroup.Title.widget, "right", 10, -2) otherTalents.Texture = DF:CreateImage (otherTalents, [[Interface\BUTTONS\AdventureGuideMicrobuttonAlert]], 24, 24) @@ -6595,7 +6710,7 @@ DF.DataScrollFunctions = { CreateLine = function (self, index) --create a new line - local line = CreateFrame ("button", "$parentLine" .. index, self) + local line = CreateFrame ("button", "$parentLine" .. index, self, "BackdropTemplate") line.Update = self.options.update_line_func --set its parameters @@ -6826,7 +6941,6 @@ end ]] function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString) - local authorName = DF:CreateLabel (f, "" .. (addonBy or "An addon by") .. "|cFFFFFFFF" .. (authorsNameString or "Terciob") .. "|r") authorName.textcolor = "silver" local discordLabel = DF:CreateLabel (f, "Discord: ") @@ -6851,6 +6965,9 @@ function DF:BuildStatusbarAuthorInfo (f, addonBy, authorsNameString) discordTextEntry:HighlightText() end) + f.authorName = authorName + f.discordLabel = discordLabel + f.discordTextEntry = discordTextEntry end local statusbar_default_options = { @@ -6858,7 +6975,7 @@ local statusbar_default_options = { } function DF:CreateStatusBar(f, options) - local statusBar = CreateFrame ("frame", nil, f) + local statusBar = CreateFrame ("frame", nil, f, "BackdropTemplate") DF:Mixin (statusBar, DF.OptionsFunctions) DF:Mixin (statusBar, DF.LayoutFrame) @@ -6988,10 +7105,28 @@ DF.StatusBarFunctions = { WidgetType = "healthBar", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["healthBar"]] = _G [DF.GlobalWidgetControlNames ["healthBar"]] or healthBarMetaPrototype - local healthBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["healthBar"]] + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["healthBar"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["healthBar"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(healthBarMetaPrototype) do + oldMetaPrototype[funcName] = healthBarMetaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["healthBar"]] = healthBarMetaPrototype + end + + local healthBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["healthBar"]] --hook list local defaultHooksForHealthBar = { @@ -7028,9 +7163,9 @@ DF.StatusBarFunctions = { healthBarMetaFunctions.HealthBarEvents = { {"PLAYER_ENTERING_WORLD"}, - --{"UNIT_HEALTH", true}, + {"UNIT_HEALTH", true}, {"UNIT_MAXHEALTH", true}, - {"UNIT_HEALTH_FREQUENT", true}, + --{"UNIT_HEALTH_FREQUENT", true}, {"UNIT_HEAL_PREDICTION", true}, {"UNIT_ABSORB_AMOUNT_CHANGED", true}, {"UNIT_HEAL_ABSORB_AMOUNT_CHANGED", true}, @@ -7163,9 +7298,9 @@ DF.StatusBarFunctions = { if (self.Settings.ShowHealingPrediction) then --incoming heal on the unit from all sources - local unitHealIncoming = UnitGetIncomingHeals (self.displayedUnit) or 0 + local unitHealIncoming = self.displayedUnit and UnitGetIncomingHeals (self.displayedUnit) or 0 --heal absorbs - local unitHealAbsorb = UnitGetTotalHealAbsorbs (self.displayedUnit) or 0 + local unitHealAbsorb = 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 @@ -7191,7 +7326,7 @@ DF.StatusBarFunctions = { if (self.Settings.ShowShields) then --damage absorbs - local unitDamageAbsorb = UnitGetTotalAbsorbs (self.displayedUnit) or 0 + local unitDamageAbsorb = self.displayedUnit and UnitGetTotalAbsorbs (self.displayedUnit) or 0 if (unitDamageAbsorb > 0) then local damageAbsorbPercent = unitDamageAbsorb / currentHealthMax @@ -7266,7 +7401,7 @@ function DF:CreateHealthBar (parent, name, settingsOverride) 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) + local healthBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "HealthBar"), parent, "BackdropTemplate") do --layers --background healthBar.background = healthBar:CreateTexture (nil, "background") @@ -7464,10 +7599,13 @@ DF.PowerFrameFunctions = { --> when a event different from unit_power_update is triggered, update which type of power the unit should show UpdatePowerInfo = function (self) if (self.Settings.ShowAlternatePower) then - local _, minPower, _, _, _, _, showOnRaid = UnitAlternatePowerInfo (self.displayedUnit) - if (showOnRaid and IsInGroup()) then + local barID = UnitPowerBarID(self.displayedUnit) + local barInfo = GetUnitPowerBarInfoByID(barID) + --local name, tooltip, cost = GetUnitPowerBarStringsByID(barID); + --barInfo.barType,barInfo.minPower, barInfo.startInset, barInfo.endInset, barInfo.smooth, barInfo.hideFromOthers, barInfo.showOnRaid, barInfo.opaqueSpark, barInfo.opaqueFlash, barInfo.anchorTop, name, tooltip, cost, barInfo.ID, barInfo.forcePercentage, barInfo.sparkUnderFrame; + if (barInfo and barInfo.showOnRaid and IsInGroup()) then self.powerType = ALTERNATE_POWER_INDEX - self.minPower = minPower + self.minPower = barInfo.minPower return end end @@ -7537,7 +7675,7 @@ function DF: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) + local powerBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "PowerBar"), parent, "BackdropTemplate") do --layers --background powerBar.background = powerBar:CreateTexture (nil, "background") @@ -8165,18 +8303,19 @@ DF.CastFrameFunctions = { 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:SetAlpha (1) self:Show() - - --> set the statusbar color - self:UpdateCastColor() - + --> update the interrupt cast border self:UpdateInterruptState() @@ -8222,17 +8361,18 @@ DF.CastFrameFunctions = { 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:SetAlpha (1) self:Show() - --> set the statusbar color - self:UpdateCastColor() - --> update the interrupt cast border self:UpdateInterruptState() @@ -8402,7 +8542,7 @@ function DF: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) + local castBar = CreateFrame ("StatusBar", name or (parent:GetName() .. "CastBar"), parent, "BackdropTemplate") do --layers @@ -8506,10 +8646,10 @@ DF.BorderFunctions = { end, SetBorderThickness = function (self, newThickness) - PixelUtil.SetWidth (f.leftBorder, newThickness, newThickness) - PixelUtil.SetWidth (f.rightBorder, newThickness, newThickness) - PixelUtil.SetHeight (f.topBorder, newThickness, newThickness) - PixelUtil.SetHeight (f.bottomBorder, newThickness, 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) end, WidgetType = "border", @@ -8520,7 +8660,7 @@ function DF:CreateBorderFrame (parent, name) local parentName = name or "DetailsFrameworkBorderFrame" .. tostring (math.random (1, 100000000)) - local f = CreateFrame ("frame", parentName, parent) + local f = CreateFrame ("frame", parentName, parent, "BackdropTemplate") f:SetFrameLevel (f:GetFrameLevel()+1) f:SetAllPoints() @@ -9025,7 +9165,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS local parentName = name or ("DetailsFrameworkUnitFrame" .. tostring (math.random (1, 100000000))) --> create the main unit frame - local f = CreateFrame ("button", parentName, parent) + local f = CreateFrame ("button", parentName, parent, "BackdropTemplate") --> base level local baseFrameLevel = f:GetFrameLevel() @@ -9051,7 +9191,7 @@ function DF:CreateUnitFrame (parent, name, unitFrameSettingsOverride, healthBarS f.border = borderFrame --> overlay frame (widgets that need to stay above the unit frame) - local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f) + local overlayFrame = CreateFrame ("frame", "$parentOverlayFrame", f, "BackdropTemplate") borderFrame:SetFrameLevel (f:GetFrameLevel() + 6) f.overlayFrame = overlayFrame @@ -9225,7 +9365,7 @@ DF.TimeLineElapsedTimeFunctions = { --creates a frame to show the elapsed time in a row function DF:CreateElapsedTimeFrame (parent, name, options) - local elapsedTimeFrame = CreateFrame ("frame", name, parent) + local elapsedTimeFrame = CreateFrame ("frame", name, parent, "BackdropTemplate") DF:Mixin (elapsedTimeFrame, DF.OptionsFunctions) DF:Mixin (elapsedTimeFrame, DF.LayoutFrame) @@ -9292,7 +9432,7 @@ DF.TimeLineBlockFunctions = { else self.icon:SetTexture (nil) self.text:SetText (lineData.text or "") - text:SetPoint ("left", self, "left", 2, 0) + self.text:SetPoint ("left", self, "left", 2, 0) end if (self.dataIndex % 2 == 1) then @@ -9302,12 +9442,14 @@ DF.TimeLineBlockFunctions = { self:SetBackdropColor (r, g, b, a) end - self:SetWidth (5000) + 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] @@ -9316,6 +9458,8 @@ DF.TimeLineBlockFunctions = { local isAura = blockInfo [3] local auraDuration = blockInfo [4] + local payload = blockInfo.payload + local xOffset = pixelPerSecond * time local width = pixelPerSecond * length @@ -9323,13 +9467,16 @@ DF.TimeLineBlockFunctions = { xOffset = xOffset / 2.5 end - local block = self:GetBlock (i) + local block = self:GetBlock(i) block:Show() - PixelUtil.SetPoint (block, "left", self, "left", xOffset + headerWidth, 0) + block:SetFrameLevel(baseFrameLevel + i) + + PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0) block.info.spellId = spellId block.info.time = time block.info.duration = auraDuration + block.info.payload = payload if (useIconOnBlock) then block.icon:SetTexture (lineData.icon) @@ -9365,7 +9512,7 @@ DF.TimeLineBlockFunctions = { GetBlock = function (self, index) local block = self.blocks [index] if (not block) then - block = CreateFrame ("frame", nil, self) + block = CreateFrame ("frame", nil, self, "BackdropTemplate") self.blocks [index] = block local background = block:CreateTexture (nil, "background") @@ -9412,7 +9559,7 @@ DF.TimeLineFunctions = { local line = self.lines [index] if (not line) then --create a new line - line = CreateFrame ("frame", "$parentLine" .. index, self.body) + line = CreateFrame ("frame", "$parentLine" .. index, self.body, "BackdropTemplate") DF:Mixin (line, DF.TimeLineBlockFunctions) self.lines [index] = line @@ -9543,7 +9690,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) local scrollWidth = 800 --placeholder until the timeline receives data local scrollHeight = 800 --placeholder until the timeline receives data - local frameCanvas = CreateFrame ("scrollframe", name, parent) + local frameCanvas = CreateFrame ("scrollframe", name, parent, "BackdropTemplate") DF:Mixin (frameCanvas, DF.TimeLineFunctions) frameCanvas.data = {} @@ -9556,7 +9703,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) insets = {left = 1, right = 1, top = 0, bottom = 1},}) frameCanvas:SetBackdropColor (.1, .1, .1, .3) - local frameBody = CreateFrame ("frame", nil, frameCanvas) + local frameBody = CreateFrame ("frame", nil, frameCanvas, "BackdropTemplate") frameBody:SetSize (scrollWidth, scrollHeight) frameCanvas:SetScrollChild (frameBody) @@ -9571,7 +9718,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) frameCanvas.elapsedTimeFrame = DF:CreateElapsedTimeFrame (frameBody, frameCanvas:GetName() and frameCanvas:GetName() .. "ElapsedTimeFrame", timelineOptions) --create horizontal slider - local horizontalSlider = CreateFrame ("slider", nil, parent) + local horizontalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate") horizontalSlider.bg = horizontalSlider:CreateTexture (nil, "background") horizontalSlider.bg:SetAllPoints (true) horizontalSlider.bg:SetTexture (0, 0, 0, 0.5) @@ -9594,7 +9741,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) horizontalSlider:SetValue (0) horizontalSlider:SetScript ("OnValueChanged", function (self) local _, maxValue = horizontalSlider:GetMinMaxValues() - local stepValue = ceil (ceil(self:GetValue() * maxValue)/maxValue) + local stepValue = ceil (ceil(self:GetValue() * maxValue) / max(maxValue, SMALL_FLOAT)) if (stepValue ~= horizontalSlider.currentValue) then horizontalSlider.currentValue = stepValue frameCanvas:SetHorizontalScroll (stepValue) @@ -9604,7 +9751,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) frameCanvas.horizontalSlider = horizontalSlider --create scale slider - local scaleSlider = CreateFrame ("slider", nil, parent) + local scaleSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate") scaleSlider.bg = scaleSlider:CreateTexture (nil, "background") scaleSlider.bg:SetAllPoints (true) scaleSlider.bg:SetTexture (0, 0, 0, 0.5) @@ -9638,7 +9785,7 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions) end) --create vertical slider - local verticalSlider = CreateFrame ("slider", nil, parent) + local verticalSlider = CreateFrame ("slider", nil, parent, "BackdropTemplate") verticalSlider.bg = verticalSlider:CreateTexture (nil, "background") verticalSlider.bg:SetAllPoints (true) verticalSlider.bg:SetTexture (0, 0, 0, 0.5) @@ -9753,7 +9900,7 @@ f:Hide() function DF:ShowErrorMessage (errorMessage, titleText) if (not DF.ErrorMessagePanel) then - local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent) + local f = CreateFrame ("frame", "DetailsFrameworkErrorMessagePanel", UIParent, "BackdropTemplate") f:SetSize (400, 120) f:SetFrameStrata ("FULLSCREEN") f:SetPoint ("center", UIParent, "center", 0, 100) diff --git a/libs/DF/picture.lua b/libs/DF/picture.lua index 0aa1210..e5dbb4f 100644 --- a/libs/DF/picture.lua +++ b/libs/DF/picture.lua @@ -21,12 +21,29 @@ do WidgetType = "image", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["image"]] = _G [DF.GlobalWidgetControlNames ["image"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["image"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["image"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["image"]] = metaPrototype + end end -local ImageMetaFunctions = _G [DF.GlobalWidgetControlNames ["image"]] +local ImageMetaFunctions = _G[DF.GlobalWidgetControlNames ["image"]] ------------------------------------------------------------------------------------------------------------ --> metatables diff --git a/libs/DF/pictureedit.lua b/libs/DF/pictureedit.lua index 956f4c3..45596bc 100644 --- a/libs/DF/pictureedit.lua +++ b/libs/DF/pictureedit.lua @@ -1,7 +1,7 @@ local DF = _G ["DetailsFramework"] if (not DF or not DetailsFrameworkCanLoad) then - return + return end local _ @@ -30,7 +30,7 @@ local CreateImageEditorFrame = function() edit_texture:SetAllPoints() _G.DetailsFrameworkImageEdit_EditTexture = edit_texture - local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit) + local background_frame = CreateFrame ("frame", "DetailsFrameworkImageEditBackground", DetailsFrameworkImageEdit, "BackdropTemplate") background_frame:SetPoint ("topleft", DetailsFrameworkImageEdit, "topleft", -10, 30) background_frame:SetFrameStrata ("TOOLTIP") background_frame:SetFrameLevel (window:GetFrameLevel()) @@ -351,7 +351,7 @@ local CreateImageEditorFrame = function() end end) - local resizer = CreateFrame ("Button", nil, window.widget) + local resizer = CreateFrame ("Button", nil, window.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) @@ -419,7 +419,7 @@ local CreateImageEditorFrame = function() --> select area to crop - local DragFrame = CreateFrame ("frame", nil, background_frame) + local DragFrame = CreateFrame ("frame", nil, background_frame, "BackdropTemplate") DragFrame:EnableMouse (false) DragFrame:SetFrameStrata ("TOOLTIP") DragFrame:SetPoint ("topleft", edit_texture.widget, "topleft") @@ -473,8 +473,7 @@ local CreateImageEditorFrame = function() SelectionBox_Left:SetPoint ("topleft", UIParent, "bottomleft", x1, y1) SelectionBox_Left:SetPoint ("bottomleft", UIParent, "bottomleft", x1, y2) - - print (1) + else --bottom diff --git a/libs/DF/scrollbar.lua b/libs/DF/scrollbar.lua index fae545c..5fb91e6 100644 --- a/libs/DF/scrollbar.lua +++ b/libs/DF/scrollbar.lua @@ -10,7 +10,7 @@ end function DF:NewScrollBar (master, slave, x, y) - local new_slider = CreateFrame ("Slider", nil, master) + local new_slider = CreateFrame ("Slider", nil, master,"BackdropTemplate") new_slider.scrollMax = 560 --default - tamanho da janela de fundo -- ///// SLIDER ///// @@ -32,7 +32,7 @@ function DF:NewScrollBar (master, slave, x, y) new_slider:SetValue(0) new_slider.ultimo = 0 - local botao_cima = CreateFrame ("Button", nil, master) + local botao_cima = CreateFrame ("Button", nil, master,"BackdropTemplate") botao_cima:SetPoint ("BOTTOM", new_slider, "TOP", 0, -12) botao_cima.x = 0 @@ -46,7 +46,7 @@ function DF:NewScrollBar (master, slave, x, y) botao_cima:Show() botao_cima:Disable() - local botao_baixo = CreateFrame ("Button", nil, master) + local botao_baixo = CreateFrame ("Button", nil, master,"BackdropTemplate") botao_baixo:SetPoint ("TOP", new_slider, "BOTTOM", 0, 12) botao_baixo.x = 0 botao_baixo.y = 12 diff --git a/libs/DF/slider.lua b/libs/DF/slider.lua index 345eee2..61b5147 100644 --- a/libs/DF/slider.lua +++ b/libs/DF/slider.lua @@ -22,13 +22,32 @@ do local metaPrototype = { WidgetType = "slider", SetHook = DF.SetHook, + HasHook = DF.HasHook, + ClearHooks = DF.ClearHooks, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion } - _G [DF.GlobalWidgetControlNames ["slider"]] = _G [DF.GlobalWidgetControlNames ["slider"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["slider"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["slider"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["slider"]] = metaPrototype + end end -local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] +local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]] ------------------------------------------------------------------------------------------------------------ --> metatables @@ -228,6 +247,18 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] return self.thumb:SetSize (w, h) end + function DFSliderMetaFunctions:SetBackdrop(...) + return self.slider:SetBackdrop(...) + end + + function DFSliderMetaFunctions:SetBackdropColor(...) + return self.slider:SetBackdropColor(...) + end + + function DFSliderMetaFunctions:SetBackdropBorderColor(...) + return self.slider:SetBackdropBorderColor(...) + end + -- setpoint function DFSliderMetaFunctions:SetPoint (v1, v2, v3, v4, v5) @@ -405,7 +436,7 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] end - local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent) + local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons1", UIParent, "BackdropTemplate") f:Hide() f:SetHeight (18) @@ -421,6 +452,7 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] end function f:ShowMe (host) + f:SetParent(host) f:SetPoint ("bottomleft", host, "topleft", -3, -5) f:SetPoint ("bottomright", host, "topright", 3, -5) --f:SetFrameStrata (host:GetFrameStrata()) @@ -441,8 +473,8 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] f:SetScript ("OnUpdate", going_hide) end - local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f) - local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f) + local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f, "BackdropTemplate") + local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f, "BackdropTemplate") button_plus:SetFrameStrata (f:GetFrameStrata()) button_minor:SetFrameStrata (f:GetFrameStrata()) @@ -618,7 +650,7 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]] if (not DFSliderMetaFunctions.editbox_typevalue) then - local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent) + local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent, "BackdropTemplate") editbox:SetSize (40, 20) editbox:SetJustifyH ("center") @@ -901,6 +933,7 @@ local set_switch_func = function (self, newFunction) end local set_as_checkbok = function (self) + if self.is_checkbox and self.checked_texture then return end local checked = self:CreateTexture (self:GetName() .. "CheckTexture", "overlay") checked:SetTexture ([[Interface\Buttons\UI-CheckBox-Check]]) checked:SetPoint ("center", self.button, "center", -1, -1) @@ -1139,7 +1172,7 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de SliderObject.lockdown = false SliderObject.container = container - SliderObject.slider = CreateFrame ("slider", name, parent) + SliderObject.slider = CreateFrame ("slider", name, parent,"BackdropTemplate") SliderObject.widget = SliderObject.slider SliderObject.useDecimals = isDecemal or false @@ -1177,6 +1210,8 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de SliderObject.thumb = SliderObject.slider:CreateTexture (nil, "artwork") SliderObject.thumb:SetTexture ("Interface\\Buttons\\UI-ScrollBar-Knob") SliderObject.thumb:SetSize (30+(h*0.2), h*1.2) + SliderObject.thumb.originalWidth = SliderObject.thumb:GetWidth() + SliderObject.thumb.originalHeight =SliderObject.thumb:GetHeight() SliderObject.thumb:SetAlpha (0.7) SliderObject.slider:SetThumbTexture (SliderObject.thumb) SliderObject.slider.thumb = SliderObject.thumb diff --git a/libs/DF/spells.lua b/libs/DF/spells.lua index 393f296..add002b 100644 --- a/libs/DF/spells.lua +++ b/libs/DF/spells.lua @@ -14,6 +14,8 @@ DF.CooldownsBySpec = { -- 4 raid defensive cooldown -- 5 personal utility cooldown + --Shadowlands 9.0.2 revision by Juliana Maison + --MAGE --arcane [62] = { @@ -22,6 +24,7 @@ DF.CooldownsBySpec = { [45438] = 2, --Ice Block [12051] = 5, --Evocation [110960] = 5, --Greater Invisibility + [235450] = 5, --Prismatic Barrier }, --fire [63] = { @@ -29,36 +32,42 @@ DF.CooldownsBySpec = { [55342] = 1, --Mirror Image [45438] = 2, --Ice Block [66] = 5, --Invisibility + [235313] = 5, --Blazing Barrier }, --frost [64] = { [12472] = 1, --Icy Veins - [205021] = 1, --Ray of Frost + [205021] = 1, --Ray of Frost (talent) [55342] = 1, --Mirror Image [45438] = 2, --Ice Block [66] = 5, --Invisibility [235219] = 5, --Cold Snap + [11426] = 5, --Ice Barrier + [113724] = 5, --Ring of Frost (talent) }, --PRIEST --discipline [256] = { + [10060] = 1, --Power Infusion [34433] = 1, --Shadowfiend [123040] = 1, --Mindbender [33206] = 3, --Pain Suppression [62618] = 4, --Power Word: Barrier [271466] = 4, --Luminous Barrier (talent) + [109964] = 4, --Spirit Shell (talent) [47536] = 5, --Rapture [19236] = 5, --Desperate Prayer [8122] = 5, --Psychic Scream }, --holy [257] = { + [10060] = 1, --Power Infusion [200183] = 2, --Apotheosis [47788] = 3, --Guardian Spirit [64844] = 4, --Divine Hymn [64901] = 4, --Symbol of Hope - [265202] = 4, --Holy Word: Salvation + [265202] = 4, --Holy Word: Salvation (talent) [88625] = 5, --Holy Word: Chastise [34861] = 5, --Holy Word: Sanctify [2050] = 5, --Holy Word: Serenity @@ -67,13 +76,17 @@ DF.CooldownsBySpec = { }, --shadow priest [258] = { + [10060] = 1, --Power Infusion [34433] = 1, --Shadowfiend [200174] = 1, --Mindbender + [205385] = 1, --Shadow Clash [193223] = 1, --Surrender to Madness [47585] = 2, --Dispersion [15286] = 4, --Vampiric Embrace + [19236] = 5, --Desperate Prayer [64044] = 5, --Psychic Horror [8122] = 5, --Psychic Scream + [205369] = 5, --Mind Bomb }, --ROGUE @@ -84,6 +97,7 @@ DF.CooldownsBySpec = { [5277] = 2, --Evasion [31224] = 2, --Cloak of Shadows [2094] = 5, --Blind + [185311] = 5, --Crimson Vial [114018] = 5, --Shroud of Concealment }, --outlaw @@ -92,9 +106,12 @@ DF.CooldownsBySpec = { [51690] = 1, --Killing Spree (talent) [199754] = 2, --Riposte [31224] = 2, --Cloak of Shadows + [5277] = 2, --Evasion [1856] = 2, --Vanish [2094] = 5, --Blind + [185311] = 5, --Crimson Vial [114018] = 5, --Shroud of Concealment + [343142] = 5, --Dreadblades }, --subtlety [261] = { @@ -103,6 +120,7 @@ DF.CooldownsBySpec = { [1856] = 2, --Vanish [5277] = 2, --Evasion [2094] = 5, --Blind + [185311] = 5, --Crimson Vial [114018] = 5, --Shroud of Concealment }, @@ -110,17 +128,19 @@ DF.CooldownsBySpec = { --affliction [265] = { [205180] = 1, --Summon Darkglare + [342601] = 1, --Ritual of Doom [113860] = 1, --Dark Soul: Misery (talent) - [104773] = 2, --Unending Resolve - - [108416] = 2, --Dark Pact (talent) - + [104773] = 2, --Unending Resolve + [108416] = 2, --Dark Pact (talent) [30283] = 5, --Shadowfury - [6789] = 5, --Mortal Coil + [6789] = 5, --Mortal Coil (talent) + [333889] = 5, --Fel Domination }, - --demo + --demonology [266] = { [265187] = 1, --Summon Demonic Tyrant + [342601] = 1, --Ritual of Doom + [267171] = 1, --Demonic Strength (talent) [111898] = 1, --Grimoire: Felguard (talent) [267217] = 1, --Nether Portal (talent) @@ -128,31 +148,31 @@ DF.CooldownsBySpec = { [108416] = 2, --Dark Pact (talent) [30283] = 5, --Shadowfury - [6789] = 5, --Mortal Coil + [6789] = 5, --Mortal Coil (talent) + [5484] = 5, --Howl of Terror (talent) + [333889] = 5, --Fel Domination }, - --destro + --destruction [267] = { [1122] = 1, --Summon Infernal - [113858] = 1, --Dark Soul: Instability (talent) - + [342601] = 1, --Ritual of Doom + [113858] = 1, --Dark Soul: Instability (talent) [104773] = 2, --Unending Resolve - [108416] = 2, --Dark Pact (talent) - - [6789] = 5, --Mortal Coil + [108416] = 2, --Dark Pact (talent) + [6789] = 5, --Mortal Coil (talent) [30283] = 5, --Shadowfury + [333889] = 5, --Fel Domination }, --WARRIOR --Arms [71] = { - [107574] = 1, --Avatar + [107574] = 1, --Avatar (talent) [227847] = 1, --Bladestorm [152277] = 1, --Ravager (talent) - [118038] = 2, --Die by the Sword - [97462] = 4, --Rallying Cry - + [64382] = 5, --Shattering Throw [18499] = 5, --Berserker Rage [5246] = 5, --Intimidating Shout }, @@ -160,11 +180,9 @@ DF.CooldownsBySpec = { [72] = { [1719] = 1, --Recklessness [46924] = 1, --Bladestorm (talent) - [184364] = 2, --Enraged Regeneration - [97462] = 4, --Rallying Cry - + [64382] = 5, --Shattering Throw [18499] = 5, --Berserker Rage [5246] = 5, --Intimidating Shout }, @@ -172,12 +190,10 @@ DF.CooldownsBySpec = { [73] = { [228920] = 1, --Ravager (talent) [107574] = 1, --Avatar - [12975] = 2, --Last Stand [871] = 2, --Shield Wall - [97462] = 4, --Rallying Cry - + [64382] = 5, --Shattering Throw [18499] = 5, --Berserker Rage [5246] = 5, --Intimidating Shout }, @@ -186,17 +202,15 @@ DF.CooldownsBySpec = { --holy [65] = { [31884] = 1, --Avenging Wrath - [216331] = 1, --Avenging Crusader (talent) - + [216331] = 1, --Avenging Crusader (talent) [498] = 2, --Divine Protection [642] = 2, --Divine Shield [105809] = 2, --Holy Avenger (talent) - - [1022] = 3, --Blessing of Protection + [152262] = 2, --Seraphim [633] = 3, --Lay on Hands - + [1022] = 3, --Blessing of Protection + [6940] = 3, --Blessing of Sacrifice [31821] = 4, --Aura Mastery - [1044] = 5, --Blessing of Freedom [853] = 5, --Hammer of Justice [115750] = 5, --Blinding Light (talent) @@ -205,16 +219,14 @@ DF.CooldownsBySpec = { --protection [66] = { [31884] = 1, --Avenging Wrath - + [327193] = 1, --Moment of Glory (talent) [31850] = 2, --Ardent Defender [86659] = 2, --Guardian of Ancient Kings - + [105809] = 2, --Holy Avenger (talent) + [152262] = 2, --Seraphim [1022] = 3, --Blessing of Protection [204018] = 3, --Blessing of Spellwarding (talent) [6940] = 3, --Blessing of Sacrifice - - [204150] = 4, --Aegis of Light (talent) - [1044] = 5, --Blessing of Freedom [853] = 5, --Hammer of Justice [115750] = 5, --Blinding Light (talent) @@ -224,13 +236,12 @@ DF.CooldownsBySpec = { [70] = { [31884] = 1, --Avenging Wrath [231895] = 1, --Crusade (talent) - + [205191] = 2, --Eye for an Eye (talent) [184662] = 2, --Shield of Vengeance [642] = 2, --Divine Shield - [1022] = 3, --Blessing of Protection + [6940] = 3, --Blessing of Sacrifice [633] = 3, --Lay on Hands - [1044] = 5, --Blessing of Freedom [853] = 5, --Hammer of Justice [115750] = 5, --Blinding Light (talent) @@ -240,19 +251,23 @@ DF.CooldownsBySpec = { --havoc [577] = { [200166] = 1, --Metamorphosis - [206491] = 1, --Nemesis (talent) - + [198589] = 2, --Blur [196555] = 2, --Netherwalk (talent) - [196718] = 4, --Darkness + [188501] = 5, --Spectral Sight + [179057] = 5, --Chaos Nova + [211881] = 5, --Fel Eruption (talent) }, --vengeance [581] = { + [320341] = 1, --Bulk Extraction (talent) [187827] = 2, --Metamorphosis - + [204021] = 2, --Fiery Brand + [263648] = 2, --Soul Barrier (talent) [207684] = 5, --Sigil of Misery [202137] = 5, --Sigil of Silence [202138] = 5, --Sigil of Chains (talent) + [188501] = 5, --Spectral Sight }, --DEATH KNIGHT @@ -261,78 +276,95 @@ DF.CooldownsBySpec = { [275699] = 1, --Apocalypse [42650] = 1, --Army of the Dead [49206] = 1, --Summon Gargoyle (talent) - + [207289] = 1, --Unholy Assault (talent) + [48707] = 2, --Anti-magic Shell [48792] = 2, --Icebound Fortitude [48743] = 2, --Death Pact (talent) + [51052] = 4, --Anti-magic Zone + [108194] = 5, --Asphyxiate (talent) + [287081] = 5, --Lichborne + [212552] = 5, --Wraith walk (talent) }, --frost [251] = { [152279] = 1, --Breath of Sindragosa (talent) [47568] = 1, --Empower Rune Weapon - [279302] = 1, --Frostwyrm's Fury (talent) - + [279302] = 1, --Frostwyrm's Fury + [48707] = 2, --Anti-magic Shell [48792] = 2, --Icebound Fortitude [48743] = 2, --Death Pact (talent) - + [51052] = 4, --Anti-magic Zone [207167] = 5, --Blinding Sleet (talent) + [108194] = 5, --Asphyxiate (talent) + [287081] = 5, --Lichborne + [212552] = 5, --Wraith walk (talent) }, --blood [250] = { [49028] = 1, --Dancing Rune Weapon - + [48707] = 2, --Anti-magic Shell + [48743] = 2, --Death Pact (talent) + [219809] = 2, --Tombstone (talent) [55233] = 2, --Vampiric Blood [48792] = 2, --Icebound Fortitude - + [51052] = 4, --Anti-magic Zone [108199] = 5, --Gorefiend's Grasp + [221562] = 5, --Asphyxiate + [212552] = 5, --Wraith walk (talent) }, --DRUID - --balance + --Balance [102] = { [194223] = 1, --Celestial Alignment [102560] = 1, --Incarnation: Chosen of Elune (talent) - [22812] = 2, --Barkskin [108238] = 2, --Renewal (talent) - [29166] = 3, --Innervate - + [77761] = 4, --Stampeding Roar + [99] = 5, --Incapacitating Roar + [319454] = 5, --Heart of the Wild (talent) + [132469] = 5, --Typhoon [78675] = 5, --Solar Beam }, - --feral + --Feral [103] = { [106951] = 1, --Berserk [102543] = 1, --Incarnation: King of the Jungle (talent) - + [22812] = 2, --Barkskin [61336] = 2, --Survival Instincts [108238] = 2, --Renewal (talent) - [77764] = 4, --Stampeding Roar + [132469] = 5, --Typhoon + [319454] = 5, --Heart of the Wild (talent) }, - --guardian + --Guardian [104] = { + [106951] = 1, --Berserk + [204066] = 1, --Lunar Beam [22812] = 2, --Barkskin [61336] = 2, --Survival Instincts [102558] = 2, --Incarnation: Guardian of Ursoc (talent) - + [108238] = 2, --Renewal (talent) [77761] = 4, --Stampeding Roar - + [132469] = 5, --Typhoon [99] = 5, --Incapacitating Roar + [319454] = 5, --Heart of the Wild (talent) }, - --restoration + --Restoration [105] = { [22812] = 2, --Barkskin [108238] = 2, --Renewal (talent) [33891] = 2, --Incarnation: Tree of Life (talent) - [102342] = 3, --Ironbark [29166] = 3, --Innervate - + [203651] = 3, --Overgrowth (talent) [740] = 4, --Tranquility [197721] = 4, --Flourish (talent) - + [77761] = 4, --Stampeding Roar + [319454] = 5, --Heart of the Wild (talent) [102793] = 5, --Ursol's Vortex }, @@ -342,62 +374,74 @@ DF.CooldownsBySpec = { [193530] = 1, --Aspect of the Wild [19574] = 1, --Bestial Wrath [201430] = 1, --Stampede (talent) - [194407] = 1, --Spitting Cobra (talent) - [186265] = 2, --Aspect of the Turtle - + [109304] = 2, --Exhilaration + [199483] = 2, --Camouflage (talent) + [186257] = 5, --Aspect of the cheetah [19577] = 5, --Intimidation + [109248] = 5, --Binding Shot (talent) + [187650] = 5, --Freezing Trap }, --marksmanship [254] = { [193526] = 1, --Trueshot - + [260402] = 1, --Double tap [186265] = 2, --Aspect of the Turtle + [199483] = 2, --Camouflage (talent) [109304] = 2, --Exhilaration [281195] = 2, --Survival of the Fittest - + [186257] = 5, --Aspect of the cheetah [187650] = 5, --Freezing Trap }, --survival [255] = { [266779] = 1, --Coordinated Assault - [186265] = 2, --Aspect of the Turtle + [199483] = 2, --Camouflage (talent) [109304] = 2, --Exhilaration - + [186289] = 5, --Aspect of the eagle [19577] = 5, --Intimidation + [187650] = 5, --Freezing Trap }, --MONK --brewmaster [268] = { + [132578] = 1, --Invoke Niuzao, the Black Ox + [115080] = 1, --Touch of Death [115203] = 2, --Fortifying Brew + [115399] = 2, --Black Ox brew (talent) [115176] = 2, --Zen Meditation [122278] = 2, --Dampen Harm (talent) + [116844] = 5, --Ring of peace (talent) + [119381] = 5, --Leg Sweep }, --windwalker [269] = { [137639] = 1, --Storm, Earth, and Fire - [123904] = 1, --Invoke Xuen, the White Tiger (talent) + [123904] = 1, --Invoke Xuen, the White Tiger [152173] = 1, --Serenity (talent) - + [115080] = 1, --Touch of Death + [115203] = 2, --Fortifying Brew [122470] = 2, --Touch of Karma [122278] = 2, --Dampen Harm (talent) [122783] = 2, --Diffuse Magic (talent) - + [116844] = 5, --Ring of peace (talent) [119381] = 5, --Leg Sweep }, --mistweaver [270] = { + [115080] = 1, --Touch of Death [122278] = 2, --Dampen Harm (talent) [243435] = 2, --Fortifying Brew [122783] = 2, --Diffuse Magic (talent) - [116849] = 3, --Life Cocoon - + [322118] = 4, --Invoke Yulon, the Jade serpent [198664] = 4, --Invoke Chi-Ji, the Red Crane (talent) - [115310] = 4, --Revival + [116844] = 5, --Ring of peace (talent) + [197908] = 5, --Mana tea (talent) + [119381] = 5, --Leg Sweep }, --SHAMAN @@ -406,17 +450,23 @@ DF.CooldownsBySpec = { [198067] = 1, --Fire Elemental [192249] = 1, --Storm Elemental (talent) [114050] = 1, --Ascendance (talent) - [108271] = 2, --Astral Shift - [108281] = 4, --Ancestral Guidance (talent) + [198103] = 4, --Earth Elemental + [79206] = 5, --Spiritwalkers grace + [65992] = 5, --Tremor Totem + [192058] = 5, --Capacitor Totem + [192077] = 5, --Wind Rush Totem (talent) }, --enhancement [263] = { [51533] = 1, --Feral Spirit [114051] = 1, --Ascendance (talent) - [108271] = 2, --Astral Shift + [198103] = 4, --Earth Elemental + [65992] = 5, --Tremor Totem + [192058] = 5, --Capacitor Totem + }, --restoration [263] = { @@ -424,7 +474,11 @@ DF.CooldownsBySpec = { [114052] = 2, --Ascendance (talent) [98008] = 4, --Spirit Link Totem [108280] = 4, --Healing Tide Totem + [16191] = 4, --Mana Tide Totem + [198103] = 4, --Earth Elemental [207399] = 4, --Ancestral Protection Totem (talent) + [198103] = 4, --Earth Elemental + [65992] = 5, --Tremor Totem }, } @@ -436,16 +490,20 @@ DF.CooldownsInfo = { [498] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Protection [642] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Divine Shield [105809] = {cooldown = 90, duration = 20, talent = 22164, charges = 1, class = "PALADIN", type = 2}, --Holy Avenger (talent) - [1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection + [152262] = { cooldown = 45, duration = 15, talent = 17601, charges = 1, class = "PALADIN", type = 2}, --Seraphim [633] = {cooldown = 600, duration = false, talent = false, charges = 1, class = "PALADIN", type = 3}, --Lay on Hands + [1022] = {cooldown = 300, duration = 10, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Protection + [6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice [31821] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 4}, --Aura Mastery [1044] = {cooldown = 25, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 5}, --Blessing of Freedom + [853] = {cooldown = 60, duration = 6, talent = false, charges = 1, class = "PALADIN", type = 5}, --Hammer of Justice + [115750] = {cooldown = 90, duration = 6, talent = 21811, charges = 1, class = "PALADIN", type = 5}, --Blinding Light(talent) + [327193] = {cooldown = 90, duration = 15, talent = 23468, charges = 1, class = "PALADIN", type = 1}, --Moment of Glory (talent) [31850] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Ardent Defender [86659] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "PALADIN", type = 2}, --Guardian of Ancient Kings [204018] = {cooldown = 180, duration = 10, talent = 22435, charges = 1, class = "PALADIN", type = 3}, --Blessing of Spellwarding (talent) - [6940] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "PALADIN", type = 3}, --Blessing of Sacrifice - [204150] = {cooldown = 180, duration = 6, talent = 23087, charges = 1, class = "PALADIN", type = 4}, --Aegis of Light (talent) [231895] = {cooldown = 120, duration = 25, talent = 22215, charges = 1, class = "PALADIN", type = 1}, --Crusade (talent) + [205191] = {cooldown = 60, duration = 10, talent = 22183, charges = 1, class = "PALADIN", type = 2}, --Eye for an Eye (talent) [184662] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "PALADIN", type = 2}, --Shield of Vengeance --> warrior @@ -460,55 +518,79 @@ DF.CooldownsInfo = { [228920] = {cooldown = 60, duration = 6, talent = 23099, charges = 1, class = "WARRIOR", type = 1}, --Ravager (talent) [12975] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Last Stand [871] = {cooldown = 8, duration = 240, talent = false, charges = 1, class = "WARRIOR", type = 2}, --Shield Wall + [64382] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Shattering Throw + [5246] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "WARRIOR", type = 5}, --Intimidating Shout + --> warlock [205180] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Darkglare + [342601] = {cooldown = 3600, duration = false, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Ritual of Doom [113860] = {cooldown = 120, duration = 20, talent = 19293, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Misery (talent) [104773] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "WARLOCK", type = 2}, --Unending Resolve [108416] = {cooldown = 60, duration = 20, talent = 19286, charges = 1, class = "WARLOCK", type = 2}, --Dark Pact (talent) [265187] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Demonic Tyrant - [111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard + [111898] = {cooldown = 120, duration = 15, talent = 21717, charges = 1, class = "WARLOCK", type = 1}, --Grimoire: Felguard (talent) + [267171] = {cooldown = 60, duration = false, talent = 23138, charges = 1, class = "WARLOCK", type = 1}, --Demonic Strength (talent) [267217] = {cooldown = 180, duration = 20, talent = 23091, charges = 1, class = "WARLOCK", type = 1}, --Nether Portal [1122] = {cooldown = 180, duration = 30, talent = false, charges = 1, class = "WARLOCK", type = 1}, --Summon Infernal [113858] = {cooldown = 120, duration = 20, talent = 23092, charges = 1, class = "WARLOCK", type = 1}, --Dark Soul: Instability (talent) + [30283] = {cooldown = 60, duration = 3, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Shadowfury + [333889] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "WARLOCK", type = 5}, --Fel Domination --> shaman [198067] = {cooldown = 150, duration = 30, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Fire Elemental [192249] = {cooldown = 150, duration = 30, talent = 19272, charges = 1, class = "SHAMAN", type = 1}, --Storm Elemental (talent) - [114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent) [108271] = {cooldown = 90, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 2}, --Astral Shift [108281] = {cooldown = 120, duration = 10, talent = 22172, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Guidance (talent) [51533] = {cooldown = 120, duration = 15, talent = false, charges = 1, class = "SHAMAN", type = 1}, --Feral Spirit + [114050] = {cooldown = 180, duration = 15, talent = 21675, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent) [114051] = {cooldown = 180, duration = 15, talent = 21972, charges = 1, class = "SHAMAN", type = 1}, --Ascendance (talent) [114052] = {cooldown = 180, duration = 15, talent = 22359, charges = 1, class = "SHAMAN", type = 2}, --Ascendance (talent) [98008] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Spirit Link Totem [108280] = {cooldown = 180, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Healing Tide Totem [207399] = {cooldown = 240, duration = 30, talent = 22323, charges = 1, class = "SHAMAN", type = 4}, --Ancestral Protection Totem (talent) + [16191] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Mana Tide Totem + [198103] = {cooldown = 300, duration = 60, talent = false, charges = 1, class = "SHAMAN", type = 4}, --Earth Elemental + [192058] = {cooldown = 60, duration = false, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Capacitor Totem + [65992] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "SHAMAN", type = 5}, --Tremor Totem + [192077] = {cooldown = 120, duration = 15, talent = 21966, charges = 1, class = "SHAMAN", type = 5}, --Wind Rush Totem (talent) --> monk + [132578] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Niuzao, the Black Ox + [115080] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 1}, --Touch of Death [115203] = {cooldown = 420, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew [115176] = {cooldown = 300, duration = 8, talent = false, charges = 1, class = "MONK", type = 2}, --Zen Meditation + [115399] = {cooldown = 120, duration = false, talent = 19992, charges = 1, class = "MONK", type = 2}, --Black Ox brew (talent) [122278] = {cooldown = 120, duration = 10, talent = 20175, charges = 1, class = "MONK", type = 2}, --Dampen Harm (talent) [137639] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 1}, --Storm, Earth, and Fire - [123904] = {cooldown = 120, duration = 20, talent = 22102, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger (talent) + [123904] = {cooldown = 120, duration = 24, talent = false, charges = 1, class = "MONK", type = 1}, --Invoke Xuen, the White Tiger [152173] = {cooldown = 90, duration = 12, talent = 21191, charges = 1, class = "MONK", type = 1}, --Serenity (talent) [122470] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MONK", type = 2}, --Touch of Karma + [322118] = {cooldown = 180, duration = 25, talent = false, charges = 1, class = "MONK", type = 4}, --Invoke Yulon, the Jade serpent [198664] = {cooldown = 180, duration = 25, talent = 22214, charges = 1, class = "MONK", type = 4}, --Invoke Chi-Ji, the Red Crane (talent) [243435] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "MONK", type = 2}, --Fortifying Brew [122783] = {cooldown = 90, duration = 6, talent = 20173, charges = 1, class = "MONK", type = 2}, --Diffuse Magic (talent) [116849] = {cooldown = 120, duration = 12, talent = false, charges = 1, class = "MONK", type = 3}, --Life Cocoon [115310] = {cooldown = 180, duration = false, talent = false, charges = 1, class = "MONK", type = 4}, --Revival + [197908] = {cooldown = 90, duration = 10, talent = 22166, charges = 1, class = "MONK", type = 5}, --Mana tea (talent) + [116844] = {cooldown = 45, duration = 5, talent = 19995, charges = 1, class = "MONK", type = 5}, --Ring of peace (talent) + [119381] = {cooldown = 50, duration = 3, talent = false, charges = 1, class = "MONK", type = 5}, --Leg Sweep --> hunter [193530] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Aspect of the Wild [19574] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "HUNTER", type = 1}, --Bestial Wrath [201430] = {cooldown = 180, duration = 12, talent = 23044, charges = 1, class = "HUNTER", type = 1}, --Stampede (talent) - [194407] = {cooldown = 90, duration = 20, talent = 22295, charges = 1, class = "HUNTER", type = 1}, --Spitting Cobra (talent) [193526] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 1}, --Trueshot - [281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest + [199483] = {cooldown = 60, duration = 60, talent = 23100, charges = 1, class = "HUNTER", type = 2}, --Camouflage (talent) + [281195] = {cooldown = 180, duration = 6, talent = false, charges = 1, class = "HUNTER", type = 2}, --Survival of the Fittest [266779] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "HUNTER", type = 1}, --Coordinated Assault [186265] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "HUNTER", type = 2}, --Aspect of the Turtle [109304] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "HUNTER", type = 2}, --Exhilaration + [186257] = {cooldown = 144, duration = 14, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the cheetah + [19577] = {cooldown = 60, duration = 5, talent = false, charges = 1, class = "HUNTER", type = 5}, --Intimidation + [109248] = {cooldown = 45, duration = 10, talent = 22499, charges = 1, class = "HUNTER", type = 5}, --Binding Shot (talent) + [187650] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "HUNTER", type = 5}, --Freezing Trap + [186289] = {cooldown = 72, duration = 15, talent = false, charges = 1, class = "HUNTER", type = 5}, --Aspect of the eagle --> druid [194223] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "DRUID", type = 1}, --Celestial Alignment @@ -524,42 +606,67 @@ DF.CooldownsInfo = { [102558] = {cooldown = 180, duration = 30, talent = 22388, charges = 1, class = "DRUID", type = 2}, --Incarnation: Guardian of Ursoc (talent) [33891] = {cooldown = 180, duration = 30, talent = 22421, charges = 1, class = "DRUID", type = 2}, --Incarnation: Tree of Life (talent) [102342] = {cooldown = 60, duration = 12, talent = false, charges = 1, class = "DRUID", type = 3}, --Ironbark + [203651] = {cooldown = 60, duration = false, talent = 22422, charges = 1, class = "DRUID", type = 3}, --Overgrowth (talent) [740] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DRUID", type = 4}, --Tranquility [197721] = {cooldown = 90, duration = 8, talent = 22404, charges = 1, class = "DRUID", type = 4}, --Flourish (talent) + [132469] = {cooldown = 30, duration = false, talent = false, charges = 1, class = "DRUID", type = 5}, --Typhoon + [319454] = {cooldown = 300, duration = 45, talent = 18577, charges = 1, class = "DRUID", type = 5}, --Heart of the Wild (talent) --> death knight [275699] = {cooldown = 90, duration = 15, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Apocalypse [42650] = {cooldown = 480, duration = 30, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Army of the Dead - [49206] = {cooldown = 180, duration = 30, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent) + [49206] = {cooldown = 180, duration = 30, talent = 22110, charges = 1, class = "DEATHKNIGHT", type = 1}, --Summon Gargoyle (talent) + [207289] = {cooldown = 78, duration = 12, talent = 22538, charges = 1, class = "DEATHKNIGHT", type = 1}, --Unholy Assault (talent) [48743] = {cooldown = 120, duration = 15, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Death Pact (talent) + [48707] = {cooldown = 60, duration = 10, talent = 23373, charges = 1, class = "DEATHKNIGHT", type = 2}, --Anti-magic Shell [152279] = {cooldown = 120, duration = 5, talent = 22537, charges = 1, class = "DEATHKNIGHT", type = 1}, --Breath of Sindragosa (talent) [47568] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Empower Rune Weapon [279302] = {cooldown = 120, duration = 10, talent = 22535, charges = 1, class = "DEATHKNIGHT", type = 1}, --Frostwyrm's Fury (talent) [49028] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 1}, --Dancing Rune Weapon [55233] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Vampiric Blood [48792] = {cooldown = 120, duration = 8, talent = false, charges = 1, class = "DEATHKNIGHT", type = 2}, --Icebound Fortitude - [108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp (utility) + [51052] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "DEATHKNIGHT", type = 4}, --Anti-magic Zone + [219809] = {cooldown = 60, duration = 8, talent = 23454, charges = 1, class = "DEATHKNIGHT", type = 2}, --Tombstone (talent) + [108199] = {cooldown = 120, duration = false, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Gorefiend's Grasp + [207167] = {cooldown = 60, duration = 5, talent = 22519, charges = 1, class = "DEATHKNIGHT", type = 5}, --Blinding Sleet (talent) + [108194] = {cooldown = 45, duration = 4, talent = 22520, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate (talent) + [221562] = {cooldown = 45, duration = 5, talent = false, charges = 1, class = "DEATHKNIGHT", type = 5}, --Asphyxiate --> demon hunter [200166] = {cooldown = 240, duration = 30, talent = false, charges = 1, class = "DEMONHUNTER", type = 1}, --Metamorphosis - [206491] = {cooldown = 120, duration = 60, talent = 22547, charges = 1, class = "DEMONHUNTER", type = 1}, --Nemesis (talent) + [198589] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Blur [196555] = {cooldown = 120, duration = 5, talent = 21865, charges = 1, class = "DEMONHUNTER", type = 2}, --Netherwalk (talent) [196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness [187827] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Metamorphosis + [196718] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 4}, --Darkness + [188501] = {cooldown = 30, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Spectral Sight + [179057] = {cooldown = 60, duration = 2, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Chaos Nova + [211881] = {cooldown = 30, duration = 4, talent = 22767, charges = 1, class = "DEMONHUNTER", type = 5}, --Fel Eruption (talent) + [320341] = {cooldown = 90, duration = false, talent = 21902, charges = 1, class = "DEMONHUNTER", type = 1}, --Bulk Extraction (talent) + [204021] = {cooldown = 60, duration = 10, talent = false, charges = 1, class = "DEMONHUNTER", type = 2}, --Fiery Brand + [263648] = {cooldown = 30, duration = 12, talent = 22768, charges = 1, class = "DEMONHUNTER", type = 2}, --Soul Barrier (talent) + [207684] = {cooldown = 90, duration = 12, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Misery + [202137] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Silence + [202138] = {cooldown = 90, duration = 6, talent = 22511, charges = 1, class = "DEMONHUNTER", type = 5}, --Sigil of Chains (talent) --> mage [12042] = {cooldown = 90, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Arcane Power [12051] = {cooldown = 90, duration = 6, talent = false, charges = 1, class = "MAGE", type = 1}, --Evocation [110960] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Greater Invisibility + [235450] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Prismatic Barrier + [235313] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Blazing Barrier + [11426] = {cooldown = 25, duration = 60, talent = false, charges = 1, class = "MAGE", type = 5}, --Ice Barrier [190319] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "MAGE", type = 1}, --Combustion - [55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image (talent) + [55342] = {cooldown = 120, duration = 40, talent = 22445, charges = 1, class = "MAGE", type = 1}, --Mirror Image [66] = {cooldown = 300, duration = 20, talent = false, charges = 1, class = "MAGE", type = 2}, --Invisibility [12472] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "MAGE", type = 1}, --Icy Veins [205021] = {cooldown = 78, duration = 5, talent = 22309, charges = 1, class = "MAGE", type = 1}, --Ray of Frost (talent) [45438] = {cooldown = 240, duration = 10, talent = false, charges = 1, class = "MAGE", type = 2}, --Ice Block [235219] = {cooldown = 300, duration = false, talent = false, charges = 1, class = "MAGE", type = 5}, --Cold Snap + [113724] = {cooldown = 45, duration = 10, talent = 22471, charges = 1, class = "MAGE", type = 5}, --Ring of Frost (talent) --> priest + [10060] = {cooldown = 120, duration = 20, talent = false, charges = 1, class = "PRIEST", type = 1}, --Power Infusion [34433] = {cooldown = 180, duration = 15, talent = false, charges = 1, class = "PRIEST", type = 1}, --Shadowfiend [123040] = {cooldown = 60, duration = 12, talent = 22094, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent) [33206] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 3}, --Pain Suppression @@ -572,6 +679,7 @@ DF.CooldownsInfo = { [64844] = {cooldown = 180, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 4}, --Divine Hymn [64901] = {cooldown = 300, duration = 6, talent = false, charges = 1, class = "PRIEST", type = 4}, --Symbol of Hope [265202] = {cooldown = 720, duration = false, talent = 23145, charges = 1, class = "PRIEST", type = 4}, --Holy Word: Salvation (talent) + [109964] = {cooldown = 60, duration = 12, talent = 21184, charges = 1, class = "PRIEST", type = 4}, --Spirit Shell (talent) [8122] = {cooldown = 60, duration = 8, talent = false, charges = 1, class = "PRIEST", type = 5}, --Psychic Scream [200174] = {cooldown = 60, duration = 15, talent = 21719, charges = 1, class = "PRIEST", type = 1}, --Mindbender (talent) [193223] = {cooldown = 240, duration = 60, talent = 21979, charges = 1, class = "PRIEST", type = 1}, --Surrender to Madness (talent) @@ -585,10 +693,13 @@ DF.CooldownsInfo = { [31224] = {cooldown = 120, duration = 5, talent = false, charges = 1, class = "ROGUE", type = 2}, --Cloak of Shadows [2094] = {cooldown = 120, duration = 60, talent = false, charges = 1, class = "ROGUE", type = 5}, --Blind [114018] = {cooldown = 360, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Shroud of Concealment + [185311] = {cooldown = 30, duration = 15, talent = false, charges = 1, class = "ROGUE", type = 5}, --Crimson Vial [13750] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Adrenaline Rush [51690] = {cooldown = 120, duration = 2, talent = 23175, charges = 1, class = "ROGUE", type = 1}, --Killing Spree (talent) [199754] = {cooldown = 120, duration = 10, talent = false, charges = 1, class = "ROGUE", type = 2}, --Riposte [121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades + [343142] = {cooldown = 90, duration = 10, talent = 19250, charges = 1, class = "ROGUE", type = 5}, --Dreadblades + [121471] = {cooldown = 180, duration = 20, talent = false, charges = 1, class = "ROGUE", type = 1}, --Shadow Blades } -- {cooldown = , duration = , talent = false, charges = 1} @@ -633,7 +744,6 @@ DF.CrowdControlSpells = { [408] = "ROGUE", --Kidney Shot [6770] = "ROGUE", --Sap [1776] = "ROGUE", --Gouge - [199804] = "ROGUE", --Between the Eyes [853] = "PALADIN", --Hammer of Justice [20066] = "PALADIN", --Repentance (talent) @@ -656,7 +766,8 @@ DF.CrowdControlSpells = { [209753] = "DRUID", --Cyclone (from pvp talent) [33786] = "DRUID", --Cyclone (from pvp talent - resto druid) - [3355] = "HUNTER", --Freezing Trap + [3355] = "HUNTER", --Freezing Trap + [3355] = "HUNTER", --Diamond Ice (from pvp talent) [19577] = "HUNTER", --Intimidation [190927] = "HUNTER", --Harpoon [162480] = "HUNTER", --Steel Trap @@ -786,92 +897,67 @@ end --consumables DF.FlaskIDs = { - [251836] = true, -- Flask of the Currents agility - [251837] = true, -- Flask of Endless Fathoms intellect - [251838] = true, -- Flask of the Vast Horizon stamina - [251839] = true, -- Flask of the Undertow strength - - ------------------------------------------------------------------------ - --revision ny nullKomplex july 07 2019 - [298836] = true, -- Greater Flask of the Currents agility - [298837] = true, -- Greater Flask of Endless Fathoms intellect - [298839] = true, -- Greater Flask of the Vast Horizon stamina - [298841] = true, -- Greater Flask of the Undertow strength + --Shadowlands + [307185] = true, --Spectral Flask of Power + [307187] = true, --Spectral Stamina Flask + [307166] = true, --Eternal Flask + + + } DF.FoodIDs = { - [257422] = 41, --Mon'Dazi versatility - [257413] = 41, --Ravenberry Tarts haste - [257418] = 41, --Loa Loaf mastery - [257408] = 41, --Kul Tiramisu critical - - [257424] = 55, --Spiced Snapper versatility - [257415] = 55, --Swamp Fish 'n Chips haste - [257420] = 55, --Sailor's Pie mastery - [257410] = 55, --Honey-Glazed Haunches critical - - [259448] = 75, --Galley Banquet agility - [259449] = 75, --Galley Banquet intellect - [259453] = 75, --Galley Banquet stamina - [259452] = 75, --Galley Banquet strength - - [259454] = 100, --Bountiful Captain's Feast agility - [259455] = 100, --Bountiful Captain's Feast intellect - [259457] = 100, --Bountiful Captain's Feast stamina - [257427] = 100, --Bountiful Captain's Feast strength - - ------------------------------------------------------------------------ - --revision ny nullKomplex july 07 2019 - [288074] = 113, -- Wild Berry Bread stamina (maybe fake it as 41?) - - [285721] = 60, -- Druid Rebirth trait agility - [285719] = 60, -- Druid Rebirth trait intellect - [285720] = 60, -- Druid Rebirth trait strength - - -- Put in 70 section: - [288075] = 150, -- Seasoned Steak and Potatoes (70?) - - [290467] = 85, -- Boralus Blood Sausage agility - [290468] = 85, -- Boralus Blood Sausage intellect - [290469] = 85, -- Boralus Blood Sausage strength - - [297037] = 93, -- Bil'Tong versatility - [297034] = 93, -- Baked Port Tato haste - [297035] = 93, -- Abyssal-Fried Rissole mastery - [297039] = 93, -- Mech-Dowel's "Big Mech" critical - [297040] = 198, -- Fragrant Kakavia stamina (93?) - - [297116] = 131, -- Famine Evaluator And Snack Table agility - [297117] = 131, -- Famine Evaluator And Snack Table intellect - [297118] = 131, -- Famine Evaluator And Snack Table strength + --shadowlands tier 1 + [259454] = 1, -- (agility) Feast of Gluttonous Hedonism + [308434] = 1, -- (critical) Phantasmal Souffle and Fries + [308488] = 1, -- (haste) Tenebrous Crown Roast Aspic + [308506] = 1, -- (mastery) Crawler Ravioli with Apple Sauce + [308525] = 1, -- (stamina) Banana Beef Pudding + [308514] = 1, -- (versatility) Steak a la Mode + [327851] = 1, -- (periodicaly heal out of combat) Seraph Tenders + [308637] = 1, -- (periodicaly damage) Smothered Shank + [327715] = 1, -- (speed) Fried Bonefish } DF.PotionIDs = { - [279152] = true, --Battle Potion of Agility - [279151] = true, --Battle Potion of Intellect - [279154] = true, --Battle Potion of Stamina - [279153] = true, --Battle Potion of Strength - - [269853] = true, --Potion of Rising Death (range) - [251316] = true, --Potion of Bursting Blood (melee) - [251231] = true, --Steelskin Potion (tank) - - ------------------------------------------------------------------------ - --revision ny nullKomplex july 07 2019 - [298146] = true, -- Superior Battle Potion of Agility - [298152] = true, -- Superior Battle Potion of Intellect - [298153] = true, -- Superior Battle Potion of Stamina - [298154] = true, -- Superior Battle Potion of Strength - - [298317] = true, -- Potion of Focused Resolve (crit) - [300714] = true, -- Potion of Unbridled Fury (fire damage) - [298225] = true, -- Potion of Empowered Proximity (main stat per enemy) - [298155] = true, -- Superior Steelskin Potion (tank) - [300741] = true, -- Potion of Wild Mending (healer) + --Shadowlands + [307159] = true, --Potion of Spectral Agility + [307163] = true, --Potion of Spectral Stamina + [307164] = true, --Potion of Spectral Strength + [307160] = true, --Potion of Hardened Shadows + [307162] = true, --Potion of Spectral Intellect + [307494] = true, --Potion of Empowered Exorcisms + [307495] = true, --Potion of Phantom Fire + [307496] = true, --Potion of Divine Awakening + [307161] = true, --Potion of Spiritual Clarity + [307496] = true, --Potion of Divine Awakening + [307501] = true, --Potion of Specter Swiftness + [322302] = true, --Potion of Sacrificial Anima + [307497] = true, --Potion of Deathly Fixation + [307195] = true, --Potion of the Hidden Spirit + [307199] = true, --Potion of Soul Purity + [307196] = true, --Potion of Shadow Sight + [307192] = true, --Spiritual Healing Potion + [307194] = true, --Spiritual Rejuvenation Potion + [307193] = true, --Spiritual Mana Potion + [323436] = true, --Purify Soul (greek convent) +-- [] = true, -- + + [307165] = true, --Spiritual Anti-Venom + + +} + +DF.FeastIDs = { + [308462] = true, --Feast of Gluttonous Hedonism + [307153] = true, --Eternal Cauldron + + + } DF.RuneIDs = { - [270058] = true, --Battle-Scarred Augment Rune + } -- /dump UnitAura ("player", 1) diff --git a/libs/DF/split_bar.lua b/libs/DF/split_bar.lua index 2208e02..9cbff37 100644 --- a/libs/DF/split_bar.lua +++ b/libs/DF/split_bar.lua @@ -20,12 +20,29 @@ do WidgetType = "split_bar", SetHook = DF.SetHook, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["split_bar"]] = _G [DF.GlobalWidgetControlNames ["split_bar"]] or metaPrototype + --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"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["split_bar"]] = metaPrototype + end end -local SplitBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["split_bar"]] +local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]] ------------------------------------------------------------------------------------------------------------ --> metatables diff --git a/libs/DF/textentry.lua b/libs/DF/textentry.lua index 5105ad8..fe77317 100644 --- a/libs/DF/textentry.lua +++ b/libs/DF/textentry.lua @@ -22,13 +22,32 @@ do local metaPrototype = { WidgetType = "textentry", SetHook = DF.SetHook, + HasHook = DF.HasHook, + ClearHooks = DF.ClearHooks, RunHooksForWidget = DF.RunHooksForWidget, + + dversion = DF.dversion, } - _G [DF.GlobalWidgetControlNames ["textentry"]] = _G [DF.GlobalWidgetControlNames ["textentry"]] or metaPrototype + --check if there's a metaPrototype already existing + if (_G[DF.GlobalWidgetControlNames["textentry"]]) then + --get the already existing metaPrototype + local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["textentry"]] + --check if is older + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + --the version is older them the currently loading one + --copy the new values into the old metatable + for funcName, _ in pairs(metaPrototype) do + oldMetaPrototype[funcName] = metaPrototype[funcName] + end + end + else + --first time loading the framework + _G[DF.GlobalWidgetControlNames ["textentry"]] = metaPrototype + end end -local TextEntryMetaFunctions = _G [DF.GlobalWidgetControlNames ["textentry"]] +local TextEntryMetaFunctions = _G[DF.GlobalWidgetControlNames ["textentry"]] DF.TextEntryCounter = DF.TextEntryCounter or 1 ------------------------------------------------------------------------------------------------------------ @@ -226,6 +245,18 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 end end + function TextEntryMetaFunctions:SetBackdrop(...) + return self.editbox:SetBackdrop(...) + end + + function TextEntryMetaFunctions:SetBackdropColor(...) + return self.editbox:SetBackdropColor(...) + end + + function TextEntryMetaFunctions:SetBackdropBorderColor(...) + return self.editbox:SetBackdropBorderColor(...) + end + --> select all text function TextEntryMetaFunctions:SelectAll() self.editbox:HighlightText() @@ -304,6 +335,12 @@ DF.TextEntryCounter = DF.TextEntryCounter or 1 end end end + + function TextEntryMetaFunctions:SetCommitFunction(func) + if (type(func) == "function") then + self.func = func + end + end ------------------------------------------------------------------------------------------------------------ --> scripts and hooks @@ -583,7 +620,7 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p TextEntryObject.container = container TextEntryObject.have_tooltip = nil - TextEntryObject.editbox = CreateFrame ("EditBox", name, parent) + 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}}) @@ -1086,17 +1123,17 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show name = name:gsub ("$parent", parentName) end - local borderframe = CreateFrame ("Frame", name, parent) + 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") - local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate") + local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate") + local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate, BackdropTemplate") - scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe) + scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe,"BackdropTemplate") scrollframe.editbox:SetMultiLine (true) scrollframe.editbox:SetAutoFocus (false) scrollframe.editbox:SetScript ("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged) @@ -1106,9 +1143,10 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show --line number if (showLineNumbers) then - scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines) + scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines, "BackdropTemplate") scrollframeNumberLines.editbox:SetMultiLine (true) scrollframeNumberLines.editbox:SetAutoFocus (false) + scrollframeNumberLines.editbox:SetEnabled (false) scrollframeNumberLines.editbox:SetFontObject ("GameFontHighlightSmall") scrollframeNumberLines.editbox:SetJustifyH ("left") scrollframeNumberLines.editbox:SetJustifyV ("top") @@ -1117,10 +1155,11 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show scrollframeNumberLines.editbox:SetPoint ("bottomright", borderframe, "bottomright", -30, 10) scrollframeNumberLines:SetScrollChild (scrollframeNumberLines.editbox) + scrollframeNumberLines:EnableMouseWheel (false) for i = 1, 1000 do scrollframeNumberLines.editbox:Insert (i .. "\n") - end + end --place the lua code field 20 pixels to the right to make run to the lines scroll scrollframe:SetPoint ("topleft", borderframe, "topleft", 30, -10) @@ -1163,7 +1202,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show scrollframeNumberLines:SetPoint ("bottomright", borderframe, "bottomright", -10, 10) scrollframeNumberLines:Hide() end ---16:40 + borderframe.SetAsAutoComplete = TextEntryMetaFunctions.SetAsAutoComplete scrollframe:SetScript ("OnSizeChanged", function (self) @@ -1233,7 +1272,7 @@ local function bit (x,b) end local function lor (x,y) - result = 0 + local result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and 2^(p-1) or 0) end return result end