Aufruf als
Conditions.build.imbueObservation(value, cache)
Erfassen Sie die Abhängigkeit Conditions.build.imbueObservation und rufen Sie sie dann unter diesem Namen auf. Ein Aufruf über den Namensraum übergibt kein self: Verwenden Sie einen Doppelpunkt-Aufruf oder übergeben Sie das Objekt selbst.
Was sie bewirkt
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.
Argumente
| Name | Typ | Was sie bewirkt |
|---|---|---|
value | table | Condition settings; a truthy offhand field selects the off hand. |
cache | table | nil | Evaluation-pass cache passed to getCached, or nil to read directly. |
Rückgabewerte
| 1 | number | boolean | nil | Enchant ID of the temporary enchant, false when the hand has none, or nil when it cannot be read. |
|---|---|---|
| 2 | string | nil | Reason for nil: missing-api, api-error, restricted-value or invalid-weapon-observation. |
Editionen
Integrierte Hilfsfunktionen werden auf jeder Edition registriert. Unterschiedlich ist die Spiel-API, die sie lesen; fehlt eine, weicht die Hilfsfunktion aus oder gibt nil mit einem Grund zurück.
- Auf dieser Edition nicht verfügbar (den Grund nennt der Tooltip)
- Nur, solange Blizzards Ersatz für veraltete Funktionen aktiv ist
Geheime Werte (Retail und Forever)
Auf Retail und Forever übergibt das Spiel Addons geheime Werte. Diese Hilfsfunktion prüft, was sie liest (addon.Platform:CanReadValue), und gibt statt eines geheimen Werts, den sie nicht vergleichen kann, nil mit einem Grund wie restricted-value zurück. Behandeln Sie nil als nicht verfügbar, nicht als false.
Wie das Addon sie aufruft
- Art der Waffenverzauberung (evaluate)
local id, reason = imbueObservation(value, cache)
Abhängigkeiten
Functions.cache.getCached→Functions.cache.getCachedFunctions.presentation.nullable→Functions.presentation.nullableFunctions.values.compare→Functions.values.compareFunctions.values.isin→Functions.values.isin
Quelle
Conditions/build.lua, Zeile 88. Im Spiel schreibgeschützt; Duplizieren erstellt eine bearbeitbare Kopie.
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




