更新发送到功能
更新仇恨计算方式 还在开发 更新其他细节
This commit is contained in:
69
Modules/DamageTaken.lua
Normal file
69
Modules/DamageTaken.lua
Normal 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)
|
||||
Reference in New Issue
Block a user