---
name: wow-combat-and-taint
description: >-
How a World of Warcraft addon avoids being blocked by the game: taint (when the game's
own code counts as the addon's), protected functions, secure frames and combat. Which of
the game's shared systems an addon should not use (StaticPopup, HelpTip, the Esc list),
how a secure button clicks the game's own buttons, how own slots for items in bags and
bank are built so that clicks work, and how the cause of a block is found. Use this skill
when an addon changes, hooks, opens or hides one of the game's own windows, when it uses
secure buttons (SecureActionButtonTemplate), when it shows questions or tips, when it
touches bags, bank, the reagent bag, merchants or using items, when the game shows "has
been blocked from an action only available to the Blizzard UI" or "Interface action
failed because of an AddOn", when something stops working in combat, and every time such
code is reviewed.
---
# Combat, protected actions and taint
The game only trusts its own code. The addon's code may read almost everything and draw
what it likes, but some actions only the game itself may do: use an item, cast a spell,
and show or move certain windows in combat. This skill collects what went wrong in real
addons and what Blizzard's source code says, so it does not have to be looked up again.
Files in this skill:
| File | When you read it |
|---|---|
| `references/taint-patterns.md` | Before you touch one of the game's windows, and when the game has blocked something |
| `references/secure-buttons.md` | When the addon needs a button that does something protected (open the bag, use an item) |
| `references/bags-and-bank.md` | When the addon touches bags, bank, the reagent bag or slots for items |
| `references/gamepad-cursor.md` | When the addon must work with a controller in WoW Forever (the cursor, LB/RB, D-pad) |
## How it works
- **Secure and insecure code.** Blizzard's code runs as secure. The addon's code is
insecure ("tainted"). Every value the addon's code creates or changes carries the
addon's mark.
- **Taint spreads.** When the game's code reads a marked value, the rest of that run
becomes marked. That can happen much later and in another place than where the addon
wrote the value – which is why the errors are hard to connect.
<!-- ‹guest · 2026-11-29› -->
- **Protected functions** refuse to run from marked code. The game then shows the box
"<addon> has been blocked from an action only available to the Blizzard UI" (the event
`ADDON_ACTION_FORBIDDEN`).
- **Secure frames** (frames with a `Secure…` template, or `protected="true"` in the game's
XML) may not be shown, hidden, moved, re-parented or given new attributes by the addon's
code in combat. The attempt gives "Interface action failed because of an AddOn" (the
event `ADDON_ACTION_BLOCKED`). A frame can become protected without being so itself –
see `references/secure-buttons.md`.
- **A safe way to react to the game's code:** `hooksecurefunc` and `HookScript`. The
addon's function runs after the game's, and the game's run stays secure.
## Rules of thumb
1. **Never open the game's windows for the player from the addon's code** when the window
contains buttons that do protected things (bags, bank, spellbook, action bars). The game
builds the buttons when the window opens, and then they become the addon's. Let a secure
button click the game's own button. Closing a window is harmless.
2. **Do not use the game's shared systems**: `StaticPopup`, `HelpTip:Show`,
`RegisterGameMenuEscHandler`. Build own frames from the game's templates.
`UISpecialFrames` (close with Esc) is fine.
3. **Never write into the game's tables and frames.** No own fields on the game's frames,
no changed constants (e.g. `ENDING_BAG_INDEX`), no overwritten functions, no `SetScript`
on the game's frames. Own data lives in an own table with the frame as key.
4. **Do not hide a window whose `OnHide` does something.** Read the game's code first. The
bank window closes the bank when it is hidden; make it invisible instead.
5. **Secure buttons**: set attributes, position and visibility only outside combat, and
always restore an attribute changed in `PreClick`. Do not put a secure button in a
window that the game itself shows and moves (e.g. a page in the options).
6. **Own slots for items** are built from the game's template
`ContainerFrameItemButtonTemplate` with the bag's number on the parent (`SetID`) – not
with own click functions that call `C_Container.UseContainerItem`.
7. **With a controller (WoW Forever)**: never disable or enable the button under the
cursor, write no own fields on buttons the cursor reaches, add no own button bindings,
open no menu from the addon's code, and set the cursor's values only with
`SmartNavigation_*` outside combat – jumps with buttons, never with functions
(`references/gamepad-cursor.md`).
8. **Wait for the end of combat** (`PLAYER_REGEN_ENABLED`) for everything that may not be
done in combat, with a single listener registered once.
9. **Every such choice is written in the addon's `AGENTS.md`** with the reason, and the
game's functions the choice relies on go into `.wow-check/watch.txt` (see below).
<!-- ‹guest · 2026-11-29› -->
## What does the addon want to do?
| The addon wants to | Do this | Read |
|---|---|---|
| Open the bag from an own button | Secure button with `type` = `click` on `MainMenuBarBackpackButton` | `references/secure-buttons.md` |
| Open the bag from a slash command or the addon menu | Not possible without taint. Open the addon's own page instead, with a secure button there | `references/taint-patterns.md` |
| Show items in own slots that can be clicked, dragged and used | `ContainerFrameItemButtonTemplate` on a parent with `SetID(bag)` | `references/bags-and-bank.md` |
| Replace the bank window | Own slots, and the game's window invisible but not hidden | `references/bags-and-bank.md` |
| Show the reagent bag together with the others | Own slots for bag 5 – never change `ENDING_BAG_INDEX` | `references/bags-and-bank.md` |
| Ask a question | Own frame from `DefaultPanelFlatTemplate` | `../wow-ui-frames/references/dialogs.md` |
| Show tips that point at something | Own frames from `HelpTipTemplate` | `../wow-ui-frames/references/dialogs.md` |
| Close an own window with Esc | `tinsert(UISpecialFrames, name)` | `../wow-ui-frames/references/dialogs.md` |
| React when the game lays out a window | `hooksecurefunc(frame, "Method", function)` | `../wow-new-addon/references/building-blocks.md` |
| Steer the controller cursor (D-pad in rows, ignore frames, LB/RB) | `SmartNavigation_AddJumpNavigationOverride` and `SmartNavigation_MarkFrameIgnored` outside combat | `references/gamepad-cursor.md` |
| Delete, sell or use an item for the player | Only in a click from the player – see the table of items | `../wow-new-addon/references/building-blocks.md` |
## The tools
- `check-addon.mjs` (skill `wow-check`) warns about the patterns above: opening bags,
`StaticPopup`, `HelpTip:Show`, `RegisterGameMenuEscHandler`, `SetScript` on the game's
frames, fields and functions written into the game's tables, and gives a tip for every
secure frame.
- `check-game.mjs` (same skill) reads the game's source code. It lists which of the
addon's calls the game marks as protected or restricted (`--list`), and watches the
functions in `.wow-check/watch.txt`. Every time the addon starts relying on how one of
the game's functions behaves – without calling it – the function goes into that file with
a line about why. Then the check after the next patch shows whether it has changed.
## When the game has blocked something
1. Read the function's name. The addon should print it in the chat
(`ADDON_ACTION_FORBIDDEN`/`ADDON_ACTION_BLOCKED`, code in the section Robustness in
`building-blocks.md`), and the game's logs have the rest
(`../wow-maintain/references/bug-reports.md`, section 4).
2. Turn on tracing: `/console taintLog 1`, repeat the error, and read `Logs/taint.log` in
the game folder. The lines show which value carried the addon's mark and where the game
read it.
3. Ask: what has the addon created, opened or written that the game's code later used?
Compare with `references/taint-patterns.md`.
<!-- ‹guest · 2026-11-29› -->
4. Fix the cause, not the symptom – a `pcall` around the call does not help.
5. Add a test to the test list that does exactly that protected action after `/reload`
(e.g. disenchant, use an item on another), and write the pattern in the addon's
`AGENTS.md`.
## How certain is the information?
Every item in the reference files is marked:
- **[game]** – the error or the solution has been seen in the game, with date and version.
- **[source]** – read in Blizzard's code (`Gethe/wow-ui-source`), with file and build, but
not tried in the game.
Trust [game]. Treat [source] as a well-founded expectation: build on it, but ask the user
to try it, and change the marking once that is done. Everything applies to WoW Forever
1.60.1 (build 70938, November 2026) unless stated otherwise; the same code is in retail
12.1.5 except what lives in folders named `Camelot`.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.