Reference › Function reference › Conditions

Conditions.equipment.subclassName

dependency

Call as

Conditions.equipment.subclassName(id)

Record the dependency Conditions.equipment.subclassName, 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

Names a weapon subclass for WEAPON_TYPE descriptions, using the client's GetItemSubClassInfo when it returns a readable name, else the addon's built-in name, else "weapon type N".

Arguments

NameTypeWhat it does
idnumberWeapon subclass ID.

Returns

1stringDisplay name for the subclass.

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_Item.GetItemSubClassInfoClassic EraTBC AnniversaryClassic progressionForeverRetail
GetItemSubClassInfoClassic 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

  • Weapon Type (print)
    if value.subclass ~= nil then what = subclassName(value.subclass) else what = kinds[value.kind] end

Dependencies

Source

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

Conditions.equipment.subclassName(id)
    local fn = C_Item and C_Item.GetItemSubClassInfo or GetItemSubClassInfo
    if type(fn) == "function" then
        local ok, name = pcall(fn, WEAPON_CLASS, id)
        if ok and addon.Platform:CanReadValue(name) and type(name) == "string" and name ~= "" then return name end
    end
    return subclassNames[id] and L[subclassNames[id]] or string.format(L["weapon type %d"], id)

Back to Function reference