Blizzard has made in-combat weapon swapping a protected action, so this addon is no longer able to function properly.
ItemRackStun is a LoD plugin for Gello's ItemRack addon that adds stun/disarm (or anything that causes you lose control of your character or weapon) detection, allowing weapon/gear changes to be postponed until those effects fade (instead of ItemRack trying a few times and then giving up; waiting until combat fades; etc...).
Example:
1) You use a macro which tells ItemRack to equip a sword/shield.
2) Another player disarms you either before or during your weapon swap.
3a) Without ItemRackStun: Normally, ItemRack would just keep trying to equip the weapon even though you can't swap weapons while disarmed. Eventually ItemRack would give up, sometimes disabling your ability to swap weapons until combat fades.
3b) With ItemRackStun: ItemRack detects that you've been disarmed and queues the weapon swap to be completed after disarm fades.
CanCastOptionParse:
I've added a new options parser for insecure actions (talking, dismounting, changing equipment, etc...) that checks a spell's casting status in addition to the player's control status.
The new options are:
spell(or &)=* -> The spell that is going to be checked. (If this is not specified then all other options will be ignored.)
gcd=* -> The maximum amount of time left on the spells cooldown in order to be considered ready. (Default: 0)
ignore:control/equip/form/reagent -> Specifies if the parser should ignore any spell form/equipment/reagent requirements or if the player is unable to act.
cast=*: Can be either start/stop/done/fail and will cause the command to be passed along to a handle which will be triggered when the provided spell (spell=* or the next sent spell) cast has either started, stopped, finished or failed.
no*: If any (or rather most) of the above options are prefixed with 'no' then the opposite will be checked/preformed.
To reiterate: This is only usable with INSECURE ACTIONS. You cannot use this to cast spells, change targets, etc...
Slash Commands:
/dismount & /itemrack: Now use CanCastOptionParse, so you can preform actions based on spell conditions.
/scopt: New command for performing any insecure action.
ex. /scopt [spell=Cyclone] /raid Casting Cyclone on %t!
This will announce "Casting Cyclone on <target>!" in raid chat if cyclone is castable.
Alternatively, you could do:
ex. /scopt [cast=start] /raid Casting Cyclone on %t!
/cast Cyclone
This will perform the same action as in the previous example except it will be triggered when the casting of Cyclone begins.
History:
Blizzard's default API does not give any information whether a player is disarmed or completely unable to act (the closest is HasFullControl() which only returns false for Fear effects). So, I've created a library that watches for effects (gathered from WoW's DBC files) that cause the player to be stunned/feared/charmed/confused/disarmed and offers new functions and events regarding the players control state.
I'll be adding features as I (or anyone with any suggestions) comes up with them.
There are no options (and I can't really think of any to add), but if you have any you'd like to see please feel free to comment on them.