dragon1155
Member
- Joined
- Mar 5, 2010
- Messages
- 136
- Reaction score
- 8
Hey guys, I'm having trouble getting the attack speed attribute to work with crossbows and bows. I tried a workaround I found in another discussion, but strangely, it only works when the attack speed attribute is applied to the ammunition, completely ignoring the attribute applied to the distance weapon.
player.cpp:
so, I think this line is for regular weapons (not including distance weapons that use ammunition):
player.cpp:
interestingly, the attack speed value set for vocation in vocations.xml works well with all weapon types. Im not familiar with C++ at all, so i would really appreciate any suggestions and tips on what to do. TFS 0.4
player.cpp:
C++:
void Player::doAttacking(uint32_t)
{
Item* item = getWeapon(false);
uint32_t attackSpeed = (item && item->getAttackSpeed() != 0) ? item->getAttackSpeed() : getAttackSpeed();
if(!lastAttack)
lastAttack = OTSYS_TIME() - attackSpeed - 1;
else if((OTSYS_TIME() - lastAttack) < attackSpeed)
return;
if(hasCondition(CONDITION_PACIFIED) && !hasCustomFlag(PlayerCustomFlag_IgnorePacification))
{
lastAttack = OTSYS_TIME();
return;
}
if(const Weapon* _weapon = g_weapons->getWeapon(item))
{
player.cpp:
C++:
uint32_t Player::getAttackSpeed() const
{
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() / std::max((size_t)1, getWeapons().size())));
}