호출 방법
addon.Platform:GetZonePVPObservation()
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
보호된 인수 없는 점 호출 한 번으로 지역 PvP 분류의 첫 번째 결과를 관찰합니다. 호출 가능한 C_PvP.GetZonePVPInfo를 우선하며, 최신 호출이 없을 때만 전역 도우미를 사용합니다. 성공적인 nil이나 반환값 없음은 알려진 빈 레코드를 만들며, 없거나 실패하거나 제한되거나 잘못된 관찰은 사용할 수 없음으로 남습니다. 읽을 수 있는 빈 문자열과 향후 문자열은 정확한 의미를 유지하며, 사용하지 않는 반환 필드는 사용 가능 여부를 결정하지 않습니다. 최신 방식의 결과나 실패 후에는 절대 다른 방식으로 바꾸지 않습니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
반환값
| 1 | table | nil | pvpType 문자열 또는 nil을 담은 성공 관찰 레코드. 레코드가 nil이면 사용할 수 없다는 뜻입니다. |
|---|---|---|
| 2 | string | nil | nil인 기록에 대한 클라이언트 정책, 기능, 호출 또는 관찰 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
| 게임 API | |||||
|---|---|---|---|---|---|
C_PvP | |||||
GetZonePVPInfo | |||||
canaccessvalue |
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
local zone = addon.Platform:GetZonePVPObservation()
if not zone then return nil end
return zone.pvpType == "sanctuary"소스
Platform/zone_pvp.lua, 18번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
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}




