API CombatLogGetCurrentEventInfo

From Wowpedia
Jump to: navigation, search

Returns the current COMBAT_LOG_EVENT payload.

arg1, arg2, ... = CombatLogGetCurrentEventInfo()
      eventInfo = {CombatLogGetCurrentEventInfo()}

Returns

Returns a variable number of parameters: 11 base parameters and up to 13 extra parameters.

timestamp 
number - Unix Time in seconds with milliseconds precision, for example 1555749627.861. Similar to time() and can be passed as the second argument of date().
event 
string
hideCaster 
boolean - Returns true if the source unit should be hidden in the Blizzard combat log.
sourceGuid 
string - Globally unique identifier for units (NPCs, players, pets, etc), for example "Creature-0-3113-0-47-94-00003AD5D7".
sourceName 
string
sourceFlags 
number - Contains the flag bits for a unit's type, controller, reaction and affiliation. For example 68168 = 0x10A48: Unit is the current target, is an NPC, the controller is an NPC, reaction is hostile and affiliation is outsider.
sourceRaidFlags 
number - Contains the raid flag bits for a unit's raid target icon.
destGuid 
string
destName 
string
destFlags 
number
destRaidFlags 
number

The number and type of additional return values depend on 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]

Examples

  • 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)
	-- pass a variable number of arguments
	self:OnEvent(event, CombatLogGetCurrentEventInfo())
end)

function f:OnEvent(event, ...)
	local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
	local spellId, spellName, spellSchool
	local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand

	if subevent == "SWING_DAMAGE" then
		amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
	elseif subevent == "SPELL_DAMAGE" then
		spellId, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing, isOffHand = select(12, ...)
	end
	
	if critical and sourceGUID == playerGUID then
		local action = spellId and GetSpellLink(spellId) or "melee swing"
		print(MSG_CRITICAL_HIT:format(action, destName, amount))
	end
end

Patch changes

References

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