Reference › Function reference › Core

Core.creature_conditions.GetConditionCreatureTypeMatch

public

Call as

addon:GetConditionCreatureTypeMatch(unit, key, cache)

Available directly through addon; no dependency is needed.

What it does

Compare the selected unit creature ID with one existing saved creature-type key. Resolve the fixed key-to-ID identity in one private executable mapper; gameplay matching does not depend on the mutable localized UI caption map. Share complete native observations within the supplied evaluation-pass cache by actual observer, receiver and unit, including absence and unavailable reasons. Known absence or a known different ID returns false; an unavailable required observation returns nil with a reason. No longterm state or caption mutation is added.

Arguments

NameTypeWhat it does
selfRMAddonRotation Master addon instance (implicit with colon calls).
unitstringReadable nonempty unit token to match, unchanged in the native observation.
keystringExisting stored CREATURE key: BEAST, DRAGONKIN, DEMON, ELEMENTAL, GIANT, UNDEAD, HUMANOID, CRITTER, MECHANICAL, OTHER, TOTEM, NONCOMBAT_PET or GAS_CLUUD.
cachetable | nilEvaluation-pass cache for complete unit observations; nil observes directly. Different selected keys reuse the same unit snapshot.

Returns

1boolean | nilTrue for an exact identity match; false for known absence or mismatch; nil when required data or the query is unavailable.
2string | nilPolicy, query-validation or required-observation availability reason for a nil match.

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.

It reads no game API directly.

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

  • Creature Type (evaluate)
    return addon:GetConditionCreatureTypeMatch(value.unit,value.value,cache)

Dependencies

Source

Core/creature_conditions.lua, line 43. Read only in game; Duplicate makes an editable copy.

Core.creature_conditions.GetConditionCreatureTypeMatch(self, unit, key, cache)
    if not self.Platform:CanReadValue(unit) or not self.Platform:CanReadValue(key) then return nil,'restricted-value' end
    if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
    if type(key)~='string' then return nil,'invalid-creature-type-selection' end
    local expected=configuredID(key)
    if expected==nil then return nil,'invalid-creature-type-selection' end
    local observed,reason=addon.Functions.cache.getCached(cache,self.Platform.GetUnitCreatureTypeID,self.Platform,unit)
    if observed==nil then return nil,reason end
    if observed==false then return false end
    return observed==expected

Back to Function reference