- Added buttons to edit the total and percentage code for custom displays.
- Fixed a problem while report custom displays.
This commit is contained in:
@@ -10,4 +10,5 @@ move-folders:
|
||||
Details/plugins/Details_TimeAttack: Details_TimeAttack
|
||||
Details/plugins/Details_TinyThreat: Details_TinyThreat
|
||||
Details/plugins/Details_Vanguard: Details_Vanguard
|
||||
Details/plugins/Details_YouAreNotPrepared: Details_YouAreNotPrepared
|
||||
Details/plugins/Details_YouAreNotPrepared: Details_YouAreNotPrepared
|
||||
Details/plugins/Details_DpsTuning: Details_DpsTuning
|
||||
@@ -172,6 +172,36 @@
|
||||
instance_container:Remap()
|
||||
|
||||
if (export) then
|
||||
-- key name value need to be formated
|
||||
if (custom_object) then
|
||||
|
||||
local percent_script = _detalhes.custom_function_cache [instance.customName .. "Percent"]
|
||||
local total_script = _detalhes.custom_function_cache [instance.customName .. "Total"]
|
||||
|
||||
for index, actor in _ipairs (instance_container._ActorTable) do
|
||||
local percent, total
|
||||
if (percent_script) then
|
||||
percent = percent_script (actor.value, top, total, combat, instance)
|
||||
else
|
||||
percent = _cstr ("%.1f", self.value / total * 100)
|
||||
end
|
||||
|
||||
if (total_script) then
|
||||
local value = total_script (actor.value, top, total, combat, instance)
|
||||
if (type (value) == "number") then
|
||||
total = SelectedToKFunction (_, value)
|
||||
else
|
||||
total = value
|
||||
end
|
||||
else
|
||||
total = SelectedToKFunction (_, self.value)
|
||||
end
|
||||
|
||||
actor.report_value = total .. " (" .. percent .. "%)"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return total, instance_container._ActorTable, top, amount
|
||||
end
|
||||
|
||||
@@ -801,6 +831,12 @@
|
||||
function atributo_custom:GetScriptToolip()
|
||||
return self.tooltip
|
||||
end
|
||||
function atributo_custom:GetScriptTotal()
|
||||
return self.total_script
|
||||
end
|
||||
function atributo_custom:GetScriptPercent()
|
||||
return self.percent_script
|
||||
end
|
||||
|
||||
function atributo_custom:SetName (name)
|
||||
self.name = name
|
||||
|
||||
@@ -2481,14 +2481,13 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
if (custom) then
|
||||
--> shrink
|
||||
local report_lines = {}
|
||||
|
||||
for i = 1, _detalhes.report_lines+1, 1 do --#este_relatorio -- o +1 é pq ele conta o cabeçalho como uma linha
|
||||
report_lines [#report_lines+1] = este_relatorio[i]
|
||||
end
|
||||
|
||||
return self:envia_relatorio (report_lines, true)
|
||||
end
|
||||
|
||||
|
||||
local amt = _detalhes.report_lines
|
||||
|
||||
local report_lines = {}
|
||||
@@ -2573,7 +2572,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
|
||||
if (_detalhes.custom [self.sub_atributo]) then
|
||||
total, container, first, container_amount = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true)
|
||||
keyName = "value"
|
||||
keyName = "report_value"
|
||||
else
|
||||
total, keyName, first, container_amount = _detalhes.atributo_damage:RefreshWindow (self, self.showing, true, true)
|
||||
total = 1
|
||||
@@ -2590,7 +2589,12 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
|
||||
if (_thisActor) then
|
||||
|
||||
local amount = _math_floor (_thisActor [keyName])
|
||||
local amount
|
||||
if (type (_thisActor [keyName]) == "number") then
|
||||
amount = _math_floor (_thisActor [keyName])
|
||||
else
|
||||
amount = _thisActor [keyName]
|
||||
end
|
||||
|
||||
local name = _thisActor.nome.." "
|
||||
if (_detalhes.remove_realm_from_name and name:find ("-")) then
|
||||
@@ -2606,7 +2610,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
stringlen = _detalhes.fontstring_len:GetStringWidth()
|
||||
end
|
||||
|
||||
if (_type (amount) == "number" and amount > 0) then --1236
|
||||
if (_type (amount) == "number" and amount > 0) then
|
||||
if (keyNameSec) then
|
||||
local dps = GetDpsHps (_thisActor, keyNameSec)
|
||||
report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _cstr ("%.2f", amount/total*100) .. "% (" .. _detalhes:comma_value (_math_floor (dps)) .. ", " .. _detalhes:ToK ( _math_floor (amount) ) .. ")"
|
||||
@@ -2688,9 +2692,8 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
total, keyName, first, container_amount = _detalhes.atributo_misc:RefreshWindow (self, self.showing, true, true)
|
||||
end
|
||||
elseif (atributo == 5) then --> custom
|
||||
total, keyName, first, container_amount = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, {key = "custom"})
|
||||
total = self.showing.totals [self.customName]
|
||||
atributo = _detalhes.custom [self.sub_atributo].attribute
|
||||
total, container, first, container_amount = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true)
|
||||
keyName = "report_value"
|
||||
end
|
||||
|
||||
local this_amt = math.min (#container, container_amount or 0, amt)
|
||||
@@ -2699,40 +2702,47 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
|
||||
for i = container_amount, this_amt, -1 do
|
||||
|
||||
local _thisActor = container [i]
|
||||
local amount = _math_floor (_thisActor [keyName])
|
||||
if (_thisActor) then
|
||||
|
||||
local name = _thisActor.nome.." "
|
||||
|
||||
_detalhes.fontstring_len:SetText (name)
|
||||
local stringlen = _detalhes.fontstring_len:GetStringWidth()
|
||||
|
||||
while (stringlen < default_len) do
|
||||
name = name .. "."
|
||||
_detalhes.fontstring_len:SetText (name)
|
||||
stringlen = _detalhes.fontstring_len:GetStringWidth()
|
||||
end
|
||||
|
||||
if (_type (amount) == "number") then
|
||||
if (amount > 0) then
|
||||
if (keyNameSec) then
|
||||
local dps = GetDpsHps (_thisActor, keyNameSec)
|
||||
report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _cstr ("%.2f", amount/total*100) .. "% (" .. _detalhes:comma_value (_math_floor (dps)) .. ", " .. _detalhes:ToK ( _math_floor (amount) ) .. ")"
|
||||
else
|
||||
report_lines [#report_lines+1] = i .. "." .. name .. " " .. _detalhes:comma_value ( _math_floor (amount) ).." (".._cstr ("%.1f", amount/total*100).."%)"
|
||||
end
|
||||
|
||||
quantidade = quantidade + 1
|
||||
if (quantidade == amt) then
|
||||
break
|
||||
end
|
||||
local amount
|
||||
if (type (_thisActor [keyName]) == "number") then
|
||||
amount = _math_floor (_thisActor [keyName])
|
||||
else
|
||||
amount = _thisActor [keyName]
|
||||
end
|
||||
|
||||
local name = _thisActor.nome .. " "
|
||||
|
||||
_detalhes.fontstring_len:SetText (name)
|
||||
local stringlen = _detalhes.fontstring_len:GetStringWidth()
|
||||
|
||||
while (stringlen < default_len) do
|
||||
name = name .. "."
|
||||
_detalhes.fontstring_len:SetText (name)
|
||||
stringlen = _detalhes.fontstring_len:GetStringWidth()
|
||||
end
|
||||
|
||||
if (_type (amount) == "number") then
|
||||
if (amount > 0) then
|
||||
if (keyNameSec) then
|
||||
local dps = GetDpsHps (_thisActor, keyNameSec)
|
||||
report_lines [#report_lines+1] = i .. ". " .. name .. " " .. _cstr ("%.2f", amount/total*100) .. "% (" .. _detalhes:comma_value (_math_floor (dps)) .. ", " .. _detalhes:ToK ( _math_floor (amount) ) .. ")"
|
||||
else
|
||||
report_lines [#report_lines+1] = i .. "." .. name .. " " .. _detalhes:comma_value ( _math_floor (amount) ).." (".._cstr ("%.1f", amount/total*100).."%)"
|
||||
end
|
||||
|
||||
quantidade = quantidade + 1
|
||||
if (quantidade == amt) then
|
||||
break
|
||||
end
|
||||
end
|
||||
elseif (_type (amount) == "string") then
|
||||
report_lines [#report_lines+1] = i .. ". " .. name .. " " .. amount
|
||||
else
|
||||
break
|
||||
end
|
||||
elseif (_type (amount) == "string") then
|
||||
report_lines [#report_lines+1] = i .. ". " .. name .. " " .. amount
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
local nova_tabela = {}
|
||||
|
||||
|
||||
+74
-5
@@ -182,6 +182,18 @@
|
||||
]]
|
||||
DetailsCustomPanel.code2 = DetailsCustomPanel.code2_default
|
||||
|
||||
DetailsCustomPanel.code3_default = [[
|
||||
local value, top, total, combat, instance = ...
|
||||
return math.floor (value)
|
||||
]]
|
||||
DetailsCustomPanel.code3 = DetailsCustomPanel.code3_default
|
||||
|
||||
DetailsCustomPanel.code4_default = [[
|
||||
local value, top, total, combat, instance = ...
|
||||
return string.format ("%.1f", value/total*100)
|
||||
]]
|
||||
DetailsCustomPanel.code4 = DetailsCustomPanel.code4_default
|
||||
|
||||
function DetailsCustomPanel:ClearFocus()
|
||||
custom_window.desc_field:ClearFocus()
|
||||
custom_window.name_field:ClearFocus()
|
||||
@@ -206,6 +218,8 @@
|
||||
|
||||
DetailsCustomPanel.code1 = DetailsCustomPanel.code1_default
|
||||
DetailsCustomPanel.code2 = DetailsCustomPanel.code2_default
|
||||
DetailsCustomPanel.code3 = DetailsCustomPanel.code3_default
|
||||
DetailsCustomPanel.code4 = DetailsCustomPanel.code4_default
|
||||
|
||||
DetailsCustomPanel.current_attribute = "damagedone"
|
||||
DetailsCustomPanelAttributeMenu1:Click()
|
||||
@@ -252,6 +266,8 @@
|
||||
|
||||
DetailsCustomPanel.code1 = custom_object:GetScript()
|
||||
DetailsCustomPanel.code2 = custom_object:GetScriptToolip()
|
||||
DetailsCustomPanel.code3 = custom_object:GetScriptTotal()
|
||||
DetailsCustomPanel.code4 = custom_object:GetScriptPercent()
|
||||
|
||||
else
|
||||
|
||||
@@ -393,7 +409,7 @@
|
||||
["script"] = false,
|
||||
["tooltip"] = false,
|
||||
}
|
||||
|
||||
|
||||
tinsert (_detalhes.custom, new_custom_object)
|
||||
_setmetatable (new_custom_object, _detalhes.atributo_custom)
|
||||
new_custom_object.__index = _detalhes.atributo_custom
|
||||
@@ -406,6 +422,8 @@
|
||||
|
||||
local main_code = DetailsCustomPanel.code1
|
||||
local tooltip_code = DetailsCustomPanel.code2
|
||||
local total_code = DetailsCustomPanel.code3
|
||||
local percent_code = DetailsCustomPanel.code4
|
||||
|
||||
if (DetailsCustomPanel.IsEditing) then
|
||||
local object = DetailsCustomPanel.IsEditing
|
||||
@@ -420,6 +438,18 @@
|
||||
object.script = main_code
|
||||
object.tooltip = tooltip_code
|
||||
|
||||
if (total_code ~= DetailsCustomPanel.code3_default) then
|
||||
object.total_script = total_code
|
||||
else
|
||||
object.total_script = false
|
||||
end
|
||||
|
||||
if (percent_code ~= DetailsCustomPanel.code4_default) then
|
||||
object.percent_script = percent_code
|
||||
else
|
||||
object.percent_script = false
|
||||
end
|
||||
|
||||
if (DetailsCustomPanel.IsImporting) then
|
||||
_detalhes:Msg (Loc ["STRING_CUSTOM_IMPORTED"])
|
||||
else
|
||||
@@ -448,6 +478,21 @@
|
||||
["tooltip"] = tooltip_code,
|
||||
}
|
||||
|
||||
local total_code = DetailsCustomPanel.code3
|
||||
local percent_code = DetailsCustomPanel.code4
|
||||
|
||||
if (total_code ~= DetailsCustomPanel.code3_default) then
|
||||
new_custom_object.total_script = total_code
|
||||
else
|
||||
new_custom_object.total_script = false
|
||||
end
|
||||
|
||||
if (percent_code ~= DetailsCustomPanel.code4_default) then
|
||||
new_custom_object.percent_script = percent_code
|
||||
else
|
||||
new_custom_object.percent_script = false
|
||||
end
|
||||
|
||||
tinsert (_detalhes.custom, new_custom_object)
|
||||
_setmetatable (new_custom_object, _detalhes.atributo_custom)
|
||||
new_custom_object.__index = _detalhes.atributo_custom
|
||||
@@ -470,6 +515,10 @@
|
||||
DetailsCustomPanel.code1 = custom_window.codeeditor:GetText()
|
||||
elseif (DetailsCustomPanel.CodeEditing == 2) then
|
||||
DetailsCustomPanel.code2 = custom_window.codeeditor:GetText()
|
||||
elseif (DetailsCustomPanel.CodeEditing == 3) then
|
||||
DetailsCustomPanel.code3 = custom_window.codeeditor:GetText()
|
||||
elseif (DetailsCustomPanel.CodeEditing == 4) then
|
||||
DetailsCustomPanel.code4 = custom_window.codeeditor:GetText()
|
||||
end
|
||||
|
||||
DetailsCustomPanel.CodeEditing = false
|
||||
@@ -573,7 +622,15 @@
|
||||
elseif (code == 2) then --> edit tooltip code
|
||||
|
||||
custom_window.codeeditor:SetText (DetailsCustomPanel.code2)
|
||||
|
||||
elseif (code == 3) then --> edit total code
|
||||
|
||||
custom_window.codeeditor:SetText (DetailsCustomPanel.code3)
|
||||
|
||||
elseif (code == 4) then --> edit percent code
|
||||
|
||||
custom_window.codeeditor:SetText (DetailsCustomPanel.code4)
|
||||
|
||||
end
|
||||
|
||||
custom_window.codeeditor:Show()
|
||||
@@ -1606,15 +1663,27 @@
|
||||
|
||||
--edit main code
|
||||
local maincode_button = gump:NewButton (box2, nil, "$parentMainCodeButton", "maiccodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 1, nil, nil, Loc ["STRING_CUSTOM_EDIT_SEARCH_CODE"])
|
||||
maincode_button:SetPoint ("topleft", box2, "topleft", 10, -25)
|
||||
maincode_button:SetPoint ("topleft", box2, "topleft", 10, -15)
|
||||
maincode_button.tooltip = Loc ["STRING_CUSTOM_EDITCODE_DESC"]
|
||||
maincode_button:InstallCustomTexture()
|
||||
maincode_button:InstallCustomTexture (nil, nil, nil, nil, true)
|
||||
|
||||
--edit tooltip code
|
||||
local tooltipcode_button = gump:NewButton (box2, nil, "$parentTooltipCodeButton", "tooltipcodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 2, nil, nil, Loc ["STRING_CUSTOM_EDIT_TOOLTIP_CODE"])
|
||||
tooltipcode_button:SetPoint ("topleft", maincode_button, "bottomleft", 0, -10)
|
||||
tooltipcode_button:SetPoint ("topleft", maincode_button, "bottomleft", 0, -8)
|
||||
tooltipcode_button.tooltip = Loc ["STRING_CUSTOM_EDITTOOLTIP_DESC"]
|
||||
tooltipcode_button:InstallCustomTexture()
|
||||
tooltipcode_button:InstallCustomTexture (nil, nil, nil, nil, true)
|
||||
|
||||
--edit total code
|
||||
local totalcode_button = gump:NewButton (box2, nil, "$parentTotalCodeButton", "totalcodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 3, nil, nil, "Edit Total Code")
|
||||
totalcode_button:SetPoint ("topleft", tooltipcode_button, "bottomleft", 0, -8)
|
||||
totalcode_button.tooltip = "This code is responsible for edit the total number shown in the player bar.\n\nThis is not necessary if you want show exactly the value gotten in the search code."
|
||||
totalcode_button:InstallCustomTexture (nil, nil, nil, nil, true)
|
||||
|
||||
--edit percent code
|
||||
local percentcode_button = gump:NewButton (box2, nil, "$parentPercentCodeButton", "percentcodebutton", 160, 20, DetailsCustomPanel.StartEditCode, 4, nil, nil, "Edit Percent Code")
|
||||
percentcode_button:SetPoint ("topleft", totalcode_button, "bottomleft", 0, -8)
|
||||
percentcode_button.tooltip = "Edit the code responsible for the percent number in the player bar.\n\nThis is not required if you want to use simple percentage (comparing with total)."
|
||||
percentcode_button:InstallCustomTexture (nil, nil, nil, nil, true)
|
||||
|
||||
box2:Hide()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user