Core Concepts

Object Attributes

Complete reference guide to SYNQ object attributes

Attributes are keys within a SYNQ object that return values about the object's state, properties, and information. Understanding attributes is fundamental to building effective SYNQ routines.

What's an Attribute?

An attribute is just a key within a SYNQ object that is expected to return some value. Think of them as properties that tell you everything you need to know about a unit, player, or object.

Key Features:

  • Non-case-sensitiveobject.enemy works, but so does object.Enemy and object.isEnemy
  • Fallback aliases – Many attributes have intuitive aliases for easier use
  • Cached per tick – Values are generated on reference and cached until the next tick

Attribute Performance

Reading attributes is extremely performant. They act as normal key-value pairs, but their value is generated upon reference of the key, and the value is cached until the next "tick". This means:

  • Fast access – Once read, values are cached for the current tick
  • On-demand generation – Values only computed when you actually need them
  • No performance penalty – Reading attributes multiple times in the same tick is free

Multi-returns

A few attributes have multiple returns that are only available by selection #, which you can add to the end of the key. Example: player.casting9 == select(9, UnitCastingInfo("player")). You can also use bracket notation to access them variably: player["casting" .. selection].

General Attributes

exists

Returns true if the object exists, nil otherwise.

unit.exists : true | nil

Example:

print("Target exists: " .. tostring(target.exists))
-- true

class

The class of the object, plus all returns of UnitClass available by multi-selection #.

unit.class : "class" | nil
unit.class2 : "CLASS" | nil

Alternative: classLiteral - 2nd return from UnitClass. Upper case class name which is always the same across different localizations. Equivalent of class2.

Example:

if target.class == "Hunter" then
    print("Target is a Hunter!")
elseif target.class2 == "WARLOCK" then
    print("Target is a Warlock!")
end

combat

Returns true if the unit is in combat.

unit.combat : isInCombat | nil

Example:

if not enemy.combat then
    sap:Cast(enemy)
end

enemy

Returns true if the unit is an enemy.

unit.enemy : isEnemy | false

Example:

if target.enemy then
    -- Target exists and is an enemy - safe to use enemy-specific logic
end

friend / friendly

Returns true if the unit is friendly.

unit.friend : isFriend | false
unit.friendly : isFriend | false

Example:

if target.friendly then
    -- Target exists and is friendly - safe to use friendly-specific logic
end

hp

The health of the object in percentage.

unit.hp : hpPercentage | 0

Example:

print("Target health percentage: " .. target.hp .. "%")
-- 69

Other HP attributes:

  • health - actual current health of object, as returned from UnitHealth (instead of percentage)
  • healthMax - max health of object, as returned from UnitHealthMax

name

The name of the object.

unit.name : "name" | nil

Example:

print("Target name: " .. target.name)
-- Synqplayer

level

The level of the object via UnitLevel.

unit.level : level

Example:

if player.level < 60 then
    print("Player level is below 60 - still leveling!")
end

role

The role of the object, either healer, melee, ranged, tank, or pet.

unit.role : role | nil

Example:

if enemy.role == "healer" then
    kidneyShot:Cast(enemy)
end

Limitations: Built primarily for use in arena or on party members. For enemies in BG, World PVP, etc. or for friendly players who are not in your group, it is essentially guessing based on buffs, power resources, etc, and could be wrong sometimes.

Power / PowerTypes

Power Attributes

You can check power, powerMax, or powerPct for any powerType on the unit - just replace power with your powerType alias.

unit.power -- default UnitPower return w/ no powerType specified
unit.energy -- energy
unit.energyMax -- max energy
unit.mana -- mana
unit.manaPct -- mana percentage (mana / manaMax) * 100
unit.comboPoints -- combo points
unit.comboPointsMax -- max combo points
unit.rage -- current rage
unit.astralPowerMax -- works for all powerTypes

Example:

if player.energy < 30 then
    -- Player has low energy - pooling energy for upcoming abilities
end

if player.cp >= 5 then
    -- Player has maximum combo points - use finisher ability
    kidney:Cast()
end

Buffs & Debuffs

buffCount

Returns number of buffs the unit has.

unit.buffCount : numBuffs | 0

buffs

Returns an array of all buffs the unit has. Each buff is indexed appropriately, and contains all UnitBuff returns.

unit.buffs : { { buffName, ... }, { buffName, ... }, ... } | {}

Example:

for i, buff in ipairs(player.buffs) do
    local name, rank, icon, count = unpack(buff)
    -- Process each buff - buffs are cached and performant to iterate
end

debuffCount

Returns number of debuffs the unit has.

unit.debuffCount : numDebuffs | 0

debuffs

Returns an array of all debuffs the unit has. Each debuff is indexed appropriately, and contains all UnitDebuff returns.

unit.debuffs : { { debuffName, ... }, { debuffName, ... }, ... } | {}

Casts / Channels

casting

If the object is casting, returns the Casting Info from UnitCastingInfo.

unit.casting : "castName" | nil

Returns: string spellName | nil. Every return of UnitCastingInfo can be queried with selection # e.g, unit.casting9.

Example:

-- Check what spell the target is currently casting
print("Target is casting: " .. target.casting)
-- "Kill Command"

