Reference › Function reference › Conditions

Conditions.build.imbueObservation

dependency

Call as

Conditions.build.imbueObservation(value, cache)

Record the dependency Conditions.build.imbueObservation, then call it by that name. A namespaced call does not pass self: use a colon call or pass the object yourself.

What it does

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.

Arguments

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

Returns

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.

Editions

Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.

  • Not available on that edition (the reason is in the tooltip)
  • Only while Blizzard's deprecation fallbacks are on
Game APIClassic EraTBC AnniversaryClassic progressionForeverRetail
C_PaperDollInfo.GetTemporaryEnchantmentInfoClassic EraTBC AnniversaryClassic progressionForeverRetail
GetWeaponEnchantInfoClassic EraTBC AnniversaryClassic progressionForeverRetail

Secret values (Retail and Forever)

On Retail and Forever the game hands addons secret values. This helper checks what it reads (addon.Platform:CanReadValue) and returns nil with a reason such as restricted-value instead of a secret it cannot compare. Treat nil as unavailable, not as false.

How the addon calls it

Dependencies

Source

Conditions/build.lua, line 88. Read only in game; Duplicate makes an editable copy.

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

Back to Function reference