Referencia › Referencia de funciones › Platform

Platform.points.GetPlayerComboPointObservation

pública

Llamar como

addon.Platform:GetPlayerComboPointObservation(powerType, kind)

Disponible directamente a través de addon; no se necesita ninguna dependencia.

Qué hace

Observa el transporte de combo del jugador de TBC seleccionado explícitamente. Current usa exactamente GetComboPoints(player,target); maximum usa UnitPowerMax(player,powerType) con el selector original. Las demás familias no están disponibles aquí y deben usar su observador de poder de puntos existente. Conserva los valores finitos legibles con signo, fraccionarios y cero. Los datos que faltan, fallan, están restringidos o mal formados siguen sin estar disponibles; una consulta de combo elegida fallida nunca recurre a UnitPower. No observa a ningún otro actor ni agrega caché.

Argumentos

NombreTipoQué hace
selfRMPlatformAdaptador de plataforma de Rotation Master (implícito en las llamadas con dos puntos).
powerTypenumberSelector original explícito de recurso de combo, legible, finito, entero y no negativo, incluido cero; se conserva para la consulta del máximo.
kindstringExactamente current para la consulta de combo jugador/objetivo o maximum para la consulta de capacidad del jugador.

Retornos

1number | nilCantidad de recurso nativa finita, que conserva su signo y su parte fraccionaria; nil si no está disponible.
2string | nilMotivo de política, validación de la consulta o disponibilidad de una observación necesaria para una cantidad nil.

Ediciones

Las funciones auxiliares integradas se registran en todas las ediciones. Lo que cambia es la API del juego que leen; donde falta alguna, la función auxiliar usa una alternativa o devuelve nil con un motivo.

  • No disponible en esa edición (el motivo aparece en la información emergente)
  • Solo mientras estén activas las alternativas de Blizzard para API obsoletas
API del juegoClassic EraTBC AnniversaryClassic ProgressionForeverRetail
GetComboPointsClassic EraTBC AnniversaryClassic ProgressionForeverRetail
UnitPowerMaxClassic EraTBC AnniversaryClassic ProgressionForeverRetail
canaccessvalueClassic EraTBC AnniversaryClassic ProgressionForeverRetail

Valores secretos (Retail y Forever)

En Retail y Forever, el juego les entrega a los addons valores secretos. Esta función auxiliar verifica lo que lee (addon.Platform:CanReadValue) y, en lugar de un secreto que no puede comparar, devuelve nil con un motivo como restricted-value. Trata nil como no disponible, no como falso.

Ejemplo

-- 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 fuente

Platform/points.lua, línea 216. Solo lectura en el juego; Duplicar crea una copia editable.

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

Volver a Referencia de funciones