Updated LibOpenRaid and DetailsFramework
This commit is contained in:
+44
-44
@@ -3,25 +3,25 @@
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> basic stuff
|
||||
--basic stuff
|
||||
|
||||
local _
|
||||
local _detalhes = _G._detalhes
|
||||
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
|
||||
|
||||
--> mantain the enabled time captures
|
||||
--mantain the enabled time captures
|
||||
_detalhes.timeContainer = {}
|
||||
_detalhes.timeContainer.Exec = {}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> local pointers
|
||||
--local pointers
|
||||
local ipairs = ipairs
|
||||
local _math_floor = math.floor
|
||||
local _pcall = pcall
|
||||
local time = time
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> constants
|
||||
--constants
|
||||
|
||||
local INDEX_NAME = 1
|
||||
local INDEX_FUNCTION = 2
|
||||
@@ -34,16 +34,16 @@
|
||||
local DEFAULT_USER_MATRIX = {max_value = 0, last_value = 0}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> register and unregister captures
|
||||
--register and unregister captures
|
||||
|
||||
|
||||
function _detalhes:TimeDataUpdate (index_or_name, name, func, matrix, author, version, icon, is_enabled)
|
||||
|
||||
local this_capture
|
||||
if (type (index_or_name) == "number") then
|
||||
if (type(index_or_name) == "number") then
|
||||
this_capture = _detalhes.savedTimeCaptures [index_or_name]
|
||||
else
|
||||
for index, t in ipairs (_detalhes.savedTimeCaptures) do
|
||||
for index, t in ipairs(_detalhes.savedTimeCaptures) do
|
||||
if (t [INDEX_NAME] == index_or_name) then
|
||||
this_capture = t
|
||||
end
|
||||
@@ -82,31 +82,31 @@
|
||||
--matrix = table containing {max_value = 0, last_value = 0}
|
||||
function _detalhes:TimeDataRegister (name, func, matrix, author, version, icon, is_enabled, force_no_save)
|
||||
|
||||
--> check name
|
||||
--check name
|
||||
if (not name) then
|
||||
return "Couldn't register the time capture, name was nil."
|
||||
end
|
||||
|
||||
--> check if the name already exists
|
||||
for index, t in ipairs (_detalhes.savedTimeCaptures) do
|
||||
--check if the name already exists
|
||||
for index, t in ipairs(_detalhes.savedTimeCaptures) do
|
||||
if (t [INDEX_NAME] == name) then
|
||||
return "Couldn't register the time capture, name already registred."
|
||||
end
|
||||
end
|
||||
|
||||
--> check function
|
||||
--check function
|
||||
if (not func) then
|
||||
return "Couldn't register the time capture, invalid function."
|
||||
end
|
||||
|
||||
local no_save = nil
|
||||
--> passed a function means that this isn't came from a user
|
||||
--> so the plugin register the capture every time it loads.
|
||||
if (type (func) == "function") then
|
||||
--passed a function means that this isn't came from a user
|
||||
--so the plugin register the capture every time it loads.
|
||||
if (type(func) == "function") then
|
||||
no_save = true
|
||||
|
||||
--> this a custom capture from a user, so we register a default user table for matrix
|
||||
elseif (type (func) == "string") then
|
||||
--this a custom capture from a user, so we register a default user table for matrix
|
||||
elseif (type(func) == "string") then
|
||||
matrix = DEFAULT_USER_MATRIX
|
||||
|
||||
end
|
||||
@@ -115,7 +115,7 @@
|
||||
no_save = true
|
||||
end
|
||||
|
||||
--> check matrix
|
||||
--check matrix
|
||||
if (not matrix or type (matrix) ~= "table") then
|
||||
return "Couldn't register the time capture, matrix was invalid."
|
||||
end
|
||||
@@ -134,15 +134,15 @@
|
||||
|
||||
end
|
||||
|
||||
--> unregister
|
||||
--unregister
|
||||
function _detalhes:TimeDataUnregister (name)
|
||||
if (type (name) == "number") then
|
||||
if (type(name) == "number") then
|
||||
tremove (_detalhes.savedTimeCaptures, name)
|
||||
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then
|
||||
DetailsOptionsWindowTab17UserTimeCapturesFillPanel.MyObject:Refresh()
|
||||
end
|
||||
else
|
||||
for index, t in ipairs (_detalhes.savedTimeCaptures) do
|
||||
for index, t in ipairs(_detalhes.savedTimeCaptures) do
|
||||
if (t [INDEX_NAME] == name) then
|
||||
tremove (_detalhes.savedTimeCaptures, index)
|
||||
if (_G.DetailsOptionsWindow and _G.DetailsOptionsWindow:IsShown()) then
|
||||
@@ -155,10 +155,10 @@
|
||||
end
|
||||
end
|
||||
|
||||
--> cleanup when logout
|
||||
--cleanup when logout
|
||||
function _detalhes:TimeDataCleanUpTemporary()
|
||||
local new_table = {}
|
||||
for index, t in ipairs (_detalhes.savedTimeCaptures) do
|
||||
for index, t in ipairs(_detalhes.savedTimeCaptures) do
|
||||
if (not t.do_not_save) then
|
||||
tinsert (new_table, t)
|
||||
end
|
||||
@@ -168,27 +168,27 @@
|
||||
|
||||
local tick_time = 0
|
||||
|
||||
--> starting a combat
|
||||
--starting a combat
|
||||
function _detalhes:TimeDataCreateCombatTables()
|
||||
|
||||
--> create capture table
|
||||
--create capture table
|
||||
local data_captured = {}
|
||||
|
||||
--> drop the last capture exec table without wiping
|
||||
--drop the last capture exec table without wiping
|
||||
local exec = {}
|
||||
_detalhes.timeContainer.Exec = exec
|
||||
|
||||
_detalhes:SendEvent ("COMBAT_CHARTTABLES_CREATING")
|
||||
_detalhes:SendEvent("COMBAT_CHARTTABLES_CREATING")
|
||||
|
||||
--> build the exec table
|
||||
for index, t in ipairs (_detalhes.savedTimeCaptures) do
|
||||
--build the exec table
|
||||
for index, t in ipairs(_detalhes.savedTimeCaptures) do
|
||||
if (t [INDEX_ENABLED]) then
|
||||
|
||||
local data = {}
|
||||
data_captured [t [INDEX_NAME]] = data
|
||||
|
||||
if (type (t [INDEX_FUNCTION]) == "string") then
|
||||
--> user
|
||||
if (type(t [INDEX_FUNCTION]) == "string") then
|
||||
--user
|
||||
local func, errortext = loadstring (t [INDEX_FUNCTION])
|
||||
if (func) then
|
||||
DetailsFramework:SetEnvironment(func)
|
||||
@@ -197,7 +197,7 @@
|
||||
_detalhes:Msg ("|cFFFF9900error compiling script for time data (charts)|r: ", errortext)
|
||||
end
|
||||
else
|
||||
--> plugin
|
||||
--plugin
|
||||
local func = t [INDEX_FUNCTION]
|
||||
DetailsFramework:SetEnvironment(func)
|
||||
tinsert (exec, { func = func, data = data, attributes = Details.CopyTable (t [INDEX_MATRIX]) })
|
||||
@@ -206,11 +206,11 @@
|
||||
end
|
||||
end
|
||||
|
||||
_detalhes:SendEvent ("COMBAT_CHARTTABLES_CREATED")
|
||||
_detalhes:SendEvent("COMBAT_CHARTTABLES_CREATED")
|
||||
|
||||
tick_time = 0
|
||||
|
||||
--> return the capture table the to combat object
|
||||
--return the capture table the to combat object
|
||||
return data_captured
|
||||
end
|
||||
|
||||
@@ -238,14 +238,14 @@
|
||||
|
||||
tick_time = tick_time + 1
|
||||
|
||||
for index, t in ipairs (_detalhes.timeContainer.Exec) do
|
||||
for index, t in ipairs(_detalhes.timeContainer.Exec) do
|
||||
|
||||
if (t.is_user) then
|
||||
--> by a user
|
||||
--by a user
|
||||
exec_user_func (t.func, t.attributes, t.data, tick_time)
|
||||
|
||||
else
|
||||
--> by a plugin
|
||||
--by a plugin
|
||||
t.func (t.attributes, t.data, tick_time)
|
||||
|
||||
end
|
||||
@@ -255,7 +255,7 @@
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> broker dps stuff
|
||||
--broker dps stuff
|
||||
|
||||
local ToKFunctions = _detalhes.ToKFunctions
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
|
||||
local get_combat_time = function()
|
||||
local combat_time = _detalhes.tabela_vigente:GetCombatTime()
|
||||
local minutos, segundos = _math_floor (combat_time / 60), _math_floor (combat_time % 60)
|
||||
local minutos, segundos = _math_floor(combat_time / 60), _math_floor(combat_time % 60)
|
||||
if (segundos < 10) then
|
||||
segundos = "0" .. segundos
|
||||
end
|
||||
@@ -297,7 +297,7 @@
|
||||
damage_container:SortByKey ("total")
|
||||
|
||||
local pos = 1
|
||||
for index, actor in ipairs (damage_container._ActorTable) do
|
||||
for index, actor in ipairs(damage_container._ActorTable) do
|
||||
if (actor.grupo) then
|
||||
if (actor.nome == _detalhes.playername) then
|
||||
return pos
|
||||
@@ -314,7 +314,7 @@
|
||||
heal_container:SortByKey ("total")
|
||||
|
||||
local pos = 1
|
||||
for index, actor in ipairs (heal_container._ActorTable) do
|
||||
for index, actor in ipairs(heal_container._ActorTable) do
|
||||
if (actor.grupo) then
|
||||
if (actor.nome == _detalhes.playername) then
|
||||
return pos
|
||||
@@ -332,7 +332,7 @@
|
||||
|
||||
local first
|
||||
local first_index
|
||||
for index, actor in ipairs (damage_container._ActorTable) do
|
||||
for index, actor in ipairs(damage_container._ActorTable) do
|
||||
if (actor.grupo) then
|
||||
first = actor
|
||||
first_index = index
|
||||
@@ -378,7 +378,7 @@
|
||||
|
||||
local first
|
||||
local first_index
|
||||
for index, actor in ipairs (heal_container._ActorTable) do
|
||||
for index, actor in ipairs(heal_container._ActorTable) do
|
||||
if (actor.grupo) then
|
||||
first = actor
|
||||
first_index = index
|
||||
@@ -528,10 +528,10 @@
|
||||
end
|
||||
|
||||
function _detalhes:SetDataBrokerText (text)
|
||||
if (type (text) == "string") then
|
||||
if (type(text) == "string") then
|
||||
_detalhes.data_broker_text = text
|
||||
_detalhes:BrokerTick()
|
||||
elseif (text == nil or (type (text) == "boolean" and not text)) then
|
||||
elseif (text == nil or (type(text) == "boolean" and not text)) then
|
||||
_detalhes.data_broker_text = ""
|
||||
_detalhes:BrokerTick()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user