peteralto
Member
- Joined
- Nov 1, 2020
- Messages
- 93
- Solutions
- 1
- Reaction score
- 19
Would it be possible to include a check in this function, so that classicAttackSpeed only works for players with storage x = 1? The idea would be to limit this feature so that only a few people can have this advantage, without the server exploding.
TFS 1.3 downgrade
player.cpp
TFS 1.3 downgrade
player.cpp
C++:
void Player::doAttacking(uint32_t)
{
if (lastAttack == 0) {
lastAttack = OTSYS_TIME() - getAttackSpeed() - 1;
}
if (hasCondition(CONDITION_PACIFIED)) {
return;
}
if ((OTSYS_TIME() - lastAttack) >= getAttackSpeed()) {
bool result = false;
Item* tool = getWeapon();
const Weapon* weapon = g_weapons->getWeapon(tool);
uint32_t delay = getAttackSpeed();
bool classicSpeed = g_config.getBoolean(ConfigManager::CLASSIC_ATTACK_SPEED);
if (weapon) {
if (!weapon->interruptSwing()) {
result = weapon->useWeapon(this, tool, attackedCreature);
} else if (!classicSpeed && !canDoAction()) {
delay = getNextActionTime();
} else {
result = weapon->useWeapon(this, tool, attackedCreature);
}
} else {
result = Weapon::useFist(this, attackedCreature);
}
SchedulerTask* task = createSchedulerTask(std::max<uint32_t>(SCHEDULER_MINTICKS, delay),
[id = getID()]() { g_game.checkCreatureAttack(id); });
if (!classicSpeed) {
setNextActionTask(task, false);
} else {
g_scheduler.addEvent(task);
}
if (result) {
lastAttack = OTSYS_TIME();
}
}
}
Last edited: