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