I wanted the players on our server to be able to auto attack while still being able to deal damage with offensive spells and do this meanwhile running, so I sat down and looked through the source and turns out this was a rather simple procedure.
Here's how you do it:
Allow auto attacking without exhausting players (EXHAUST_COMBAT):
Open player.cpp and find:
In this function you'll find an if statement just like the following:
Remove or comment it like this:
Save and rebuild and you're done.
Casting runes while running:
Easy fix as well -- start by opening player.cpp and find:
You'll find a a function call like the following:
Remove or comment it like this:
Save and rebuild and you may run and cast runes/spells without stopping.
Both fixes/changes are stable and thoroughly tested on the TFS 0.3.6pl1 distribution.
Here's how you do it:
Allow auto attacking without exhausting players (EXHAUST_COMBAT):
Open player.cpp and find:
Code:
void Player::doAttacking(uint32_t interval)
In this function you'll find an if statement just like the following:
Code:
else if(!weapon->hasExhaustion() || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT)) && weapon->useWeapon(this, tool, attackedCreature))
Remove or comment it like this:
Code:
else if(!weapon->hasExhaustion() && weapon->useWeapon(this, tool, attackedCreature))
else if(!weapon->hasExhaustion() /* || !hasCondition(CONDITION_EXHAUST, EXHAUST_COMBAT)) */ && weapon->useWeapon(this, tool, attackedCreature))
Save and rebuild and you're done.
Casting runes while running:
Easy fix as well -- start by opening player.cpp and find:
Code:
void Player::onWalk(Direction& dir)
You'll find a a function call like the following:
Code:
setNextAction(OTSYS_TIME() + getStepDuration(dir));
Remove or comment it like this:
Code:
//setNextAction(OTSYS_TIME() + getStepDuration(dir));
Save and rebuild and you may run and cast runes/spells without stopping.
Both fixes/changes are stable and thoroughly tested on the TFS 0.3.6pl1 distribution.