Skip to main content

Enums

Overview

The enums module provides a comprehensive collection of enumeration constants used throughout the API. These constants help make your code more readable and maintainable by replacing magic numbers with meaningful names.

Importing The Module

---@type enums
local enums = require("common/enums")
IZI SDK Shorthand

If you're using the IZI SDK, you can access enums directly:

local izi = require("common/izi_sdk")
local enums = izi.enums

Class Identification

class_id

Constants for identifying player classes.

ConstantValueDescription
ANY0Matches any class
WARRIOR1Warrior
PALADIN2Paladin
HUNTER3Hunter
ROGUE4Rogue
PRIEST5Priest
DEATHKNIGHT6Death Knight
SHAMAN7Shaman
MAGE8Mage
WARLOCK9Warlock
MONK10Monk
DRUID11Druid
DEMONHUNTER12Demon Hunter
EVOKER13Evoker

Example Usage

local enums = require("common/enums")
local me = core.object_manager.get_local_player()

if me:get_class() == enums.class_id.PALADIN then
-- Paladin-specific logic
end

class_id_to_name

Lookup table to convert class IDs to their string names.

Example Usage

local class_name = enums.class_id_to_name[enums.class_id.WARRIOR]
-- class_name = "WARRIOR"

Specializations

spec_enum

Constants for identifying specific class specializations.

Warrior

ConstantDescription
ARMS_WARRIORArms
FURY_WARRIORFury
PROTECTION_WARRIORProtection

Paladin

ConstantDescription
HOLY_PALADINHoly
PROTECTION_PALADINProtection
RETRIBUTION_PALADINRetribution

Hunter

ConstantDescription
BEAST_MASTERY_HUNTERBeast Mastery
MARKSMANSHIP_HUNTERMarksmanship
SURVIVAL_HUNTERSurvival

Rogue

ConstantDescription
ASSASSINATION_ROGUEAssassination
OUTLAW_ROGUEOutlaw
SUBTLETY_ROGUESubtlety

Priest

ConstantDescription
DISCIPLINE_PRIESTDiscipline
HOLY_PRIESTHoly
SHADOW_PRIESTShadow

Death Knight

ConstantDescription
BLOOD_DEATHKNIGHTBlood
FROST_DEATHKNIGHTFrost
UNHOLY_DEATHKNIGHTUnholy

Shaman

ConstantDescription
ELEMENTAL_SHAMANElemental
ENHANCEMENT_SHAMANEnhancement
RESTORATION_SHAMANRestoration

Mage

ConstantDescription
ARCANE_MAGEArcane
FIRE_MAGEFire
FROST_MAGEFrost

Warlock

ConstantDescription
AFFLICTION_WARLOCKAffliction
DEMONOLOGY_WARLOCKDemonology
DESTRUCTION_WARLOCKDestruction

Monk

ConstantDescription
BREWMASTER_MONKBrewmaster
MISTWEAVER_MONKMistweaver
WINDWALKER_MONKWindwalker

Druid

ConstantDescription
BALANCE_DRUIDBalance
FERAL_DRUIDFeral
GUARDIAN_DRUIDGuardian
RESTORATION_DRUIDRestoration

Demon Hunter

ConstantDescription
HAVOC_DEMON_HUNTERHavoc
VENGEANCE_DEMON_HUNTERVengeance

Evoker

ConstantDescription
EVOKER_DEVASTATIONDevastation
EVOKER_PRESERVATIONPreservation
EVOKER_AUGMENTATIONAugmentation

Example Usage

local spec = enums.class_spec_id.spec_enum

if player_spec == spec.FROST_MAGE then
-- Frost Mage specific logic
end

class_spec_id

Helper functions for working with class and specialization IDs.

Methods

MethodDescription
get_specialization_name(class_id, spec_id)Returns the spec name as a string
get_specialization_enum(class_id, spec_id)Returns the spec_enum value
get_spec_id_from_enum(spec_enum)Converts spec_enum back to numeric ID

Example Usage

local me = core.object_manager.get_local_player()
local class_id = me:get_class()
local spec_id = me:get_spec()

local spec_name = enums.class_spec_id.get_specialization_name(class_id, spec_id)
core.log("Playing as: " .. spec_name)

Power Types

power_type

Constants for identifying unit power/resource types.

ConstantValueDescription
HEALTH-2Health (special)
NONE-1No power type
MANA0Mana
RAGE1Rage
FOCUS2Focus
ENERGY3Energy
COMBOPOINTS4Combo Points
RUNES5Runes
RUNICPOWER6Runic Power
SOULSHARDS7Soul Shards
LUNARPOWER8Astral Power (Lunar Power)
HOLYPOWER9Holy Power
ALTERNATE10Alternate Power
MAELSTROM11Maelstrom
CHI12Chi
INSANITY13Insanity
ARCANECHARGES16Arcane Charges
FURY17Fury
PAIN18Pain
ESSENCE19Essence (Evoker)
RUNEFORGEPOWER20Runeforge Power
COMBOPOINTS_TBC-TBC Combo Points (Classic)

Example Usage

local enums = require("common/enums")
local me = core.object_manager.get_local_player()

