manerinhu
I'm very very MaNeRiNhU
Hello guys,
I saw a code like this some time ago in this section, but it didn't worked here, so I get his idea and developed my own code.
It adds a new field in "mounts.xml" that's called "attackspeed" which one reduces the delay of attacks.
How it works: If I set attackspeed="1000" to Racing Bird mount, when mounted I will give a hit on monsters each 2000-1000 ms, so it'll be 2x faster, but when not using mounts, it will attack with a 2000 ms delay.
Now, the code:
In mounts.cpp, find:
Add 2 lines below:
find:
change for:
Now in mounts.h, find:
change for:
find:
add below:
find:
add below:
find:
change for:
Now in player.cpp, find:
change the whole function for this one:
Now you are done, I guess.
This also can be used for making other attributes for mounts, like add critical chance or something like.
I saw a code like this some time ago in this section, but it didn't worked here, so I get his idea and developed my own code.
It adds a new field in "mounts.xml" that's called "attackspeed" which one reduces the delay of attacks.
How it works: If I set attackspeed="1000" to Racing Bird mount, when mounted I will give a hit on monsters each 2000-1000 ms, so it'll be 2x faster, but when not using mounts, it will attack with a 2000 ms delay.
Now, the code:
In mounts.cpp, find:
Code:
int32_t speed = 0;
if(readXMLInteger(p, "speed", intValue))
speed = intValue;
Add 2 lines below:
Code:
int32_t attackSpeed = 0;
if(readXMLInteger(p, "attackspeed", intValue))
attackSpeed = intValue;
find:
Code:
Mount* mount = new Mount(name, mountId, clientId,
speed, premium, storageId, storageValue);
change for:
Code:
Mount* mount = new Mount(name, mountId, clientId,
speed, attackSpeed, premium, storageId, storageValue);
Now in mounts.h, find:
Code:
Mount(std::string _name, uint16_t _id, uint16_t _clientId, int32_t _speed,
bool _premium, std::string _storageId, std::string _storageValue)
change for:
Code:
Mount(std::string _name, uint16_t _id, uint16_t _clientId, int32_t _speed, int32_t _attackSpeed,
bool _premium, std::string _storageId, std::string _storageValue)
find:
Code:
id = _id;
add below:
Code:
attackSpeed = _attackSpeed;
find:
Code:
uint32_t getSpeed() const {return speed;}
add below:
Code:
uint32_t getAttackSpeed() const {return attackSpeed;}
find:
Code:
int32_t speed;
change for:
Code:
int32_t speed, attackSpeed;
Now in player.cpp, find:
Code:
uint32_t Player::getAttackSpeed()
change the whole function for this one:
Code:
uint32_t Player::getAttackSpeed() const
{
Mount* mount = Mounts::getInstance()->getMountByCid(currentOutfit.lookMount);
if(!mounted){
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() / std::max((size_t)1, getWeapons().size())));
} else if(mount->getAttackSpeed() > 0){
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() - mount->getAttackSpeed() / std::max((size_t)1, getWeapons().size())));
}
else {
return ((weapon && weapon->getAttackSpeed() != 0) ? weapon->getAttackSpeed() : (vocation->getAttackSpeed() / std::max((size_t)1, getWeapons().size())));
}
}
Now you are done, I guess.
This also can be used for making other attributes for mounts, like add critical chance or something like.