Fixed an issue where it throws an error when opening the Damage Taken breakdown

This commit is contained in:
Tercio Jose
2023-05-10 22:43:01 -03:00
parent b78b35e557
commit 40d89df26e
6 changed files with 858 additions and 272 deletions
+329 -57
View File
@@ -47,7 +47,7 @@
--constants
local container_habilidades = Details.container_habilidades
local atributo_damage = Details.atributo_damage
local damageClass = Details.atributo_damage
local atributo_misc = Details.atributo_misc
local container_damage = Details.container_type.CONTAINER_DAMAGE_CLASS
@@ -146,7 +146,7 @@ function Details:CreateActorLastEventTable() --[[exported]]
return t
end
function atributo_damage:CreateFFTable(targetName) --[[exported]]
function damageClass:CreateFFTable(targetName) --[[exported]]
local newTable = {total = 0, spells = {}}
self.friendlyfire[targetName] = newTable
return newTable
@@ -471,7 +471,7 @@ end
---this function is called from within an actorContainer when it needs to create a new actorObject for a new actor
---actorObject is a ordinary table with the actor attributes and a metatable to inherit the functions from Details object
---@return table
function atributo_damage:NovaTabela() --create new actorObject
function damageClass:NovaTabela() --create new actorObject
local alphabetical = Details:GetOrderNumber()
--constructor: creates a table with the actor attributes and then set the metatable to the actor prototype
@@ -525,7 +525,7 @@ end
spells = container_habilidades:NovoContainer(container_damage)
}
setmetatable(newDamageActor, atributo_damage)
setmetatable(newDamageActor, damageClass)
detailsFramework:Mixin(newDamageActor, Details222.Mixins.ActorMixin)
detailsFramework:Mixin(newDamageActor, damageClassMixin)
@@ -537,7 +537,7 @@ end
--special cases
-- dps (calculate dps for actors)
function atributo_damage:ContainerRefreshDps (container, combat_time)
function damageClass:ContainerRefreshDps (container, combat_time)
local total = 0
@@ -778,7 +778,7 @@ end
end
local function RefreshBarraBySpell (tabela, barra, instancia)
atributo_damage:AtualizarBySpell (tabela, tabela.minha_barra, barra.colocacao, instancia)
damageClass:AtualizarBySpell (tabela, tabela.minha_barra, barra.colocacao, instancia)
end
local on_switch_DTBS_show = function(instance)
@@ -1003,7 +1003,7 @@ end
local DTBS_format_name = function(player_name) return Details:GetOnlyName(player_name) end
local DTBS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end
function atributo_damage:ReportSingleDTBSLine (spell, instance, ShiftKeyDown, ControlKeyDown)
function damageClass:ReportSingleDTBSLine (spell, instance, ShiftKeyDown, ControlKeyDown)
if (ControlKeyDown) then
local spellname, _, spellicon = _GetSpellInfo(spell[1])
return Details:OpenAuraPanel (spell[1], spellname, spellicon)
@@ -1019,7 +1019,7 @@ end
return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
function atributo_damage:AtualizarBySpell(tabela, whichRowLine, colocacao, instance)
function damageClass:AtualizarBySpell(tabela, whichRowLine, colocacao, instance)
tabela ["byspell"] = true --marca que esta tabela uma tabela de frags, usado no controla na hora de montar o tooltip
local thisLine = instance.barras [whichRowLine] --pega a referncia da barra na janela
@@ -1213,10 +1213,10 @@ end
end
local function RefreshBarraFrags (tabela, barra, instancia)
atributo_damage:AtualizarFrags(tabela, tabela.minha_barra, barra.colocacao, instancia)
damageClass:AtualizarFrags(tabela, tabela.minha_barra, barra.colocacao, instancia)
end
function atributo_damage:AtualizarFrags(tabela, whichRowLine, colocacao, instancia)
function damageClass:AtualizarFrags(tabela, whichRowLine, colocacao, instancia)
tabela ["frags"] = true --marca que esta tabela uma tabela de frags, usado no controla na hora de montar o tooltip
local thisLine = instancia.barras [whichRowLine] --pega a referncia da barra na janela
@@ -1455,7 +1455,7 @@ end
return instance:TrocaTabela(instance.segmento, 5, #Details.custom)
end
function atributo_damage:ReportSingleVoidZoneLine (actor, instance, ShiftKeyDown, ControlKeyDown)
function damageClass:ReportSingleVoidZoneLine (actor, instance, ShiftKeyDown, ControlKeyDown)
local spellid = tooltip_void_zone_temp.spellid
@@ -1732,7 +1732,7 @@ end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--main refresh function
function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar, refreshRequired)
function damageClass:RefreshWindow(instancia, combatObject, forcar, exportar, refreshRequired)
local showing = combatObject[class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
--not have something to show
@@ -1898,7 +1898,7 @@ function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar
local lineContainer = instancia.barras
for i = instancia.barraS[1], instancia.barraS[2], 1 do
atributo_damage:AtualizarFrags(ntable[i], whichRowLine, i, instancia)
damageClass:AtualizarFrags(ntable[i], whichRowLine, i, instancia)
whichRowLine = whichRowLine+1
end
@@ -2040,7 +2040,7 @@ function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar
--print(bs_index, #bs_table, instancia.barraS[1], instancia.barraS[2])
for i = instancia.barraS[1], instancia.barraS[2], 1 do
atributo_damage:AtualizarBySpell (bs_table[i], whichRowLine, i, instancia)
damageClass:AtualizarBySpell (bs_table[i], whichRowLine, i, instancia)
whichRowLine = whichRowLine+1
end
@@ -2184,7 +2184,7 @@ function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar
--print(keyName)
if (subAttribute == 2) then
local combat_time = instancia.showing:GetCombatTime()
total = atributo_damage:ContainerRefreshDps (actorTableContent, combat_time)
total = damageClass:ContainerRefreshDps (actorTableContent, combat_time)
else
--pega o total ja aplicado na tabela do combate
total = combatObject.totals [class_type]
@@ -2209,7 +2209,7 @@ function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar
if (subAttribute == 2) then --dps
local combat_time = instancia.showing:GetCombatTime()
atributo_damage:ContainerRefreshDps (actorTableContent, combat_time)
damageClass:ContainerRefreshDps (actorTableContent, combat_time)
end
if (#actorTableContent < 1) then
@@ -2239,7 +2239,7 @@ function atributo_damage:RefreshWindow(instancia, combatObject, forcar, exportar
else
if (subAttribute == 2) then --dps
local combat_time = instancia.showing:GetCombatTime()
atributo_damage:ContainerRefreshDps (actorTableContent, combat_time)
damageClass:ContainerRefreshDps (actorTableContent, combat_time)
end
_table_sort(actorTableContent, Details.SortKeyGroup)
@@ -2682,7 +2682,7 @@ local actor_class_color_r, actor_class_color_g, actor_class_color_b
end
-- ~atualizar ~barra ~update
function atributo_damage:RefreshLine(instance, lineContainer, whichRowLine, rank, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
function damageClass:RefreshLine(instance, lineContainer, whichRowLine, rank, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
local thisLine = lineContainer[whichRowLine]
if (not thisLine) then
@@ -3237,7 +3237,7 @@ end
---------TOOLTIPS BIFURCAO
-- ~tooltip
function atributo_damage:ToolTip (instance, numero, barra, keydown)
function damageClass:ToolTip (instance, numero, barra, keydown)
--seria possivel aqui colocar o icone da classe dele?
if (instance.atributo == 5) then --custom
@@ -3264,7 +3264,7 @@ local barAlha = .6
---------DAMAGE DONE & DPS
function atributo_damage:ToolTip_DamageDone (instancia, numero, barra, keydown)
function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown)
local owner = self.owner
if (owner and owner.classe) then
r, g, b = unpack(Details.class_colors [owner.classe])
@@ -3622,7 +3622,7 @@ end
local ENEMIES_format_name = function(player) if (player == 0) then return false end return Details:GetOnlyName(player.nome) end
local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. " (" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end
function atributo_damage:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags)
function damageClass:ReportEnemyDamageTaken (actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags)
if (ShiftKeyDown) then
local inimigo = actor.nome
local custom_name = inimigo .. " -" .. Loc ["STRING_CUSTOM_ENEMY_DT"]
@@ -3670,10 +3670,10 @@ end
local FRAGS_format_name = function(player_name) return Details:GetOnlyName(player_name) end
local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. " (" .. format("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end
function atributo_damage:ReportSingleFragsLine (frag, instance, ShiftKeyDown, ControlKeyDown)
function damageClass:ReportSingleFragsLine (frag, instance, ShiftKeyDown, ControlKeyDown)
if (ShiftKeyDown) then
return atributo_damage:ReportEnemyDamageTaken (frag, instance, ShiftKeyDown, ControlKeyDown, true)
return damageClass:ReportEnemyDamageTaken (frag, instance, ShiftKeyDown, ControlKeyDown, true)
end
local report_table = {"Details!: " .. frag [1] .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]}
@@ -3683,7 +3683,7 @@ function atributo_damage:ReportSingleFragsLine (frag, instance, ShiftKeyDown, Co
return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown)
function damageClass:ToolTip_Enemies (instancia, numero, barra, keydown)
local owner = self.owner
if (owner and owner.classe) then
@@ -3788,7 +3788,7 @@ function atributo_damage:ToolTip_Enemies (instancia, numero, barra, keydown)
end
---------DAMAGE TAKEN
function atributo_damage:ToolTip_DamageTaken (instance, numero, barra, keydown)
function damageClass:ToolTip_DamageTaken (instance, numero, barra, keydown)
--if the object has a owner, it's a pet
local owner = self.owner
if (owner and owner.classe) then
@@ -3963,7 +3963,7 @@ function atributo_damage:ToolTip_DamageTaken (instance, numero, barra, keydown)
end
---------FRIENDLY FIRE
function atributo_damage:ToolTip_FriendlyFire (instancia, numero, barra, keydown)
function damageClass:ToolTip_FriendlyFire (instancia, numero, barra, keydown)
local owner = self.owner
if (owner and owner.classe) then
@@ -4078,7 +4078,7 @@ end
---------DETALHES BIFURCAO ~detalhes ~detailswindow ~bi
function atributo_damage:MontaInfo()
function damageClass:MontaInfo()
if (info.sub_atributo == 1 or info.sub_atributo == 2 or info.sub_atributo == 6) then --damage done & dps
return self:MontaInfoDamageDone()
elseif (info.sub_atributo == 3) then --damage taken
@@ -4089,7 +4089,7 @@ function atributo_damage:MontaInfo()
end
---------DETALHES bloco da direita BIFURCAO
function atributo_damage:MontaDetalhes (spellid, barra, instancia)
function damageClass:MontaDetalhes (spellid, barra, instancia)
if (info.sub_atributo == 1 or info.sub_atributo == 2) then
return self:MontaDetalhesDamageDone (spellid, barra, instancia)
@@ -4109,7 +4109,7 @@ end
------ Friendly Fire
function atributo_damage:MontaInfoFriendlyFire()
function damageClass:MontaInfoFriendlyFire()
local instancia = info.instancia
local combat = instancia:GetShowingCombat()
@@ -4249,27 +4249,65 @@ function atributo_damage:MontaInfoFriendlyFire()
end
------ Damage Taken
function atributo_damage:MontaInfoDamageTaken()
local damageTakenHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true}
function damageClass:MontaInfoDamageTaken()
---@type actor
local actorObject = self
---@type instance
local instance = info.instancia
---@type combat
local combatObject = instance:GetCombat()
---@type string
local actorName = actorObject:Name()
--build the code for the new breakdown window
---@type number
local damageTakenTotal = actorObject.damage_taken
---@type table<string, boolean>
local damageTakenFrom = actorObject.damage_from
---@type actorcontainer
local damageContainer = combatObject:GetContainer(class_type)
local resultTable = {}
---@type string
for aggressorName in pairs(damageTakenFrom) do
local sourceActorObject = damageContainer:GetActor(aggressorName)
if (sourceActorObject) then
---@type table<string, number>
local targets = sourceActorObject:GetTargets()
---@type number|nil
local amountOfDamage = targets[actorName]
if (amountOfDamage) then
---@type texturetable
local iconTable = Details:GetActorIcon(sourceActorObject)
---@type {name: string, amount: number, icon: texturetable}
local damageTakenTable = {name = aggressorName, total = amountOfDamage, icon = iconTable}
resultTable[#resultTable+1] = damageTakenTable
end
end
end
resultTable.totalValue = damageTakenTotal
resultTable.combatTime = combatObject:GetCombatTime()
resultTable.headersAllowed = damageTakenHeadersAllowed
Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance)
if 1 then return end
local damage_taken = self.damage_taken
local agressores = self.damage_from
local instancia = info.instancia
local tabela_do_combate = instancia.showing
local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
local barras = info.barras1
local meus_agressores = {}
local este_agressor
for nome, _ in pairs(agressores) do
este_agressor = showing._ActorTable[showing._NameIndexTable[nome]]
for nome, _ in pairs(damageTakenFrom) do
este_agressor = damageContainer._ActorTable[damageContainer._NameIndexTable[nome]]
if (este_agressor) then
local alvos = este_agressor.targets
local este_alvo = alvos [self.nome]
if (este_alvo) then
meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_alvo/damage_taken*100, este_agressor.classe}
meus_agressores [#meus_agressores+1] = {nome, este_alvo, este_alvo/damageTakenTotal*100, este_agressor.classe}
end
end
end
@@ -4291,7 +4329,7 @@ function atributo_damage:MontaInfoDamageTaken()
for index, tabela in ipairs(meus_agressores) do
barra = barras [index]
if (not barra) then
barra = gump:CriaNovaBarraInfo1 (instancia, index)
barra = gump:CriaNovaBarraInfo1 (instance, index)
end
self:FocusLock(barra, tabela[1])
@@ -4305,6 +4343,49 @@ function atributo_damage:MontaInfoDamageTaken()
self:UpdadeInfoBar(barra, index, tabela[1], tabela[1], tabela[2], formated_value, max_, tabela[3], "Interface\\AddOns\\Details\\images\\classes_small_alpha", true, texCoords, nil, tabela[4])
end
--[=[
---@type number, spelltable
for spellId, spellTable in pairs(actorSpells) do
spellTable.ChartData = nil
---@type string
local spellName = _GetSpellInfo(spellId)
if (spellName) then
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index) then
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
---@type bknesteddata
local nestedData = {spellId = spellId, spellTable = spellTable, petName = "", value = 0}
bkSpellData.nestedData[#bkSpellData.nestedData+1] = nestedData
bkSpellData.bCanExpand = true
else
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId),
bCanExpand = false,
spellTables = {spellTable},
nestedData = {{spellId = spellId, spellTable = spellTable, petName = "", value = 0}},
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData
alreadyAdded[spellName] = #breakdownSpellDataList
end
end
end
--]=]
end
--[[exported]] function Details:UpdadeInfoBar(row, index, spellId, name, value, formattedValue, max, percent, icon, detalhes, texCoords, spellSchool, class)
@@ -4487,7 +4568,7 @@ end
--]=]
------ Damage Done & Dps
function atributo_damage:MontaInfoDamageDone() --I guess this fills the list of spells in the topleft scrollBar in the summary tab
function damageClass:MontaInfoDamageDone() --I guess this fills the list of spells in the topleft scrollBar in the summary tab
--the goal of this function is to build a list of spells the actor used and send the data to Details! which will delivery to the summary tab actived
--so the script only need to build the list of spells and send it to Details!
---@type actor
@@ -4896,7 +4977,7 @@ end
------ Detalhe Info Friendly Fire
function atributo_damage:MontaDetalhesFriendlyFire (nome, barra)
function damageClass:MontaDetalhesFriendlyFire (nome, barra)
local barras = info.barras3
local instancia = info.instancia
@@ -4961,7 +5042,7 @@ function atributo_damage:MontaDetalhesFriendlyFire (nome, barra)
end
-- detalhes info enemies
function atributo_damage:MontaDetalhesEnemy (spellid, barra)
function damageClass:MontaDetalhesEnemy (spellid, barra)
local container = info.instancia.showing[1]
local barras = info.barras3
@@ -5059,7 +5140,7 @@ function atributo_damage:MontaDetalhesEnemy (spellid, barra)
end
------ Detalhe Info Damage Taken
function atributo_damage:MontaDetalhesDamageTaken (nome, barra)
function damageClass:MontaDetalhesDamageTaken (nome, barra)
local barras = info.barras3
local instancia = info.instancia
@@ -5196,9 +5277,200 @@ local MontaDetalhesBuffProcs = function(actor, row, instance)
end
end
---called from the spell breakdown when a spellbar is hovered over
---@param spellBar breakdownspellbar
---@param spellBlockContainer breakdownspellblockframe
---@param blockIndex number
---@param summaryBlock breakdownspellblock
---@param spellId number
---@param elapsedTime number
---@param actorName string
---@param spellTable spelltable
---@param trinketData trinketdata
---@param combatObject combat
function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex, summaryBlock, spellId, elapsedTime, actorName, spellTable, trinketData, combatObject)
---@type number
local totalHits = spellTable.counter
--damage section showing damage done sub section
blockIndex = blockIndex + 1
do --update the texts in the summary block
local blockLine1, blockLine2, blockLine3 = summaryBlock:GetLines()
local totalCasts = spellBar.amountCasts > 0 and spellBar.amountCasts or "(?)"
blockLine1.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. totalCasts) --total amount of casts
if (trinketData[spellId] and combatObject.trinketProcs) then
local trinketProcData = combatObject.trinketProcs[actorName]
if (trinketProcData) then
local trinketProc = trinketProcData[spellId]
if (trinketProc) then
blockLine1.leftText:SetText("Procs: " .. trinketProc.total)
end
end
end
blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime
blockLine2.leftText:SetText(Loc ["STRING_DAMAGE"]..": " .. Details:Format(spellTable.total)) --total damage
blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps
end
local emporwerSpell = spellTable.e_total
if (emporwerSpell) then
local empowerLevelSum = spellTable.e_total --total sum of empower levels
local empowerAmount = spellTable.e_amt --amount of casts with empower
local empowerAmountPerLevel = spellTable.e_lvl --{[1] = 4; [2] = 9; [3] = 15}
local empowerDamagePerLevel = spellTable.e_dmg --{[1] = 54548745, [2] = 74548745}
---@type breakdownspellblock
local empowerBlock = spellBlockContainer:GetBlock(blockIndex)
blockIndex = blockIndex + 1
local level1AverageDamage = "0"
local level2AverageDamage = "0"
local level3AverageDamage = "0"
local level4AverageDamage = "0"
local level5AverageDamage = "0"
if (empowerDamagePerLevel[1]) then
level1AverageDamage = Details:Format(empowerDamagePerLevel[1] / empowerAmountPerLevel[1])
end
if (empowerDamagePerLevel[2]) then
level2AverageDamage = Details:Format(empowerDamagePerLevel[2] / empowerAmountPerLevel[2])
end
if (empowerDamagePerLevel[3]) then
level3AverageDamage = Details:Format(empowerDamagePerLevel[3] / empowerAmountPerLevel[3])
end
if (empowerDamagePerLevel[4]) then
level4AverageDamage = Details:Format(empowerDamagePerLevel[4] / empowerAmountPerLevel[4])
end
if (empowerDamagePerLevel[5]) then
level5AverageDamage = Details:Format(empowerDamagePerLevel[5] / empowerAmountPerLevel[5])
end
empowerBlock:Show()
empowerBlock:SetValue(100)
empowerBlock.sparkTexture:SetPoint("left", empowerBlock, "left", empowerBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
empowerBlock:SetColor(0.200, 0.576, 0.498, 0.6)
local blockLine1, blockLine2, blockLine3 = empowerBlock:GetLines()
blockLine1.leftText:SetText("Spell Empower Average Level: " .. string.format("%.2f", empowerLevelSum / empowerAmount))
if (level1AverageDamage ~= "0") then
blockLine2.leftText:SetText("Level 1 Avg: " .. level1AverageDamage .. " (" .. (empowerAmountPerLevel[1] or 0) .. ")")
end
if (level2AverageDamage ~= "0") then
blockLine2.centerText:SetText("Level 2 Avg: " .. level2AverageDamage .. " (" .. (empowerAmountPerLevel[2] or 0) .. ")")
end
if (level3AverageDamage ~= "0") then
blockLine2.rightText:SetText("Level 3 Avg: " .. level3AverageDamage .. " (" .. (empowerAmountPerLevel[3] or 0) .. ")")
end
if (level4AverageDamage ~= "0") then
blockLine3.leftText:SetText("Level 4 Avg: " .. level4AverageDamage .. " (" .. (empowerAmountPerLevel[4] or 0) .. ")")
end
if (level5AverageDamage ~= "0") then
blockLine3.rightText:SetText("Level 5 Avg: " .. level5AverageDamage .. " (" .. (empowerAmountPerLevel[5] or 0) .. ")")
end
end
--check if there's normal hits and build the block
---@type number
local normalHitsAmt = spellTable.n_amt
if (normalHitsAmt > 0) then
---@type breakdownspellblock
local normalHitsBlock = spellBlockContainer:GetBlock(blockIndex)
normalHitsBlock:Show()
blockIndex = blockIndex + 1
local percent = normalHitsAmt / math.max(totalHits, 0.0001) * 100
normalHitsBlock:SetValue(percent)
normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = normalHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_NORMAL_HITS"])
blockLine1.rightText:SetText(normalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", normalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]")
blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_min))
blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_max))
local normalAverage = spellTable.n_total / math.max(normalHitsAmt, 0.0001)
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage))
local tempo = (elapsedTime * spellTable.n_total) / math.max(spellTable.total, 0.001)
local normalAveragePercent = spellBar.average / normalAverage * 100
local normalTempoPercent = normalAveragePercent * tempo / 100
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent))
end
---@type number
local criticalHitsAmt = spellTable.c_amt
if (criticalHitsAmt > 0) then
---@type breakdownspellblock
local critHitsBlock = spellBlockContainer:GetBlock(blockIndex)
critHitsBlock:Show()
blockIndex = blockIndex + 1
local percent = Details.SpellTableMixin.GetCritPercent(spellTable)
critHitsBlock:SetValue(percent)
critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_CRITICAL_HITS"])
blockLine1.rightText:SetText(criticalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", criticalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]")
blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_min))
blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_max))
local critAverage = Details.SpellTableMixin.GetCritAverage(spellTable)
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage))
local tempo = (elapsedTime * spellTable.c_total) / math.max(spellTable.total, 0.001)
local critAveragePercent = spellBar.average / critAverage * 100
local critTempoPercent = critAveragePercent * tempo / 100
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent))
end
if (trinketData[spellId]) then
---@type trinketdata
local trinketInfo = trinketData[spellId]
local minTime = trinketInfo.minTime
local maxTime = trinketInfo.maxTime
local average = trinketInfo.averageTime
---@type breakdownspellblock
local trinketBlock = spellBlockContainer:GetBlock(blockIndex)
trinketBlock:Show()
trinketBlock:SetValue(100)
trinketBlock.sparkTexture:SetPoint("left", trinketBlock, "left", trinketBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
blockIndex = blockIndex + 1
local blockLine1, blockLine2, blockLine3 = trinketBlock:GetLines()
blockLine1.leftText:SetText("Trinket Info")
blockLine1.rightText:SetText("PPM: " .. string.format("%.2f", average / 60))
if (minTime == 9999999) then
blockLine2.leftText:SetText("Min Time: " .. _G["UNKNOWN"])
else
blockLine2.leftText:SetText("Min Time: " .. math.floor(minTime))
end
blockLine2.rightText:SetText("Max Time: " .. math.floor(maxTime))
end
end
--this build p the 6 rectangle boxes in the right side of the breakdown window summary tab
function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance) --this should be ~deprecated with the new breakdown tab
function damageClass:MontaDetalhesDamageDone (spellId, spellLine, instance) --this should be ~deprecated with the new breakdown tab
print("MontaDetalhesDamageDone - deprecated", debugstack())
@@ -5689,7 +5961,7 @@ function Details:BuildPlayerDetailsSpellChart()
end
end
function atributo_damage:MontaTooltipDamageTaken (thisLine, index)
function damageClass:MontaTooltipDamageTaken (thisLine, index)
local aggressor = info.instancia.showing [1]:PegarCombatente (_, thisLine.nome_inimigo)
local container = aggressor.spells._ActorTable
local habilidades = {}
@@ -5725,7 +5997,7 @@ function atributo_damage:MontaTooltipDamageTaken (thisLine, index)
end
function atributo_damage:MontaTooltipAlvos (thisLine, index, instancia) --~deprecated
function damageClass:MontaTooltipAlvos (thisLine, index, instancia) --~deprecated
local inimigo = thisLine.nome_inimigo
local habilidades = {}
@@ -5850,7 +6122,7 @@ function atributo_damage:MontaTooltipAlvos (thisLine, index, instancia) --~depre
end
--controla se o dps do jogador esta travado ou destravado
function atributo_damage:Iniciar (iniciar)
function damageClass:Iniciar (iniciar)
if (iniciar == nil) then
return self.dps_started --retorna se o dps esta aberto ou fechado para este jogador
elseif (iniciar) then
@@ -5866,7 +6138,7 @@ end
--core functions
--limpa as tabelas temporrias ao resetar
function atributo_damage:ClearTempTables()
function damageClass:ClearTempTables()
for i = #ntable, 1, -1 do
ntable [i] = nil
end
@@ -5889,7 +6161,7 @@ end
end
--atualize a funcao de abreviacao
function atributo_damage:UpdateSelectedToKFunction()
function damageClass:UpdateSelectedToKFunction()
SelectedToKFunction = ToKFunctions [Details.ps_abbreviation]
FormatTooltipNumber = ToKFunctions [Details.tooltip.abbreviation]
TooltipMaximizedMethod = Details.tooltip.maximize_method
@@ -5897,13 +6169,13 @@ end
end
--diminui o total das tabelas do combate
function atributo_damage:subtract_total (combat_table)
function damageClass:subtract_total (combat_table)
combat_table.totals [class_type] = combat_table.totals [class_type] - self.total
if (self.grupo) then
combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] - self.total
end
end
function atributo_damage:add_total (combat_table)
function damageClass:add_total (combat_table)
combat_table.totals [class_type] = combat_table.totals [class_type] + self.total
if (self.grupo) then
combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] + self.total
@@ -5911,7 +6183,7 @@ end
end
--restaura a tabela de last event
function atributo_damage:r_last_events_table (actor)
function damageClass:r_last_events_table (actor)
if (not actor) then
actor = self
end
@@ -5919,7 +6191,7 @@ end
end
--restaura e liga o ator com a sua shadow durante a inicializao (startup function)
function atributo_damage:r_onlyrefresh_shadow (actor)
function damageClass:r_onlyrefresh_shadow (actor)
--criar uma shadow desse ator se ainda no tiver uma
local overall_dano = Details.tabela_overall [1]
local shadow = overall_dano._ActorTable [overall_dano._NameIndexTable [actor.nome]]
@@ -5985,7 +6257,7 @@ end
return shadow
end
function atributo_damage:r_connect_shadow (actor, no_refresh, combat_object)
function damageClass:r_connect_shadow (actor, no_refresh, combat_object)
--check if there's a custom combat, if not just use the overall container
local host_combat = combat_object or Details.tabela_overall
@@ -6228,7 +6500,7 @@ function Details.SumDamageActors(actor1, actor2, actorContainer)
end
atributo_damage.__add = function(tabela1, tabela2)
damageClass.__add = function(tabela1, tabela2)
--tempo decorrido
local tempo = (tabela2.end_time or time()) - tabela2.start_time
@@ -6337,7 +6609,7 @@ atributo_damage.__add = function(tabela1, tabela2)
return tabela1
end
atributo_damage.__sub = function(tabela1, tabela2)
damageClass.__sub = function(tabela1, tabela2)
--tempo decorrido
local tempo = (tabela2.end_time or time()) - tabela2.start_time