调整dps插件对仇恨的估算方式

优化dps插件
This commit is contained in:
rucky
2026-03-25 00:57:35 +08:00
parent 5c3f2243c4
commit 12c8c55159
16 changed files with 2454 additions and 165 deletions

View File

@@ -385,6 +385,24 @@ for pat in pairs(dispel_parser) do
sanitize(pat)
end
-----------------------------------------------------------------------
-- Aura gain patterns for threat-clearing abilities
-----------------------------------------------------------------------
local auraGainPatterns = {}
if AURAADDEDSELFHELPFUL then
table.insert(auraGainPatterns, { pat = sanitize(AURAADDEDSELFHELPFUL), self = true })
end
if AURAADDEDOTHERHELPFUL then
table.insert(auraGainPatterns, { pat = sanitize(AURAADDEDOTHERHELPFUL), self = false })
end
Parser:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_SELF_BUFFS")
Parser:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_PARTY_BUFFS")
Parser:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_FRIENDLYPLAYER_BUFFS")
Parser:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_SELF")
Parser:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_OTHER")
Parser:RegisterEvent("CHAT_MSG_SPELL_AURA_GONE_PARTY")
-----------------------------------------------------------------------
-- Main event handler
-----------------------------------------------------------------------
@@ -415,6 +433,36 @@ Parser:SetScript("OnEvent", function()
return
end
-- Threat-clearing aura detection (Feign Death, Vanish, etc.)
local TC = NanamiDPS.ThreatCoefficients
local TE = NanamiDPS.ThreatEngine
if TC and TE and TC.threatWipeEvents then
for auraName, wipeType in pairs(TC.threatWipeEvents) do
if string.find(arg1, auraName, 1, true) then
local who = nil
if string.find(arg1, player, 1, true) or
(AURAADDEDSELFHELPFUL and string.find(arg1, "You gain", 1, true)) then
who = player
else
for aIdx, aPat in pairs(auraGainPatterns) do
if not aPat.self then
local _, _, aName = string.find(arg1, aPat.pat)
if aName then who = aName; break end
end
end
end
if who then
TE:WipePlayerThreat(who, wipeType)
local DS = NanamiDPS.DataStore
if DS then
DS:AddThreat(who, -(DS:GetPlayerThreat(who) or 0))
end
end
return
end
end
end
-- Strip absorb/resist suffixes
if absorb then arg1 = string.gsub(arg1, absorb, empty) end
if resist then arg1 = string.gsub(arg1, resist, empty) end