Check for monsters to attack every x seconds
Give up attacking a monster if it can't be reached within x seconds
When disconnected, wait x seconds before reconnecting again reconnect 30
Send the attack packet every x seconds, if it hasn't been send already
If you've just killed a monster, and there are no aggressives,and you're not picking up any items, wait x seconds before doing anything else.