-- Get the spell ID of the cast (casting9 is same as castID)
print("Target cast spell ID: " .. target.casting9)
-- 34026

castID

The spellID of the spell being cast by the object, if they are casting.

unit.castID : castID | nil

castTarget

If the object is casting, returns the SYNQ Object being targeted by that spellcast.

unit.castTarget : castTargetObject | nil

Example:

if enemy.cast == "Chaos Bolt" and enemy.castTarget.isUnit(player) and enemy.castTimeLeft < synq.buffer then
    blazingBarrier:Cast()
end

castRemains

The time remaining on the object's cast, minus latency.

unit.castRemains : castTimeLeft | 0

Example:

-- Interrupt enemy casts that are dangerous
if target.casting and target.castRemains < 0.5 then
    intimidation:Cast(target)
end

channeling

If the object is channeling, returns the Channeling Info from UnitChannelInfo.

unit.channel : "channelName" | nil

Example:

-- Check what spell the target is currently channeling
print("Target is channeling: " .. target.channel)
-- "Soothing Mist"

Movement & Positioning

distance

Distance between the player and the object, accounting for combat reach and bounding radius.

unit.distance : distance | 9999

Sister Attribute: distanceTo - checks distance from the object to another object
Similar: distanceLiteral - checks distance without accounting for combat reach or bounding radius

Example:

if target.distance > 15 then
    charge:Cast(target)
end

los

Checks if the object is in line of sight of the player.

unit.los : isLoS | false

Sister Function: losOf(otherObject) - checks this between the object and another object
Similar: losLiteral - checks LoS without accounting for LoS-impairing effects like smoke bomb.

Example:

if enemy.los then
    print("Enemy has line of sight to player!")
end

meleeRange

Returns true if the player is in melee range of the object.

unit.meleeRange : true | false

Sister Function: meleeRangeOf(otherObject) - Checks if object is in meleeRange of another object

Example:

if enemy.meleeRange then
    warbreaker:Cast()
end

moving

Checks if the unit is moving : (speed > 0).

unit.moving : isMoving | false

Example:

if player.moving then
    print("Player is currently moving!")
end

speed

The current speed of the object (in yards per second), plus all other returns of GetUnitSpeed available by selection #.

unit.speed : currentSpeed | 0
unit.speed2 : runSpeed | 0

Example:

if target.speed < player.speed then
    print("Player is moving faster than the target!")
end

Crowd Control

bcc

If the object is in breakable crowd control, returns the spellID of that crowd control debuff.

unit.bcc : ccDebuffID | nil

Example:

if target.bcc then
    print("Target is in breakable crowd control - avoiding attack!")
end

cc

If the object is in crowd control, returns the spellID of that crowd control debuff.

unit.cc : ccDebuffID | nil

Example:

if healer.cc then
    print("Our healer is in crowd control - need help!")
end

stunned

If the object is stunned, returns the spellID of the stun debuff.

unit.stunned : stunID | nil

Example:

if player.stun then
    print("Player is stunned!")
end

rooted

If the object is rooted, returns the spellID of the root debuff.

unit.rooted : rootID | nil

Example:

if player.rooted then
    print("Player is rooted!")
end

silenced

If the object is silenced, returns the spellID of the silence debuff.

unit.silenced : silenceID | nil

Example:

if player.silence then
    print("Player is silenced!")
end

Immunities & Defensives

About immunities...

For the most common applications, you don't need to use these. Spell Objects handle literally all immunity checking you would otherwise need to do when attempting to cast a spell, you just have to set your options when initializing the spell object.

immuneCC

Checks if the unit is currently immune to crowd control effects.

unit.immuneCC : true | false

Example:

if target.immuneCC then
    print("Target is immune to crowd control!")
end

immuneMagic

Checks if the unit is currently immune to magic damage or effects.

unit.immuneMagic : true | false

Example:

if target.immuneMagic then
    print("Target is immune to magic damage and effects!")
end

immunePhysical

Checks if the unit is currently immune to physical damage or effects.

unit.immunePhysical : true | false

Example:

if target.immunePhysical then
    print("Target is immune to physical damage and effects!")
end

Diminishing Returns

stunDR

The stun DR of the object. 0.25 is quarter DR, 0.5 is half DR, 1 is full DR.

unit.sdr : stunDR | 1
unit.stunDR : stunDR | 1

Example:

if enemy.stunDR >= 0.25 and enemy.stunRemains < 0.4 then
    cheapShot:Cast(enemy)
end

incapacitateDR

The incapacitate DR of the object. 0.25 is quarter DR, 0.5 is half DR, 1 is full DR.

unit.idr : incapacitateDR | 1
unit.incapDR : incapacitateDR | 1

Example:

-- Cast Intimidation when enemy has full DR (no diminishing returns)
if enemy.incapDR == 1 then
    intimidation:Cast(enemy)
end

Summary

This comprehensive reference covers the most commonly used object attributes in SYNQ development. Attributes provide a clean, intuitive way to access all the information you need about units, players, and objects in your routines.

Key Takeaways:

  • Attributes are cached per tick for performance
  • Many attributes have aliases for flexibility
  • Spell objects handle most immunity checking automatically
  • Use attributes to make informed decisions in your rotation logic

Next: Learn about Object Functions for performing operations and calculations.