diff options
author | shennetsind <ind@henn.et> | 2013-08-04 12:19:25 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-08-08 15:07:40 -0300 |
commit | 6b9f58446c46877ecfc5fe40847636145acf5af8 (patch) | |
tree | 81b71aa95a47e611a5415528cf72efefe0d552b1 /src/login | |
parent | defac0ef9714121a872ab48c3f6c4ddd177ae509 (diff) | |
download | hercules-6b9f58446c46877ecfc5fe40847636145acf5af8.tar.gz hercules-6b9f58446c46877ecfc5fe40847636145acf5af8.tar.bz2 hercules-6b9f58446c46877ecfc5fe40847636145acf5af8.tar.xz hercules-6b9f58446c46877ecfc5fe40847636145acf5af8.zip |
HPM Update
- Custom Packet Support
- Custom Data Struct Support (currently append-able to map_session_data and socket_data)
- Char Server Support
- Login Server Support
http://hercules.ws/board/topic/1934-hercules-plugin-manager-update/
Documentation will soon be updated in http://hercules.ws/wiki/HPM
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/account.h | 2 | ||||
-rw-r--r-- | src/login/account_sql.c | 3 | ||||
-rw-r--r-- | src/login/login.c | 49 |
3 files changed, 36 insertions, 18 deletions
diff --git a/src/login/account.h b/src/login/account.h index 999c93075..f55e38b0c 100644 --- a/src/login/account.h +++ b/src/login/account.h @@ -135,6 +135,6 @@ struct AccountDB AccountDBIterator* (*iterator)(AccountDB* self); }; -void account_db_sql_up(AccountDB* self); +Sql *account_db_sql_up(AccountDB* self); #endif // __ACCOUNT_H_INCLUDED__ diff --git a/src/login/account_sql.c b/src/login/account_sql.c index 218248c82..533b3d860 100644 --- a/src/login/account_sql.c +++ b/src/login/account_sql.c @@ -687,10 +687,11 @@ static bool mmo_auth_tosql(AccountDB_SQL* db, const struct mmo_account* acc, boo return result; } -void account_db_sql_up(AccountDB* self) { +Sql* account_db_sql_up(AccountDB* self) { AccountDB_SQL* db = (AccountDB_SQL*)self; Sql_HerculesUpdateCheck(db->accounts); #ifdef CONSOLE_INPUT console->setSQL(db->accounts); #endif + return db->accounts; } diff --git a/src/login/login.c b/src/login/login.c index a17faa058..f92f0094d 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -11,6 +11,7 @@ #include "../common/socket.h" #include "../common/strlib.h" #include "../common/timer.h" +#include "../common/HPM.h" #include "account.h" #include "ipban.h" #include "login.h" @@ -372,12 +373,17 @@ int parse_fromchar(int fd) ipl = server[id].ip; ip2str(ipl, ip); - while( RFIFOREST(fd) >= 2 ) - { + while( RFIFOREST(fd) >= 2 ) { uint16 command = RFIFOW(fd,0); - switch( command ) - { + if( HPM->packetsc[hpParse_FromChar] ) { + if( (j = HPM->parse_packets(fd,hpParse_FromChar)) ) { + if( j == 1 ) continue; + if( j == 2 ) return 0; + } + } + + switch( command ) { case 0x2712: // request from char-server to authenticate an account if( RFIFOREST(fd) < 23 ) @@ -1324,12 +1330,17 @@ int parse_login(int fd) sd->fd = fd; } - while( RFIFOREST(fd) >= 2 ) - { + while( RFIFOREST(fd) >= 2 ) { uint16 command = RFIFOW(fd,0); - switch( command ) - { + if( HPM->packetsc[hpParse_Login] ) { + if( (result = HPM->parse_packets(fd,hpParse_Login)) ) { + if( result == 1 ) continue; + if( result == 2 ) return 0; + } + } + + switch( command ) { case 0x0200: // New alive packet: structure: 0x200 <account.userid>.24B. used to verify if client is always alive. if (RFIFOREST(fd) < 26) @@ -1688,15 +1699,17 @@ void do_final(void) int i; struct client_hash_node *hn = login_config.client_hash_nodes; - while (hn) - { + ShowStatus("Terminating...\n"); + + HPM->event(HPET_FINAL); + + while (hn) { struct client_hash_node *tmp = hn; hn = hn->next; aFree(tmp); } login_log(0, "login server", 100, "login server shutdown"); - ShowStatus("Terminating...\n"); if( login_config.log_login ) loginlog_final(); @@ -1770,7 +1783,7 @@ int do_init(int argc, char** argv) login_lan_config_read((argc > 2) ? argv[2] : LAN_CONF_NAME); rnd_init(); - + for( i = 0; i < ARRAYLENGTH(server); ++i ) chrif_server_init(i); @@ -1780,7 +1793,7 @@ int do_init(int argc, char** argv) // initialize static and dynamic ipban system ipban_init(); - + // Online user database init online_db = idb_alloc(DB_OPT_RELEASE_DATA); iTimer->add_timer_func_list(waiting_disconnect_timer, "waiting_disconnect_timer"); @@ -1814,6 +1827,10 @@ int do_init(int argc, char** argv) } } + HPM->share(account_db_sql_up(accounts),"sql_handle"); + HPM->config_read(); + HPM->event(HPET_INIT); + // server port open & binding if( (login_fd = make_listen_bind(login_config.login_ip,login_config.login_port)) == -1 ) { ShowFatalError("Failed to bind to port '"CL_WHITE"%d"CL_RESET"'\n",login_config.login_port); @@ -1824,11 +1841,11 @@ int do_init(int argc, char** argv) shutdown_callback = do_shutdown; runflag = LOGINSERVER_ST_RUNNING; } - - account_db_sql_up(accounts); ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %u).\n\n", login_config.login_port); login_log(0, "login server", 100, "login server started"); - + + HPM->event(HPET_READY); + return 0; } |