UnitPhaseReason

From Warcraft Wiki
Jump to navigation Jump to search

Returns the reason if a unit is NOT in the same phase.

reason = UnitPhaseReason(unit)

Arguments

unit
string : UnitId

Returns

reason
Enum.PhaseReason?
Value Field Description
0 Phasing The unit is in a different phase
1 Sharding The unit is in a different shard
2 WarMode The unit has a different war mode
3 ChromieTime The unit is in a Timewalking Campaign

Details

  • Returns nil if the unit is in the same phase.

Example

local function PrintPhaseReason(unit)
	local msg
	local reason = UnitPhaseReason(unit)
	if reason == Enum.PhaseReason.WarMode then
		msg = "has a different warmode"
	elseif reason == Enum.PhaseReason.ChromieTime then
		msg = "either of you is doing a Timewalking Campaign"
	elseif reason == Enum.PhaseReason.Phasing then
		msg = "is in a different phase"
	elseif reason == Enum.PhaseReason.Sharding then
		msg = "is in a different shard"
	elseif not reason then
		msg = "is in the same phase"
	end
	print(unit, msg)
end

PrintPhaseReason("party1")

Patch changes

Shadowlands Patch 9.0.1 (2020-10-13): Added. Replaces UnitIsWarModePhased() and UnitInPhase()

See also