local energy = me:get_power(enums.power_type.ENERGY)
local max_energy = me:get_max_power(enums.power_type.ENERGY)

Group Roles

group_role

Constants for identifying unit roles in a group.

ConstantValueDescription
NONE-1No role / Unknown
TANK0Tank
HEALER1Healer
DAMAGER2Damage dealer

Example Usage

local enums = require("common/enums")

if unit:get_role() == enums.group_role.HEALER then
-- Prioritize this target
end

Unit Classification

classification

Constants for unit classification (elite status).

ConstantValueDescription
UNKNOWN-1Unknown
NORMAL0Normal mob
ELITE1Elite mob
RARE_ELITE2Rare elite mob
WORLD_BOSS3World boss
RARE4Rare mob
TRIVIAL5Trivial (grey) mob
MINUS6Minus (weak) mob

Creature Types

creature_type

Constants for identifying creature types.

ConstantValueDescription
ABERRATION0Aberration
BEAST1Beast
DRAGONKIN2Dragonkin
DEMON3Demon
ELEMENTAL4Elemental
GIANT5Giant
UNDEAD6Undead
HUMANOID7Humanoid
CRITTER8Critter
MECHANICAL9Mechanical
NOT_SPECIFIED10Not specified
TOTEM11Totem
NON_COMBAT_PET12Non-combat pet
GAS_CLOUD13Gas cloud
WILD_PET14Wild pet

Example Usage

local enums = require("common/enums")

-- Check if target is a demon (for Exorcism, etc.)
if target:get_creature_type() == enums.creature_type.DEMON then
-- Use anti-demon abilities
end

Raid Markers

mark_index

Constants for raid target icons.

ConstantValueIcon
NO_MARK-1No mark (warning)
NO_ICON0No icon
STAR1⭐ Star
CIRCLE2🟠 Circle (Orange)
DIAMOND3💎 Diamond (Purple)
TRIANGLE4🔺 Triangle (Green)
MOON5🌙 Moon
SQUARE6🟦 Square (Blue)
CROSS7❌ Cross (Red X)
SKULL8💀 Skull
NO_MARK_29No mark (alternate)

Loss of Control

loss_of_control_type

Constants for loss of control effects.

ConstantValueDescription
NONE0No effect
POSSES1Possessed
CONFUSE2Confused
CHARM3Charmed
FEAR4Feared
STUN5Stunned
PACIFY6Pacified
ROOT7Rooted
SILENCE8Silenced
PACIFY_SILENCE9Pacified and silenced
DISARM10Disarmed
SCHOOL_INTERRUPT11School interrupted
STUN_MECHANIC12Stun (mechanic)
FEAR_MECHANIC13Fear (mechanic)

Buff Types

buff_type

Constants for categorizing buff/debuff types.

ConstantValueDescription
EXCEPTION-2Exception
UNDEFINIED-1Undefined
UNKNOWN0Unknown
MAGIC1Magic
CURSE2Curse
DISEASE3Disease
POISON4Poison
STEALTH5Stealth
TO_BE_DETERMINED6To be determined
MAGIC_CURSE_DISEASE_POISON7Multiple types
SPECIAL8Special
ENRAGE9Enrage

Spell Schools

spell_schools_flags

Bitmask constants for spell school types. Can be combined using bitwise OR.

Base Schools

ConstantValueDescription
Physical1Physical damage
Holy2Holy damage
Fire4Fire damage
Nature8Nature damage
Frost16Frost damage
Shadow32Shadow damage
Arcane64Arcane damage

Combined Schools

ConstantCombinationDescription
FrostfireFire + FrostFrostfire
ShadowflameFire + ShadowShadowflame
ShadowfrostFrost + ShadowShadowfrost
SpellfireFire + ArcaneSpellfire
SpellfrostFrost + ArcaneSpellfrost
AstralNature + ArcaneAstral
RadiantHoly + FireRadiant
TwilightHoly + ShadowTwilight
DivineHoly + NatureDivine
PlagueNature + ShadowPlague
VolcanicFire + NatureVolcanic
HolyfrostHoly + FrostHolyfrost
HolystormHoly + NatureHolystorm
FroststormFrost + NatureFroststorm
SpellstrikePhysical + ArcaneSpellstrike
FlamestrikePhysical + FireFlamestrike
FroststrikePhysical + FrostFroststrike
HolystrikePhysical + HolyHolystrike
StormstrikePhysical + NatureStormstrike
ShadowstrikePhysical + ShadowShadowstrike
SpellshadowShadow + ArcaneSpellshadow

Methods

-- Combine multiple schools
local combined = enums.spell_schools_flags.combine("Fire", "Frost")

-- Check if a school is present
local has_fire = enums.spell_schools_flags.contains(spell_school, enums.spell_schools_flags.Fire)

Collision Flags

collision_flags

Bitmask constants for collision detection.

