diff options
Diffstat (limited to 'src/map/chrif.c')
-rw-r--r-- | src/map/chrif.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/src/map/chrif.c b/src/map/chrif.c index 6ac7d5695..d3d0aa10c 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -247,6 +247,7 @@ int chrif_isconnected(void) { * Flag = 1: Character is quitting * Flag = 2: Character is changing map-servers *------------------------------------------*/ +// TODO: Flag enum bool chrif_save(struct map_session_data *sd, int flag) { nullpo_ret(sd); @@ -263,11 +264,11 @@ bool chrif_save(struct map_session_data *sd, int flag) { chrif_check(false); //Character is saved on reconnect. //For data sync - if (sd->state.storage_flag == 2) + if (sd->state.storage_flag == STORAGE_FLAG_GUILD) gstorage->save(sd->status.account_id, sd->status.guild_id, flag); if (flag) - sd->state.storage_flag = 0; //Force close it. + sd->state.storage_flag = STORAGE_FLAG_CLOSED; //Force close it. //Saving of registry values. if (sd->vars_dirty) @@ -401,7 +402,7 @@ bool chrif_changemapserverack(int account_id, int login_id1, int login_id2, int if ( !login_id1 ) { ShowError("chrif_changemapserverack: map server change failed.\n"); - clif->authfail_fd(node->fd, 0); + clif->authfail_fd(node->fd, 0); // Disconnected from server } else clif->changemapserver(node->sd, map_index, x, y, ntohl(ip), ntohs(port)); @@ -465,7 +466,7 @@ int chrif_reconnect(DBKey key, DBData *data, va_list ap) { if( map->mapname2ipport(sd->mapindex,&ip,&port) == 0 ) chrif->changemapserver(sd, ip, port); else //too much lag/timeout is the closest explanation for this error. - clif->authfail_fd(sd->fd, 3); + clif->authfail_fd(sd->fd, 3); // timeout break; } } @@ -643,7 +644,7 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used ( node->sex == sex && node->state == ST_LOGIN ) {// found a match - clif->authfail_fd(node->fd, 0); + clif->authfail_fd(node->fd, 0); // Disconnected from server chrif->auth_delete(account_id, char_id, ST_LOGIN); } } @@ -747,15 +748,15 @@ bool chrif_changeemail(int id, const char *actual_email, const char *new_email) * S 2b0e <accid>.l <name>.24B <type>.w { <additional fields>.12B } * { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } * Send an account modification request to the login server (via char server). - * type of operation {additional fields}: - * 1: block { n/a } - * 2: ban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } - * 3: unblock { n/a } - * 4: unban { n/a } - * 5: changesex { n/a } -- use chrif_changesex - * 6: charban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } - * 7: charunban { n/a } - * 8: changecharsex { <sex>.b } -- use chrif_changesex + * type of operation: @see enum zh_char_ask_name + * block { n/a } + * ban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } + * unblock { n/a } + * unban { n/a } + * changesex { n/a } -- use chrif_changesex + * charban { <year>.w <month>.w <day>.w <hour>.w <minute>.w <second>.w } + * charunban { n/a } + * changecharsex { <sex>.b } -- use chrif_changesex *------------------------------------------*/ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short operation_type, int year, int month, int day, int hour, int minute, int second) { @@ -767,7 +768,7 @@ bool chrif_char_ask_name(int acc, const char* character_name, unsigned short ope safestrncpy((char*)WFIFOP(chrif->fd,6), character_name, NAME_LENGTH); WFIFOW(chrif->fd,30) = operation_type; - if ( operation_type == 2 || operation_type == 6 ) { + if (operation_type == CHAR_ASK_NAME_BAN || operation_type == CHAR_ASK_NAME_CHARBAN) { WFIFOW(chrif->fd,32) = year; WFIFOW(chrif->fd,34) = month; WFIFOW(chrif->fd,36) = day; @@ -795,7 +796,7 @@ bool chrif_changesex(struct map_session_data *sd, bool change_account) WFIFOW(chrif->fd,0) = 0x2b0e; WFIFOL(chrif->fd,2) = sd->status.account_id; safestrncpy((char*)WFIFOP(chrif->fd,6), sd->status.name, NAME_LENGTH); - WFIFOW(chrif->fd,30) = change_account ? 5 : 8; + WFIFOW(chrif->fd,30) = change_account ? CHAR_ASK_NAME_CHANGESEX : CHAR_ASK_NAME_CHANGECHARSEX; if (!change_account) WFIFOB(chrif->fd,32) = sd->status.sex == SEX_MALE ? SEX_FEMALE : SEX_MALE; WFIFOSET(chrif->fd,44); @@ -812,19 +813,14 @@ bool chrif_changesex(struct map_session_data *sd, bool change_account) /*========================================== * R 2b0f <accid>.l <name>.24B <type>.w <answer>.w * Processing a reply to chrif->char_ask_name() (request to modify an account). - * type of operation: - * 1: block, 2: ban, 3: unblock, 4: unban, 5: changesex, 6: charban, 7: charunban, 8: changecharsex - * type of answer: - * 0: login-server request done - * 1: player not found - * 2: gm level too low - * 3: login-server offline + * type of operation: @see chrif_char_ask_name + * type of answer: @see hz_char_ask_name_answer *------------------------------------------*/ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, uint16 answer) { struct map_session_data* sd; char action[25]; char output[256]; - bool charsrv = ( type == 6 || type == 7 ) ? true : false; + bool charsrv = ( type == CHAR_ASK_NAME_CHARBAN || type == CHAR_ASK_NAME_CHARUNBAN ) ? true : false; sd = map->id2sd(acc); @@ -834,19 +830,19 @@ bool chrif_char_ask_name_answer(int acc, const char* player_name, uint16 type, u } /* re-use previous msg_number */ - if( type == 6 ) type = 2; - if( type == 7 ) type = 4; + if( type == CHAR_ASK_NAME_CHARBAN ) type = CHAR_ASK_NAME_BAN; + if( type == CHAR_ASK_NAME_CHARUNBAN ) type = CHAR_ASK_NAME_UNBAN; - if( type > 0 && type <= 5 ) + if( type >= CHAR_ASK_NAME_BLOCK && type <= CHAR_ASK_NAME_CHANGESEX ) snprintf(action,25,"%s",msg_sd(sd,427+type)); //block|ban|unblock|unban|change the sex of else snprintf(action,25,"???"); switch( answer ) { - case 0 : sprintf(output, msg_sd(sd,charsrv?434:424), action, NAME_LENGTH, player_name); break; - case 1 : sprintf(output, msg_sd(sd,425), NAME_LENGTH, player_name); break; - case 2 : sprintf(output, msg_sd(sd,426), action, NAME_LENGTH, player_name); break; - case 3 : sprintf(output, msg_sd(sd,427), action, NAME_LENGTH, player_name); break; + case CHAR_ASK_NAME_ANS_DONE: sprintf(output, msg_sd(sd,charsrv?434:424), action, NAME_LENGTH, player_name); break; + case CHAR_ASK_NAME_ANS_NOTFOUND: sprintf(output, msg_sd(sd,425), NAME_LENGTH, player_name); break; + case CHAR_ASK_NAME_ANS_GMLOW: sprintf(output, msg_sd(sd,426), action, NAME_LENGTH, player_name); break; + case CHAR_ASK_NAME_ANS_OFFLINE: sprintf(output, msg_sd(sd,427), action, NAME_LENGTH, player_name); break; default: output[0] = '\0'; break; } @@ -904,14 +900,14 @@ bool chrif_divorceack(int char_id, int partner_id) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) - pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); + pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_OTHER); } if( ( sd = map->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) { sd->status.partner_id = 0; for(i = 0; i < MAX_INVENTORY; i++) if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F) - pc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); + pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_OTHER); } return true; |