호출 방법
addon.Platform:GetRosterClassObservation(unit)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
식별된 클라이언트 계열에서 공개 구성원 식별 정보를 읽습니다. 입력은 player, party1부터 party4, raid1부터 raid40까지로 제한됩니다. 먼저 그 정확한 토큰 하나로 UnitExists를 호출하며, false로 알려지면 직업을 조회하지 않고 false를 반환합니다. 있는 유닛은 UnitClass의 두 번째 반환값만 읽을 수 있는 비어 있지 않은 직업 파일 이름 문자열로 사용하며, 직업 열거형 제한은 없습니다. 필수 정보가 없거나, 실패하거나, 잘못되거나, 제한되면 nil과 이유를 반환합니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
unit | string | 도우미가 소유한 정확한 player, party1..party4, raid1..raid40 토큰. |
반환값
| 1 | string | boolean | nil | 관찰된 직업 파일 이름 문자열, 없는 것으로 알려진 유닛이면 false, 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil 결과에 대한 검증, 정책 또는 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
| 게임 API | |||||
|---|---|---|---|---|---|
UnitClass | |||||
UnitExists | |||||
canaccessvalue |
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
for index = 1, 4 do
local class = addon.Platform:GetRosterClassObservation("party" .. index)
if class == "PRIEST" then return true end
end
return false의존성
rosterUnit→Platform.roster_class.rosterUnit
소스
Platform/roster_class.lua, 29번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Platform.roster_class.GetRosterClassObservation(self, unit)
if not self:CanReadValue(unit) then return nil,'restricted-value' end
if type(unit)~='string' or not rosterUnit(unit) then return nil,'invalid-roster-unit' end
if self:GetClientFamily()=='unknown' then return nil,'unsupported-client' end
if type(UnitExists)~='function' then return nil,'missing-api' end
local ok,exists=pcall(UnitExists,unit)
if not ok then return nil,'api-error' end
if not self:CanReadValue(exists) then return nil,'restricted-value' end
if exists==nil then return nil,'roster-data-unavailable' end
if type(exists)~='boolean' then return nil,'invalid-api-result' end
if not exists then return false end
if type(UnitClass)~='function' then return nil,'missing-api' end
local success,_,class=pcall(UnitClass,unit)
if not success then return nil,'api-error' end
if not self:CanReadValue(class) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(class) then return nil,'restricted-value' end
if class==nil then return nil,'roster-class-unavailable' end
if type(class)~='string' or class=='' then return nil,'invalid-api-result' end
return class




