Wowpedia
Advertisement
Wowpedia
240,511
pages
Game Flavors
Links
Patch
Added in 2.4.0 / 1.13.2

Compares two UnitFlag bitfields.

flag1, flag2 = CombatLog_Object_IsA(flag1, flag2)

Arguments

flag1 
number - UnitFlag bitfield, typically a sourceFlags or destFlags paramater from COMBAT_LOG_EVENT.
flag2 
number - UnitFlag bitfield, typically a COMBATLOG_FILTER constant.

Returns

isTrue 
boolean - true if the flags match, false otherwise.

Details

  • Both of the arguments to this function must be valid Combat Log Objects. That is, for the four main categories of the UnitFlag bitfield, there must be at least one nonzero bit. Passing in a single COMBATLOG_OBJECT constant will cause the check to return false. The easiest way to obtain a valid bitfield to pass as the second parameter is to use one of the COMBATLOG_FILTER objects from FrameXML/Constants.lua:
Constant bitfield
COMBATLOG_FILTER_ME 0x 0 0 0 0 0 5 1 1
COMBATLOG_FILTER_MINE 0x 0 0 0 0 4 5 1 1
COMBATLOG_FILTER_MY_PET 0x 0 0 0 0 3 1 1 1
COMBATLOG_FILTER_FRIENDLY_UNITS 0x 0 0 0 0 7 F 1 E
COMBATLOG_FILTER_HOSTILE_PLAYERS 0x 0 0 0 0 7 D 4 E
COMBATLOG_FILTER_HOSTILE_UNITS 0x 0 0 0 0 7 E 4 E
COMBATLOG_FILTER_NEUTRAL_UNITS 0x 0 0 0 0 7 F 2 E
COMBATLOG_FILTER_UNKNOWN_UNITS 0x 8 0 0 0 0 0 0 0
COMBATLOG_FILTER_EVERYTHING 0x F F F F F F F F

You can also construct your own filter, making sure to use at least one constant from each category:

local filter = bit.bor(
	COMBATLOG_OBJECT_AFFILIATION_PARTY,
	COMBATLOG_OBJECT_AFFILIATION_RAID,
	COMBATLOG_OBJECT_AFFILIATION_OUTSIDER,
	COMBATLOG_OBJECT_REACTION_HOSTILE,
	COMBATLOG_OBJECT_CONTROL_NPC,
	COMBATLOG_OBJECT_TYPE_PLAYER,
	COMBATLOG_OBJECT_TYPE_NPC,
	COMBATLOG_OBJECT_TYPE_PET,
	COMBATLOG_OBJECT_TYPE_GUARDIAN,
	COMBATLOG_OBJECT_TYPE_OBJECT
)

CombatLog_Object_IsA(sourceFlags, filter)

Example

Checks if the sourceFlags parameter of a COMBAT_LOG_EVENT matches the player.

function(event, timestamp, subEvent, hideCaster, sourceGUID, sourceName, sourceFlags, ...)
    return CombatLog_Object_IsA(sourceFlags, COMBATLOG_FILTER_ME)
end

Patch changes

See also

Advertisement