Procházet zdrojové kódy

* Fixed #109
- @charunban is fully usable now
- Updated Inter-Server Packet documentation
* Added misc battle config, 'disp_servervip_msg' (default: no)

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh před 10 roky
rodič
revize
796b97455c

+ 1 - 0
conf/battle/misc.conf

@@ -146,6 +146,7 @@ discount_item_point_shop: 0
 
 // Don't display message "login-serv has been asked to %s the player '%.*s'." (Note 1)
 disp_serverbank_msg: no
+disp_servervip_msg: no
 
 // Delay to allow user resend new mail (default & minimum is 1000)
 mail_delay: 1000

+ 5 - 3
doc/packet_interserv.txt

@@ -2753,11 +2753,13 @@ Currently the max packet size is 0xFFFF (see 'WFIFOSET()' in 'src/common/socket.
 
 0x2b2a
 	Type: ZA
-	Structure: <cmd>.W <cid>.L
-	index: 0,2
-	len: 6
+	Structure: <cmd>.W <aid>.L <character_name>.?B
+	index: 0,2,6
+	len: 6+NAME_LENGTH
 	parameter:
 		- cmd : packet identification (0x2b2a)
+		- aid
+		- character_name
 	desc:
 		- chrif_req_charunban
 

+ 1 - 1
src/char/char_clif.c

@@ -712,7 +712,7 @@ int chclif_parse_charselect(int fd, struct char_session_data* sd,uint32 ipl){
 			WFIFOSET(fd,3);
 			return 1;
 		}
-                
+
 		/* set char as online prior to loading its data so 3rd party applications will realise the sql data is not reliable */
 		char_set_char_online(-2,char_id,sd->account_id);
 		if( !char_mmo_char_fromsql(char_id, &char_dat, true) ) { /* failed? set it back offline */

+ 51 - 50
src/char/char_mapif.c

@@ -1205,7 +1205,8 @@ int chmapif_parse_reqcharban(int fd){
 				|| SQL_SUCCESS != SqlStmt_BindParam(stmt,  1, SQLDT_INT,    (void*)&t_cid,     sizeof(t_cid))
 				|| SQL_SUCCESS != SqlStmt_Execute(stmt)
 
-				) {
+				)
+			{
 				SqlStmt_ShowDebug(stmt);
 				SqlStmt_Free(stmt);
 				return 1;
@@ -1229,13 +1230,13 @@ int chmapif_parse_reqcharban(int fd){
 }
 
 int chmapif_parse_reqcharunban(int fd){
-	if (RFIFOREST(fd) < 6)
-            return 0;
+	if (RFIFOREST(fd) < 6+NAME_LENGTH)
+		return 0;
 	else {
-		int cid = RFIFOL(fd,2);
-		RFIFOSKIP(fd,6);
+		const char* name = (char*)RFIFOP(fd,6);
+		RFIFOSKIP(fd,6+NAME_LENGTH);
 
-		if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `char_id` = '%d' LIMIT 1", schema_config.char_db, cid) ) {
+		if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `name` = '%s' LIMIT 1", schema_config.char_db, name) ) {
 			Sql_ShowDebug(sql_handle);
 			return 1;
 		}
@@ -1249,7 +1250,7 @@ int chmapif_parse_reqcharunban(int fd){
 */
 int chmapif_bonus_script_get(int fd) {
 	if (RFIFOREST(fd) < 6)
-            return 0;
+		return 0;
 	else {
 		int cid;
 		cid = RFIFOL(fd,2);
@@ -1301,7 +1302,7 @@ int chmapif_bonus_script_get(int fd) {
 */
 int chmapif_bonus_script_save(int fd) {
 	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
-            return 0;
+		return 0;
 	else {
 		int count, cid;
 
@@ -1342,7 +1343,7 @@ int chmapif_bonus_script_save(int fd) {
  */
 int chmapif_parse(int fd){
 	int id; //mapserv id
-        
+
 	ARR_FIND( 0, ARRAYLENGTH(map_server), id, map_server[id].fd == fd );
 	if( id == ARRAYLENGTH(map_server) )
 	{// not a map server
@@ -1361,47 +1362,47 @@ int chmapif_parse(int fd){
 	while(RFIFOREST(fd) >= 2){
 		int next=1;
 		switch(RFIFOW(fd,0)){
-            case 0x2736: next=chmapif_parse_updmapip(fd,id); break;
-            case 0x2afa: next=chmapif_parse_getmapname(fd,id); break;
-            case 0x2afc: next=chmapif_parse_askscdata(fd); break;
-            case 0x2afe: next=chmapif_parse_getusercount(fd,id); break; //get nb user
-            case 0x2aff: next=chmapif_parse_regmapuser(fd,id); break; //register users
-            case 0x2b01: next=chmapif_parse_reqsavechar(fd,id); break;
-            case 0x2b02: next=chmapif_parse_authok(fd); break;
-            case 0x2b05: next=chmapif_parse_reqchangemapserv(fd); break;
-            case 0x2b07: next=chmapif_parse_askrmfriend(fd); break;
-            case 0x2b08: next=chmapif_parse_reqcharname(fd); break;
-            case 0x2b0a: next=chmapif_parse_req_skillcooldown(fd); break;
-            case 0x2b0c: next=chmapif_parse_reqnewemail(fd); break;
-            case 0x2b0e: next=chmapif_parse_fwlog_changestatus(fd); break;
-            case 0x2b10: next=chmapif_parse_updfamelist(fd); break;
-            case 0x2b11: next=chmapif_parse_reqdivorce(fd); break;
-            case 0x2b15: next=chmapif_parse_req_saveskillcooldown(fd); break;
-            case 0x2b16: next=chmapif_parse_updmapinfo(fd); break;
-            case 0x2b17: next=chmapif_parse_setcharoffline(fd); break;
-            case 0x2b18: next=chmapif_parse_setalloffline(fd,id); break;
-            case 0x2b19: next=chmapif_parse_setcharonline(fd,id); break;
-            case 0x2b1a: next=chmapif_parse_reqfamelist(fd); break;
-            case 0x2b1c: next=chmapif_parse_save_scdata(fd); break;
-            case 0x2b23: next=chmapif_parse_keepalive(fd); break;
-            case 0x2b26: next=chmapif_parse_reqauth(fd,id); break;
-            case 0x2b28: chmapif_parse_reqcharban(fd); break; //charban
-            case 0x2b2a: chmapif_parse_reqcharunban(fd); break; //charunban
-            //case 0x2b2c: /*free*/; break;
-            case 0x2b2d: chmapif_bonus_script_get(fd); break; //Load data
-            case 0x2b2e: chmapif_bonus_script_save(fd); break;//Save data
-            case 0x3008: next=chmapif_parse_fw_configstats(fd); break;
-            default:
-            {
-                    // inter server - packet
-                    int r = inter_parse_frommap(fd);
-                    if (r == 1) break;		// processed
-                    if (r == 2) return 0;	// need more packet
-                    // no inter server packet. no char server packet -> disconnect
-                    ShowError("Unknown packet 0x%04x from map server, disconnecting.\n", RFIFOW(fd,0));
-                    set_eof(fd);
-                    return 0;
-            }
+			case 0x2736: next=chmapif_parse_updmapip(fd,id); break;
+			case 0x2afa: next=chmapif_parse_getmapname(fd,id); break;
+			case 0x2afc: next=chmapif_parse_askscdata(fd); break;
+			case 0x2afe: next=chmapif_parse_getusercount(fd,id); break; //get nb user
+			case 0x2aff: next=chmapif_parse_regmapuser(fd,id); break; //register users
+			case 0x2b01: next=chmapif_parse_reqsavechar(fd,id); break;
+			case 0x2b02: next=chmapif_parse_authok(fd); break;
+			case 0x2b05: next=chmapif_parse_reqchangemapserv(fd); break;
+			case 0x2b07: next=chmapif_parse_askrmfriend(fd); break;
+			case 0x2b08: next=chmapif_parse_reqcharname(fd); break;
+			case 0x2b0a: next=chmapif_parse_req_skillcooldown(fd); break;
+			case 0x2b0c: next=chmapif_parse_reqnewemail(fd); break;
+			case 0x2b0e: next=chmapif_parse_fwlog_changestatus(fd); break;
+			case 0x2b10: next=chmapif_parse_updfamelist(fd); break;
+			case 0x2b11: next=chmapif_parse_reqdivorce(fd); break;
+			case 0x2b15: next=chmapif_parse_req_saveskillcooldown(fd); break;
+			case 0x2b16: next=chmapif_parse_updmapinfo(fd); break;
+			case 0x2b17: next=chmapif_parse_setcharoffline(fd); break;
+			case 0x2b18: next=chmapif_parse_setalloffline(fd,id); break;
+			case 0x2b19: next=chmapif_parse_setcharonline(fd,id); break;
+			case 0x2b1a: next=chmapif_parse_reqfamelist(fd); break;
+			case 0x2b1c: next=chmapif_parse_save_scdata(fd); break;
+			case 0x2b23: next=chmapif_parse_keepalive(fd); break;
+			case 0x2b26: next=chmapif_parse_reqauth(fd,id); break;
+			case 0x2b28: next=chmapif_parse_reqcharban(fd); break; //charban
+			case 0x2b2a: next=chmapif_parse_reqcharunban(fd); break; //charunban
+			//case 0x2b2c: /*free*/; break;
+			case 0x2b2d: next=chmapif_bonus_script_get(fd); break; //Load data
+			case 0x2b2e: next=chmapif_bonus_script_save(fd); break;//Save data
+			case 0x3008: next=chmapif_parse_fw_configstats(fd); break;
+			default:
+			{
+					// inter server - packet
+					int r = inter_parse_frommap(fd);
+					if (r == 1) break;		// processed
+					if (r == 2) return 0;	// need more packet
+					// no inter server packet. no char server packet -> disconnect
+					ShowError("Unknown packet 0x%04x from map server, disconnecting.\n", RFIFOW(fd,0));
+					set_eof(fd);
+					return 0;
+			}
 		} // switch
 		if(next==0) return 0; //avoid processing rest of packet
 	} // while

+ 27 - 22
src/map/atcommand.c

@@ -2889,8 +2889,9 @@ ACMD_FUNC(char_block)
 		return -1;
 	}
 
-	chrif_req_login_operation(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0); // type: 1 - block
-	clif_displaymessage(fd, msg_txt(sd,88)); // Character name sent to char-server to ask it.
+	chrif_req_login_operation(sd->status.account_id, atcmd_player_name, CHRIF_OP_LOGIN_BLOCK, 0, 0, 0); // type: 1 - block
+	sprintf(atcmd_output, msg_txt(sd,88), "login"); // Sending request to %s server...
+	clif_displaymessage(fd, atcmd_output);
 
 	return 0;
 }
@@ -2903,15 +2904,15 @@ ACMD_FUNC(char_block)
 ACMD_FUNC(char_ban)
 {
 	char * modif_p;
-	int32 timediff=0; //don't set this as uint as we may want to decrease banned time
-	int bantype=0; //2=account block, 6=char specific
+	int32 timediff = 0; //don't set this as uint as we may want to decrease banned time
+	int bantype = 0; //2=account block, 6=char specific
 
 	nullpo_retr(-1, sd);
 
 	memset(atcmd_output, '\0', sizeof(atcmd_output));
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
 
-	bantype = strcmpi(command+1,"charban")?2:6; //! FIXME this breaking alias recognition
+	bantype = strcmpi(command+1,"charban") ? CHRIF_OP_LOGIN_BAN : CHRIF_OP_BAN; //! FIXME this breaking alias recognition
 	if (!message || !*message || sscanf(message, "%255s %23[^\n]", atcmd_output, atcmd_player_name) < 2) {
 		clif_displaymessage(fd, msg_txt(sd,1022)); // Please enter ban time and a player name (usage: @charban/@ban/@banish/@charbanish <time> <char name>).
 		return -1;
@@ -2925,28 +2926,29 @@ ACMD_FUNC(char_ban)
 
 	if (timediff == 0) { //allow negative ?
 		char output[256];
-		safesnprintf(output,sizeof(output),msg_txt(sd,85),bantype==6?"charban":"ban",timediff); // Invalid time for %s command (time=%d)
+		safesnprintf(output, sizeof(output), msg_txt(sd,85), bantype == CHRIF_OP_BAN ? "charban" : "ban", timediff); // Invalid time for %s command (time=%d)
 		clif_displaymessage(fd, output);
 		clif_displaymessage(fd, msg_txt(sd,702)); // Time parameter format is +/-<value> to alter. y/a = Year, m = Month, d/j = Day, h = Hour, n/mn = Minute, s = Second.
 		return -1;
 	}
 	
 	if( timediff<0 && (
-		( bantype==2 && !pc_can_use_command(sd, "unban", COMMAND_ATCOMMAND) ) 
-		|| ( bantype==6 && !pc_can_use_command(sd, "charunban", COMMAND_ATCOMMAND)) )
-		){
+		( bantype==CHRIF_OP_LOGIN_BAN && !pc_can_use_command(sd, "unban", COMMAND_ATCOMMAND) ) 
+		|| ( bantype==CHRIF_OP_BAN && !pc_can_use_command(sd, "charunban", COMMAND_ATCOMMAND)) )
+		)
+	{
 		clif_displaymessage(fd,msg_txt(sd,1023)); // You are not allowed to alter the time of a ban.
 		return -1;
 	}
 	
-	if(bantype==2) 
-		chrif_req_login_operation(sd->status.account_id, atcmd_player_name, 2, timediff, 0, 0); // type: 2 - ban
+	if (bantype == CHRIF_OP_LOGIN_BAN) 
+		chrif_req_login_operation(sd->status.account_id, atcmd_player_name, CHRIF_OP_LOGIN_BAN, timediff, 0, 0); // type: 2 - ban
 	else 
 		chrif_req_charban(sd->status.account_id, atcmd_player_name,timediff);
-	
+
 	{
 		char output[256];
-		safesnprintf(output,sizeof(output),msg_txt(sd,88),bantype==6?"char":"login"); // Sending request to %s server...
+		safesnprintf(output, sizeof(output), msg_txt(sd,88), bantype == CHRIF_OP_BAN ? "char" : "login"); // Sending request to %s server...
 		clif_displaymessage(fd, output);
 	}
 	return 0;
@@ -2967,8 +2969,9 @@ ACMD_FUNC(char_unblock)
 	}
 
 	// send answer to login server via char-server
-	chrif_req_login_operation(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0); // type: 3 - unblock
-	clif_displaymessage(fd, msg_txt(sd,88)); // Character name sent to char-server to ask it.
+	chrif_req_login_operation(sd->status.account_id, atcmd_player_name, CHRIF_OP_LOGIN_UNBLOCK, 0, 0, 0); // type: 3 - unblock
+	sprintf(atcmd_output, msg_txt(sd,88), "login"); // Sending request to %s server...
+	clif_displaymessage(fd, atcmd_output);
 
 	return 0;
 }
@@ -2978,11 +2981,12 @@ ACMD_FUNC(char_unblock)
  * char unban command (usage: charunban <player_name>)
  *------------------------------------------*/
 ACMD_FUNC(char_unban){
-	int unbantype=0;
+	int unbantype = 0;
 	nullpo_retr(-1, sd);
 
+	memset(atcmd_output, '\0', sizeof(atcmd_output));
 	memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-	unbantype = strcmpi(command+1,"charunban")?4:7; //! FIXME this breaking alias recognition
+	unbantype = strcmpi(command+1,"charunban") ? CHRIF_OP_LOGIN_UNBAN : CHRIF_OP_UNBAN; //! FIXME this breaking alias recognition
 
 	if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {	
 		if(unbantype==4) clif_displaymessage(fd, msg_txt(sd,1025)); // Please enter a player name (usage: @unblock <char name>).
@@ -2990,11 +2994,12 @@ ACMD_FUNC(char_unban){
 		return -1;
 	} 
 	
-	if(unbantype==4) // send answer to login server via char-server
-		chrif_req_login_operation(sd->status.account_id, atcmd_player_name, 4, 0, 0, 0); // type: 4 - unban
+	if (unbantype == CHRIF_OP_LOGIN_UNBAN) // send answer to login server via char-server
+		chrif_req_login_operation(sd->status.account_id, atcmd_player_name, CHRIF_OP_LOGIN_UNBAN, 0, 0, 0); // type: 4 - unban
 	else //directly unban via char-serv
-		chrif_req_charunban(sd->status.char_id);
-	clif_displaymessage(fd, msg_txt(sd,88)); // Character name sent to char-server to ask it.
+		chrif_req_charunban(sd->status.account_id,atcmd_player_name);
+	sprintf(atcmd_output, msg_txt(sd,88), unbantype == CHRIF_OP_UNBAN ? "char":"login"); // Sending request to %s server...
+	clif_displaymessage(fd, atcmd_output);
 
 	return 0;
 }
@@ -9395,7 +9400,7 @@ ACMD_FUNC(vip) {
 			clif_displaymessage(fd,atcmd_output);
 		}
 	}
-	chrif_req_login_operation(pl_sd->status.account_id, pl_sd->status.name, 6, vipdifftime, 7, 0); 
+	chrif_req_login_operation(pl_sd->status.account_id, pl_sd->status.name, CHRIF_OP_LOGIN_VIP, vipdifftime, 7, 0); 
 	return 0;
 }
 

+ 1 - 0
src/map/battle.c

@@ -7892,6 +7892,7 @@ static const struct _battle_data {
 	{ "feature.autotrade_sit",				&battle_config.feature_autotrade_sit,			1,		-1,		1,				},
 	{ "feature.autotrade_open_delay",		&battle_config.feature_autotrade_open_delay,	5000,	1000,	INT_MAX,		},
 	{ "disp_serverbank_msg",				&battle_config.disp_serverbank_msg,				0,		0,		1,				},
+	{ "disp_servervip_msg",					&battle_config.disp_servervip_msg,				0,		0,		1,				},
 	{ "warg_can_falcon",                    &battle_config.warg_can_falcon,                 0,      0,      1,              },
 	{ "path_blown_halt",                    &battle_config.path_blown_halt,                 1,      0,      1,              },
 	{ "rental_mount_speed_boost",           &battle_config.rental_mount_speed_boost,        25,     0,      100,        	},

+ 1 - 0
src/map/battle.h

@@ -555,6 +555,7 @@ extern struct Battle_Config
 	int fame_pharmacy_10;
 
 	int disp_serverbank_msg;
+	int disp_servervip_msg;
 	int warg_can_falcon;
 	int path_blown_halt;
 	int rental_mount_speed_boost;

+ 38 - 21
src/map/chrif.c

@@ -290,7 +290,7 @@ int chrif_save(struct map_session_data *sd, int flag) {
 			chrif_save_scdata(sd);
 			chrif_skillcooldown_save(sd);
 			chrif_save_bsdata(sd);
-			chrif_req_login_operation(sd->status.account_id, sd->status.name, 7, 0, 2, sd->status.bank_vault); //save Bank data
+			chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_BANK, 0, 2, sd->status.bank_vault); //save Bank data
 		}
 		if ( flag != 3 && !chrif_auth_logout(sd,flag == 1 ? ST_LOGOUT : ST_MAPCHANGE) )
 			ShowError("chrif_save: Failed to set up player %d:%d for proper quitting!\n", sd->status.account_id, sd->status.char_id);
@@ -830,7 +830,7 @@ int chrif_changeemail(int id, const char *actual_email, const char *new_email) {
  * Send an account modification request to the login server (via char server).
  * @aid : Player requesting operation account id
  * @character_name : Target of operation Player name
- * @operation_type : 1: block, 2: ban, 3: unblock, 4: unban, 5: changesex (use next function for 5), 6 vip, 7 bank 
+ * @operation_type : see chrif_req_op
  * @timediff : tick to add or remove to unixtimestamp
  * @val1 : extra data value to transfer for operation
  * @val2 : extra data value to transfer for operation
@@ -844,15 +844,19 @@ int chrif_req_login_operation(int aid, const char* character_name, unsigned shor
 	safestrncpy((char*)WFIFOP(char_fd,6), character_name, NAME_LENGTH);
 	WFIFOW(char_fd,30) = operation_type;
 
-	if ( operation_type == 2 || operation_type == 6)
+	if ( operation_type == CHRIF_OP_LOGIN_BAN || operation_type == CHRIF_OP_LOGIN_VIP)
 		WFIFOL(char_fd,32) = timediff;
 	WFIFOL(char_fd,36) = val1;
 	WFIFOL(char_fd,40) = val2;
-
 	WFIFOSET(char_fd,44);
 	return 0;
 }
 
+/**
+ * S 2b0e <accid>.l <name>.24B <operation_type>.w <timediff>L <val1>L <val2>L
+ * Send an account modification (changesex) request to the login server (via char server).
+ * @sd : Player requesting operation
+ */
 int chrif_changesex(struct map_session_data *sd) {
 	chrif_check(-1);
 
@@ -860,7 +864,7 @@ int chrif_changesex(struct map_session_data *sd) {
 	WFIFOW(char_fd,0) = 0x2b0e;
 	WFIFOL(char_fd,2) = sd->status.account_id;
 	safestrncpy((char*)WFIFOP(char_fd,6), sd->status.name, NAME_LENGTH);
-	WFIFOW(char_fd,30) = 5;
+	WFIFOW(char_fd,30) = CHRIF_OP_LOGIN_CHANGESEX;
 	WFIFOSET(char_fd,44);
 
 	clif_displaymessage(sd->fd, msg_txt(sd,408)); //"Need disconnection to perform change-sex request..."
@@ -878,8 +882,7 @@ int chrif_changesex(struct map_session_data *sd) {
  * NB: That ack is received just after the char has sent the request to login and therefore didn't have login reply yet
  * @param aid : player account id the request was concerning
  * @param player_name : name the request was concerning
- * @param type : code of operation done:
- *   1: block, 2: ban, 3: unblock, 4: unban, 5: changesex, 6: vip, 7: bank
+ * @param type : code of operation done. See enum chrif_req_op
  * @param answer : type of answer
  *   0: login-server request done
  *   1: player not found
@@ -897,16 +900,29 @@ static void chrif_ack_login_req(int aid, const char* player_name, uint16 type, u
 		ShowError("chrif_ack_login_req failed - player not online.\n");
 		return;
 	}
-	
-	if( type > 0 && type <= 5 )
-		snprintf(action,25,"%s",msg_txt(sd,427+type)); //block|ban|unblock|unban|change the sex of
-	else if(type == 6) snprintf(action,25,"%s",msg_txt(sd,436)); //VIP
-	else if(type == 7) {
-		if (!battle_config.disp_serverbank_msg)
-			return;
-		snprintf(action,25,"%s","bank");
-	} else
-		snprintf(action,25,"???");
+
+	switch (type) {
+		case CHRIF_OP_LOGIN_BLOCK:
+		case CHRIF_OP_LOGIN_BAN:
+		case CHRIF_OP_LOGIN_UNBLOCK:
+		case CHRIF_OP_LOGIN_UNBAN:
+		case CHRIF_OP_LOGIN_CHANGESEX:
+			snprintf(action,25,"%s",msg_txt(sd,427+type)); //block|ban|unblock|unban|change the sex of
+			break;
+		case CHRIF_OP_LOGIN_VIP:
+			if (!battle_config.disp_servervip_msg)
+				return;
+			snprintf(action,25,"%s",msg_txt(sd,436)); //VIP
+			break;
+		case CHRIF_OP_LOGIN_BANK:
+			if (!battle_config.disp_serverbank_msg)
+				return;
+			snprintf(action,25,"%s","bank");
+			break;
+		default:
+			snprintf(action,25,"???");
+			break;
+	}
 
 	switch( answer ) {
 		case 0: sprintf(output, msg_txt(sd,424), action, NAME_LENGTH, player_name); break; //Login-serv has been asked to %s '%.*s'.
@@ -1098,13 +1114,14 @@ int chrif_req_charban(int aid, const char* character_name, int32 timediff){
 	return 0;
 }
 
-int chrif_req_charunban(int cid){
+int chrif_req_charunban(int aid, const char* character_name){
 	chrif_check(-1);
 	
-	WFIFOHEAD(char_fd,6);
+	WFIFOHEAD(char_fd,6+NAME_LENGTH);
 	WFIFOW(char_fd,0) = 0x2b2a;
-	WFIFOL(char_fd,2) = cid;
-	WFIFOSET(char_fd,6);
+	WFIFOL(char_fd,2) = aid;
+	safestrncpy((char*)WFIFOP(char_fd,6), character_name, NAME_LENGTH);
+	WFIFOSET(char_fd,6+NAME_LENGTH);
 	return 0;
 }
 

+ 17 - 1
src/map/chrif.h

@@ -18,6 +18,22 @@ struct auth_node {
 	enum sd_state state; //To track whether player was login in/out or changing maps.
 };
 
+/// Char-server (to login-server) operation request
+enum chrif_req_op {
+	// Request to login-server
+	CHRIF_OP_LOGIN_BLOCK = 1,
+	CHRIF_OP_LOGIN_BAN,
+	CHRIF_OP_LOGIN_UNBLOCK,
+	CHRIF_OP_LOGIN_UNBAN,
+	CHRIF_OP_LOGIN_CHANGESEX,
+	CHRIF_OP_LOGIN_VIP,
+	CHRIF_OP_LOGIN_BANK,
+
+	// Char-server operation
+	CHRIF_OP_BAN,
+	CHRIF_OP_UNBAN,
+};
+
 void chrif_setuserid(char* id);
 void chrif_setpasswd(char* pwd);
 void chrif_checkdefaultlogin(void);
@@ -68,7 +84,7 @@ int chrif_send_report(char* buf, int len);
 void chrif_parse_ack_vipActive(int fd);
 
 int chrif_req_charban(int aid, const char* character_name, int timediff);
-int chrif_req_charunban(int cid);
+int chrif_req_charunban(int aid, const char* character_name);
 
 int chrif_load_bankdata(int fd);
 

+ 2 - 2
src/map/pc.c

@@ -1428,11 +1428,11 @@ void pc_reg_received(struct map_session_data *sd)
 	chrif_bsdata_request(sd->status.char_id);
 	sd->storage_size = MIN_STORAGE; //default to min
 	if(battle_config.feature_banking)
-		chrif_req_login_operation(sd->status.account_id, sd->status.name, 7, 0, 1, 0); //request Bank data
+		chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_BANK, 0, 1, 0); //request Bank data
 #ifdef VIP_ENABLE
 	sd->vip.time = 0;
 	sd->vip.enabled = 0;
-	chrif_req_login_operation(sd->status.account_id, sd->status.name, 6, 0, 1, 0);  // request VIP informations
+	chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, 0, 1, 0);  // request VIP informations
 #endif
 	intif_Mail_requestinbox(sd->status.char_id, 0); // MAIL SYSTEM - Request Mail Inbox
 	intif_request_questlog(sd);

+ 1 - 1
src/map/script.c

@@ -18781,7 +18781,7 @@ BUILDIN_FUNC(vip_time) {
 	if (sd == NULL)
 		return SCRIPT_CMD_FAILURE;
 
-	chrif_req_login_operation(sd->status.account_id, sd->status.name, 6, viptime, 7, 0); 
+	chrif_req_login_operation(sd->status.account_id, sd->status.name, CHRIF_OP_LOGIN_VIP, viptime, 7, 0); 
 #endif
 	return SCRIPT_CMD_SUCCESS;
 }

+ 2 - 2
src/map/trade.c

@@ -210,13 +210,13 @@ int impossible_trade_check(struct map_session_data *sd)
 			intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
 			// if we block people
 			if (battle_config.ban_hack_trade < 0) {
-				chrif_req_login_operation(-1, sd->status.name, 1, 0, 0, 0); // type: 1 - block
+				chrif_req_login_operation(-1, sd->status.name, CHRIF_OP_LOGIN_BLOCK, 0, 0, 0); // type: 1 - block
 				set_eof(sd->fd); // forced to disconnect because of the hack
 				// message about the ban
 				strcpy(message_to_gm, msg_txt(sd,540)); //  This player has been definitively blocked.
 			// if we ban people
 			} else if (battle_config.ban_hack_trade > 0) {
-				chrif_req_login_operation(-1, sd->status.name, 2, battle_config.ban_hack_trade*60, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second)
+				chrif_req_login_operation(-1, sd->status.name, CHRIF_OP_LOGIN_BAN, battle_config.ban_hack_trade*60, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second)
 				set_eof(sd->fd); // forced to disconnect because of the hack
 				// message about the ban
 				sprintf(message_to_gm, msg_txt(sd,507), battle_config.ban_hack_trade); //  This player has been banned for %d minute(s).