호출 방법
addon.Platform:GetUnitGroupMembership(unit, raidOnly)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
지정한 유닛의 플레이어 파티 또는 공격대 소속을 읽습니다. raidOnly가 true면 UnitInRaid만 조회하며, 그렇지 않으면 UnitInParty가 true일 때 바로 끝나고, false면 UnitInRaid로 넘어가며, 알 수 없으면 사용할 수 없음으로 남습니다. 읽을 수 있는 공격대 인덱스 nil은 false, 정수 인덱스 1..40은 true입니다. 이름은 기본 API에 그대로 전달되며, 기본 이름 조회가 받아들여지는지는 클라이언트 자격 확인이 필요합니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
unit | string | 그대로 전달되는 읽을 수 있는 비어 있지 않은 유닛 토큰 또는 게임이 인식하는 이름. |
raidOnly | boolean | nil | true면 공격대 소속만, false나 nil이면 파티 다음 공격대를 확인합니다. |
반환값
| 1 | boolean | nil | 관찰된 소속. 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil 결과에 대한 검증 또는 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
| 게임 API | |||||
|---|---|---|---|---|---|
UnitInParty | |||||
UnitInRaid | |||||
canaccessvalue |
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
local member = addon.Platform:GetUnitGroupMembership("focus", false)
if member == nil then return nil end
return member소스
Platform/groups.lua, 45번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Platform.groups.GetUnitGroupMembership(self, unit, raidOnly)
if not self:CanReadValue(unit) or not self:CanReadValue(raidOnly) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' or #unit>512 or unit:find('[%z\1-\31\127]') then return nil,'invalid-unit' end
if raidOnly~=nil and type(raidOnly)~='boolean' then return nil,'invalid-group-query' end
if self:GetClientFamily()=='unknown' then return nil,'unsupported-client' end
if not raidOnly then
if type(UnitInParty)~='function' then return nil,'missing-api' end
local ok,member=pcall(UnitInParty,unit)
if not ok then return nil,'api-error' end
if not self:CanReadValue(member) then return nil,'restricted-value' end
if member==nil then return nil,'group-data-unavailable' end
if type(member)~='boolean' then return nil,'invalid-api-result' end
if member then return true end
end
if type(UnitInRaid)~='function' then return nil,'missing-api' end
local ok,index=pcall(UnitInRaid,unit)
if not ok then return nil,'api-error' end
if not self:CanReadValue(index) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(index) then return nil,'restricted-value' end
-- The pinned native API returns an optional raid index: nil is nonmember.
if index==nil then return false end
if type(index)~='number' or index<1 or index>40 or index%1~=0 then return nil,'invalid-api-result' end
return true




