Reference › Function reference › Platform

Platform.player_flags.GetPlayerFlagObservation

public

Call as

addon.Platform:GetPlayerFlagObservation(kind)

Available directly through addon; no dependency is needed.

What it does

Observe one independent zero-argument player flag: stealthed uses IsStealthed, control uses HasFullControl, and outdoors uses IsOutdoors. Readable true and false retain their meanings. Required missing, failed, nil, restricted or malformed data returns nil with a reason. No existence, instance or ability-usability inference is added.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).
kindstringOne of stealthed, control or outdoors; no other predicate is invoked.

Returns

1boolean | nilReadable selected flag or nil when required data is unavailable.
2string | nilPolicy, query-validation or availability reason for a nil player flag.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
HasFullControlClassic EraTBC AnniversaryClassic progressionForeverRetail
IsOutdoorsClassic EraTBC AnniversaryClassic progressionForeverRetail
IsStealthedClassic EraTBC AnniversaryClassic progressionForeverRetail

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

Example

local stealthed = addon.Platform:GetPlayerFlagObservation("stealthed")
local outdoors = addon.Platform:GetPlayerFlagObservation("outdoors")
if stealthed == nil or outdoors == nil then return nil end
return outdoors and not stealthed

Source

Platform/player_flags.lua, line 18. Read only in game; Duplicate makes an editable copy.

Platform.player_flags.GetPlayerFlagObservation(self, kind)
    local policy=self:GetCombatDataPolicy()
    if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
    if not self:CanReadValue(kind) then return nil,'restricted-value' end
    if kind~='stealthed' and kind~='control' and kind~='outdoors' then return nil,'invalid-player-flag-query' end
    local api
    if kind=='stealthed' then api=IsStealthed
    elseif kind=='control' then api=HasFullControl
    else api=IsOutdoors end
    if type(api)~='function' then return nil,'missing-api' end
    local ok,result=pcall(api)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(result) then return nil,'restricted-value' end
    if result==nil then return nil,'player-flag-unavailable' end
    if type(result)~='boolean' then return nil,'invalid-api-result' end
    return result

Back to Function reference