Referencia › Referencia de funciones › Conditions

Conditions.spatial.nameplateDistanceCount

dependencia

Llamar como

Conditions.spatial.nameplateDistanceCount(value, cache, plates)

Registra la dependencia Conditions.spatial.nameplateDistanceCount y después llámala con ese nombre. Una llamada con espacio de nombres no pasa self: usa una llamada con dos puntos o pasa el objeto tú mismo.

Qué hace

Counts units for DISTANCE_COUNT from a nameplate unit snapshot: units that exist, whose hostility matches value.enemy, and that are definitely within value.distance yards. Compares the count with value.operator and value.value; any unreadable unit or uncertain range makes the whole result unavailable.

Argumentos

NombreTipoQué hace
valuetableCondition settings: enemy, distance, operator and value.
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.
platestableSnapshot whose keys are nameplate unit tokens.

Retornos

1boolean | nilResult of the count comparison, or nil when the count cannot be established.
2string | nilReason for nil, such as unit-snapshot-unavailable, invalid-unit-snapshot, restricted-value or range-uncertain.

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
UnitExistsClassic EraTBC AnniversaryClassic ProgressionForeverRetail
UnitIsEnemyClassic 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.

Cómo la llama el addon

Dependencias

Código fuente

Conditions/spatial.lua, línea 690. Solo lectura en el juego; Duplicar crea una copia editable.

Conditions.spatial.nameplateDistanceCount(value, cache, plates)
    if type(plates)~="table" then return nil,"unit-snapshot-unavailable" end
    local count = 0
    for unit in pairs(plates) do
        if not addon.Platform:CanReadValue(unit) then return nil,"restricted-value" end
        if type(unit)~="string" or unit=="" then return nil,"invalid-unit-snapshot" end
        local present,issue=booleanRead(cache,UnitExists,unit)
        if present==nil then return nil,issue end
        if present then
            local enemy,problem=booleanRead(cache,UnitIsEnemy,"player",unit)
            if enemy==nil then return nil,problem end
            if enemy==value.enemy then
                local fighting,combatWhy=combatFilter(value,cache,unit)
                if fighting==nil then return nil,combatWhy end
                if fighting then
                    local member,why=rangeMember(cache,unit,value.distance)
                    if member==nil then return nil,why end
                    if member then count=count+1 end
                end
            end
        end
    end
    return Functions.values.compare(value.operator, count, value.value)

Volver a Referencia de funciones