From 4c4ea452d79b9e80b3d83c88863905f3a3f1688e Mon Sep 17 00:00:00 2001 From: "alexey.min" Date: Sat, 12 May 2012 19:14:08 +0000 Subject: [PATCH] Intercept conect on start again l2c_getUserSkills() done (usage example in sources) --- l2detect/UserAI.cpp | 2 +- l2detect/UserSkills.cpp | 1 + l2detect/main.cpp | 12 ++++++------ l2detect/se_funcs/sef_skills.cpp | 20 +++++++++++++++++++- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/l2detect/UserAI.cpp b/l2detect/UserAI.cpp index fc8cbd2..65b1a23 100644 --- a/l2detect/UserAI.cpp +++ b/l2detect/UserAI.cpp @@ -195,7 +195,7 @@ DWORD WINAPI UserAI::UserAIThread( LPVOID lpParam ) } } if( shouldExit ) break; - if( !was_message ) Sleep( 250 ); + if( !was_message ) Sleep( 100 ); // process all L2Character moves in visible area, also process user move // process buff ticks, skill reuses diff --git a/l2detect/UserSkills.cpp b/l2detect/UserSkills.cpp index a5d76b9..edb9b05 100644 --- a/l2detect/UserSkills.cpp +++ b/l2detect/UserSkills.cpp @@ -159,6 +159,7 @@ void UserSkills::parse_SkillList( L2GamePacket *p ) s.isEnchanted = p->readChar(); // writeC(temp.enchanted ? 1 : 0); addSkill( &s ); } + log_error( LOG_USERAI, "UserSkills::parse_SkillList(): %d skills parsed\n", nSkills ); } void UserSkills::parse_SkillCoolTime( L2GamePacket *p ) diff --git a/l2detect/main.cpp b/l2detect/main.cpp index 86c7240..e8f6d4c 100644 --- a/l2detect/main.cpp +++ b/l2detect/main.cpp @@ -124,12 +124,12 @@ DWORD WINAPI DllThread(LPVOID lpParam) log_error( LOG_WARNING, "Maybe we're running in GameGuard protected program?\n" ); log_error( LOG_WARNING, "Be careful!\n" ); } - //Hook_InterceptConnect_my(); - //if( !Hook_ValidateInterception_my() ) - //{ - // log_error( LOG_ERROR, "Seems like my try to intercept ws2_32.dll!connect() failed.\n" ); - // log_error( LOG_ERROR, "All network connections will not be intercepted!\n" ); - //} + Hook_InterceptConnect_my(); + if( !Hook_ValidateInterception_my() ) + { + log_error( LOG_ERROR, "Seems like my try to intercept ws2_32.dll!connect() failed.\n" ); + log_error( LOG_ERROR, "All network connections will not be intercepted!\n" ); + } //Hook_InterceptConnect_Dis(); // this unused.. #ifdef _MSC_VER } diff --git a/l2detect/se_funcs/sef_skills.cpp b/l2detect/se_funcs/sef_skills.cpp index a530600..b88a965 100644 --- a/l2detect/se_funcs/sef_skills.cpp +++ b/l2detect/se_funcs/sef_skills.cpp @@ -57,12 +57,21 @@ int l2c_isCastingNow( lua_State *L ) // table l2c_getUserSkills() +/* +local sk = l2c_getUserSkills(); +local sks = #sk; +l2h_print( sks, " skills found.\n" ); +local i = 0; +for i=1,sks do + l2h_print( i, ": ", sk[i].skillId, " - ", sk[i].skillName, "\n" ); +end +*/ 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; + int tableIndex = 1; lua_createtable( L, 0, 0 ); int i = 0; char skillName[255] = {0}; @@ -81,7 +90,16 @@ int l2c_getUserSkills( lua_State *L ) lua_pushstring( L, skillName ); lua_settable( L, -3 ); // + lua_pushstring( L, "isActive" ); + lua_pushinteger( L, sk->skill[i].isPassive ? 0 : 1 ); lua_settable( L, -3 ); + // + lua_pushstring( L, "level" ); + lua_pushinteger( L, sk->skill[i].level ); + lua_settable( L, -3 ); + // + lua_settable( L, -3 ); + tableIndex++; } // return 1;