更新发送到功能

更新仇恨计算方式 还在开发
更新其他细节
This commit is contained in:
rucky
2026-03-23 10:26:31 +08:00
commit 5c3f2243c4
26 changed files with 6080 additions and 0 deletions

81
Modules/Activity.lua Normal file
View File

@@ -0,0 +1,81 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local Activity = {}
function Activity:GetName()
return L["Activity"]
end
function Activity:GetBars(segment)
if not segment or not segment.data or not segment.data.activity then return {} end
local segDuration = segment.duration
if segDuration <= 0 then
segDuration = GetTime() - (segment.startTime or GetTime())
end
if segDuration <= 0 then segDuration = 1 end
local bars = {}
for name, entry in pairs(segment.data.activity) 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 activeTime = entry._activeTime or 0
local pct = segDuration > 0 and (activeTime / segDuration * 100) or 0
pct = math.min(pct, 100)
table.insert(bars, {
id = name,
name = name,
value = pct,
class = class,
r = r, g = g, b = b,
valueText = NanamiDPS.round(pct, 1) .. "% (" .. NanamiDPS.formatTime(activeTime) .. ")",
activeTime = activeTime,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
return bars
end
function Activity:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.activity[playerName] then return end
local entry = segment.data.activity[playerName]
local segDuration = segment.duration
if segDuration <= 0 then
segDuration = GetTime() - (segment.startTime or GetTime())
end
if segDuration <= 0 then segDuration = 1 end
local activeTime = entry._activeTime or 0
local pct = math.min(activeTime / segDuration * 100, 100)
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffffffff" .. L["Activity"], "|cffffffff" .. NanamiDPS.round(pct, 1) .. "%")
tooltip:AddDoubleLine("|cffffffff" .. L["Active Time"], "|cffffffff" .. NanamiDPS.formatTime(activeTime))
tooltip:AddDoubleLine("|cffffffff" .. L["Fight Duration"], "|cffffffff" .. NanamiDPS.formatTime(segDuration))
end
function Activity: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]
table.insert(lines, string.format("%d. %s - %.1f%% active", i, d.name, d.value))
end
return lines
end
NanamiDPS:RegisterModule("Activity", Activity)

74
Modules/DPS.lua Normal file
View File

@@ -0,0 +1,74 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local DPS = {}
function DPS:GetName()
return L["DPS"]
end
function DPS:GetBars(segment)
if not segment or not segment.data or not segment.data.damage then return {} end
local bars = {}
for name, entry in pairs(segment.data.damage) 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 dps = entry._sum / math.max(entry._ctime, 1)
table.insert(bars, {
id = name,
name = name,
value = dps,
class = class,
r = r, g = g, b = b,
valueText = NanamiDPS.round(dps, 1) .. " DPS",
totalDamage = entry._sum,
ctime = entry._ctime,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local best = bars[1] and bars[1].value or 0
for _, bar in ipairs(bars) do
bar.percent = best > 0 and (bar.value / best * 100) or 0
end
return bars
end
function DPS:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.damage[playerName] then return end
local entry = segment.data.damage[playerName]
local dps = entry._sum / math.max(entry._ctime, 1)
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffffffff" .. L["DPS"], "|cffffffff" .. NanamiDPS.round(dps, 1))
tooltip:AddDoubleLine("|cffffffff" .. L["Damage Done"], "|cffffffff" .. NanamiDPS.formatNumber(entry._sum))
tooltip:AddDoubleLine("|cffffffff" .. L["Active Time"],
"|cffffffff" .. NanamiDPS.formatTime(entry._ctime))
NanamiDPS.Tooltip:ShowSpellDetail(playerName, entry.spells, nil, entry._sum, nil, tooltip)
end
function DPS: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]
table.insert(lines, string.format("%d. %s - %.1f DPS (%s)",
i, d.name, d.value, NanamiDPS.formatNumber(d.totalDamage)))
end
return lines
end
NanamiDPS:RegisterModule("DPS", DPS)

90
Modules/DamageBySpell.lua Normal file
View File

@@ -0,0 +1,90 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local DamageBySpell = {}
function DamageBySpell:GetName()
return L["Damage by Spell"]
end
function DamageBySpell:GetBars(segment)
if not segment or not segment.data or not segment.data.damage then return {} end
-- Aggregate all spells across all players
local spellTotals = {}
for name, entry in pairs(segment.data.damage) do
if entry.spells then
for spell, amount in pairs(entry.spells) do
spellTotals[spell] = (spellTotals[spell] or 0) + amount
end
end
end
local bars = {}
for spell, total in pairs(spellTotals) do
local r, g, b = NanamiDPS.str2rgb(spell)
r = r * 0.5 + 0.4
g = g * 0.5 + 0.4
b = b * 0.5 + 0.4
table.insert(bars, {
id = spell,
name = spell,
value = total,
r = r, g = g, b = b,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local grandTotal = 0
for _, bar in ipairs(bars) do grandTotal = grandTotal + bar.value end
for _, bar in ipairs(bars) do
bar.percent = grandTotal > 0 and (bar.value / grandTotal * 100) or 0
end
return bars
end
function DamageBySpell:GetTooltip(spellName, segment, tooltip)
tooltip:AddLine("|cffffd100" .. (spellName or L["Unknown"]))
if segment and segment.data.damage then
local users = {}
for name, entry in pairs(segment.data.damage) do
if entry.spells and entry.spells[spellName] then
table.insert(users, { name = name, amount = entry.spells[spellName] })
end
end
table.sort(users, function(a, b) return a.amount > b.amount end)
if table.getn(users) > 0 then
local total = 0
for _, u in ipairs(users) do total = total + u.amount end
tooltip:AddDoubleLine("|cffffffff" .. L["Total Amount"], "|cffffffff" .. NanamiDPS.formatNumber(total))
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Players"] .. ":")
for _, u in ipairs(users) do
local pct = total > 0 and NanamiDPS.round(u.amount / total * 100, 1) or 0
tooltip:AddDoubleLine("|cffffffff" .. u.name,
"|cffffffff" .. NanamiDPS.formatNumber(u.amount) .. " (" .. pct .. "%)")
end
end
end
end
function DamageBySpell: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("DamageBySpell", DamageBySpell)

79
Modules/DamageDone.lua Normal file
View File

@@ -0,0 +1,79 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local DamageDone = {}
function DamageDone:GetName()
return L["Damage Done"]
end
function DamageDone:GetBars(segment)
if not segment or not segment.data or not segment.data.damage then return {} end
local bars = {}
for name, entry in pairs(segment.data.damage) 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 dmg = entry._sum or 0
local dps = dmg / math.max(entry._ctime or 0, 1)
table.insert(bars, {
id = name,
name = name,
value = dmg,
class = class,
r = r, g = g, b = b,
dps = dps,
ctime = entry._ctime,
})
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.value)
.. " " .. NanamiDPS.formatNumber(bar.dps) .. "/s"
.. " (" .. NanamiDPS.round(bar.percent, 1) .. "%)"
end
return bars
end
function DamageDone:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.damage[playerName] then return end
local entry = segment.data.damage[playerName]
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffffffff" .. L["Damage Done"], "|cffffffff" .. NanamiDPS.formatNumber(entry._sum))
tooltip:AddDoubleLine("|cffffffff" .. L["DPS"],
"|cffffffff" .. NanamiDPS.round(entry._sum / math.max(entry._ctime, 1), 1))
tooltip:AddDoubleLine("|cffffffff" .. L["Active Time"],
"|cffffffff" .. NanamiDPS.formatTime(entry._ctime))
NanamiDPS.Tooltip:ShowSpellDetail(playerName, entry.spells, nil, entry._sum, nil, tooltip)
end
function DamageDone: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("DamageDone", DamageDone)

69
Modules/DamageTaken.lua Normal file
View File

@@ -0,0 +1,69 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local DamageTaken = {}
function DamageTaken:GetName()
return L["Damage Taken"]
end
function DamageTaken:GetBars(segment)
if not segment or not segment.data or not segment.data.damageTaken then return {} end
local bars = {}
for name, entry in pairs(segment.data.damageTaken) 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
table.insert(bars, {
id = name,
name = name,
value = entry._sum or 0,
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
end
return bars
end
function DamageTaken:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.damageTaken[playerName] then return end
local entry = segment.data.damageTaken[playerName]
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffffffff" .. L["Damage Taken"], "|cffffffff" .. NanamiDPS.formatNumber(entry._sum))
tooltip:AddDoubleLine("|cffffffff" .. L["Active Time"],
"|cffffffff" .. NanamiDPS.formatTime(entry._ctime))
NanamiDPS.Tooltip:ShowSpellDetail(playerName, entry.spells, nil, entry._sum, nil, tooltip)
end
function DamageTaken: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("DamageTaken", DamageTaken)

94
Modules/Deaths.lua Normal file
View File

@@ -0,0 +1,94 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local Deaths = {}
function Deaths:GetName()
return L["Deaths"]
end
function Deaths:GetBars(segment)
if not segment or not segment.data or not segment.data.deaths then return {} end
local bars = {}
for name, entry in pairs(segment.data.deaths) 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
table.insert(bars, {
id = name,
name = name,
value = entry._sum or 0,
class = class,
r = r, g = g, b = b,
valueText = tostring(entry._sum or 0) .. "x",
events = entry.events,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
return bars
end
function Deaths:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.deaths[playerName] then return end
local entry = segment.data.deaths[playerName]
tooltip:AddLine("|cffffd100" .. playerName .. " - " .. L["Deaths"])
tooltip:AddDoubleLine("|cffffffff" .. L["Deaths"], "|cffffffff" .. (entry._sum or 0))
if entry.events and table.getn(entry.events) > 0 then
local lastDeath = entry.events[table.getn(entry.events)]
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Last Events"] .. " (" .. (lastDeath.timeStr or "") .. "):")
if lastDeath.events then
local startIdx = math.max(1, table.getn(lastDeath.events) - 9)
for i = startIdx, table.getn(lastDeath.events) do
local evt = lastDeath.events[i]
if evt then
local timeAgo = ""
if lastDeath.time and evt.time then
timeAgo = string.format("-%.1fs", lastDeath.time - evt.time)
end
if evt.type == "damage" then
local line = string.format("|cffff4444-%s|r %s (%s)",
NanamiDPS.formatNumber(math.abs(evt.amount or 0)),
evt.spell or "?",
evt.source or "?")
tooltip:AddDoubleLine("|cffaaaaaa" .. timeAgo, line)
elseif evt.type == "heal" then
local line = string.format("|cff44ff44+%s|r %s (%s)",
NanamiDPS.formatNumber(evt.amount or 0),
evt.spell or "?",
evt.source or "?")
tooltip:AddDoubleLine("|cffaaaaaa" .. timeAgo, line)
end
end
end
end
end
end
function Deaths: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]
table.insert(lines, string.format("%d. %s - %dx deaths", i, d.name, d.value))
end
return lines
end
NanamiDPS:RegisterModule("Deaths", Deaths)

78
Modules/Dispels.lua Normal file
View File

@@ -0,0 +1,78 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local Dispels = {}
function Dispels:GetName()
return L["Dispels"]
end
function Dispels:GetBars(segment)
if not segment or not segment.data or not segment.data.dispels then return {} end
local bars = {}
for name, entry in pairs(segment.data.dispels) 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
table.insert(bars, {
id = name,
name = name,
value = entry._sum or 0,
class = class,
r = r, g = g, b = b,
valueText = tostring(entry._sum or 0),
})
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
end
return bars
end
function Dispels:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.dispels[playerName] then return end
local entry = segment.data.dispels[playerName]
tooltip:AddLine("|cffffd100" .. playerName .. " - " .. L["Dispels"])
tooltip:AddDoubleLine("|cffffffff" .. L["Dispels"], "|cffffffff" .. (entry._sum or 0))
if entry.spells then
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Details"] .. ":")
local sorted = {}
for spell, count in pairs(entry.spells) do
table.insert(sorted, { spell = spell, count = count })
end
table.sort(sorted, function(a, b) return a.count > b.count end)
for _, s in ipairs(sorted) do
tooltip:AddDoubleLine("|cffffffff" .. s.spell, "|cffffffff" .. s.count)
end
end
end
function Dispels: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]
table.insert(lines, string.format("%d. %s - %d dispels", i, d.name, d.value))
end
return lines
end
NanamiDPS:RegisterModule("Dispels", Dispels)

View File

@@ -0,0 +1,90 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local EnemyDamageDone = {}
function EnemyDamageDone:GetName()
return L["Enemy Damage Done"]
end
function EnemyDamageDone:GetBars(segment)
if not segment or not segment.data or not segment.data.damageTaken then return {} end
-- Aggregate damage by source across all targets
local bySource = {}
for targetName, entry in pairs(segment.data.damageTaken) do
if entry.spells then
for spell, amount in pairs(entry.spells) do
-- Extract real source from spell name if available
-- Otherwise group by spell
if not bySource[spell] then
bySource[spell] = 0
end
bySource[spell] = bySource[spell] + amount
end
end
end
local bars = {}
for spell, total in pairs(bySource) do
local r, g, b = NanamiDPS.str2rgb(spell)
r = r * 0.5 + 0.5
g = g * 0.3 + 0.2
b = b * 0.3 + 0.2
table.insert(bars, {
id = spell,
name = spell,
value = total,
r = r, g = g, b = b,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local grandTotal = 0
for _, bar in ipairs(bars) do grandTotal = grandTotal + bar.value end
for _, bar in ipairs(bars) do
bar.percent = grandTotal > 0 and (bar.value / grandTotal * 100) or 0
end
return bars
end
function EnemyDamageDone:GetTooltip(spellName, segment, tooltip)
tooltip:AddLine("|cffffd100" .. (spellName or L["Unknown"]))
-- Find all targets hit by this spell
if segment and segment.data.damageTaken then
local targets = {}
for targetName, entry in pairs(segment.data.damageTaken) do
if entry.spells and entry.spells[spellName] then
table.insert(targets, { name = targetName, amount = entry.spells[spellName] })
end
end
table.sort(targets, function(a, b) return a.amount > b.amount end)
if table.getn(targets) > 0 then
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Targets"] .. ":")
for _, t in ipairs(targets) do
tooltip:AddDoubleLine("|cffffffff" .. t.name, "|cffffffff" .. NanamiDPS.formatNumber(t.amount))
end
end
end
end
function EnemyDamageDone: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("EnemyDamageDone", EnemyDamageDone)

80
Modules/HPS.lua Normal file
View File

@@ -0,0 +1,80 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local HPS = {}
function HPS:GetName()
return L["HPS"]
end
function HPS: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
local hps = effectiveVal / math.max(entry._ctime, 1)
table.insert(bars, {
id = name,
name = name,
value = hps,
class = class,
r = r, g = g, b = b,
valueText = NanamiDPS.round(hps, 1) .. " HPS",
effectiveHeal = effectiveVal,
totalHeal = entry._sum,
ctime = entry._ctime,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local best = bars[1] and bars[1].value or 0
for _, bar in ipairs(bars) do
bar.percent = best > 0 and (bar.value / best * 100) or 0
end
return bars
end
function HPS: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 hps = effectiveVal / math.max(entry._ctime, 1)
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffffffff" .. L["HPS"], "|cffffffff" .. NanamiDPS.round(hps, 1))
tooltip:AddDoubleLine("|cffffffff" .. L["Healing Done"], "|cffffffff" .. NanamiDPS.formatNumber(effectiveVal))
tooltip:AddDoubleLine("|cffaaaaaa" .. L["Overheal"],
"|cffcc8888+" .. NanamiDPS.formatNumber(entry._sum - effectiveVal))
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 HPS: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]
table.insert(lines, string.format("%d. %s - %.1f HPS (%s)",
i, d.name, d.value, NanamiDPS.formatNumber(d.effectiveHeal)))
end
return lines
end
NanamiDPS:RegisterModule("HPS", HPS)

119
Modules/HealingBySpell.lua Normal file
View File

@@ -0,0 +1,119 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local HealingBySpell = {}
function HealingBySpell:GetName()
return L["Healing by Spell"]
end
function HealingBySpell:GetBars(segment)
if not segment or not segment.data or not segment.data.healing then return {} end
local spellTotals = {}
local spellEffective = {}
for name, entry in pairs(segment.data.healing) do
if entry.spells then
for spell, amount in pairs(entry.spells) do
spellTotals[spell] = (spellTotals[spell] or 0) + amount
if entry.effective and entry.effective[spell] then
spellEffective[spell] = (spellEffective[spell] or 0) + entry.effective[spell]
end
end
end
end
local bars = {}
for spell, total in pairs(spellTotals) do
local effective = spellEffective[spell] or total
local overheal = total - effective
local r, g, b = NanamiDPS.str2rgb(spell)
r = r * 0.4 + 0.3
g = g * 0.5 + 0.4
b = b * 0.4 + 0.3
local valText = NanamiDPS.formatNumber(effective)
if overheal > 0 then
valText = valText .. " |cffcc8888+" .. NanamiDPS.formatNumber(overheal)
end
table.insert(bars, {
id = spell,
name = spell,
value = effective,
r = r, g = g, b = b,
valueText = valText,
totalHeal = total,
effectiveHeal = effective,
overheal = overheal,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local grandTotal = 0
for _, bar in ipairs(bars) do grandTotal = grandTotal + bar.value end
for _, bar in ipairs(bars) do
bar.percent = grandTotal > 0 and (bar.value / grandTotal * 100) or 0
end
return bars
end
function HealingBySpell:GetTooltip(spellName, segment, tooltip)
tooltip:AddLine("|cffffd100" .. (spellName or L["Unknown"]))
if segment and segment.data.healing then
local users = {}
local totalAmount = 0
local totalEffective = 0
for name, entry in pairs(segment.data.healing) do
if entry.spells and entry.spells[spellName] then
local eff = (entry.effective and entry.effective[spellName]) or entry.spells[spellName]
table.insert(users, {
name = name,
amount = entry.spells[spellName],
effective = eff,
})
totalAmount = totalAmount + entry.spells[spellName]
totalEffective = totalEffective + eff
end
end
table.sort(users, function(a, b) return a.effective > b.effective end)
tooltip:AddDoubleLine("|cffffffff" .. L["Healing Done"], "|cffffffff" .. NanamiDPS.formatNumber(totalEffective))
if totalAmount - totalEffective > 0 then
tooltip:AddDoubleLine("|cffaaaaaa" .. L["Overheal"],
"|cffcc8888+" .. NanamiDPS.formatNumber(totalAmount - totalEffective))
end
if table.getn(users) > 0 then
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Players"] .. ":")
for _, u in ipairs(users) do
local oh = u.amount - u.effective
local rightStr = NanamiDPS.formatNumber(u.effective)
if oh > 0 then
rightStr = rightStr .. " |cffcc8888+" .. NanamiDPS.formatNumber(oh)
end
tooltip:AddDoubleLine("|cffffffff" .. u.name, "|cffffffff" .. rightStr)
end
end
end
end
function HealingBySpell: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("HealingBySpell", HealingBySpell)

83
Modules/HealingDone.lua Normal file
View File

@@ -0,0 +1,83 @@
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)

78
Modules/Interrupts.lua Normal file
View File

@@ -0,0 +1,78 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local Interrupts = {}
function Interrupts:GetName()
return L["Interrupts"]
end
function Interrupts:GetBars(segment)
if not segment or not segment.data or not segment.data.interrupts then return {} end
local bars = {}
for name, entry in pairs(segment.data.interrupts) 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
table.insert(bars, {
id = name,
name = name,
value = entry._sum or 0,
class = class,
r = r, g = g, b = b,
valueText = tostring(entry._sum or 0),
})
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
end
return bars
end
function Interrupts:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.interrupts[playerName] then return end
local entry = segment.data.interrupts[playerName]
tooltip:AddLine("|cffffd100" .. playerName .. " - " .. L["Interrupts"])
tooltip:AddDoubleLine("|cffffffff" .. L["Interrupts"], "|cffffffff" .. (entry._sum or 0))
if entry.spells then
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Details"] .. ":")
local sorted = {}
for spell, count in pairs(entry.spells) do
table.insert(sorted, { spell = spell, count = count })
end
table.sort(sorted, function(a, b) return a.count > b.count end)
for _, s in ipairs(sorted) do
tooltip:AddDoubleLine("|cffffffff" .. s.spell, "|cffffffff" .. s.count)
end
end
end
function Interrupts: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]
table.insert(lines, string.format("%d. %s - %d interrupts", i, d.name, d.value))
end
return lines
end
NanamiDPS:RegisterModule("Interrupts", Interrupts)

100
Modules/Overhealing.lua Normal file
View File

@@ -0,0 +1,100 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local Overhealing = {}
function Overhealing:GetName()
return L["Overhealing"]
end
function Overhealing: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
local overhealVal = entry._sum - effectiveVal
local overhealPct = entry._sum > 0 and (overhealVal / entry._sum * 100) or 0
if overhealVal > 0 then
table.insert(bars, {
id = name,
name = name,
value = overhealVal,
class = class,
r = r * 0.7 + 0.3, g = g * 0.5, b = b * 0.5,
valueText = NanamiDPS.formatNumber(overhealVal) .. " (" .. NanamiDPS.round(overhealPct, 1) .. "%)",
overhealPct = overhealPct,
totalHeal = entry._sum,
effectiveHeal = effectiveVal,
})
end
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
end
return bars
end
function Overhealing: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
local overhealPct = entry._sum > 0 and NanamiDPS.round(overhealVal / entry._sum * 100, 1) or 0
tooltip:AddLine("|cffffd100" .. playerName)
tooltip:AddDoubleLine("|cffcc8888" .. L["Overhealing"], "|cffcc8888" .. NanamiDPS.formatNumber(overhealVal))
tooltip:AddDoubleLine("|cffcc8888" .. L["Overheal %"], "|cffcc8888" .. overhealPct .. "%")
tooltip:AddDoubleLine("|cffffffff" .. L["Healing Done"], "|cffffffff" .. NanamiDPS.formatNumber(entry._sum))
tooltip:AddDoubleLine("|cffffffff" .. L["Effective"], "|cffffffff" .. NanamiDPS.formatNumber(effectiveVal))
if entry.spells and entry.effective then
tooltip:AddLine(" ")
tooltip:AddLine("|cffffd100" .. L["Details"] .. ":")
local sorted = {}
for spell, amount in pairs(entry.spells) do
table.insert(sorted, { spell = spell, amount = amount })
end
table.sort(sorted, function(a, b) return a.amount > b.amount end)
for _, s in ipairs(sorted) do
local eff = entry.effective[s.spell] or s.amount
local oh = s.amount - eff
if oh > 0 then
local pct = s.amount > 0 and NanamiDPS.round(oh / s.amount * 100, 1) or 0
tooltip:AddDoubleLine("|cffffffff" .. s.spell,
"|cffcc8888+" .. NanamiDPS.formatNumber(oh) .. " (" .. pct .. "%)")
end
end
end
end
function Overhealing: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.overhealPct))
end
return lines
end
NanamiDPS:RegisterModule("Overhealing", Overhealing)

110
Modules/ThreatEstimate.lua Normal file
View File

@@ -0,0 +1,110 @@
local NanamiDPS = NanamiDPS
local DataStore = NanamiDPS.DataStore
local L = NanamiDPS.L
local ThreatEstimate = {}
function ThreatEstimate:GetName()
return L["Threat (Est.)"]
end
local function ResolvePetOwner(name)
local stored = DataStore:GetClass(name)
if stored and not NanamiDPS.validClasses[stored] and stored ~= "__other__" then
local ownerClass = DataStore:GetClass(stored)
if ownerClass and NanamiDPS.validClasses[ownerClass] then
return stored, ownerClass
end
end
return nil, nil
end
function ThreatEstimate:GetBars(segment)
if not segment or not segment.data or not segment.data.threat then return {} end
local bars = {}
for name, entry in pairs(segment.data.threat) do
local class = DataStore:GetClass(name)
local r, g, b = NanamiDPS.GetClassColor(class)
local displayName = name
local ownerName, ownerClass = ResolvePetOwner(name)
if NanamiDPS.validClasses[class] then
-- player: use class color as-is
elseif ownerName and ownerClass then
r, g, b = NanamiDPS.GetClassColor(ownerClass)
r, g, b = r * 0.7, g * 0.7, b * 0.7
displayName = name .. " <" .. ownerName .. ">"
else
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
table.insert(bars, {
id = name,
name = displayName,
value = entry._sum or 0,
class = ownerClass or class,
r = r, g = g, b = b,
})
end
table.sort(bars, function(a, b) return a.value > b.value end)
local best = bars[1] and bars[1].value or 0
for _, bar in ipairs(bars) do
bar.percent = best > 0 and (bar.value / best * 100) or 0
end
return bars
end
function ThreatEstimate:GetTooltip(playerName, segment, tooltip)
if not segment or not segment.data.threat[playerName] then return end
local entry = segment.data.threat[playerName]
local ownerName, ownerClass = ResolvePetOwner(playerName)
tooltip:AddLine("|cffffd100" .. playerName)
if ownerName then
tooltip:AddDoubleLine("|cffffffff" .. L["Owner"], "|cffffffff" .. ownerName)
end
tooltip:AddDoubleLine("|cffffffff" .. L["Threat (Est.)"], "|cffffffff" .. NanamiDPS.formatNumber(entry._sum))
tooltip:AddLine(" ")
if ownerName then
tooltip:AddLine("|cffaaaaaa" .. L["Threat Note"])
else
local dmgEntry = segment.data.damage[playerName]
local healEntry = segment.data.healing[playerName]
if dmgEntry then
tooltip:AddDoubleLine("|cffffffff" .. L["Damage Done"],
"|cffffffff" .. NanamiDPS.formatNumber(dmgEntry._sum))
end
if healEntry then
tooltip:AddDoubleLine("|cffffffff" .. L["Healing Done"],
"|cffffffff" .. NanamiDPS.formatNumber(healEntry._sum) .. " (x0.5)")
end
tooltip:AddLine("|cffaaaaaa" .. L["Threat Note"])
end
end
function ThreatEstimate: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]
table.insert(lines, string.format("%d. %s - %s (%.1f%%)",
i, d.name, NanamiDPS.formatNumber(d.value), d.percent))
end
return lines
end
NanamiDPS:RegisterModule("ThreatEstimate", ThreatEstimate)