Yo, tinkering with ability properties tonight. Testly mostly with Alchemist, tried to get these values under all possible states of the ability (Targeting state, Animating State, Casted State, etc) Here are my findings:
m_bInAbilityPhase - most useful of the bunch, is "true" if the hero is casting (in cast animations) for the targeted ability.
m_bToggleState - True if the ability is a toggle-type ability (WD's heal) and is active.
m_bActivated - In my tests, always true.
m_iDirtyButtons - Always 0 in my tests. Maybe relates to autocast button graphics or something like that
m_hOwnerEntity - Links to owning hero. Woo!
m_hEffectEntity - Always returns index -1 in my tests.
m_iLevel - Skill's level.
m_iManaCost - Returns ability's mana cost, though changing it (atleast, with my technique: after a hero has been initialized in spawn) does not affect actual mana consumption.
m_flCooldownLength - 0 If the spell has not been cast yet, if it has, a number I don't understand. In my tests this number only changes if the spell is cast under a different cooldown (i.e. when it has been leveled) Here are some examples:
1101004800 - Cask Level 1 (20 Second Cooldown)
109956224 - Cask Level 2 (18 Second Cooldown)
1096810496 - Cask Level 4 (14? Second Cooldown)
Doing some cast detection using the above information, here's cheeky psuedo-sample code since the sun's almost up
Code:
//somewhere else
new bool:wasAnimating = false;
new bool:recentCast = false;
hero = GetEntPropEnt(client, Send_Prop, "m_hAssignedHero");
ability = GetEntPropEnt(hero, Send_Prop, "m_hAbilities", 0); //first ability
public OnGameFrame()
{
for (everyclient)
{
if (everythingisalright)
{
new abilityPhase = GetEntProp(ability, Send_Prop, "m_bInAbilityPhase");
new Float:cooldown = GetEntPropFloat(ability, Send_Prop, "m_flCooldownLength");
if (wasAnimating && cooldown > 0)
{
//cast confirmed, set CooldownLength to 0 so we can use it to confirm that an ability was cast recently again
SetEntPropFloat(ability, Send_Prop, "m_flCooldownLength", 0);
}
if (abilityPhase)
{
//hero is animating
wasAnimating = true;
}
else wasAnimating = false;
}
}
}
Untested, but barring any would-be obvious logical errors, it will work unless:
Resetting CooldownLength to 0 fails in some way
My assumption that CooldownLength is set in the same frame in which InAbilityPhase is reset to 0 after cast completion is incorrect. If this is the case then it seems that some small grace period could be added in easily.