호출 방법
Conditions.totem.findSpecific(value, cache, start, compareTime)
의존성 Conditions.totem.findSpecific을(를) 기록한 뒤 그 이름으로 호출하세요. 네임스페이스 호출은 self를 넘기지 않으므로 콜론 호출을 쓰거나 객체를 직접 넘기세요.
하는 일
Searches the totem slots for an active totem matching value.spell, by spell ID or name (only the exact spell ID when value.ranked is set). With compareTime it also requires the totem's remaining time, rounded to 3 decimals, to pass value.operator and value.value; an unreadable slot makes a non-match unavailable.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
value | table | Condition settings: spell, ranked and, for timed checks, operator and value. |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
start | number | nil | Evaluation start time; nil uses GetTime(). |
compareTime | boolean | True to also compare the remaining time. |
반환값
| 1 | boolean | nil | True when a matching totem is found, false when none is, or nil when a slot could not be read. |
|---|---|---|
| 2 | string | nil | Reason for nil, such as totem-data-unavailable, totem-rank-unavailable or totem-identity-unavailable. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
게임 API를 직접 읽지 않습니다.
애드온에서 호출하는 방식
- 특정 토템 있음 (evaluate)
return findSpecific(value,cache,start,false) - 특정 토템 남은 시간 (evaluate)
return findSpecific(value,cache,start,true)
의존성
observe→Conditions.totem.observeplatform(builtin:Conditions/totem.lua:platform)remaining→Conditions.totem.remaining
소스
Conditions/totem.lua, 102번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Conditions.totem.findSpecific(value, cache, start, compareTime)
local target,reason=observe(cache,platform.GetSpellInfo,value.spell)
if not target then return nil,reason end
local count,why=observe(cache,platform.GetTotemSlotCount)
if not count then return nil,why end
local unavailable
for slot=1,count do
local record,problem=observe(cache,platform.GetTotemInfo,slot)
if not record then unavailable=unavailable or problem or "totem-data-unavailable"
elseif record.active and remaining(record,start)>0 then
local matches=false
if value.ranked then
if record.spellID then matches=record.spellID==value.spell
elseif record.name==target.name or record.name=="" then unavailable=unavailable or "totem-rank-unavailable" end
else
matches=record.spellID==value.spell or record.name==target.name
if not matches and record.name=="" then
local info,issue
if record.spellID then info,issue=observe(cache,platform.GetSpellInfo,record.spellID) end
if info then matches=info.name==target.name
else unavailable=unavailable or issue or "totem-identity-unavailable" end
end
end
if matches and (not compareTime or addon.compare(value.operator,addon.round(remaining(record,start),3),value.value)) then return true end
end
end
if unavailable then return nil,unavailable end
return false