Example: One-Key Heal V4
Video Tutorial
One-Key Heal Version 4
Use Heitu Super Macro to automatically scan the health deficits of raid or party members and intelligently select the appropriate rank of healing spells. No need to manually switch targets — just press once to heal.
Warning
Requires Heitu version >= 1.11.9. If your stable version is lower, enable Beta Push in Heitu settings.
This is just an example. You can read the Heitu Super Macro documentation yourself or have an AI read it (by giving the AI the URL), and refine this function according to your needs.
What's Upgraded in V4 Compared to V3
| Upgrade | V3 | V4 |
|---|---|---|
| Smart Cancel Casting | ❌ Not supported — if a target gets topped off mid-cast, you waste mana finishing the cast | ✅ On next keystroke, automatically checks the last target; cancels casting if target is full HP to save mana |
| Auto Class Detection | ❌ Only one generic LEVELS config table; changing class requires manually editing spell IDs | ✅ Automatically detects class via GetMeInfo().classId, with built-in configs for Paladin/Priest/Shaman/Druid |
| Error Handling | ❌ No classId validation | ✅ Added classId=0 detection and prompts for unsupported classes |
| Version Requirement | Heitu >= 1.11.8 | Heitu >= 1.11.9 |
| Multi-Class Switching | Requires manually copying multiple functions and renaming them (HealRaid1, HealRaid2…) | Single codebase, automatically adapts to all classes |
Details
1. Smart Cancel Casting (Biggest Highlight)
V4 records the last heal target (lastHealTarget). When pressing the hotkey again, if that target has already been topped off by another healer, it automatically calls StopCasting() to cancel the current cast, saving mana and immediately scanning for the next teammate who needs healing.
2. Auto Class Detection
V3's LEVELS config table was a single, hardcoded Paladin spell ID set. If you played multiple healing classes, you had to copy multiple functions and manually change spell IDs in each one.
V4 instead uses GetMeInfo() to get the current character's classId and automatically matches the corresponding class config table. Built-in support includes:
- Paladin (classId=2): 圣光术 / 圣光闪现 multi-rank chain
- Priest (classId=5): 强效治疗术 / 治疗术 / 快速治疗 multi-rank chain
- Shaman (classId=7): 治疗波 / 治疗链 multi-rank chain
- Druid (classId=11): 治疗之触 / 愈合 multi-rank chain
All classes share the same code — no manual switching needed.
3. Better Error Handling
V4 adds detection for classId == 0 (when Heitu is not connected to the game) and friendly prompts for unsupported classes, making troubleshooting easier.
Use Cases
- Quick healing in raids
- Auto-healing party members in group quests
- Emergency healing in PvP
How to Use
If the macro exceeds the character limit, you can place the function in Heitu's Super Macro Base Library:
- Open Heitu → Super Macro
- Paste the function code below into the editor
- In-game, use
/s S HealRaid()to call it
Or create a new macro in-game and enter:
/s S HealRaid()Then drag the macro to your action bar and set a hotkey. One keystroke will automatically heal the raid member with the largest health deficit.
Full Code
Enter the following in the Heitu Super Macro editor:
-- 记录上次治疗的目标,用于再次按键时判断是否需要取消施法
-- 复制到黑兔编辑器的时候,这个也要复制
local lastHealTarget = nil
function HealRaid()
-- ============ 智能取消:如果上次治疗的目标已满血,取消当前施法 ============
if lastHealTarget then
local lastInfo = GetUnitInfo(lastHealTarget)
if lastInfo and lastInfo.health > 0 and lastInfo.health >= lastInfo.maxHealth then
StopCasting()
if DEBUG_HEAL then print("取消施法:" .. lastInfo.name .. " 已满血") end
lastHealTarget = nil
-- 继续往下扫描,寻找下一个需要治疗的队友
end
end
-- ============ 配置区(按需修改)============
-- 是否同时治疗宠物(true=开启,false=关闭)
local INCLUDE_PETS = true
-- 是否输出治疗调试信息(true=打印,false=静默)
local DEBUG_HEAL = true
-- 根据自身职业自动选择技能配置
local me = GetMeInfo()
local classId = me and me.classId or 0
if classId == 0 then
print("一键奶:获取自身职业失败,classId=0,请确认黑兔已连接游戏")
return
end
-- 三个治疗等级,按优先级从高到低排列
-- minLost: 最低血量缺口 maxDist: 最大施法距离(码)
-- spellId: 技能ID name: 技能名称(仅用于调试输出)
local LEVELS = {}
if classId == 2 then -- 圣骑士
-- 60级策略:圣光闪现R1最省蓝,圣光术R4是常见下级治疗,R8满级救命
LEVELS = {
{minLost = 5000, maxDist = 40, spellId = 10329, name = "圣光术(满级)"},
{minLost = 1500, maxDist = 40, spellId = 19943, name = "圣光闪现(满级)"},
{minLost = 1000, maxDist = 40, spellId = 1026, name = "圣光术(等级4)"},
{minLost = 1, maxDist = 40, spellId = 19750, name = "圣光闪现(等级1)"},
}
elseif classId == 5 then -- 牧师
-- 60级策略:治疗术R2是牧师最知名下级治疗,强效治疗术给坦克,快速治疗应急
LEVELS = {
{minLost = 5000, maxDist = 40, spellId = 25314, name = "强效治疗术(满级)"},
{minLost = 1500, maxDist = 40, spellId = 6064, name = "治疗术(等级4)"},
{minLost = 1000, maxDist = 40, spellId = 9474, name = "快速治疗(4级)"},
{minLost = 500, maxDist = 40, spellId = 2055, name = "治疗术(等级2)"},
{minLost = 1, maxDist = 40, spellId = 2054, name = "治疗术(等级1)"},
}
elseif classId == 7 then -- 萨满
-- 60级策略:治疗链自动跳转智能团刷,治疗波给坦克,次级治疗波快速抬血
LEVELS = {
{minLost = 5000, maxDist = 40, spellId = 25357, name = "治疗波(满级)"},
{minLost = 1000, maxDist = 40, spellId = 10622, name = "治疗链(等级2)"},
{minLost = 1, maxDist = 40, spellId = 1064, name = "治疗链(等级1)"},
}
elseif classId == 11 then -- 德鲁伊
-- 60级策略:治疗之触R4是德鲁伊最省蓝下级治疗,R11满级给坦克,愈合应急+HOT
LEVELS = {
{minLost = 5000, maxDist = 40, spellId = 25297, name = "治疗之触(满级)"},
{minLost = 1500, maxDist = 40, spellId = 5188, name = "治疗之触(等级4)"},
{minLost = 1000, maxDist = 40, spellId = 8941, name = "愈合(等级5)"},
{minLost = 500, maxDist = 40, spellId = 8938, name = "愈合(等级2)"},
{minLost = 1, maxDist = 40, spellId = 8936, name = "愈合(等级1)"},
}
else
print("当前职业无内置治疗配置,classId=" .. classId .. ",请手动添加LEVELS")
return
end
-- 注意:血量缺口相同的等级,靠前的优先级更高
-- ==========================================
local members = TeamMembers()
-- 构建扫描列表(包含成员,可选包含宠物)
local scanList = {}
for i, m in ipairs(members) do
scanList[#scanList + 1] = m
end
if INCLUDE_PETS then
for i, m in ipairs(members) do
local info = GetUnitInfo(m.guid)
if info and info.petGuid and info.petGuid ~= 0 then
scanList[#scanList + 1] = {guid = tostring(info.petGuid)}
end
end
end
-- 按优先级遍历每个治疗等级
for _, lv in ipairs(LEVELS) do
local bestLost = 0
local bestInfo = nil
local bestGuid = ""
for i, m in ipairs(scanList) do
local info = GetUnitInfo(m.guid)
if info and info.health > 0 and info.maxHealth > 0 then
local lost = info.maxHealth - info.health
if lost >= lv.minLost then
local dist = Distance(m.guid)
if dist <= lv.maxDist and lost > bestLost then
bestLost = lost
bestInfo = info
bestGuid = m.guid
end
end
end
end
-- 当前等级有符合条件的目标,直接施放并结束
if bestInfo ~= nil then
if DEBUG_HEAL then print("治疗: " .. bestInfo.name .. "[" .. lv.name .. "] 缺口:" .. bestLost .. " 距离:" .. Distance(bestGuid)) end
Spell(lv.spellId, bestGuid)
lastHealTarget = bestGuid -- 记录本次目标,供下次取消判断
return
end
end
-- 没有需要治疗的队友
if DEBUG_HEAL then print("无需治疗") end
endThen click the Save and Sync to Game button in the top-right corner of the interface.

How It Works
- When pressing the macro again, first check if the last healed target is at full HP. If so, cancel the current cast (to avoid wasting mana) and continue scanning for new targets
- Automatically detect your class via
GetMeInfo()and select the corresponding healing spell config (supports Paladin/Priest/Shaman/Druid) - Scan healing ranks in priority order
- Within each rank, find the teammate with the largest health deficit within range
- If a high-priority (urgent) target is found, cast immediately without checking lower priorities
- Record the target after casting for the next cancel check
- If no suitable target is found across all ranks, do nothing
flowchart TD
A[Press Hotkey] --> A1{Is last heal target full HP?}
A1 -->|Yes| A2[Cancel current cast]
A2 --> A3[GetMeInfo - detect class]
A1 -->|No| A3
A3 --> A4[Select spell table by class]
A4 --> B[Iterate healing ranks by priority]
B --> C{Current rank: scan raid members}
C --> D[Skip dead/full HP members]
D --> E[Check health deficit >= rank threshold]
E -->|Yes| F{Distance <= rank max range?}
F -->|Yes| G[Record target with largest deficit]
F -->|No| D
G --> D
E -->|No| D
C --> H{Target found at current rank?}
H -->|Yes| I[Cast spell and record target]
H -->|No| J{More lower ranks?}
J -->|Yes| C
J -->|No| K[No healing needed]Function Reference
| Function | Description |
|---|---|
GetMeInfo() | Get self info (classId, HP, etc.), used for auto class detection and spell switching |
TeamMembers() | Get all raid/party members |
GetUnitInfo(guid) | Get detailed member info via guid (HP, status, etc.) |
Distance(guid) | Get distance to specified member (yards) |
Spell(spellId, guid) | Cast a spell on the specified member |
SpellStopCasting() | Cancel the currently casting spell |
Customization
The macro comes with built-in default spell configs for Paladin/Priest/Shaman/Druid, and automatically switches based on your class. You only need to modify the LEVELS config table for your class:
Adjust Healing Ranks
Find the elseif classId == X then branch for your class and modify LEVELS:
-- 例如:调整圣骑士(classId == 2)的治疗阈值和距离
elseif classId == 2 then -- 圣骑士
LEVELS = {
{minLost = 8000, maxDist = 40, spellId = 48782, name = "圣光术"},
{minLost = 4000, maxDist = 40, spellId = 48785, name = "圣光闪现"},
{minLost = 1, maxDist = 30, spellId = 48825, name = "神圣震击"},
}Change Spells
Replace the spellId in your class branch with the spell ID of the corresponding rank — no need to manually distinguish classes anymore.
Use Health Percentage (Instead of Absolute Health Deficit)
If you prefer percentage-based thresholds instead of absolute values:
-- 在判断条件中改用 pct
local pct = (info.health / info.maxHealth) * 100
if pct < 60 and dist <= lv.maxDist then
-- 血量低于60%就治疗
endHeal Only a Specific Group
for i, m in ipairs(members) do
-- 只治疗第1小队的成员(subgroup 从0开始)
if m.subgroup == 0 then
-- ... 后续逻辑
end
endEnable/Disable Pet Healing
Set INCLUDE_PETS to true in the config area, and One-Key Heal will also scan the HP of raid members and their pets, automatically healing injured pets:
local INCLUDE_PETS = true -- 开启宠物治疗Add More Ranks
The config table supports any number of ranks — just add new rows:
local LEVELS = {
{minLost = 8000, maxDist = 40, spellId = 48782, name = "圣光术"},
{minLost = 5000, maxDist = 40, spellId = 48785, name = "圣光闪现"},
{minLost = 2000, maxDist = 35, spellId = 48825, name = "神圣震击"},
{minLost = 1, maxDist = 30, spellId = 25235, name = "恢复"}, -- 新增第四级
}Notes
- You need to enable the Model Edit feature in Heitu first; Super Macro will then take effect automatically
- It is recommended to disable your antivirus or add the Heitu directory to the whitelist
- Spell IDs can be looked up on database websites (e.g. db.heitu.org)
- Supports all 60/70/80 level clients (1.12/1.14/2.4.3/2.5.3/3.4.3)
FAQ
Q1: It doesn't work after following the tutorial
First, update Heitu to the latest version. Then check whether the spell IDs in the macro are correct — don't just copy and paste directly. The spell IDs in the example are for a level 80 Paladin.
Q2: What if I want to use One-Key Heal on multiple classes?
No action needed! The macro has built-in auto class detection and will automatically switch to the corresponding class spell config based on GetMeInfo().classId. You just need to ensure the spell IDs in each class branch are correct.
Q3: How do I cancel an in-progress heal cast?
When the target is already at full HP (e.g., topped off by another healer), simply press the macro again to automatically cancel the current cast. This is implemented via SpellStopCasting(), helping you save mana.