[cpp]int32_t LuaScriptInterface::luaGetPlayerSkillLevel(lua_State* L)
{
//getPlayerSkillLevel(cid, skill[, ignoreModifiers = true])
bool ignoreModifiers = true;
if(lua_gettop(L) > 2)
ignoreModifiers = popNumber(L);
uint32_t skill = popNumber(L);
ScriptEnviroment* env = getEnv();
if(const Player* player = env->getPlayerByUID(popNumber(L)))
{
if(skill <= SKILL_LAST)
lua_pushnumber(L, ignoreModifiers ? player->skills[skill][SKILL_LEVEL] :
player->skills[skill][SKILL_LEVEL] + player->getVarSkill((skills_t)skill));
else
lua_pushboolean(L, false);
}
else
{
errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND));
lua_pushboolean(L, false);
}
return 1;
}[/cpp]
[cpp]//
//getPlayerSkillLevel(cid, skill[, ignoreModifiers = true])
lua_register(m_luaState, "getPlayerSkillLevel", LuaScriptInterface::luaGetPlayerSkillLevel);[/cpp]
I'm sure elf won't be happy, but I changed ignoreModifiers to default to true so it won't break the existing scripts, especially those who rely on skill tries.
You'll have to add , false manually in ethereal spear script though.