This commit is contained in:
alexey.min
2012-05-10 13:05:31 +00:00
parent 9fe62a4274
commit 070dc51e92
5 changed files with 48 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ void SE_funcs_register( lua_State *L )
lua_register( L, "l2c_getSkillLevel", l2c_getSkillLevel );
lua_register( L, "l2c_getSkillReuseLeft", l2c_getSkillReuseLeft );
lua_register( L, "l2c_isCastingNow", l2c_isCastingNow );
lua_register( L, "l2c_getUserSkills", l2c_getUserSkills );
// Buffs
lua_register( L, "l2c_getBuffs", l2c_getBuffs );
lua_register( L, "l2c_buffCancel", l2c_buffCancel );

View File

@@ -48,6 +48,7 @@ int l2c_useSkill( lua_State *L );
int l2c_getSkillLevel( lua_State *L );
int l2c_getSkillReuseLeft( lua_State *L );
int l2c_isCastingNow( lua_State *L );
int l2c_getUserSkills( lua_State *L );
// Buffs
int l2c_getBuffs( lua_State *L );
int l2c_buffCancel( lua_State *L );

View File

@@ -54,3 +54,35 @@ int l2c_isCastingNow( lua_State *L )
lua_pushboolean( L, b );
return 1;
}
// table l2c_getUserSkills()
int l2c_getUserSkills( lua_State *L )
{
if( !g_game_client ) { lua_pushboolean( L, 0 ); return 1; }
UserSkills *sk = &(g_game_client->ai.skills);
//
int tableIndex = 0;
lua_createtable( L, 0, 0 );
int i = 0;
char skillName[255] = {0};
for( i=0; i<UserSkills::USERSKILL_MAX_SKILLS; i++ )
{
if( sk->skill[i].isUnused() ) continue;
sk->skill[i].getSkillName( skillName, sizeof(skillName)-1 );
lua_pushnumber( L, tableIndex );
lua_createtable( L, 0, 0 );
//
lua_pushstring( L, "skillId" );
lua_pushinteger( L, sk->skill[i].skillID );
lua_settable( L, -3 );
//
lua_pushstring( L, "skillName" );
lua_pushstring( L, skillName );
lua_settable( L, -3 );
//
lua_settable( L, -3 );
}
//
return 1;
}