Call as
addon:GetClassGroupCount(cache, class, raid)
Available directly through addon; no dependency is needed.
What it does
Count matching class tokens in the current fixed roster. Read group membership first; when requested, raid membership selects raid1 through raid40 without a separate player fact. Solo and party paths read player first, then party1 through party4 when grouped. A complete known roster returns a count, including zero; any required unavailable fact returns nil with a reason. Complete observations share the evaluation-pass cache; no player class persists across passes. Archived raw callbacks retain their original load-time class separately.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMAddon | Rotation Master addon instance (implicit with colon calls). |
cache | table | nil | Evaluation-pass cache, or nil for fresh observations. |
class | string | Nonempty class filename token to count; no class-token whitelist is applied. |
raid | boolean | nil | True permits the raid roster when raid membership is known true; false or nil uses the solo or party roster. |
Returns
| 1 | number | nil | Complete matching class count, including zero, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Validation, policy or required-fact availability reason for a nil count. |
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.
It reads no game API directly.
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.
How the addon calls it
- Class In Group (evaluate)
local count,reason=addon:GetClassGroupCount(cache,value.class,value.raid)
Source
Core/class_group_conditions.lua, line 23. Read only in game; Duplicate makes an editable copy.
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