Originally Posted by
Xelper
The reason SetRecastDelay is called so often is because of spells that have a cast time but also have a travel time. It is not very resource intensive at all, it just spams the hell out of the debug log on Advanced.
Say you have an ability that has a 2s cast time, that you cast to put up a buff as priority number one, and that you cast as a filler when everything else is on cooldown. The cast is longer than your GCD, and has a 1.5 second max flight time from 40 yards.
Here is the problem, with only using UNIT_SPELLCAST_SUCCEEDED (we cant use SENT because that can send and it wont cast because you are on GCD):
You cast the spell, it has a delay of 2 seconds. Prior to your spell fully casting, you are already off GCD and ready to start casting the next ability. The bot is thinking "Oh I need to put up this buff still" so it is queueing up that same ability even though you do not want it to cast. You then end up casting that same ability twice in a row.
If you have a better solution I would love to hear it. I do not want to try to use SPELLCAST_SENT to mark it as delayed, then SPELLCAST_FAILED to mark it as not delayed because that could cause the bot to skip over the ability for a cycle and try to cast something else. The bot is performing a dozen other checks per ability anyway, 1 more check for a complete ability check cycle isn't going to cause any major issues.
UNIT_SPELLCAST_START fires only when we start casting a spell with casttime and not instant cast.
Code:
function events:UNIT_SPELLCAST_START(...)
if (select(1, ...) == PQ_player or select(1, ...) == PQ_RaidIndex) then
if PQ_Skills[select(5, ...)] then
PQ_Skills[select(5, ...)].nexttest = select(6, UnitCastingInfo(PQ_player)) / 1000 + PQ_Skills[select(5, ...)].delay
end
end
end
This is what I got and it works fine.Fires only for your spells,then I'm setting RecastDelay= spellcasttime + abilitydelay
So for spells that needs to be chaincasted like Incinerate you can set abilitydelay to negative value and for spells that grants buffs like Soul Fire you can set this to travel time :/
Furthermore you need to use UNIT_SPELLCAST_SUCCEEDED to grab instantcasts also.