[Lua] 纯文本查看 复制代码 local playerGUID = UnitGUID("player")
local MSG_CRITICAL_HIT = "Your %s critically hit %s for %d damage!"
local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self, event)
local _, subevent, _, sourceGUID, _, _, _, _, destName = CombatLogGetCurrentEventInfo()
local spellId, amount, critical
if subevent == "SWING_DAMAGE" then
amount, _, _, _, _, _, critical = select(12, CombatLogGetCurrentEventInfo())
elseif subevent == "SPELL_DAMAGE" then
spellId, _, _, amount, _, _, _, _, _, critical = select(12, CombatLogGetCurrentEventInfo())
end
if critical and sourceGUID == playerGUID then
-- get the link of the spell or the MELEE globalstring
local action = spellId and GetSpellLink(spellId) or MELEE
print(MSG_CRITICAL_HIT:format(action, destName, amount))
end
end) |