Referência › Referência de funções › Platform

Platform.health_forecast.providerValue

dependência

Chame como

Platform.health_forecast.providerValue(self, value)

Registre a dependência Platform.health_forecast.providerValue e depois chame-a por esse nome. Uma chamada com namespace não passa self: use uma chamada com dois-pontos ou passe o objeto você mesmo.

O que faz

Normalizes one health figure returned by the RealMobHealth provider. Returns the value when it is a readable finite nonnegative number, nil with no reason when it is nil or false (the provider has no figure, so native health can be used instead), or nil with "restricted-value" or "invalid-api-result".

Argumentos

NomeTipoO que faz
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
valueanyCurrent or maximum health value from RealMobHealth.GetUnitHealth.

Retornos

1number | nilFinite nonnegative health value, or nil when absent or unavailable.
2string | nilReason when the value is unusable; nil when it is valid or simply absent.

Edições

As funções auxiliares integradas são registradas em todas as edições. O que muda é a API do jogo que elas leem; quando uma está ausente, a função auxiliar recorre a uma alternativa ou retorna nil com um motivo.

  • Indisponível nessa edição (o motivo está na dica)
  • Só enquanto as alternativas da Blizzard para APIs obsoletas estiverem ativas
API do jogoClassic EraTBC AnniversaryClassic ProgressionForeverRetail
canaccessvalueClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Valores secretos (Retail e Forever)

No Retail e no Forever, o jogo entrega valores secretos aos addons. Esta função auxiliar verifica o que lê (addon.Platform:CanReadValue) e retorna nil com um motivo como restricted-value em vez de um valor secreto que não consegue comparar. Trate nil como indisponível, não como false.

Como o addon a chama

Dependências

Código-fonte

Platform/health_forecast.lua, linha 40. Somente leitura no jogo; Duplicar cria uma cópia editável.

Platform.health_forecast.providerValue(self, value)
    if not self:CanReadValue(value) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(value) then return nil,'restricted-value' end
    if value==nil or value==false then return nil end
    if not finite(value) or value<0 then return nil,'invalid-api-result' end
    return value

Voltar para Referência de funções