Built-in Properties
The following covers 25 base templates plus the current editor’s 10 native aura fields. Built-in display labels follow your language; saved names, library references and Prop(“name”) calls remain stable. Examples keep their reference names. Use the parameters shown in your editor.
Basic State
Section titled “Basic State”Param: player
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 战斗中可能为受保护值:只能直接返回,不可比较或运算return UnitHealth(arg1)Current health of a unit (pass-through template).
Param: player
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 受保护值不可做除法,用 FromGUID 直传 0~1 小数local guid = UnitGUID(arg1)if not guid then return 0 endreturn UnitPercentHealthFromGUID(guid)Health fraction (0~1). Shows why you can’t divide yourself, plus the GUID null-check.
Param: player,3
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 资源类型:0=法力 1=怒气 2=集中 3=能量 4=连击点 5=符文 6=符能 7=灵魂碎片 8=星能-- 9=圣能 10=备用能量 11=漩涡 12=真气 13=疯狂 16=奥术充能 17=邪能 18=痛苦 19=精魂-- 返回值可能受保护:直接返回,不可比较或运算return UnitPower(arg1, arg2)Current value of a resource (2nd arg is the power type ID).
Param: player,4
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 资源类型:0=法力 1=怒气 2=集中 3=能量 4=连击点 5=符文 6=符能 7=灵魂碎片 8=星能-- 9=圣能 10=备用能量 11=漩涡 12=真气 13=疯狂 16=奥术充能 17=邪能 18=痛苦 19=精魂-- 返回值可能受保护:直接返回,不可比较或运算return UnitPower(arg1, arg2)Same code as “Energy,” only the parameter differs — demonstrates reuse.
Param: player,3
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 资源类型:0=法力 1=怒气 2=集中 3=能量 4=连击点 5=符文 6=符能 7=灵魂碎片 8=星能-- 9=圣能 10=备用能量 11=漩涡 12=真气 13=疯狂 16=奥术充能 17=邪能 18=痛苦 19=精魂-- 0~100;有 UnitPowerPercent(正式服)就直传,可能受保护:直接返回,不可比较或运算-- 没有该接口(怀旧服)则消毒后相除,受保护值归 0if UnitPowerPercent then return UnitPowerPercent(arg1, arg2) endlocal p = SuperDPS.SN(UnitPower(arg1, arg2), "lib.powpct", arg1)local m = SuperDPS.SN(UnitPowerMax(arg1, arg2), "lib.powpct", arg1)if m == 0 then return 0 endreturn p / m * 100Resource percentage (0–100). Retail returns UnitPowerPercent directly; Classic divides sanitized values — demonstrates branching on API availability.
-- 战斗中按 1、脱战按 0return InCombatLockdown()Whether in combat (boolean returned as 1/0).
return UnitExists("pet")Whether a pet is summoned.
Param: target
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 目标存在且可攻击按 1(常用作输出总开关)return UnitExists(arg1) and UnitCanAttack("player", arg1)Whether the target exists and is attackable (free posture, direct logic).
-- 可见敌对姓名板计数(AOE 张数);需在游戏内开启敌对姓名板local n = 0for i = 1, 40 do local u = "nameplate" .. i if UnitExists(u) and UnitCanAttack("player", u) then n = n + 1 endendreturn nNumber of visible hostile targets nearby, for AOE decisions.
Spells & Items
Section titled “Spells & Items”Param: 5277
-- timeUntilEndOfStartRecovery = 剩余秒数;直接返回,不可比较-- (duration/startTime 战斗中受保护,勿仿)local info = C_Spell.GetSpellCooldown(arg1)return info and info.timeUntilEndOfStartRecovery or 0Cooldown seconds remaining for a spell (parameter is the spell ID).
Param: 5277
-- isActive/isOnGCD 官方保证永不受保护,可安全逻辑判断local info = C_Spell.GetSpellCooldown(arg1)if not info then return false endreturn info.isActive and not info.isOnGCDWhether a spell is ready (off cooldown, not on GCD) — free-posture template.
-- 61304 = 公共冷却专用查询 IDlocal info = C_Spell.GetSpellCooldown(61304)return info and info.timeUntilEndOfStartRecovery or 0Global cooldown seconds remaining.
Param: 108853
-- 当前充能层数;直接返回(无充能机制的技能按 0)local c = C_Spell.GetSpellCharges(arg1)return c and c.currentCharges or 0Current charges of a charge-based spell.
Param: 116,target
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 目标在射程内按 1;直接返回,不可做逻辑判断return C_Spell.IsSpellInRange(arg1, arg2)Whether the target is within a spell’s range (params: spell ID, unit).
Param: 5512
-- 非战斗数值,可直接使用return C_Item.GetItemCount(arg1)Count of an item in your bags (potions, healthstones, etc.).
Param: player,774
-- 参数:player(增益只查自己),技能 ID 或名称return SuperDPS.BuiltinAura(arg1, arg2, "remaining", "HELPFUL")Remaining buff duration through the native aura strip; supports player buffs.
Param: player,774
-- 参数:player(增益只查自己),技能 ID 或名称return SuperDPS.BuiltinAura(arg1, arg2, "applications", "HELPFUL")Current stack count of a buff.
Param: target,589
-- 参数:target(减益只查当前目标),技能 ID 或名称return SuperDPS.BuiltinAura(arg1, arg2, "remaining", "HARMFUL")Seconds remaining on a debuff on the target.
Param: target,589
-- 参数:target(减益只查当前目标),技能 ID 或名称return SuperDPS.BuiltinAura(arg1, arg2, "applications", "HARMFUL")Stack count of a debuff on the target.
自施减益剩余
Section titled “自施减益剩余”Param: target,589
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 只认「自己施放」的减益(DoT 补覆盖判断)local name, _, _, _, _, expire, source = SuperDPS.GetUnitDebuff(arg1, arg2)if not name or source ~= "player" then return 0 endexpire = SuperDPS.SN(expire, "lib.mydotremain")if expire == 0 then return 0 endreturn expire - GetTime()Seconds remaining on a debuff applied by you only, for DoT refresh decisions.
Casting
Section titled “Casting”Param: target
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 正在施放/引导的法术 ID(打断判断),没在施法按 0local id = select(9, UnitCastingInfo(arg1))if not id then id = select(8, UnitChannelInfo(arg1)) endreturn id or 0The spell ID the target is casting or channeling.
Param: target
-- 单位参数可填:player/target/focus/pet/mouseover/targettarget,-- 或 party1-4/raid1-40/boss1-8/arena1-5/nameplate1-40-- 完成剩余秒数(打断时机);endTime 要算术,必须先 SN 消毒local endMS = select(5, UnitCastingInfo(arg1))if not endMS then endMS = select(5, UnitChannelInfo(arg1)) endendMS = SuperDPS.SN(endMS, "lib.castremain")if endMS == 0 then return 0 endreturn endMS / 1000 - GetTime()Seconds until the target’s cast completes.
Recommendation
Section titled “Recommendation”-- 游戏内置「辅助作战」推荐的下一技能 ID,零插件依赖return C_AssistedCombat and C_AssistedCombat.GetNextCastSpell() or 0The next recommended spell ID, available only when the corresponding API exists. Sanitize and check its type before comparisons or table indexing. See Dynamic Macros for a complete example.
Hekili推荐
Section titled “Hekili推荐”-- 未装 Hekili 时恒 0return SuperDPS.HekeliPrimaryThe current top recommended spell ID from the Hekili addon.
General
Section titled “General”Param: myvar
-- 读共享表:宏或初始化代码写入 全局名.Prop["名字"] = 值(全局名默认 MyDps),-- 此属性按名字读回。值可能为受保护值:直接返回,不可比较或运算if not arg1 then return 0 endreturn SuperDPS.Prop[arg1]Reads any named value from the shared table — written by macros or init code, read back by name; any custom state can reach the panel through it.
Native aura fields
Section titled “Native aura fields”The editor offers remaining/total/elapsed duration, start/end times, remaining/elapsed ratios, stacks, presence and dispel type. Supported sources are player buffs and hostile target debuffs. Choose a library entry and the generator registers it automatically, without handwritten initialization. Zero stacks do not mean absence: use present. Self-cast debuff filtering retains its existing logic.
remaining, duration, elapsed, startTime, endTime, remainingPercent, elapsedPercent, applications, present, dispelType
Numeric precision
Section titled “Numeric precision”Readable numeric properties default to two decimal places. To keep more detail in a coordinate or facing property, put SuperDPS.SetPropertyPrecision("Facing", 6) in initialization code, using its exact property name. Choose 0–6 decimals; pass nil to restore the default. Explicit precision allows up to 16 displayed characters including the sign and decimal point. Larger values are invalid. Secret values retain the existing two-decimal rendering path. This does not provide lossless float64 transport.
Each property row in a .wa1 document also accepts optional precision (integer 0–6, or null for the default). Current clients preserve this field through import, export and cloud saves. It is applied before initialization code, so an explicit SetPropertyPrecision call can override it. Use at least 4 decimals for facing when you need error below 0.001 radians.