- Fixed damage on low level training dummies where it was showing 1 damage for each ability.

- Added a line in the tooltip shown when hovering over the spec icon to show non-formated DPS, example: "12.0K" DPS shows "11,985.8".
- Developers: command /run Details:DumpTable() should now show the correct table names with quotation marks if string.
- Framework update.
This commit is contained in:
Tercio
2018-10-19 21:11:32 -03:00
parent 6cfb1a71c4
commit c8bac60626
7 changed files with 358 additions and 55 deletions
+14 -27
View File
@@ -32,8 +32,9 @@ local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]]
------------------------------------------------------------------------------------------------------------
--> metatables
ButtonMetaFunctions.__call = function (_table, value, ...)
return self.func (_table.param1, _table.param2, value, ...)
ButtonMetaFunctions.__call = function (self)
local frameWidget = self.widget
DF:CoreDispatch ((frameWidget:GetName() or "Button") .. ":__call()", self.func, frameWidget, "LeftButton", self.param1, self.param2)
end
------------------------------------------------------------------------------------------------------------
@@ -494,13 +495,16 @@ local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]]
-- exec
function ButtonMetaFunctions:Exec()
return self.func (self.param1, self.param2)
local frameWidget = self.widget
DF:CoreDispatch ((frameWidget:GetName() or "Button") .. ":Exec()", self.func, frameWidget, "LeftButton", self.param1, self.param2)
end
function ButtonMetaFunctions:Click()
return self.func (self.param1, self.param2)
local frameWidget = self.widget
DF:CoreDispatch ((frameWidget:GetName() or "Button") .. ":Click()", self.func, frameWidget, "LeftButton", self.param1, self.param2)
end
function ButtonMetaFunctions:RightClick()
return self.funcright()
local frameWidget = self.widget
DF:CoreDispatch ((frameWidget:GetName() or "Button") .. ":RightClick()", self.funcright, frameWidget, "RightButton", self.param1, self.param2)
end
--> custom textures
@@ -785,9 +789,9 @@ local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]]
if (button.MyObject.options.OnGrab) then
if (_type (button.MyObject.options.OnGrab) == "string" and button.MyObject.options.OnGrab == "PassClick") then
if (buttontype == "LeftButton") then
button.MyObject.func (button.MyObject.param1, button.MyObject.param2)
DF:CoreDispatch ((button:GetName() or "Button") .. ":OnMouseDown()", button.MyObject.func, button, buttontype, button.MyObject.param1, button.MyObject.param2)
else
button.MyObject.funcright (button.MyObject.param1, button.MyObject.param2)
DF:CoreDispatch ((button:GetName() or "Button") .. ":OnMouseDown()", button.MyObject.funcright, button, buttontype, button.MyObject.param1, button.MyObject.param2)
end
end
end
@@ -877,21 +881,9 @@ local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]]
(button.mouse_down+0.5 > GetTime() and button:IsMouseOver())
) then
if (buttontype == "LeftButton") then
local success, errorText = pcall (button.MyObject.func, button, buttontype, button.MyObject.param1, button.MyObject.param2)
if (not success) then
error ("Details! Framework: button " .. button:GetName() .. " error: " .. errorText)
end
--button.MyObject.func (button, buttontype, button.MyObject.param1, button.MyObject.param2)
DF:CoreDispatch ((button:GetName() or "Button") .. ":OnMouseUp()", button.MyObject.func, button, buttontype, button.MyObject.param1, button.MyObject.param2)
else
local success, errorText = pcall (button.MyObject.funcright, button, buttontype, button.MyObject.param1, button.MyObject.param2)
if (not success) then
error ("Details! Framework: button " .. button:GetName() .. " error: " .. errorText)
end
--button.MyObject.funcright (button, buttontype, button.MyObject.param1, button.MyObject.param2)
DF:CoreDispatch ((button:GetName() or "Button") .. ":OnMouseUp()", button.MyObject.funcright, button, buttontype, button.MyObject.param1, button.MyObject.param2)
end
end
end
@@ -1151,12 +1143,7 @@ local pickcolor_callback = function (self, r, g, b, a, button)
button.MyObject.color_texture:SetVertexColor (r, g, b, a)
--> safecall
--button.MyObject:color_callback (r, g, b, a)
local success, errorText = pcall (button.MyObject.color_callback, button.MyObject, r, g, b, a)
if (not success) then
error ("Details! Framework: colorpick " .. (self:GetName() or "-NONAME-") .. " error: " .. errorText)
end
DF:CoreDispatch ((self:GetName() or "ColorPicker") .. ".pickcolor_callback()", button.MyObject.color_callback, button.MyObject, r, g, b, a)
button.MyObject:RunHooksForWidget ("OnColorChanged", button.MyObject, r, g, b, a)
end
+54 -9
View File
@@ -1,5 +1,5 @@
local dversion = 114
local dversion = 116
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -233,25 +233,43 @@ function DF.table.dump (t, s, deep)
for i = 1, deep do
space = space .. " "
end
for key, value in pairs (t) do
local tpe = _type (value)
if (type (key) ~= "string") then
if (type (key) == "function") then
key = "#function#"
elseif (type (key) == "table") then
key = "#table#"
end
if (type (key) ~= "string" and type (key) ~= "number") then
key = "unknown?"
end
end
if (tpe == "table") then
s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
if (type (key) == "number") then
s = s .. space .. "[" .. key .. "] = |cFFa9ffa9 {|r\n"
else
s = s .. space .. "[\"" .. key .. "\"] = |cFFa9ffa9 {|r\n"
end
s = s .. DF.table.dump (value, nil, deep+1)
s = s .. space .. "|cFFa9ffa9}|r\n"
s = s .. space .. "|cFFa9ffa9},|r\n"
elseif (tpe == "string") then
s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
s = s .. space .. "[\"" .. key .. "\"] = \"|cFFfff1c1" .. value .. "|r\",\n"
elseif (tpe == "number") then
s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
s = s .. space .. "[\"" .. key .. "\"] = |cFFffc1f4" .. value .. "|r,\n"
elseif (tpe == "function") then
s = s .. space .. "[" .. key .. "] = function()\n"
s = s .. space .. "[\"" .. key .. "\"] = function()end,\n"
elseif (tpe == "boolean") then
s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
s = s .. space .. "[\"" .. key .. "\"] = |cFF99d0ff" .. (value and "true" or "false") .. "|r,\n"
end
end
return s
end
@@ -2442,6 +2460,33 @@ function DF:Dispatch (func, ...)
return result1, result2, result3, result4
end
--[=[
DF:CoreDispatch (func, context, ...)
safe call a function making a error window with what caused, the context and traceback of the error
this func is only used inside the framework for sensitive calls where the func must run without errors
@func = the function which will be called
@context = what made the function be called
... parameters to pass in the function call
--]=]
function DF:CoreDispatch (context, func, ...)
if (type (func) ~= "function") then
local stack = debugstack(2)
local errortext = "D!Framework " .. context .. " error: invalid function to call\n====================\n" .. stack .. "\n====================\n"
error (errortext)
end
local okay, result1, result2, result3, result4 = pcall (func, ...)
if (not okay) then
local stack = debugstack (2)
local errortext = "D!Framework (" .. context .. ") error: " .. result1 .. "\n====================\n" .. stack .. "\n====================\n"
error (errortext)
end
return result1, result2, result3, result4
end
--/run local a, b =32,3; local f=function(c,d) return c+d, 2, 3;end; print (xpcall(f,geterrorhandler(),a,b))
function DF_CALC_PERFORMANCE()
local F = CreateFrame ("frame")
+249 -5
View File
@@ -4089,10 +4089,7 @@ DF.ScrollBoxFunctions.Refresh = function (self)
offset = FauxScrollFrame_GetOffset (self)
end
local okay, totalLines = pcall (self.refresh_func, self, self.data, offset, self.LineAmount)
if (not okay) then
error ("Details! FrameWork: Refresh(): " .. totalLines)
end
DF:CoreDispatch ((self:GetName() or "ScrollBox") .. ":Refresh()", self.refresh_func, self, self.data, offset, self.LineAmount)
for _, frame in ipairs (self.Frames) do
if (not frame._InUse) then
@@ -6232,4 +6229,251 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
end
--functionn falsee truee breakk
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> simple data scroll
DF.DataScrollFunctions = {
RefreshScroll = function (self, data, offset, totalLines)
local filter = self.Filter
local currentData = {}
if (type (filter) == "string" and filter ~= "") then
for i = 1, #data do
for o = 1, #data[i] do
if (data[i][o]:find (filter)) then
tinsert (currentData, data[i])
break
end
end
end
else
currentData = data
end
if (self.SortAlphabetical) then
table.sort (currentData, function(t1, t2) return t1[1] < t2[1] end)
end
--update the scroll
for i = 1, totalLines do
local index = i + offset
local thisData = currentData [index]
if (thisData) then
local line = self:GetLine (i)
line:Update (index, thisData)
end
end
end,
CreateLine = function (self, index)
--create a new line
local line = CreateFrame ("button", "$parentLine" .. index, self)
line.Update = self.options.update_line_func
--set its parameters
line:SetPoint ("topleft", self, "topleft", 1, -((index-1) * (self.options.line_height+1)) - 1)
line:SetSize (self.options.width - 2, self.options.line_height)
line:RegisterForClicks ("LeftButtonDown", "RightButtonDown")
line:SetScript ("OnEnter", self.options.on_enter)
line:SetScript ("OnLeave", self.options.on_leave)
line:SetScript ("OnClick", self.options.on_click)
line:SetBackdrop (self.options.backdrop)
line:SetBackdropColor (unpack (self.options.backdrop_color))
line:SetBackdropBorderColor (unpack (self.options.backdrop_border_color))
local title = DF:CreateLabel (line, "", DF:GetTemplate ("font", self.options.title_template))
local date = DF:CreateLabel (line, "", DF:GetTemplate ("font", self.options.title_template))
local text = DF:CreateLabel (line, "", DF:GetTemplate ("font", self.options.text_tempate))
title.textsize = 14
date.textsize = 14
text:SetSize (self.options.width - 20, self.options.line_height)
text:SetJustifyV ("top")
--setup anchors
if (self.options.show_title) then
title:SetPoint ("topleft", line, "topleft", 2, 0)
date:SetPoint ("topright", line, "topright", -2, 0)
text:SetPoint ("topleft", title, "bottomleft", 0, -4)
else
text:SetPoint ("topleft", line, "topleft", 2, 0)
end
line.Title = title
line.Date = date
line.Text = text
return line
end,
LineOnEnter = function (self)
local parent = self:GetParent()
self:SetBackdropColor (unpack (parent.options.backdrop_color_highlight))
end,
LineOnLeave = function (self)
local parent = self:GetParent()
self:SetBackdropColor (unpack (parent.options.backdrop_color))
end,
OnClick = function (self)
end,
UpdateLine = function (line, lineIndex, data)
local parent = line:GetParent()
if (parent.options.show_title) then
line.Title.text = data [1] or ""
line.Date.text = data [2] or ""
line.Text.text = data [3] or ""
else
line.Text.text = data [1] or ""
end
end,
}
local default_datascroll_options = {
width = 400,
height = 700,
line_amount = 10,
line_height = 20,
show_title = true,
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdrop_color = {0, 0, 0, 0.2},
backdrop_color_highlight = {.2, .2, .2, 0.4},
backdrop_border_color = {0.1, 0.1, 0.1, .2},
title_template = "ORANGE_FONT_TEMPLATE",
text_tempate = "OPTIONS_FONT_TEMPLATE",
create_line_func = DF.DataScrollFunctions.CreateLine,
update_line_func = DF.DataScrollFunctions.UpdateLine,
refresh_func = DF.DataScrollFunctions.RefreshScroll,
on_enter = DF.DataScrollFunctions.LineOnEnter,
on_leave = DF.DataScrollFunctions.LineOnLeave,
on_click = DF.DataScrollFunctions.OnClick,
data = {},
}
--[=[
Create a scroll frame to show text in an organized way
Functions in the options table can be overritten to customize the layout
@parent = the parent of the frame
@name = the frame name to use in the CreateFrame call
@options = options table to override default values from the table above
--]=]
function DF:CreateDataScrollFrame (parent, name, options)
--call the mixin with a dummy table to built the default options before the frame creation
--this is done because CreateScrollBox needs parameters at creation time
local optionsTable = {}
DF.OptionsFunctions.BuildOptionsTable (optionsTable, default_datascroll_options, options)
optionsTable = optionsTable.options
--scroll frame
local newScroll = DF:CreateScrollBox (parent, name, optionsTable.refresh_func, optionsTable.data, optionsTable.width, optionsTable.height, optionsTable.line_amount, optionsTable.line_height)
DF:ReskinSlider (newScroll)
DF:Mixin (newScroll, DF.OptionsFunctions)
DF:Mixin (newScroll, DF.LayoutFrame)
newScroll:BuildOptionsTable (default_datascroll_options, options)
--create the scrollbox lines
for i = 1, newScroll.options.line_amount do
newScroll:CreateLine (newScroll.options.create_line_func)
end
newScroll:Refresh()
return newScroll
end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> what's new window
local default_newsframe_options = {
width = 400,
height = 700,
line_amount = 16,
line_height = 40,
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdrop_color = {0, 0, 0, 0.2},
backdrop_border_color = {0.1, 0.1, 0.1, .2},
title = "What's New?",
show_title = true,
}
DF.NewsFrameFunctions = {
}
--[=[
Creates a panel with a scroll to show texts organized in separated lines
@parent = the parent of the frame
@name = the frame name to use in the CreateFrame call
@options = options table to override default values from the table above
@newsTable = an indexed table of tables
@db = (optional) an empty table from the addon database to store the position of the frame between game sessions
--]=]
function DF:CreateNewsFrame (parent, name, options, newsTable, db)
local f = DF:CreateSimplePanel (parent, 400, 700, options and options.title or default_newsframe_options.title, name, {UseScaleBar = db and true}, db)
f:SetFrameStrata ("MEDIUM")
DF:ApplyStandardBackdrop (f)
DF:Mixin (f, DF.OptionsFunctions)
DF:Mixin (f, DF.LayoutFrame)
f:BuildOptionsTable (default_newsframe_options, options)
f:SetSize (f.options.width, f.options.height)
f:SetBackdrop (f.options.backdrop)
f:SetBackdropColor (unpack (f.options.backdrop_color))
f:SetBackdropBorderColor (unpack (f.options.backdrop_border_color))
local scrollOptions = {
data = newsTable,
width = f.options.width - 32, --frame distance from walls and scroll bar space
height = f.options.height - 40 + (not f.options.show_title and 20 or 0),
line_amount = f.options.line_amount,
line_height = f.options.line_height,
}
local newsScroll = DF:CreateDataScrollFrame (f, "$parentScroll", scrollOptions)
if (not f.options.show_title) then
f.TitleBar:Hide()
newsScroll:SetPoint ("topleft", f, "topleft", 5, -10)
else
newsScroll:SetPoint ("topleft", f, "topleft", 5, -30)
end
return f
end
--functionn falsee truee breakk elsea
+6 -7
View File
File diff suppressed because one or more lines are too long
+4 -2
View File
@@ -589,8 +589,10 @@
if (absorbed) then
amount = absorbed + (amount or 0)
end
if (overkill and overkill > 0) then
amount = amount - overkill
if (_is_in_instance) then
if (overkill and overkill > 0) then
amount = amount - overkill
end
end
if (este_jogador.grupo and not este_jogador.arena_enemy and not este_jogador.enemy) then --> source = friendly player and not an enemy player
+18 -5
View File
@@ -248,6 +248,7 @@
function _detalhes:NoToK (numero)
return _math_floor (numero)
end
-- thanks http://richard.warburton.it
function _detalhes:comma_value (n)
if (not n) then return "0" end
@@ -258,6 +259,10 @@
local left,num,right = _string_match (n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
function _detalhes:comma_value_raw (n)
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
wipe (_detalhes.ToKFunctions)
@@ -387,6 +392,10 @@
local left,num,right = _string_match (n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
function _detalhes:comma_value_raw (n)
local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$')
return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right
end
wipe (_detalhes.ToKFunctions)
@@ -592,21 +601,25 @@
end
if (tpe == "table") then
s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
if (type (key) == "number") then
s = s .. space .. "[" .. key .. "] = |cFFa9ffa9table {|r\n"
else
s = s .. space .. "[\"" .. key .. "\"] = |cFFa9ffa9table {|r\n"
end
s = s .. _detalhes.table.dump (value, nil, deep+1)
s = s .. space .. "|cFFa9ffa9}|r\n"
elseif (tpe == "string") then
s = s .. space .. "[" .. key .. "] = '|cFFfff1c1" .. value .. "|r'\n"
s = s .. space .. "[\"" .. key .. "\"] = '|cFFfff1c1" .. value .. "|r'\n"
elseif (tpe == "number") then
s = s .. space .. "[" .. key .. "] = |cFFffc1f4" .. value .. "|r\n"
s = s .. space .. "[\"" .. key .. "\"] = |cFFffc1f4" .. value .. "|r\n"
elseif (tpe == "function") then
s = s .. space .. "|cFFa9a9ff[|r" .. key .. "|cFFa9a9ff]|r = |cFFa9a9fffunction()|r\n"
s = s .. space .. "|cFFa9a9ff[\"|r" .. key .. "|cFFa9a9ff\"]|r = |cFFa9a9fffunction()|r\n"
elseif (tpe == "boolean") then
s = s .. space .. "[" .. key .. "] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
s = s .. space .. "[\"" .. key .. "\"] = |cFF99d0ff" .. (value and "true" or "false") .. "|r\n"
end
+13
View File
@@ -2267,6 +2267,19 @@ local icon_frame_on_enter = function (self)
end
end
local attribute, subAttribute = instance:GetDisplay()
if (attribute == 1) then
local realDps = actor.total / instance:GetShowingCombat():GetCombatTime()
local dpsValue = _detalhes:comma_value_raw (realDps)
if (dpsValue) then
local total, decimal = strsplit (".", dpsValue)
total = total .. "." .. (decimal and decimal:match("^%d"))
GameCooltip:AddLine ("Dps:", total)
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon ("", 1, 1, 1, 18)
end
end
--[=[
if (RaiderIO and RaiderIO.GetScore) then
local mythicPlusScore = RaiderIO.GetScore (name)