ConstantValueDescription
None0x0No collision
DoodadCollision0x1Doodad collision
DoodadRender-Doodad render
WmoCollision0x10WMO collision
WmoRender-WMO render
WmoNoCamCollision-WMO no camera collision
Terrain0x100Terrain collision
IgnoreWmoDoodad-Ignore WMO doodads
LiquidWaterWalkable-Water walkable liquid
LiquidAll-All liquids
Cull-Culling
EntityCollision0x100000Entity collision
EntityRender-Entity render
Collision-General collision
LineOfSight0x100010Line of sight check

Methods

-- Combine flags
local flags = enums.collision_flags.combine("WmoCollision", "Terrain")

PvP Crowd Control

cc_flags

Bitmask constants for crowd control types in PvP. Cross-expansion compatible.

ConstantValueDescription
ROOT0x1Root effects
INCAPACITATE0x2Incapacitate (breaks on damage)
DISORIENT0x4Disorient (breaks on damage)
STUN0x8Hard stun
SILENCE0x10Silence
KNOCKBACK0x20Knockback
DISARM0x40Disarm
SAP0x80Sap
FEAR0x100Fear
CYCLONE0x200Cyclone
MORTAL_COIL-Mortal Coil
HORROR0x800Horror
MAGICAL0x1000Magical source
PHYSICAL0x2000Physical source
MIND_CONTROL-Mind Control
RANDOM_STUN-Random stun procs
RANDOM_ROOT-Random root procs
BLINDING_LIGHT-Blinding Light
KIDNEY_SHOT-Kidney Shot
SCATTER-Scatter Shot
BANISH-Banish
ANY0x1FFFFFMatch any CC
ANY_BUT_ROOT(computed)Any except roots

Methods

-- Combine multiple CC flags
local stun_or_root = enums.cc_flags.combine(enums.cc_flags.STUN, enums.cc_flags.ROOT)

-- Check if a mask contains a flag
if enums.cc_flags.has(applied_mask, enums.cc_flags.STUN) then
-- Target is stunned
end

cc_source

Constants for CC source filtering.

ConstantValueDescription
ANY0Matches any source
PHYSICAL1Physical CC source
MAGICAL2Magical CC source

Damage Type Flags

damage_type_flags

Bitmask constants for damage types (used for immunity checks).

ConstantValueDescription
PHYSICAL0x1Physical damage
MAGICAL0x2Magical damage
ANY0x3Any damage type

Methods

-- Combine damage types
local both = enums.damage_type_flags.combine(
enums.damage_type_flags.PHYSICAL,
enums.damage_type_flags.MAGICAL
)

-- Check if contains a type
if enums.damage_type_flags.has(mask, enums.damage_type_flags.MAGICAL) then
-- Includes magical damage
end

Spell Types

spell_type

Constants for spell targeting types.

ConstantValueDescription
TARGET1Unit-targeted spell
POSITION2Position-targeted (ground) spell

Trigger Mode

trigger_mode

Constants for trigger/activation modes.

ConstantValueDescription
BASIC-Basic trigger mode
PREDICTION-Prediction-based trigger mode

Font IDs

font_id

Constants for graphics font selection.

ConstantValueDescription
FONT_VERY_SMALL2Very small font
FONT_SMALL7Small font
FONT_SEMI_BIG1Semi-big font
FONT_BIG8Big font
FONT_ICONS_SMALL3Small icons font
FONT_ICONS_BIG4Big icons font
FONT_ICONS_VERY_BIG6Very big icons font
FONT_CN9Chinese font
FONT_RU10Russian font
FONT_JP11Japanese font
FONT_KR12Korean font

Constants for menu UI element types.

ConstantValueDescription
BUTTON1Button
CHECKBOX2Checkbox
COLOR_PICKER3Color picker
COMBOBOX4Dropdown combobox
COMBOBOX_REORDERABLE5Reorderable combobox
KEY_CHECKBOX6Key + checkbox
KEYBIND7Keybind
SLIDER_FLOAT8Float slider
SLIDER_INT9Integer slider
TEXT_INPUT10Text input
TREE_NODE11Tree node
HEADER12Header
WINDOW13Window

Complete Example

local izi = require("common/izi_sdk")
local enums = izi.enums

local me = izi.me()
local target = izi.target()

-- Check if we're a caster class
local caster_classes = {
[enums.class_id.MAGE] = true,
[enums.class_id.WARLOCK] = true,
[enums.class_id.PRIEST] = true,
}

if caster_classes[me:get_class()] then
-- Check target's magic immunity
local immune, remaining = target:is_damage_immune(enums.damage_type_flags.MAGICAL)
if immune then
izi.printf("Target immune to magic for %dms", remaining)
end
end

-- Check for CC on target
local is_cc, cc_mask, cc_remaining = target:is_cc(500, enums.cc_flags.ANY)
if is_cc then
if enums.cc_flags.has(cc_mask, enums.cc_flags.STUN) then
izi.print("Target is stunned!")
end
end

-- Check creature type for special abilities
if target:get_creature_type() == enums.creature_type.UNDEAD then
-- Use Turn Undead, Shackle, etc.
end

-- Check specialization
local spec = enums.class_spec_id.get_specialization_enum(me:get_class(), me:get_spec())
if spec == enums.class_spec_id.spec_enum.FROST_MAGE then
-- Frost Mage specific rotation
end