Chiamala come
addon.Platform:GetHealthForecastIdentityObservation(unit)
Disponibile direttamente tramite addon; non serve alcuna dipendenza.
Cosa fa
Sui client con policy di sondaggio o ristretta osserva esattamente UnitExists(unit), poi UnitGUID(unit) solo per un'unità presente. Un'assenza accertata è false. L'identità presente richiede un GUID leggibile e non vuoto; dati richiesti mancanti, falliti, malformati o soggetti a restrizioni sono non disponibili. Non vengono aggiunte osservazioni su salute, fornitore o unità aggiuntive.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
self | RMPlatform | Adattatore di piattaforma di Rotation Master (implicito nelle chiamate con due punti). |
unit | string | Identificativo unità selezionato non vuoto. |
Valori restituiti
| 1 | string | boolean | nil | GUID presente, false per un'assenza accertata, oppure nil se non disponibile. |
|---|---|---|
| 2 | string | nil | Motivo di policy, di convalida o di indisponibilità dell'osservazione. |
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 | |||||
|---|---|---|---|---|---|
UnitExists | |||||
UnitGUID | |||||
canaccessvalue |
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
local guid = addon.Platform:GetHealthForecastIdentityObservation("target")
-- false when there is no target, nil when unavailable
if not guid then return guid end
return guid:sub(1, 9) == "Creature-"Sorgente
Platform/health_forecast.lua, riga 52. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Platform.health_forecast.GetHealthForecastIdentityObservation(self, unit)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not self:CanReadValue(unit) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
if type(UnitExists)~='function' then return nil,'missing-api' end
local ok,exists=pcall(UnitExists,unit)
if not ok then return nil,'api-error' end
if not self:CanReadValue(exists) then return nil,'restricted-value' end
if exists==nil then return nil,'unit-data-unavailable' end
if type(exists)~='boolean' then return nil,'invalid-api-result' end
if not exists then return false end
if type(UnitGUID)~='function' then return nil,'missing-api' end
local success,guid=pcall(UnitGUID,unit)
if not success then return nil,'api-error' end
if not self:CanReadValue(guid) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(guid) then return nil,'restricted-value' end
if guid==nil then return nil,'unit-guid-unavailable' end
if type(guid)~='string' or guid=='' then return nil,'invalid-api-result' end
return guid




