Guide to Click Casting

#0 - Oct. 14, 2006, 7:51 a.m.
Blizzard Post
This post is meant to detail and clarify the state of Click-Casting post 2.X patch World of Warcraft.

* No addon or script will be able to target units or cast spells in a dynamic way. This means scripts like "If the target has Renew, then cast Renew, else cast Heal(Rank 4)". Conditional logic is specifically what is being disabled. These restrictions only exist within combat. Outside of combat, you will still be able to make intelligent targeting and spellcasting decisions.
* There have been a number of secure templates defined which are able to take action based on a pre-defined set of values. This means we can set things up to operate a specific way (outside of combat) and they will work exactly as you have defined them.

Many people have already discussed the overall implications of the changes with regards to decursive, etc. I'd like to address them as they specifically apply to click-casting (its more of the same.)

We have lost the ability to make the following types of decisions:

* Have different behavior on units depending on whether or not they are dead (in combat restriction only)
* Have any method of spell or heal scaling
* Make any sort of intelligent decision

Click-casting is alive and well, and will continue to be a valid method of play. We've worked with the designers to make sure we have a solid method of doing what we need to do, within their parameters of gameplay. We will no longer have any method of making intelligent decisions with regards to spellcasting or item use (while in combat) but we've been given a very intelligent flexible system to build upon.

In addition to spells from the spellbook, you can also bind the following actions:
* Actions: This will allow you to bind macros to clicks (such as using a trinket and then casting a spell)
* Item: You will be able to use an item (potions, for example)
* Inventory: You will be able to use an inventory item (i.e. a specific bag/slot or slot on your paper doll)
* StopCasting: Will stop the spell currently being cast
* Target: Will target the unit. LeftClicking does this by default
* Focus: Sets your "focus" on a given unit.
* Assist: Assists the unit you click on
* Menu: Opens the menu for the given unit

I'd like to propose the following standard for click-casting addons, to make the job as easy as possible for the unit frame author, and portable between different click-casting addons. Each unit frame (or click-casting addon) would create the following global table:
if not ClickCastFrames then ClickCastFrames = {} end

This gives a central registry for any frames that want to be click-castable. The click-casting addon is then responsible for setting the proper attributes and getting everything set up. This can be done with a simple metatable to monitor new entries and register them. An example might look like this:
local newindex = function(t,k,v)
-- Since we're adding this frame to the list, we need to
-- dispatch the attribute setter
ClickCastingAddon:RegisterFrame(k)
rawset(t,k,v)
end
setmetatable(ClickCastFrames, {__index=newindex})

There are some caveats to click-casting and the way the protections work. For example, when frames are created dynamically in combat (think Raid Frames, when members join) you will be unable to apply the click-casting attributes without some tricks. Once these methods are more clearly defined (with the default UI for example) I'll update these posts here.

This common method also allows our addons to determine whether or not another addon is already controlling click-casting (to avoid conflicts). We can simply check for a metatable, and if it exists, there is likely another addon already providing click casting configuration.

As you can see, we have a lot of power, and things will be more than okay. I'd like to follow up this week with some basic tutorials and best practices that we can use to standardize click casting within the user interface.
#40 - Oct. 17, 2006, 4:09 p.m.
Blizzard Post
BTW, cladhaire, feel free to post a screenshot of your Clique UI for the Burning Crusade. It's pretty sweet.. :)
#53 - Oct. 18, 2006, 6:23 p.m.
Blizzard Post
Q u o t e:

But the need to always drop current target to heal someone and choose from a lot of spells available - that's not what I really want.


You're in luck. One of the new features of WoW 2.0 is the ability to cast spells on units which are not your current target, as long as they are in your party/raid, or are your current focus.
#60 - Oct. 19, 2006, 4:09 a.m.
Blizzard Post
Q u o t e:


What about if they are the target of party member or raid member or pet? i.e. Can you cast on any valid "unit" or only on the ones you listed in the quote above?


Those are fine, any valid "unit" can be a spell target. The key is that the unit must be defined beforehand, or set up through the secure templates.
#109 - Nov. 8, 2006, 10:06 p.m.
Blizzard Post
Q u o t e:
kk kiddies, flame away with the learn2play, winesomemore, omfgbbqlolz, and all that...


No trolling in stickies please, these are for technical discussion only.
#111 - Nov. 10, 2006, 12:14 a.m.
Blizzard Post
So please post your question without the troll. :)