WoW:UnitFlag: Difference between revisions
Jump to navigation
Jump to search
m (→Explanation: Corrected wording about unit flags) |
|||
(9 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{wowapitype}} | {{wowapitype}}<br /> | ||
==Constants== | ==Constants== | ||
{| class="darktable" | {| class="darktable" | ||
Line 5: | Line 5: | ||
!colspan="9"|bitfield | !colspan="9"|bitfield | ||
|-align="center" | |-align="center" | ||
!colspan="10"| | !colspan="10"|Type | ||
|- | |- | ||
| | |style="background:#003311;"|COMBATLOG_OBJECT_TYPE_MASK||0x||0||0||0||0||'''F'''||'''C'''||0||0 | ||
|- | |||
|class="alt"|COMBATLOG_OBJECT_TYPE_OBJECT||0x||0||0||0||0||'''4'''||0||0||0 | |||
|- | |- | ||
| | |COMBATLOG_OBJECT_TYPE_GUARDIAN||0x||0||0||0||0||'''2'''||0||0||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_TYPE_PET||0x||0||0||0||0||'''1'''||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_TYPE_NPC||0x||0||0||0||0||0||'''8'''||0||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_TYPE_PLAYER||0x||0||0||0||0||0||4||0||0 | ||
|-align="center" | |-align="center" | ||
!colspan="10"| | !colspan="10"|Controller | ||
|- | |- | ||
| | |style="background:#003311;"|COMBATLOG_OBJECT_CONTROL_MASK||0x||0||0||0||0||0||'''3'''||0||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_CONTROL_NPC||0x||0||0||0||0||0||'''2'''||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_CONTROL_PLAYER||0x||0||0||0||0||0||'''1'''||0||0 | ||
|-align="center" | |-align="center" | ||
!colspan="10"| | !colspan="10"|Reaction | ||
|- | |- | ||
| | |style="background:#003311;"|COMBATLOG_OBJECT_REACTION_MASK||0x||0||0||0||0||0||0||'''F'''||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_REACTION_HOSTILE||0x||0||0||0||0||0||0||'''4'''||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_REACTION_NEUTRAL||0x||0||0||0||0||0||0||'''2'''||0 | ||
|- | |- | ||
!colspan="10"| | |class="alt"|COMBATLOG_OBJECT_REACTION_FRIENDLY||0x||0||0||0||0||0||0||'''1'''||0 | ||
|-align="center" | |||
!colspan="10"|Controller affiliation | |||
|- | |- | ||
| | |style="background:#003311;"|COMBATLOG_OBJECT_AFFILIATION_MASK||0x||0||0||0||0||0||0||0||'''F''' | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_AFFILIATION_OUTSIDER||0x||0||0||0||0||0||0||0||'''8''' | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_AFFILIATION_RAID||0x||0||0||0||0||0||0||0||'''4''' | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_AFFILIATION_PARTY||0x||0||0||0||0||0||0||0||'''2''' | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_AFFILIATION_MINE||0x||0||0||0||0||0||0||0||'''1''' | ||
|-align="center" | |||
!colspan="10"|Special cases (non-exclusive) | |||
|- | |- | ||
| | |style="background:#003311;"|COMBATLOG_OBJECT_SPECIAL_MASK||0x||'''F'''||'''F'''||'''F'''||'''F'''||0||0||0||0 | ||
|- | |- | ||
|class="alt"|COMBATLOG_OBJECT_NONE||0x||'''8'''||0||0||0||0||0||0||0 | |||
|- | |- | ||
| | |COMBATLOG_OBJECT_RAIDTARGET8||0x||0||'''8'''||0||0||0||0||0||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_RAIDTARGET7||0x||0||'''4'''||0||0||0||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_RAIDTARGET6||0x||0||'''2'''||0||0||0||0||0||0 | ||
|- | |- | ||
| | |class="alt"|COMBATLOG_OBJECT_RAIDTARGET5||0x||0||'''1'''||0||0||0||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_RAIDTARGET4||0x||0||0||'''8'''||0||0||0||0||0 | ||
|- | |- | ||
|class="alt"|COMBATLOG_OBJECT_RAIDTARGET3||0x||0||0||'''4'''||0||0||0||0||0 | |class="alt"|COMBATLOG_OBJECT_RAIDTARGET3||0x||0||0||'''4'''||0||0||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_RAIDTARGET2||0x||0||0||'''2'''||0||0||0||0||0 | ||
|- | |- | ||
|class="alt"| | |class="alt"|COMBATLOG_OBJECT_RAIDTARGET1||0x||0||0||'''1'''||0||0||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_MAINASSIST||0x||0||0||0||'''8'''||0||0||0||0 | ||
|- | |- | ||
|class="alt"| | |class="alt"|COMBATLOG_OBJECT_MAINTANK||0x||0||0||0||'''4'''||0||0||0||0 | ||
|- | |- | ||
| | |COMBATLOG_OBJECT_FOCUS||0x||0||0||0||'''2'''||0||0||0||0 | ||
|- | |- | ||
|class="alt"| | |class="alt"|COMBATLOG_OBJECT_TARGET||0x||0||0||0||'''1'''||0||0||0||0 | ||
|} | |} | ||
==Explanation== | ==Explanation== | ||
A unit can only be one type from each the following four categories: | A unit can only be one type from each of the following four categories: | ||
# | # Type | ||
# Controller | |||
# Reaction | # Reaction | ||
# | # Controller affiliation | ||
Here’s a quick explanation of how these flags are broken down: | Here’s a quick explanation of how these flags are broken down: | ||
=== | ===Type=== | ||
A unit’s affiliation is the unit’s relationship relative to YOU. Either it is | This is the way the unit is ''currently'' being controlled: | ||
*Units directly controlled by humans are players. | |||
*Units controlled by the server are NPCs. | |||
*Pets are units controlled by a player or NPC. | |||
*Guardians are automatons that are not controlled, but automatically defend their master. | |||
*Objects are everything else, such as Traps. | |||
The result is that these bits can tell you what kind of unit that combat log object was. | |||
===Controller=== | |||
This is who currently controls this object. It can only be controlled by a physical human player or by a server NPC. | |||
===Reaction=== | |||
This is the unit’s faction reaction, relative to you. Anything that hates you is Hostile, anything that is friendly with you is Friendly, everything else is Neutral. | |||
===Controller affiliation=== | |||
A unit’s controller affiliation is the unit’s controller relationship relative to YOU. Either it is controlled by you, your party, your raid or someone else. | |||
{| | {| | ||
| | | | ||
Line 105: | Line 121: | ||
|Outsiders | |Outsiders | ||
|} | |} | ||
=== | ===Example=== | ||
*A player who is dueling you is '''0x0548''' (A hostile player controlled by an outsider physical human being) | |||
*A player who was mind controlled by another player that attacks you is '''0x1148''' (A hostile pet who is controlled by an outsider player) | |||
**Since '''0x1148''' can also be an enemy player's pet you need to check the [[API UnitGUID| unit GUID]] to know if it's an enemy pet or a player character. | |||
*A player who was charmed by a NPC is '''0x1248''' (A hostile pet controlled by an outsider NPC) | |||
if bit.band(UnitFlag, COMBATLOG_OBJECT_CONTROL_PLAYER) > 0 then | |||
print("Controller: a player") | |||
end | |||
Latest revision as of 04:49, 15 August 2023
Constants[edit]
Constant | bitfield | ||||||||
---|---|---|---|---|---|---|---|---|---|
Type | |||||||||
COMBATLOG_OBJECT_TYPE_MASK | 0x | 0 | 0 | 0 | 0 | F | C | 0 | 0 |
COMBATLOG_OBJECT_TYPE_OBJECT | 0x | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 |
COMBATLOG_OBJECT_TYPE_GUARDIAN | 0x | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 |
COMBATLOG_OBJECT_TYPE_PET | 0x | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
COMBATLOG_OBJECT_TYPE_NPC | 0x | 0 | 0 | 0 | 0 | 0 | 8 | 0 | 0 |
COMBATLOG_OBJECT_TYPE_PLAYER | 0x | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 |
Controller | |||||||||
COMBATLOG_OBJECT_CONTROL_MASK | 0x | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 |
COMBATLOG_OBJECT_CONTROL_NPC | 0x | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 |
COMBATLOG_OBJECT_CONTROL_PLAYER | 0x | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
Reaction | |||||||||
COMBATLOG_OBJECT_REACTION_MASK | 0x | 0 | 0 | 0 | 0 | 0 | 0 | F | 0 |
COMBATLOG_OBJECT_REACTION_HOSTILE | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 |
COMBATLOG_OBJECT_REACTION_NEUTRAL | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 |
COMBATLOG_OBJECT_REACTION_FRIENDLY | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Controller affiliation | |||||||||
COMBATLOG_OBJECT_AFFILIATION_MASK | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 0 | F |
COMBATLOG_OBJECT_AFFILIATION_OUTSIDER | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 |
COMBATLOG_OBJECT_AFFILIATION_RAID | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 |
COMBATLOG_OBJECT_AFFILIATION_PARTY | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
COMBATLOG_OBJECT_AFFILIATION_MINE | 0x | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
Special cases (non-exclusive) | |||||||||
COMBATLOG_OBJECT_SPECIAL_MASK | 0x | F | F | F | F | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_NONE | 0x | 8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET8 | 0x | 0 | 8 | 0 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET7 | 0x | 0 | 4 | 0 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET6 | 0x | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET5 | 0x | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET4 | 0x | 0 | 0 | 8 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET3 | 0x | 0 | 0 | 4 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET2 | 0x | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_RAIDTARGET1 | 0x | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_MAINASSIST | 0x | 0 | 0 | 0 | 8 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_MAINTANK | 0x | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_FOCUS | 0x | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 |
COMBATLOG_OBJECT_TARGET | 0x | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
Explanation[edit]
A unit can only be one type from each of the following four categories:
- Type
- Controller
- Reaction
- Controller affiliation
Here’s a quick explanation of how these flags are broken down:
Type[edit]
This is the way the unit is currently being controlled:
- Units directly controlled by humans are players.
- Units controlled by the server are NPCs.
- Pets are units controlled by a player or NPC.
- Guardians are automatons that are not controlled, but automatically defend their master.
- Objects are everything else, such as Traps.
The result is that these bits can tell you what kind of unit that combat log object was.
Controller[edit]
This is who currently controls this object. It can only be controlled by a physical human player or by a server NPC.
Reaction[edit]
This is the unit’s faction reaction, relative to you. Anything that hates you is Hostile, anything that is friendly with you is Friendly, everything else is Neutral.
Controller affiliation[edit]
A unit’s controller affiliation is the unit’s controller relationship relative to YOU. Either it is controlled by you, your party, your raid or someone else.
|
Outsiders |
Example[edit]
- A player who is dueling you is 0x0548 (A hostile player controlled by an outsider physical human being)
- A player who was mind controlled by another player that attacks you is 0x1148 (A hostile pet who is controlled by an outsider player)
- Since 0x1148 can also be an enemy player's pet you need to check the unit GUID to know if it's an enemy pet or a player character.
- A player who was charmed by a NPC is 0x1248 (A hostile pet controlled by an outsider NPC)
if bit.band(UnitFlag, COMBATLOG_OBJECT_CONTROL_PLAYER) > 0 then print("Controller: a player") end