84 lines
3.0 KiB
Lua
84 lines
3.0 KiB
Lua
local NanamiDPS = NanamiDPS
|
|
local DataStore = NanamiDPS.DataStore
|
|
local L = NanamiDPS.L
|
|
|
|
local HealingDone = {}
|
|
|
|
function HealingDone:GetName()
|
|
return L["Healing Done"]
|
|
end
|
|
|
|
function HealingDone:GetBars(segment)
|
|
if not segment or not segment.data or not segment.data.healing then return {} end
|
|
|
|
local bars = {}
|
|
for name, entry in pairs(segment.data.healing) do
|
|
local class = DataStore:GetClass(name)
|
|
local r, g, b = NanamiDPS.GetClassColor(class)
|
|
if not NanamiDPS.validClasses[class] then
|
|
r, g, b = NanamiDPS.str2rgb(name)
|
|
r = r * 0.6 + 0.4
|
|
g = g * 0.6 + 0.4
|
|
b = b * 0.6 + 0.4
|
|
end
|
|
|
|
local effectiveVal = entry._esum or entry._sum
|
|
table.insert(bars, {
|
|
id = name,
|
|
name = name,
|
|
value = effectiveVal,
|
|
totalHeal = entry._sum,
|
|
effectiveHeal = effectiveVal,
|
|
overheal = entry._sum - effectiveVal,
|
|
class = class,
|
|
r = r, g = g, b = b,
|
|
})
|
|
end
|
|
|
|
table.sort(bars, function(a, b) return a.value > b.value end)
|
|
|
|
local total = 0
|
|
for _, bar in ipairs(bars) do total = total + bar.value end
|
|
for _, bar in ipairs(bars) do
|
|
bar.percent = total > 0 and (bar.value / total * 100) or 0
|
|
bar.valueText = NanamiDPS.formatNumber(bar.effectiveHeal)
|
|
if bar.overheal > 0 then
|
|
bar.valueText = bar.valueText .. " |cffcc8888+" .. NanamiDPS.formatNumber(bar.overheal)
|
|
end
|
|
end
|
|
|
|
return bars
|
|
end
|
|
|
|
function HealingDone:GetTooltip(playerName, segment, tooltip)
|
|
if not segment or not segment.data.healing[playerName] then return end
|
|
local entry = segment.data.healing[playerName]
|
|
local effectiveVal = entry._esum or entry._sum
|
|
local overhealVal = entry._sum - effectiveVal
|
|
|
|
tooltip:AddLine("|cffffd100" .. playerName)
|
|
tooltip:AddDoubleLine("|cffffffff" .. L["Healing Done"], "|cffffffff" .. NanamiDPS.formatNumber(effectiveVal))
|
|
tooltip:AddDoubleLine("|cffaaaaaa" .. L["Overheal"], "|cffcc8888+" .. NanamiDPS.formatNumber(overhealVal))
|
|
tooltip:AddDoubleLine("|cffffffff" .. L["HPS"],
|
|
"|cffffffff" .. NanamiDPS.round(effectiveVal / math.max(entry._ctime, 1), 1))
|
|
tooltip:AddDoubleLine("|cffffffff" .. L["Active Time"],
|
|
"|cffffffff" .. NanamiDPS.formatTime(entry._ctime))
|
|
|
|
NanamiDPS.Tooltip:ShowSpellDetail(playerName, entry.spells, entry.effective, entry._sum, effectiveVal, tooltip)
|
|
end
|
|
|
|
function HealingDone:GetReportLines(segment, count)
|
|
local bars = self:GetBars(segment)
|
|
local lines = {}
|
|
count = count or 5
|
|
for i = 1, math.min(count, table.getn(bars)) do
|
|
local d = bars[i]
|
|
local oh = d.overheal > 0 and (" [+" .. NanamiDPS.formatNumber(d.overheal) .. "]") or ""
|
|
table.insert(lines, string.format("%d. %s - %s%s (%.1f%%)",
|
|
i, d.name, NanamiDPS.formatNumber(d.effectiveHeal), oh, d.percent))
|
|
end
|
|
return lines
|
|
end
|
|
|
|
NanamiDPS:RegisterModule("HealingDone", HealingDone)
|