Reference › Function reference › Platform

Platform.zone_pvp.GetZonePVPObservation

public

Call as

addon.Platform:GetZonePVPObservation()

Available directly through addon; no dependency is needed.

What it does

Observe the first zone PvP classification result with one protected zero-argument dot call. Prefer callable C_PvP.GetZonePVPInfo and use the global helper only when the modern callable is absent. A successful nil or no returned values produces a known empty record; missing, failed, restricted or malformed observations remain unavailable. Readable empty and future strings retain their exact meaning, and unused return fields do not determine availability. Never switch backends after a modern result or failure.

Arguments

NameTypeWhat it does
selfRMPlatformRotation Master platform adapter (implicit with colon calls).

Returns

1table | nilSuccessful observation record with pvpType string or nil; nil record means unavailable.
2string | nilClient-policy, capability, call or observation availability reason for a nil record.

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
C_PvPClassic EraTBC AnniversaryClassic progressionForeverRetail
GetZonePVPInfoClassic EraTBC AnniversaryClassic progressionForeverRetail
canaccessvalueClassic 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 zone = addon.Platform:GetZonePVPObservation()
if not zone then return nil end
return zone.pvpType == "sanctuary"

Source

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

Platform.zone_pvp.GetZonePVPObservation(self)
    local family=self:GetClientFamily()
    if family~='retail' and family~='forever' and family~='era' and family~='tbc' and family~='progression' then return nil,'unsupported-policy' end
    local namespace=C_PvP
    if not self:CanReadValue(namespace) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(namespace) then return nil,'restricted-value' end
    local api
    if type(namespace)=='table' then api=namespace.GetZonePVPInfo end
    if not self:CanReadValue(api) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(api) then return nil,'restricted-value' end
    if type(api)~='function' then
        api=GetZonePVPInfo
        if not self:CanReadValue(api) then return nil,'restricted-value' end
        if canaccessvalue and not canaccessvalue(api) then return nil,'restricted-value' end
        if type(api)~='function' then return nil,'missing-api' end
    end
    local ok,pvpType=pcall(api)
    if not ok then return nil,'api-error' end
    if not self:CanReadValue(pvpType) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(pvpType) then return nil,'restricted-value' end
    if pvpType==nil then return {} end
    if type(pvpType)~='string' then return nil,'invalid-api-result' end
    return {pvpType=pvpType}

Back to Function reference