Chiamala come
addon.Platform:GetUnitPointFragmentObservation(unit, powerType, kind)
Disponibile direttamente tramite addon; non serve alcuna dipendenza.
Cosa fa
Osserva una risorsa a punti che il client riporta in frammenti (Braci Ardenti di Mists of Pandaria). Current usa esattamente UnitPower(unit,powerType,true) e maximum usa UnitPowerMax(unit,powerType,true); il risultato viene diviso per MAX_POWER_PER_EMBER (10) di Blizzard, quindi 35 frammenti valgono 3,5. Solo criterio di verifica. Dati mancanti, falliti, soggetti a restrizioni o malformati restano non disponibili; non ripiega mai sulla query in unità intere. Non viene aggiunta alcuna cache.
Argomenti
| Nome | Tipo | Cosa fa |
|---|---|---|
self | RMPlatform | Adattatore di piattaforma di Rotation Master (implicito nelle chiamate con due punti). |
unit | string | Identificativo unità esatto e non vuoto, passato invariato. |
powerType | number | Selettore di risorsa esplicito, leggibile, finito, intero e non negativo. |
kind | string | Esattamente current per UnitPower o maximum per UnitPowerMax. |
Valori restituiti
| 1 | number | nil | Quantità finita in unità intere con la sua parte frazionaria; nil se non disponibile. |
|---|---|---|
| 2 | string | nil | Motivo di policy, di convalida della query o di indisponibilità di un'osservazione richiesta quando la quantità è 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 | |||||
|---|---|---|---|---|---|
UnitPower | |||||
UnitPowerMax | |||||
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 embers = Enum.PowerType.BurningEmbers
if not embers then return nil end
local current = addon.Platform:GetUnitPointFragmentObservation("player", embers, "current")
if current == nil then return nil end
return current >= 3.5Dipendenze
pointFragmentsPerWhole(builtin:Platform/points.lua:pointFragmentsPerWhole)
Sorgente
Platform/points.lua, riga 162. Nel gioco è in sola lettura; Duplica crea una copia modificabile.
Platform.points.GetUnitPointFragmentObservation(self, unit, powerType, kind)
if self:GetCombatDataPolicy()~='probe' then return nil,'unsupported-policy' end
if not self:CanReadValue(unit) or not self:CanReadValue(powerType) or not self:CanReadValue(kind) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
if type(powerType)~='number' or powerType~=powerType or powerType<0 or powerType==math.huge or powerType%1~=0 then return nil,'invalid-point-power-query' end
if kind~='current' and kind~='maximum' then return nil,'invalid-point-power-query' end
local api
if kind=='current' then api=UnitPower else api=UnitPowerMax end
if type(api)~='function' then return nil,'missing-api' end
local ok,result=pcall(api,unit,powerType,true)
if not ok then return nil,'api-error' end
if not self:CanReadValue(result) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(result) then return nil,'restricted-value' end
if result==nil then return nil,'point-power-unavailable' end
if type(result)~='number' or result~=result or result==math.huge or result==-math.huge then return nil,'invalid-api-result' end
return result/pointFragmentsPerWhole




