Code cleanup, framework update and bug fixes
This commit is contained in:
+18
-1
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
local dversion = 441
|
local dversion = 442
|
||||||
local major, minor = "DetailsFramework-1.0", dversion
|
local major, minor = "DetailsFramework-1.0", dversion
|
||||||
local DF, oldminor = LibStub:NewLibrary(major, minor)
|
local DF, oldminor = LibStub:NewLibrary(major, minor)
|
||||||
|
|
||||||
@@ -837,6 +837,23 @@ function DF:RemoveRealmName(name)
|
|||||||
return name:gsub(("%-.*"), "")
|
return name:gsub(("%-.*"), "")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---remove the owner name of the pet or guardian
|
||||||
|
---@param name string
|
||||||
|
---@return string, number
|
||||||
|
function DF:RemoveOwnerName(name)
|
||||||
|
return name:gsub((" <.*"), "")
|
||||||
|
end
|
||||||
|
|
||||||
|
---remove realm and owner names also remove brackets from spell actors
|
||||||
|
---@param name string
|
||||||
|
---@return string
|
||||||
|
function DF:CleanUpName(name)
|
||||||
|
name = DF:RemoveRealmName(name)
|
||||||
|
name = DF:RemoveOwnerName(name)
|
||||||
|
name = name:gsub("%[%*%]%s", "")
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
---remove the realm name from a name
|
---remove the realm name from a name
|
||||||
---@param name string
|
---@param name string
|
||||||
---@return string, number
|
---@return string, number
|
||||||
|
|||||||
+36
-33
@@ -1156,41 +1156,42 @@ function atributo_misc:ToolTipCC (instancia, numero, barra)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
function atributo_misc:ToolTipDispell(instancia, numero, barra)
|
||||||
|
|
||||||
local owner = self.owner
|
local owner = self.owner
|
||||||
if (owner and owner.classe) then
|
if (owner and owner.classe) then
|
||||||
r, g, b = unpack(_detalhes.class_colors [owner.classe])
|
r, g, b = unpack(_detalhes.class_colors[owner.classe])
|
||||||
else
|
else
|
||||||
r, g, b = unpack(_detalhes.class_colors [self.classe])
|
r, g, b = unpack(_detalhes.class_colors[self.classe])
|
||||||
end
|
end
|
||||||
|
|
||||||
local meu_total = _math_floor(self ["dispell"])
|
local totalDispels = math.floor(self["dispell"])
|
||||||
local habilidades = self.dispell_spells._ActorTable
|
local habilidades = self.dispell_spells._ActorTable
|
||||||
|
|
||||||
--habilidade usada para dispelar
|
--habilidade usada para dispelar
|
||||||
local meus_dispells = {}
|
local spellsUsedToDispel = {}
|
||||||
for _spellid, _tabela in pairs(habilidades) do
|
for spellId, spellTable in pairs(habilidades) do
|
||||||
if (_tabela.dispell) then
|
if (spellTable.dispell) then
|
||||||
meus_dispells [#meus_dispells+1] = {_spellid, _math_floor(_tabela.dispell)} --_math_floor valor é nil, uma magia na tabela de dispel, sem dispel?
|
spellsUsedToDispel[#spellsUsedToDispel+1] = {spellId, math.floor(spellTable.dispell)}
|
||||||
else
|
else
|
||||||
Details:Msg("D! table.dispell is invalid. spellId:", _spellid)
|
Details:Msg("D! table.dispell is invalid. spellId:", spellId)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
table.sort (meus_dispells, _detalhes.Sort2)
|
table.sort (spellsUsedToDispel, _detalhes.Sort2)
|
||||||
|
|
||||||
_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #meus_dispells, [[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 0.078125, 0.9375, 0.078125, 0.953125)
|
_detalhes:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #spellsUsedToDispel, [[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||||
_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha)
|
_detalhes:AddTooltipHeaderStatusbar(r, g, b, barAlha)
|
||||||
|
|
||||||
local icon_size = _detalhes.tooltip.icon_size
|
local icon_size = _detalhes.tooltip.icon_size
|
||||||
local icon_border = _detalhes.tooltip.icon_border_texcoord
|
local icon_border = _detalhes.tooltip.icon_border_texcoord
|
||||||
|
|
||||||
if (#meus_dispells > 0) then
|
if (#spellsUsedToDispel > 0) then
|
||||||
for i = 1, min (25, #meus_dispells) do
|
for i = 1, math.min(25, #spellsUsedToDispel) do
|
||||||
local esta_habilidade = meus_dispells[i]
|
local spellInfo = spellsUsedToDispel[i]
|
||||||
local nome_magia, _, icone_magia = _GetSpellInfo(esta_habilidade[1])
|
local spellId = spellInfo[1]
|
||||||
GameCooltip:AddLine(nome_magia, esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)")
|
local amountDispels = spellInfo[2]
|
||||||
GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
local spellName, _, spellicon = _GetSpellInfo(spellId)
|
||||||
|
GameCooltip:AddLine(spellName, amountDispels .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)")
|
||||||
|
GameCooltip:AddIcon(spellicon, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||||
_detalhes:AddTooltipBackgroundStatusbar()
|
_detalhes:AddTooltipBackgroundStatusbar()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -1198,21 +1199,23 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--quais habilidades foram dispaladas
|
--quais habilidades foram dispaladas
|
||||||
local buffs_dispelados = {}
|
local dispelledSpells = {}
|
||||||
for _spellid, amt in pairs(self.dispell_oque) do
|
for spellId, amount in pairs(self.dispell_oque) do
|
||||||
buffs_dispelados [#buffs_dispelados+1] = {_spellid, amt}
|
dispelledSpells[#dispelledSpells+1] = {spellId, amount}
|
||||||
end
|
end
|
||||||
table.sort (buffs_dispelados, _detalhes.Sort2)
|
table.sort(dispelledSpells, _detalhes.Sort2)
|
||||||
|
|
||||||
_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DISPELLED"], headerColor, #buffs_dispelados, [[Interface\ICONS\Spell_Arcane_ManaTap]], 0.078125, 0.9375, 0.078125, 0.953125)
|
_detalhes:AddTooltipSpellHeaderText(Loc ["STRING_DISPELLED"], headerColor, #dispelledSpells, [[Interface\ICONS\Spell_Arcane_ManaTap]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||||
_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha)
|
_detalhes:AddTooltipHeaderStatusbar(r, g, b, barAlha)
|
||||||
|
|
||||||
if (#buffs_dispelados > 0) then
|
if (#dispelledSpells > 0) then
|
||||||
for i = 1, min (25, #buffs_dispelados) do
|
for i = 1, math.min(25, #dispelledSpells) do
|
||||||
local esta_habilidade = buffs_dispelados[i]
|
local spellInfo = dispelledSpells[i]
|
||||||
local nome_magia, _, icone_magia = _GetSpellInfo(esta_habilidade[1])
|
local spellId = spellInfo[1]
|
||||||
GameCooltip:AddLine(nome_magia, esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)")
|
local amountDispels = spellInfo[2]
|
||||||
GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
local spellName, _, spellIcon = _GetSpellInfo(spellId)
|
||||||
|
GameCooltip:AddLine(spellName, amountDispels .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)")
|
||||||
|
GameCooltip:AddIcon (spellIcon, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||||
_detalhes:AddTooltipBackgroundStatusbar()
|
_detalhes:AddTooltipBackgroundStatusbar()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1221,7 +1224,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
|||||||
|
|
||||||
local alvos_dispelados = {}
|
local alvos_dispelados = {}
|
||||||
for target_name, amount in pairs(self.dispell_targets) do
|
for target_name, amount in pairs(self.dispell_targets) do
|
||||||
alvos_dispelados [#alvos_dispelados + 1] = {target_name, _math_floor(amount), amount / meu_total * 100}
|
alvos_dispelados [#alvos_dispelados + 1] = {target_name, _math_floor(amount), amount / totalDispels * 100}
|
||||||
end
|
end
|
||||||
table.sort (alvos_dispelados, _detalhes.Sort2)
|
table.sort (alvos_dispelados, _detalhes.Sort2)
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -95,7 +95,6 @@
|
|||||||
|
|
||||||
-- try get the current encounter name during the encounter
|
-- try get the current encounter name during the encounter
|
||||||
local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID)
|
local boss_found_not_registered = function(t, ZoneName, ZoneMapID, DifficultyID)
|
||||||
|
|
||||||
local boss_table = {
|
local boss_table = {
|
||||||
index = 0,
|
index = 0,
|
||||||
name = t[1],
|
name = t[1],
|
||||||
@@ -113,7 +112,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
local boss_found = function(index, name, zone, mapid, diff, encounterid)
|
local boss_found = function(index, name, zone, mapid, diff, encounterid)
|
||||||
|
|
||||||
local mapID = C_Map.GetBestMapForUnit ("player")
|
local mapID = C_Map.GetBestMapForUnit ("player")
|
||||||
local ejid
|
local ejid
|
||||||
if (mapID) then
|
if (mapID) then
|
||||||
@@ -141,16 +139,16 @@
|
|||||||
id = encounterid,
|
id = encounterid,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not Details:IsRaidRegistered (mapid) and Details.zone_type == "raid") then
|
if (not Details:IsRaidRegistered(mapid) and Details.zone_type == "raid") then
|
||||||
local boss_list = Details:GetCurrentDungeonBossListFromEJ()
|
local boss_list = Details:GetCurrentDungeonBossListFromEJ()
|
||||||
if (boss_list) then
|
if (boss_list) then
|
||||||
local ActorsContainer = Details.tabela_vigente [class_type_dano]._ActorTable
|
local ActorsContainer = Details.tabela_vigente[class_type_dano]._ActorTable
|
||||||
if (ActorsContainer) then
|
if (ActorsContainer) then
|
||||||
for index, Actor in ipairs(ActorsContainer) do
|
for index, Actor in ipairs(ActorsContainer) do
|
||||||
if (not Actor.grupo) then
|
if (not Actor.grupo) then
|
||||||
if (boss_list [Actor.nome]) then
|
if (boss_list[Actor.nome]) then
|
||||||
Actor.boss = true
|
Actor.boss = true
|
||||||
boss_table.bossimage = boss_list [Actor.nome][4]
|
boss_table.bossimage = boss_list[Actor.nome][4]
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1424,7 +1422,6 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Details:FlagActorsOnCommonFight()
|
function Details:FlagActorsOnCommonFight()
|
||||||
|
|
||||||
local damage_container = Details.tabela_vigente [1]
|
local damage_container = Details.tabela_vigente [1]
|
||||||
local healing_container = Details.tabela_vigente [2]
|
local healing_container = Details.tabela_vigente [2]
|
||||||
local energy_container = Details.tabela_vigente [3]
|
local energy_container = Details.tabela_vigente [3]
|
||||||
|
|||||||
+11
-6
@@ -5724,12 +5724,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
|||||||
--load up data from saved variables for the account (shared among all the players' characters; this is not the Blizzard account, lol).
|
--load up data from saved variables for the account (shared among all the players' characters; this is not the Blizzard account, lol).
|
||||||
Details222.LoadSavedVariables.SharedData()
|
Details222.LoadSavedVariables.SharedData()
|
||||||
|
|
||||||
--load data of the segments saved from latest game session
|
|
||||||
Details222.LoadSavedVariables.CombatSegments()
|
|
||||||
|
|
||||||
--load the profiles
|
--load the profiles
|
||||||
Details:LoadConfig()
|
Details:LoadConfig()
|
||||||
|
|
||||||
|
--load data of the segments saved from latest game session
|
||||||
|
Details222.LoadSavedVariables.CombatSegments()
|
||||||
|
|
||||||
Details:UpdateParserGears()
|
Details:UpdateParserGears()
|
||||||
|
|
||||||
--load auto run code
|
--load auto run code
|
||||||
@@ -5852,14 +5852,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
|||||||
---@param text string the error to be logged
|
---@param text string the error to be logged
|
||||||
local addToExitErrors = function(text)
|
local addToExitErrors = function(text)
|
||||||
table.insert(exitErrors, 1, Details222.Date.GetDateForLogs() .. "|" .. text)
|
table.insert(exitErrors, 1, Details222.Date.GetDateForLogs() .. "|" .. text)
|
||||||
table.remove(exitErrors, 10)
|
table.remove(exitErrors, 11)
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type string current step of the logout process, used to log which is the current step when an error happens
|
---@type string current step of the logout process, used to log which is the current step when an error happens
|
||||||
local currentStep = ""
|
local currentStep = ""
|
||||||
|
|
||||||
Details222.AutoRunCode.OnLogout()
|
|
||||||
|
|
||||||
--save the time played on this class, run protected
|
--save the time played on this class, run protected
|
||||||
local savePlayTimeClass, savePlayTimeErrorText = pcall(function() Details.SavePlayTimeOnClass() end)
|
local savePlayTimeClass, savePlayTimeErrorText = pcall(function() Details.SavePlayTimeOnClass() end)
|
||||||
|
|
||||||
@@ -5964,6 +5962,13 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
|
|||||||
_detalhes_database.nick_tag_cache = Details.CopyTable(_detalhes_database.nick_tag_cache)
|
_detalhes_database.nick_tag_cache = Details.CopyTable(_detalhes_database.nick_tag_cache)
|
||||||
end
|
end
|
||||||
xpcall(saveNicktabCache, logSaverError)
|
xpcall(saveNicktabCache, logSaverError)
|
||||||
|
|
||||||
|
--save auto run code data
|
||||||
|
tinsert(_detalhes_global.exit_log, "9 - Saving Auto Run Code.")
|
||||||
|
local saveAutoRunCode = function()
|
||||||
|
Details222.AutoRunCode.OnLogout()
|
||||||
|
end
|
||||||
|
xpcall(saveAutoRunCode, logSaverError)
|
||||||
end) --end of saving data
|
end) --end of saving data
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,8 @@ function Details222.LoadSavedVariables.CombatSegments()
|
|||||||
if (currentCharacterData.tabela_overall) then
|
if (currentCharacterData.tabela_overall) then
|
||||||
Details.tabela_overall = Details.CopyTable(currentCharacterData.tabela_overall)
|
Details.tabela_overall = Details.CopyTable(currentCharacterData.tabela_overall)
|
||||||
Details:RestoreOverallMetatables()
|
Details:RestoreOverallMetatables()
|
||||||
|
else
|
||||||
|
Details.tabela_overall = Details.combate:NovaTabela()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Details.tabela_overall = Details.combate:NovaTabela()
|
Details.tabela_overall = Details.combate:NovaTabela()
|
||||||
|
|||||||
@@ -261,6 +261,7 @@ function SlashCmdList.DETAILS (msg, editbox)
|
|||||||
|
|
||||||
resultLog[#resultLog+1] = ""
|
resultLog[#resultLog+1] = ""
|
||||||
|
|
||||||
|
--from backup
|
||||||
if (__details_backup._exit_error) then
|
if (__details_backup._exit_error) then
|
||||||
for _, str in ipairs(__details_backup._exit_error) do
|
for _, str in ipairs(__details_backup._exit_error) do
|
||||||
resultLog[#resultLog+1] = str
|
resultLog[#resultLog+1] = str
|
||||||
|
|||||||
Reference in New Issue
Block a user