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

Platform.points.GetPlayerComboPointObservation

pública

Chame como

addon.Platform:GetPlayerComboPointObservation(powerType, kind)

Disponível diretamente por meio de addon; nenhuma dependência é necessária.

O que faz

Observa o transporte de combo do jogador do TBC selecionado explicitamente. Current usa exatamente GetComboPoints(player,target); maximum usa UnitPowerMax(player,powerType) com o seletor original. Outras famílias ficam indisponíveis aqui e devem usar o observador de poder de pontos existente. Preserva valores finitos legíveis com sinal, fracionários e zero. Dados ausentes, com falha, restritos ou malformados continuam indisponíveis; uma consulta de combo escolhida com falha nunca recorre a UnitPower. Não observa nenhum outro ator nem adiciona cache.

Argumentos

NomeTipoO que faz
selfRMPlatformAdaptador de plataforma do Rotation Master (implícito nas chamadas com dois-pontos).
powerTypenumberSeletor original explícito de recurso de combo, legível, finito, inteiro e não negativo, incluindo zero; mantido para a consulta do máximo.
kindstringExatamente current para a consulta de combo jogador/alvo ou maximum para a consulta de capacidade do jogador.

Retornos

1number | nilQuantidade de recurso nativa finita, mantendo o sinal e a parte fracionária; nil quando indisponível.
2string | nilMotivo de política, validação da consulta ou disponibilidade de observação necessária para uma quantidade nil.

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
GetComboPointsClassic EraTBC AnniversaryClassic ProgressionForeverRetail
UnitPowerMaxClassic 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.

Exemplo

-- TBC only; 4 is the combo point power type
local current = addon.Platform:GetPlayerComboPointObservation(4, "current")
if current == nil then return nil end
return current >= 5

Código-fonte

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

Platform.points.GetPlayerComboPointObservation(self, powerType, kind)
    local info=self:GetClientInfo()
    if info.combatDataPolicy~='probe' then return nil,'unsupported-policy' end
    local family
    if self:CanReadValue(info) and type(info)=='table' then family=rawget(info,'family') end
    if not self:CanReadValue(family) then return nil,'restricted-value' end
    if canaccessvalue and not canaccessvalue(family) then return nil,'restricted-value' end
    if family~='tbc' then return nil,'unsupported-point-transport' end
    if not self:CanReadValue(powerType) or not self:CanReadValue(kind) then return nil,'restricted-value' 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=GetComboPoints else api=UnitPowerMax end
    if type(api)~='function' then return nil,'missing-api' end
    local ok,result
    if kind=='current' then ok,result=pcall(api,'player','target') else ok,result=pcall(api,'player',powerType) end
    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

Voltar para Referência de funções