Function tested in TFS 0.3.5Pl1
player.cpp
Find:
Replace with this:
Find:
And replace with this:
At the end of the file paste this:
player.h
Below:
Paste this:
Below:
Paste this:
luascript.cpp
Below:
Add this:
After:
Paste this:
luacript.h
Below:
Add:
How to use?
Now compile and enjoy
player.cpp
Find:
Code:
lastAttack = idleTime = marriage = blessings = balance = premiumDays = mana = manaMax = manaSpent = 0;
Replace with this:
Code:
lastAttack = idleTime = marriage = blessings = balance = premiumDays = mana = manaMax = manaSpent = extraAttackSpeed = 0;
Find:
Code:
return vocation->getAttackSpeed()
And replace with this:
Code:
return vocation->getAttackSpeed() - getPlayer()->getExtraAttackSpeed();
At the end of the file paste this:
Code:
void Player::setPlayerExtraAttackSpeed(uint32_t speed)
{
extraAttackSpeed = speed;
}
player.h
Below:
Code:
uint64_t getSpentMana() const {return manaSpent;}
Paste this:
Code:
uint32_t getExtraAttackSpeed() const {return extraAttackSpeed;}
void setPlayerExtraAttackSpeed(uint32_t speed);
Below:
Code:
uint32_t idleTime;
Paste this:
Code:
uint32_t extraAttackSpeed;
luascript.cpp
Below:
Code:
//doPlayerAddSoul(cid, soul)
lua_register(m_luaState, "doPlayerAddSoul", LuaInterface::luaDoPlayerAddSoul);
Add this:
Code:
//doPlayerSetExtraAttackSpeed(cid, speed)
lua_register(m_luaState, "doPlayerSetExtraAttackSpeed", LuaInterface::luaDoPlayerSetExtraAttackSpeed);
After:
Code:
int32_t LuaInterface::luaDoPlayerAddSoul(lua_State* L)
{
//doPlayerAddSoul(cid, soul)
int32_t soul = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->changeSoul(soul);
lua_pushboolean(L, true);
}
else
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}
Paste this:
Code:
int32_t LuaInterface::luaDoPlayerSetExtraAttackSpeed(lua_State *L)
{
uint32_t speed = popNumber(L);
ScriptEnviroment* env = getEnv();
if(Player* player = env->getPlayerByUID(popNumber(L))){
player->setPlayerExtraAttackSpeed(speed);
lua_pushnumber(L, true);
}
else{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushnumber(L, false);
}
return 1;
}
luacript.h
Below:
Code:
static int32_t luaDoPlayerAddSoul(lua_State* L);
Add:
Code:
static int32_t luaDoPlayerSetExtraAttackSpeed(lua_State* L);
How to use?
Lua:
doPlayerSetExtraAttackSpeed(cid, 2000) <- attack speed will be 2 seconds more faster
Now compile and enjoy
Last edited: