호출 방법
addon:GetClassGroupCount(cache, class, raid)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
현재 고정 구성에서 일치하는 직업 토큰을 셉니다. 먼저 그룹 소속을 읽고, 요청하면 공격대 소속으로 별도의 플레이어 정보 없이 raid1부터 raid40까지 선택합니다. 솔로와 파티 경로는 먼저 player를 읽고, 그룹 중이면 party1부터 party4까지 읽습니다. 알려진 구성이 완전하면 0을 포함한 개수를 반환하며, 필수 정보를 하나라도 사용할 수 없으면 nil과 이유를 반환합니다. 완전한 관찰은 평가 패스 캐시를 공유하며, 플레이어 직업은 패스 간에 유지되지 않습니다. 보관된 원시 콜백은 불러올 당시의 직업을 따로 유지합니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMAddon | Rotation Master 애드온 인스턴스 (콜론 호출에서는 암묵적). |
cache | table | nil | 평가 패스 캐시. 새로 관찰하려면 nil. |
class | string | 셀 비어 있지 않은 직업 파일 이름 토큰. 직업 토큰 허용 목록은 적용하지 않습니다. |
raid | boolean | nil | true면 공격대 소속이 true로 알려졌을 때 공격대 구성을 허용하고, false나 nil이면 솔로나 파티 구성을 사용합니다. |
반환값
| 1 | number | nil | 0을 포함한 일치하는 직업의 전체 개수. 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil 개수에 대한 검증, 정책 또는 필수 정보 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
게임 API를 직접 읽지 않습니다.
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
애드온에서 호출하는 방식
- 그룹 내 직업 (evaluate)
local count,reason=addon:GetClassGroupCount(cache,value.class,value.raid)
소스
Core/class_group_conditions.lua, 23번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Core.class_group_conditions.GetClassGroupCount(self, cache, class, raid)
local platform=self.Platform
if not platform:CanReadValue(class) or not platform:CanReadValue(raid) then return nil,'restricted-value' end
if type(class)~='string' or class=='' then return nil,'invalid-class-group-query' end
if raid~=nil and type(raid)~='boolean' then return nil,'invalid-class-group-query' end
local grouped,reason=self.Functions.cache.getCached(cache,platform.GetGroupMembership,platform,false)
if grouped==nil then return nil,reason end
local prefix,size='party',4
if grouped and raid then
local inRaid,why=self.Functions.cache.getCached(cache,platform.GetGroupMembership,platform,true)
if inRaid==nil then return nil,why end
if inRaid then prefix,size='raid',40 end
end
local count=0
if not grouped or prefix=='party' then
local player,why=self.Functions.cache.getCached(cache,platform.GetRosterClassObservation,platform,'player')
if player==nil then return nil,why end
if player==class then count=1 end
if not grouped then return count end
end
for index=1,size do
local observed,why=self.Functions.cache.getCached(cache,platform.GetRosterClassObservation,platform,prefix..tostring(index))
if observed==nil then return nil,why end
if observed==class then count=count+1 end
end
return count