As we know, exhaust is very important thing in ot server.
Well, function such as doPlayerAddExhaust was very helpful for me, so I made it and now I would like to share it
It's simple:
luascript.cpp
Find:
Add below:
Find:
Add below (as a new function):
luascript.h
Find:
Add below:
Tested with TFS 0.3 on 8.42.
Usage:
doPlayerAddExhaust(uid, A, B)
Where:
uid - target player
A - exhaustion type:
1 - aggressive spells
2 - non-aggressive spells
etc.
B - exhaustation time
Well, function such as doPlayerAddExhaust was very helpful for me, so I made it and now I would like to share it
It's simple:
luascript.cpp
Find:
Code:
//doPlayerAddSkillTry(cid, skillid, n)
lua_register(m_luaState, "doPlayerAddSkillTry", LuaScriptInterface::luaDoPlayerAddSkillTry);
Add below:
Code:
//doPlayerAddExhaust(cid, exhaust)
lua_register(m_luaState, "doPlayerAddExhaust", LuaScriptInterface::luaDoPlayerAddExhaust);
Find:
Code:
int32_t LuaScriptInterface::luaDoPlayerAddSkillTry(lua_State* L)
Add below (as a new function):
Code:
int32_t LuaScriptInterface::luaDoPlayerAddExhaust(lua_State* L)
{
//doPlayerAddExhaust(uid, type, exhaust)
uint32_t exhaust = popNumber(L), type = popNumber(L);
ScriptEnviroment* env = getScriptEnv();
if(Player* player = env->getPlayerByUID(popNumber(L)))
{
player->addExhaust(exhaust, type);
lua_pushboolean(L, LUA_NO_ERROR);
}
else
{
reportErrorFunc(getErrorDesc(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, LUA_ERROR);
}
return 1;
}
luascript.h
Find:
Code:
static int32_t luaDoPlayerAddSkillTry(lua_State* L);
Add below:
Code:
static int32_t luaDoPlayerAddExhaust(lua_State* L);
Tested with TFS 0.3 on 8.42.
Usage:
doPlayerAddExhaust(uid, A, B)
Where:
uid - target player
A - exhaustion type:
1 - aggressive spells
2 - non-aggressive spells
etc.
B - exhaustation time