SmartTargeting automatically swaps your key bindings for "target nearest enemy" and "target nearest enemy player" when you enter/leave a battleground, arena or outdoor PvP zone (such as Wintergrasp). It's oblivious to whether you're using <tab> or any other key for targeting enemies.
This addon is based on TabBinder.
Another similar addon is SmartTabTarget.
The "<Entering ...>" text in the image will not be shown, it's just there to illustrate that the player entered a PvP/PvE zone,
Usage
There is not really any configuration for this addon beyond disabling notifications (see commands section below). The addon is small, uses nearly no resources at all and (should) just work out of the box.
Example
In PvE I've set up <tab> to "target nearest enemy", and <shift-tab> to "target nearest enemy player". When I now enter Wintergrasp/Tol Barad, a battleground or an arena then these two will be swapped so <tab> will "target nearest enemy player" and <shift-tab> will "target nearest enemy".
Commands
Two slash commands have been added to the addon to allow easier control.
Command prefixes: /smarttargeting or /st
Commands: (examples using /st prefix)
/st - passing no command will force swap the current key bindings.
/st quiet - will enable/disable the notifications of key binding swaps.
Issues
- If you want to change the key bindings permanently (say, going from using TAB and SHIFT-TAB to for example T and SHIFT-T) then this must be done using the Blizzard Key Bindings UI (if this doesn't make any sense to you, you probably don't need to worry about it).
- You should not run other addons changing key bindings for targeting nearest enemy/enemy player at the same time as SmartTargeting, they may interfere with each other.
Differences from TabBinder
- SmartTargeting swaps "target nearest enemy" and "target nearest enemy player", TabBinder only sets the key bindings. This means that if you got a key binding for both targeting functions, you'll lose one of them as you move into a PvP-zone with TabBinder.
- Improved battleground detection, TabBinder had a list of battleground names, but there's a function you can use instead to detect if you're in a battleground. This means that SmartTargeting should work with new battlegrounds and while it still print messages in English, it should work with non-English clients.
- If you're in combat when you enter/leave a PvP zone, then SmartTargeting should set your bindings as soon as you leave combat (you're not allowed to change keybindings while in combat), TabBinder doesn't do this.
Differences from SmartTabTarget
- SmartTabTarget is much more customizable than SmartTargeting, although its code is also significantly larger than SmartTargeting.
- It appears that SmartTabTarget only sets what the <tab> key should target, and that it won't swap "target nearest enemy"/"target nearest enemy player" keys like SmartTargeting. This means that <tab> must be used to target enemies (which often is what most people want), and that you can't have a key to "target all enemies" while in PvP zones nor a key to "target all enemy players" while in PvE zones (you can, but it will be lost when you move between PvP/PvE zones).