Chiamala come
Core.point_conditions.pointIdentity(self, unit, key)
Registra la dipendenza Core.point_conditions.pointIdentity, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.
Cosa fa
Observes whether unit exists and, if so, its class, for the point-resource selectors. For the player it reuses a class stored in self.longtermCache under key when it was recorded against the same UnitClass function, and otherwise stores the freshly read class there.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
self | RMAddon | Rotation Master addon instance. |
unit | string | Unit token to observe. |
key | any | Long-term cache key for the player's class; only used for "player". The addon passes a private table. |
Valori restituiti
| 1 | table | nil | {exists=false}, or {exists=true, class=token}; nil when unavailable. |
|---|---|---|
| 2 | string | nil | The platform observer's reason for nil. |
Edizioni
Le funzioni di supporto integrate sono registrate su ogni edizione. Ciò che cambia è l'API di gioco che leggono; dove ne manca una, la funzione di supporto ripiega su un'alternativa o restituisce nil con un motivo.
- Non disponibile su quell'edizione (il motivo è nel suggerimento)
- Solo mentre sono attivi i ripieghi di Blizzard per le API deprecate
| API di gioco | |||||
|---|---|---|---|---|---|
UnitClass |
Valori segreti (Retail e Forever)
Su Retail e Forever il gioco fornisce agli addon valori segreti. Questa funzione di supporto controlla ciò che legge (addon.Platform:CanReadValue) e restituisce nil con un motivo come restricted-value invece di un valore segreto che non può confrontare. Considera nil come non disponibile, non come false.
Esempio
-- needs the dependency Core.point_conditions.pointIdentity
local record, reason = Functions.cache.getCached(cache, Core.point_conditions.pointIdentity, addon, "target")
if not record then return nil, reason end
return record.exists and record.class == "ROGUE"Sorgente
Core/point_conditions.lua, riga 27. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Core.point_conditions.pointIdentity(self, unit, key)
local platform=self.Platform
local nativeClass=UnitClass
local longterm=self.longtermCache
if not platform:CanReadValue(longterm) or type(longterm)~='table' then longterm=nil end
local class
if unit=='player' and longterm and platform:CanReadValue(nativeClass) and type(nativeClass)=='function' then
local entry=rawget(longterm,key)
if platform:CanReadValue(entry) and type(entry)=='table' then
local api,candidate=rawget(entry,'api'),rawget(entry,'class')
if platform:CanReadValue(api) and api==nativeClass and platform:CanReadValue(candidate) and type(candidate)=='string' and candidate~='' then class=candidate end
end
end
local record,reason=platform:GetUnitPointIdentityObservation(unit,class==nil)
if not record then return nil,reason end
if not record.exists then return record end
if class then record.class=class
elseif unit=='player' and longterm and type(nativeClass)=='function' and nativeClass==UnitClass then
rawset(longterm,key,{api=nativeClass,class=record.class})
end
return record




