Riferimento › Riferimento delle funzioni › Conditions

Conditions.build.imbueObservation

dipendenza

Chiamala come

Conditions.build.imbueObservation(value, cache)

Registra la dipendenza Conditions.build.imbueObservation, poi chiamala con quel nome. Una chiamata con spazio dei nomi non passa self: usa una chiamata con i due punti o passa tu l'oggetto.

Cosa fa

Reads the temporary enchant ID on the main hand, or the off hand when value.offhand is set, for the WEAPON_IMBUE condition. Uses the cached GetWeaponEnchantInfo, or the platform's composed reader on clients with C_PaperDollInfo.GetTemporaryEnchantmentInfo, and returns false when that hand has no temporary enchant.

Argomenti

NomeTipoCosa fa
valuetableCondition settings; a truthy offhand field selects the off hand.
cachetable | nilEvaluation-pass cache passed to getCached, or nil to read directly.

Valori restituiti

1number | boolean | nilEnchant ID of the temporary enchant, false when the hand has none, or nil when it cannot be read.
2string | nilReason for nil: missing-api, api-error, restricted-value or invalid-weapon-observation.

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 giocoClassic EraTBC AnniversaryClassic progressionForeverRetail
C_PaperDollInfo.GetTemporaryEnchantmentInfoClassic EraTBC AnniversaryClassic progressionForeverRetail
GetWeaponEnchantInfoClassic EraTBC AnniversaryClassic progressionForeverRetail

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.

Come la chiama l'addon

Dipendenze

Sorgente

Conditions/build.lua, riga 88. Nel gioco è in sola lettura; Duplica crea una copia modificabile.

Conditions.build.imbueObservation(value, cache)
    local reader = GetWeaponEnchantInfo
    if C_PaperDollInfo and C_PaperDollInfo.GetTemporaryEnchantmentInfo then reader = addon.Platform.ComposedWeaponEnchantInfo end
    if type(reader) ~= "function" then return nil, "missing-api" end
    ---@diagnostic disable-next-line: unbalanced-assignments
    local ok, main, _, _, mainID, off, _, _, offID = pcall(Functions.cache.getCached, cache, reader)
    if not ok then return nil, "api-error" end
    local enchanted, id = main, mainID
    if value.offhand then enchanted, id = off, offID end
    if not addon.Platform:CanReadValue(enchanted) or not addon.Platform:CanReadValue(id) then return nil, "restricted-value" end
    if enchanted == nil or enchanted == false or enchanted == 0 then return false end
    if type(id) ~= "number" then return nil, "invalid-weapon-observation" end
    return id

Torna a Riferimento delle funzioni