diff options
author | shennetsind <ind@henn.et> | 2014-01-06 15:26:00 -0200 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2014-01-08 11:22:00 -0200 |
commit | b79a9d7efa9213e3c791ec356bf21b712878d1aa (patch) | |
tree | 043173233a97e805a49089a5ced25f213a86217f /src/map/chrif.c | |
parent | 85327cde8e451b8b1bacd1f5a98c034a6f42e5ea (diff) | |
download | hercules-b79a9d7efa9213e3c791ec356bf21b712878d1aa.tar.gz hercules-b79a9d7efa9213e3c791ec356bf21b712878d1aa.tar.bz2 hercules-b79a9d7efa9213e3c791ec356bf21b712878d1aa.tar.xz hercules-b79a9d7efa9213e3c791ec356bf21b712878d1aa.zip |
Introducing Hercules Autotrade Persistency
Aka autotrading merchants survive server restarts.
Originally sekai's (aka me).
Special Thanks to Haruna, Michieru.
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r-- | src/map/chrif.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index e9c3bbabf..7b5cbbe59 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -119,7 +119,7 @@ struct auth_node* chrif_auth_check(int account_id, int char_id, enum sd_state st bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { struct auth_node *node; - + if ( (node = chrif->auth_check(account_id, char_id, state) ) ) { int fd = node->sd ? node->sd->fd : node->fd; @@ -128,7 +128,7 @@ bool chrif_auth_delete(int account_id, int char_id, enum sd_state state) { if ( node->char_dat ) aFree(node->char_dat); - + if ( node->sd ) aFree(node->sd); @@ -486,6 +486,7 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { /// Called when all the connection steps are completed. void chrif_on_ready(void) { + static bool once = false; ShowStatus("Map Server is now online.\n"); chrif->state = 2; @@ -503,6 +504,13 @@ void chrif_on_ready(void) { //Re-save any guild castles that were modified in the disconnection time. guild->castle_reconnect(-1, 0, 0); + + if( !once ) { +#ifdef AUTOTRADE_PERSISTENCY + pc->autotrade_load(); +#endif + once = true; + } } @@ -544,22 +552,23 @@ int chrif_scdata_request(int account_id, int char_id) { /*========================================== * Request auth confirmation *------------------------------------------*/ -void chrif_authreq(struct map_session_data *sd) { +void chrif_authreq(struct map_session_data *sd, bool hstandalone) { struct auth_node *node= chrif->search(sd->bl.id); - + if( node != NULL || !chrif->isconnected() ) { set_eof(sd->fd); return; } - WFIFOHEAD(chrif->fd,19); + WFIFOHEAD(chrif->fd,20); WFIFOW(chrif->fd,0) = 0x2b26; WFIFOL(chrif->fd,2) = sd->status.account_id; WFIFOL(chrif->fd,6) = sd->status.char_id; WFIFOL(chrif->fd,10) = sd->login_id1; WFIFOB(chrif->fd,14) = sd->status.sex; WFIFOL(chrif->fd,15) = htonl(session[sd->fd]->client_addr); - WFIFOSET(chrif->fd,19); + WFIFOB(chrif->fd,19) = hstandalone ? 1 : 0; + WFIFOSET(chrif->fd,20); chrif->sd_to_auth(sd, ST_LOGIN); } |