Chiamala come
Core.health_forecast_conditions.nativeValue(self, unit, kind, cache)
Registra la dipendenza Core.health_forecast_conditions.nativeValue, 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
Reads a unit's current or maximum health through the platform's health-forecast observer and the evaluation cache, rejecting restricted, missing, nonfinite or negative values.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
self | RMAddon | Rotation Master addon instance whose Platform is used. |
unit | string | Unit token to read. |
kind | string | "current" or "maximum". |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
Valori restituiti
| 1 | number | nil | Health value, or nil when unavailable. |
|---|---|---|
| 2 | string | nil | Reason for nil: missing-api, restricted-value, the observer's reason, health-data-unavailable or invalid-health-forecast-number. |
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 legge direttamente alcuna API di gioco.
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.
Come la chiama l'addon
Core.health_forecast_conditions.GetConditionHealthForecastif current==nil or current==false then current,why=nativeValue(self,unit,'current',cache);if current==nil then return nil,why end end
Dipendenze
Sorgente
Core/health_forecast_conditions.lua, riga 52. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Core.health_forecast_conditions.nativeValue(self, unit, kind, cache)
local platform=self.Platform
if type(platform.GetHealthForecastValueObservation)~='function' then return nil,'missing-api' end
local value,why=addon.Functions.cache.getCached(cache,platform.GetHealthForecastValueObservation,platform,unit,kind)
if not platform:CanReadValue(value) then return nil,'restricted-value' end
if value==nil then return nil,why or 'health-data-unavailable' end
local valid,reason=finite(platform,value)
if not valid then return nil,reason end
if value<0 then return nil,'invalid-health-forecast-number' end
return value