@@ -205,13 +205,14 @@ static struct DBData char_create_online_char_data(union DBKey key, va_list args)
205205 return DB -> ptr2data (character );
206206}
207207
208- static void char_set_account_online (int account_id )
208+ static void char_set_account_online (int account_id , bool standalone )
209209{
210210 WFIFOHEAD (chr -> login_fd , sizeof (struct PACKET_CHARLOGIN_SET_ACCOUNT_ONLINE ));
211211
212212 struct PACKET_CHARLOGIN_SET_ACCOUNT_ONLINE * p = WFIFOP (chr -> login_fd , 0 );
213213 p -> packetType = HEADER_CHARLOGIN_SET_ACCOUNT_ONLINE ;
214214 p -> account_id = account_id ;
215+ p -> standalone = standalone ? 1 : 0 ;
215216
216217 WFIFOSET (chr -> login_fd , sizeof (* p ));
217218}
@@ -247,10 +248,10 @@ static void char_set_char_charselect(int account_id)
247248 }
248249
249250 if (chr -> login_fd > 0 && !sockt -> session [chr -> login_fd ]-> flag .eof )
250- chr -> set_account_online (account_id );
251+ chr -> set_account_online (account_id , false );
251252}
252253
253- static void char_set_char_online (bool is_initializing , int char_id , int account_id )
254+ static void char_set_char_online (bool is_initializing , int char_id , int account_id , bool standalone )
254255{
255256 struct online_char_data * character ;
256257 struct mmo_charstatus * cp ;
@@ -284,7 +285,7 @@ static void char_set_char_online(bool is_initializing, int char_id, int account_
284285
285286 //Notify login server
286287 if (chr -> login_fd > 0 && !sockt -> session [chr -> login_fd ]-> flag .eof )
287- chr -> set_account_online (account_id );
288+ chr -> set_account_online (account_id , standalone );
288289}
289290
290291static void char_set_char_offline (int char_id , int account_id )
@@ -3279,7 +3280,7 @@ static void char_parse_frommap_save_character(int fd)
32793280 } else {
32803281 //This may be valid on char-server reconnection, when re-sending characters that already logged off.
32813282 ShowError ("parse_from_map (save-char): Received data for non-existing/offline character (%d:%d).\n" , aid , cid );
3282- chr -> set_char_online (false, cid , aid );
3283+ chr -> set_char_online (false, cid , aid , false );
32833284 }
32843285
32853286 if (RFIFOB (fd ,12 )) {
@@ -3681,7 +3682,7 @@ static void char_parse_frommap_set_all_offline(int fd)
36813682
36823683static void char_parse_frommap_set_char_online (int fd )
36833684{
3684- chr -> set_char_online (false, RFIFOL (fd , 2 ), RFIFOL (fd , 6 ));
3685+ chr -> set_char_online (false, RFIFOL (fd , 2 ), RFIFOL (fd , 6 ), false );
36853686 RFIFOSKIP (fd ,10 );
36863687}
36873688
@@ -3787,12 +3788,12 @@ static void char_parse_frommap_auth_request(int fd)
37873788
37883789 const struct PACKET_MAPCHAR_AUTH_REQ * p = RFIFOP (fd , 0 );
37893790
3790- int account_id = p -> account_id ;
3791- int char_id = p -> char_id ;
3792- int login_id1 = p -> login_id1 ;
3793- char sex = p -> sex ;
3794- uint32 ip = ntohl (p -> client_addr );
3795- char standalone = p -> standalone ;
3791+ int account_id = p -> account_id ;
3792+ int char_id = p -> char_id ;
3793+ int login_id1 = p -> login_id1 ;
3794+ char sex = p -> sex ;
3795+ uint32 ip = ntohl (p -> client_addr );
3796+ uint8 standalone = p -> standalone ;
37963797
37973798 RFIFOSKIP (fd , sizeof (struct PACKET_MAPCHAR_AUTH_REQ ));
37983799
@@ -3804,11 +3805,11 @@ static void char_parse_frommap_auth_request(int fd)
38043805 cd = (struct mmo_charstatus * )uidb_get (chr -> char_db_ ,char_id );
38053806 }
38063807
3807- if ( core -> runflag == CHARSERVER_ST_RUNNING && cd && standalone ) {
3808+ if ( core -> runflag == CHARSERVER_ST_RUNNING && cd != NULL && standalone != 0 ) {
38083809 cd -> sex = sex ;
38093810
38103811 chr -> map_auth_ok (fd , account_id , NULL , cd );
3811- chr -> set_char_online (false, char_id , account_id );
3812+ chr -> set_char_online (false, char_id , account_id , true );
38123813 return ;
38133814 }
38143815
@@ -3827,7 +3828,7 @@ static void char_parse_frommap_auth_request(int fd)
38273828 chr -> map_auth_ok (fd , account_id , node , cd );
38283829 // only use the auth once and mark user online
38293830 idb_remove (auth_db , account_id );
3830- chr -> set_char_online (false, char_id , account_id );
3831+ chr -> set_char_online (false, char_id , account_id , ( standalone != 0 ) );
38313832 }
38323833 else
38333834 {// auth failed
@@ -4583,7 +4584,7 @@ static void char_parse_char_select(int fd, struct char_session_data *sd, uint32
45834584 }
45844585
45854586 /* set char as online prior to loading its data so 3rd party applications will realize the sql data is not reliable */
4586- chr -> set_char_online (true, char_id , sd -> account_id );
4587+ chr -> set_char_online (true, char_id , sd -> account_id , false );
45874588 loginif -> set_char_online (char_id , sd -> account_id );
45884589 if (!chr -> mmo_char_fromsql (char_id , & char_dat , true)) { /* failed? set it back offline */
45894590 chr -> set_char_offline (char_id , sd -> account_id );
0 commit comments