CombatLogGetCurrentEventInfo

From Warcraft Wiki
Jump to navigation Jump to search
Flavors
Links
Info
Added in 8.0.1 / 1.13.2

Returns the current COMBAT_LOG_EVENT payload.

arg1, arg2, ... = CombatLogGetCurrentEventInfo()

Returns

  • Returns a variable number of values: 11 base values and up to 13 extra values based upon the subtype of the event.

Details

  • In the new event system for 8.0, supporting the original functionality of the CLEU event was problematic due to the "context" arguments, i.e. each argument can be interpreted differently depending on the previous arguments. The payload was subsequently moved to this function. [1]

Example

  • Prints all CLEU parameters.
local function OnEvent(self, event)
	print(CombatLogGetCurrentEventInfo())
end

local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", OnEvent)
  • Displays your spell or melee critical hits.
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)

Patch changes

Battle for Azeroth Patch 8.0.1 (2018-07-17): Added. [2]

References

  1. ^ TheDanW 2018-02-06. #wowuidev IRC log.
  2. ^ Ythisens 2018-04-24. Combat Log Event Changes.