호출 방법
addon.Platform:GetAnnouncementRecipientGroupMembership(recipient, raidOnly)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
정확한 시전 받는 대상 이름을 현재 제한된 파티 또는 공격대 구성과 대조한 뒤, 유닛 토큰으로 소속을 관찰합니다. 구성 데이터가 없거나, 모호하거나, 바뀌는 중이면 사용할 수 없음으로 남으며, 선택한 대상을 읽거나 시전 간 상태를 유지하지 않습니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
recipient | string | 이 시전에 기록된 읽을 수 있는 정확한 받는 대상 이름. |
raidOnly | boolean | nil | true면 공격대 소속만, false나 nil이면 파티 또는 공격대를 확인합니다. |
반환값
| 1 | boolean | nil | 관찰된 소속. 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | nil 결과에 대한 검증 또는 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
local name = UnitName("target")
if type(name) ~= "string" then return nil end
local member = addon.Platform:GetAnnouncementRecipientGroupMembership(name, false)
if member == nil then return nil end
return member소스
Platform/announcement_recipient.lua, 24번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Platform.announcement_recipient.GetAnnouncementRecipientGroupMembership(self, recipient, raidOnly)
if not self:CanReadValue(recipient) or not self:CanReadValue(raidOnly) then return nil,'restricted-value' end
if type(recipient)~='string' or recipient=='' or #recipient>256 then return nil,'cast-recipient-unavailable' end
if raidOnly~=nil and type(raidOnly)~='boolean' then return nil,'invalid-group-query' end
local grouped,reason=self:GetGroupMembership(raidOnly)
if grouped~=true then return grouped,reason end
local raid,why=self:GetGroupMembership(true)
if raid==nil then return nil,why end
local exists,name,guid,normalized=UnitExists,UnitName,UnitGUID,GetNormalizedRealmName
local groupQuery=self.GetGroupMembership
local membership=self.GetUnitGroupMembership
if type(exists)~='function' or type(name)~='function' or type(guid)~='function' or type(membership)~='function' then return nil,'missing-api' end
local function read(unit)
local ok,present=pcall(exists,unit)
if not ok or not self:CanReadValue(present) or type(present)~='boolean' then return nil end
if not present then return false end
local named,first,realm=pcall(name,unit)
local identified,identity=pcall(guid,unit)
if not named or not identified or not self:CanReadValue(first) or not self:CanReadValue(realm) or not self:CanReadValue(identity) then return nil end
if canaccessvalue and not canaccessvalue(first) then return nil end
if canaccessvalue and not canaccessvalue(realm) then return nil end
if canaccessvalue and not canaccessvalue(identity) then return nil end
if type(first)~='string' or first=='' or #first>256 or type(identity)~='string' or identity=='' or #identity>256 then return nil end
if realm~=nil and type(realm)~='string' then return nil end
if realm==nil or realm=='' then
if type(normalized)=='function' then
local got,value=pcall(normalized)
if not got or not self:CanReadValue(value) then return nil end
if canaccessvalue and not canaccessvalue(value) then return nil end
if type(value)=='string' and value~='' and #value<=256 then realm=value end
end
end
return {first=first,full=type(realm)=='string' and realm~='' and first..'-'..realm or nil,guid=identity}
end
local function scan()
local rows,selected,count={},nil,0
for index=raid and 1 or 0,raid and 40 or 4 do
local unit=raid and 'raid'..index or index==0 and 'player' or 'party'..index
local record=read(unit)
if record==nil then return nil,'group-data-unavailable' end
rows[unit]=record
if record then
count=count+1
if recipient==record.first or recipient==record.full then
if selected then return nil,'cast-recipient-ambiguous' end
selected=unit
elseif not record.full and recipient:sub(1,#record.first+1)==record.first..'-' then
return nil,'cast-recipient-unavailable'
end
end
end
if count==0 then return nil,'group-data-unavailable' end
return rows,selected
end
local before,selected=scan()
if not before then return nil,selected end
local member,failure=false,nil
if selected then member,failure=membership(self,selected,raidOnly) end
-- Native calls and extension callbacks may reenter. Re-read the complete
-- bounded roster after membership/context reads, including negative results:
-- a stale false must not turn a NOT condition into permission to announce.
local currentGroup=self:GetGroupMembership(raidOnly)
local currentRaid=self:GetGroupMembership(true)
local after,matched=scan()
if exists~=UnitExists or name~=UnitName or guid~=UnitGUID or normalized~=GetNormalizedRealmName
or membership~=self.GetUnitGroupMembership or groupQuery~=self.GetGroupMembership
or currentGroup~=grouped or currentRaid~=raid or not after or matched~=selected then return nil,'group-data-unavailable' end
for unit,record in pairs(before) do
local fresh=after[unit]
if type(record)~=type(fresh) then return nil,'group-data-unavailable' end
if record and (fresh.guid~=record.guid or fresh.first~=record.first or fresh.full~=record.full) then return nil,'group-data-unavailable' end
end
return member,failure




