瀏覽代碼

Removed type param from accinfo command (#8918)

Removed the half broken and undocumented type parameter from the atcommand accinfo.
Lemongrass3110 4 月之前
父節點
當前提交
ce71846eab
共有 8 個文件被更改,包括 43 次插入65 次删除
  1. 10 12
      src/char/char_logif.cpp
  2. 1 1
      src/char/char_logif.hpp
  3. 19 28
      src/char/inter.cpp
  4. 1 3
      src/char/inter.hpp
  5. 4 5
      src/login/loginchrif.cpp
  6. 3 10
      src/map/atcommand.cpp
  7. 4 5
      src/map/intif.cpp
  8. 1 1
      src/map/intif.hpp

+ 10 - 12
src/char/char_logif.cpp

@@ -695,17 +695,16 @@ int32 chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int32 mapfd) {
 * HA 0x2720
 * Request account info to login-server
 */
-int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type) {
+int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id) {
 	loginif_check(-1);
-	//ShowInfo("%d request account info for %d (type %d)\n", u_aid, account_id, type);
-	WFIFOHEAD(login_fd,19);
+	//ShowInfo("%d request account info for %d\n", u_aid, account_id);
+	WFIFOHEAD(login_fd,18);
 	WFIFOW(login_fd,0) = 0x2720;
 	WFIFOL(login_fd,2) = fd;
 	WFIFOL(login_fd,6) = u_fd;
 	WFIFOL(login_fd,10) = u_aid;
 	WFIFOL(login_fd,14) = account_id;
-	WFIFOB(login_fd,18) = type;
-	WFIFOSET(login_fd,19);
+	WFIFOSET(login_fd,18);
 	return 1;
 }
 
@@ -717,16 +716,15 @@ int32 chlogif_parse_AccInfoAck(int32 fd) {
 	if (RFIFOREST(fd) < 19)
 		return 0;
 	else {
-		int8 type = RFIFOB(fd, 18);
-		if (type == 0 || RFIFOREST(fd) < 122+NAME_LENGTH) {
-			mapif_accinfo_ack(false, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), 0, -1, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr);
+		bool success = RFIFOB(fd, 18) != 0;
+
+		if( !success ){
+			mapif_accinfo_ack( success, RFIFOL( fd, 2 ), RFIFOL( fd, 6 ), RFIFOL( fd, 10 ), RFIFOL( fd, 14 ), -1, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr );
 			RFIFOSKIP(fd,19);
 			return 1;
 		}
-		type>>=1;
-		mapif_accinfo_ack(true, RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), type, RFIFOL(fd,19), RFIFOL(fd,23), RFIFOL(fd,27),
-			RFIFOCP(fd,31), RFIFOCP(fd,71), RFIFOCP(fd,87), RFIFOCP(fd,111),
-			RFIFOCP(fd,122));
+
+		mapif_accinfo_ack( success, RFIFOL( fd, 2 ), RFIFOL( fd, 6 ), RFIFOL( fd, 10 ), RFIFOL( fd, 14 ), RFIFOL( fd, 19 ), RFIFOL( fd, 23 ), RFIFOL( fd, 27 ), RFIFOCP( fd, 31 ), RFIFOCP( fd, 71 ), RFIFOCP( fd, 87 ), RFIFOCP( fd, 111 ), RFIFOCP( fd, 122 ) );
 		RFIFOSKIP(fd,122+NAME_LENGTH);
 	}
 	return 1;

+ 1 - 1
src/char/char_logif.hpp

@@ -40,7 +40,7 @@ int32 chlogif_parse_updip(int32 fd);
 
 int32 chlogif_parse_vipack(int32 fd);
 int32 chlogif_reqvipdata(uint32 aid, uint8 flag, int32 timediff, int32 mapfd);
-int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type);
+int32 chlogif_req_accinfo(int32 fd, int32 u_fd, int32 u_aid, int32 account_id);
 
 int32 chlogif_parse(int32 fd);
 

+ 19 - 28
src/char/inter.cpp

@@ -56,7 +56,7 @@ uint32 party_share_level = 10;
 
 /// Received packet Lengths from map-server
 int32 inter_recv_packet_length[] = {
-	-1,-1, 7,-1, -1,13,36, (2+4+4+4+1+NAME_LENGTH),  0,-1, 0, 0,  0, 0,  0, 0,	// 3000-
+	-1,-1, 7,-1, -1,13,36, (2+4+4+4+NAME_LENGTH),  0,-1, 0, 0,  0, 0,  0, 0,	// 3000-
 	 6,-1, 0, 0,  0, 0, 0, 0, 10,-1, 0, 0,  0, 0,  0, 0,	// 3010-
 	-1,10,-1,14, 15+NAME_LENGTH,17+MAP_NAME_LENGTH_EXT, 6,-1, 14,14, 6, 0,  0, 0,  0, 0,	// 3020- Party
 	-1, 6,-1,-1, 55,19, 6,-1, 14,-1,-1,-1, 18,19,186,-1,	// 3030-
@@ -488,12 +488,11 @@ void mapif_acc_info_ack(int32 fd, int32 u_fd, int32 acc_id, const char* acc_name
  */
 void mapif_parse_accinfo(int32 fd) {
 	int32 u_fd = RFIFOL(fd,2), u_aid = RFIFOL(fd,6), u_group = RFIFOL(fd,10);
-	char type= RFIFOB(fd,14);
 	char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
 	uint32 account_id = 0;
 	char *data;
 
-	safestrncpy(query, RFIFOCP(fd,15), NAME_LENGTH);
+	safestrncpy(query, RFIFOCP(fd,14), NAME_LENGTH);
 	Sql_EscapeString(sql_handle, query_esq, query);
 
 	account_id = atoi(query);
@@ -502,10 +501,10 @@ void mapif_parse_accinfo(int32 fd) {
 		if ( SQL_ERROR == Sql_Query(sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `%s` WHERE `name` LIKE '%s' LIMIT 10", schema_config.char_db, query_esq)
 				|| Sql_NumRows(sql_handle) == 0 ) {
 			if( Sql_NumRows(sql_handle) == 0 ) {
-				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(212) ,query);
+				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(212) ,query); // No matches were found for your criteria, '%s'
 			} else {
 				Sql_ShowDebug(sql_handle);
-				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(213));
+				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(213)); // An error occured, bother your admin about it.
 			}
 			Sql_FreeResult(sql_handle);
 			return;
@@ -515,7 +514,7 @@ void mapif_parse_accinfo(int32 fd) {
 				Sql_GetData(sql_handle, 0, &data, nullptr); account_id = atoi(data);
 				Sql_FreeResult(sql_handle);
 			} else {// more than one, listing... [Dekamaster/Nightroad]
-				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int32)Sql_NumRows(sql_handle));
+				inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(214),(int32)Sql_NumRows(sql_handle)); // Your query returned the following %d results, please be more specific...
 				while ( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
 					int32 class_;
 					short base_level, job_level, online;
@@ -528,7 +527,7 @@ void mapif_parse_accinfo(int32 fd) {
 					Sql_GetData(sql_handle, 4, &data, nullptr); job_level = atoi(data);
 					Sql_GetData(sql_handle, 5, &data, nullptr); online = atoi(data);
 
-					inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(215), account_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline");
+					inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(215), account_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline"); // [AID: %d] %s | %s | Level: %d/%d | %s
 				}
 				Sql_FreeResult(sql_handle);
 				return;
@@ -537,8 +536,8 @@ void mapif_parse_accinfo(int32 fd) {
 	}
 
 	/* it will only get here if we have a single match then ask login-server to fetch the `login` record */
-	if (!account_id || chlogif_req_accinfo(fd, u_fd, u_aid, account_id, type) != 1) {
-		inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(213));
+	if (!account_id || chlogif_req_accinfo(fd, u_fd, u_aid, account_id) != 1) {
+		inter_to_fd(fd, u_fd, u_aid, (char *)msg_txt(213)); // An error occured, bother your admin about it.
 	}
 	return;
 }
@@ -546,38 +545,30 @@ void mapif_parse_accinfo(int32 fd) {
 /**
  * Show account info from login-server to user
  */
-void mapif_accinfo_ack(bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type,
-	int32 group_id, int32 logincount, int32 state, const char *email, const char *last_ip, const char *lastlogin,
-	const char *birthdate, const char *userid)
-{
+void mapif_accinfo_ack( bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int32 group_id, int32 logincount, int32 state, const char *email, const char *last_ip, const char *lastlogin, const char *birthdate, const char *userid ){
 	
 	if (map_fd <= 0 || !session_isActive(map_fd))
 		return; // check if we have a valid fd
 
 	if (!success) {
-		inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(216), account_id);
-		return;
-	}
-
-	if (type == 1) { //type 1 we don't want all the info [lighta] @CHECKME
-		mapif_acc_info_ack(map_fd, u_fd, account_id, userid);
+		inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(216), account_id); // No account with ID '%d' was found.
 		return;
 	}
 
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(217), account_id);
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(218), userid, group_id, state);
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(221), email, birthdate);
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(222), last_ip, geoip_getcountry(str2ip(last_ip)));
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(223), logincount, lastlogin);
-	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(224));
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(217), account_id); // -- Account %d --
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(218), userid, group_id, state); // User: %s | GM Group: %d | State: %d
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(221), email, birthdate); // Account e-mail: %s | Birthdate: %s
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(222), last_ip, geoip_getcountry(str2ip(last_ip))); // Last IP: %s (%s)
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(223), logincount, lastlogin); // This user has logged in %d times, the last time was at %s
+	inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(224)); // -- Character Details --
 
 	if ( SQL_ERROR == Sql_Query(sql_handle, "SELECT `char_id`, `name`, `char_num`, `class`, `base_level`, `job_level`, `online` FROM `%s` WHERE `account_id` = '%d' ORDER BY `char_num` LIMIT %d", schema_config.char_db, account_id, MAX_CHARS)
 		|| Sql_NumRows(sql_handle) == 0 )
 	{
 		if( Sql_NumRows(sql_handle) == 0 )
-			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(226));
+			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(226)); // This account doesn't have characters.
 		else {
-			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(213));
+			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(213)); // An error occured, bother your admin about it.
 			Sql_ShowDebug(sql_handle);
 		}
 	} else {
@@ -595,7 +586,7 @@ void mapif_accinfo_ack(bool success, int32 map_fd, int32 u_fd, int32 u_aid, int3
 			Sql_GetData(sql_handle, 5, &data, nullptr); job_level = atoi(data);
 			Sql_GetData(sql_handle, 6, &data, nullptr); online = atoi(data);
 
-			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(225), char_num, char_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline");
+			inter_to_fd(map_fd, u_fd, u_aid, (char *)msg_txt(225), char_num, char_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline"); // [Slot/CID: %d/%d] %s | %s | Level: %d/%d | %s
 		}
 	}
 	Sql_FreeResult(sql_handle);

+ 1 - 3
src/char/inter.hpp

@@ -31,9 +31,7 @@ void inter_final(void);
 int32 inter_parse_frommap(int32 fd);
 int32 inter_mapif_init(int32 fd);
 int32 mapif_disconnectplayer(int32 fd, uint32 account_id, uint32 char_id, int32 reason);
-void mapif_accinfo_ack(bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int8 type,
-	int32 group_id, int32 logincount, int32 state, const char *email, const char *last_ip, const char *lastlogin,
-	const char *birthdate, const char *userid);
+void mapif_accinfo_ack( bool success, int32 map_fd, int32 u_fd, int32 u_aid, int32 account_id, int32 group_id, int32 logincount, int32 state, const char* email, const char* last_ip, const char* lastlogin, const char* birthdate, const char* userid );
 
 int32 inter_log(const char *fmt,...);
 

+ 4 - 5
src/login/loginchrif.cpp

@@ -717,14 +717,13 @@ int32 logchrif_parse_reqvipdata(int32 fd) {
 * Get account info that asked by inter/char-server
 */
 int32 logchrif_parse_accinfo(int32 fd) {
-	if( RFIFOREST(fd) < 19 )
+	if( RFIFOREST(fd) < 18 )
 		return 0;
 	else {
 		int32 map_fd = RFIFOL(fd, 2), u_fd = RFIFOL(fd, 6), u_aid = RFIFOL(fd, 10), account_id = RFIFOL(fd, 14);
-		int8 type = RFIFOB(fd, 18);
 		AccountDB* accounts = login_get_accounts_db();
 		struct mmo_account acc;
-		RFIFOSKIP(fd,19);
+		RFIFOSKIP(fd,18);
 
 		// Send back the result to char-server
 		if (accounts->load_num(accounts, &acc, account_id)) {
@@ -736,7 +735,7 @@ int32 logchrif_parse_accinfo(int32 fd) {
 			WFIFOL(fd, 6) = u_fd;
 			WFIFOL(fd, 10) = u_aid;
 			WFIFOL(fd, 14) = account_id;
-			WFIFOB(fd, 18) = (1<<type); // success
+			WFIFOB(fd, 18) = true; // success
 			WFIFOL(fd, 19) = acc.group_id;
 			WFIFOL(fd, 23) = acc.logincount;
 			WFIFOL(fd, 27) = acc.state;
@@ -755,7 +754,7 @@ int32 logchrif_parse_accinfo(int32 fd) {
 			WFIFOL(fd, 6) = u_fd;
 			WFIFOL(fd, 10) = u_aid;
 			WFIFOL(fd, 14) = account_id;
-			WFIFOB(fd, 18) = 0; // failed
+			WFIFOB(fd, 18) = false; // failed
 			WFIFOSET(fd, 19);
 		}
 	}

+ 3 - 10
src/map/atcommand.cpp

@@ -9857,23 +9857,16 @@ ACMD_FUNC(mount2) {
 
 ACMD_FUNC(accinfo) {
 	char query[NAME_LENGTH];
-	char type = 0; // type = 1, get only account name
 
 	if (!message || !*message || strlen(message) > NAME_LENGTH
-		|| ( sscanf(message, "%23s %c", query, &type) < 1))
+		|| ( sscanf(message, "%23s", query) < 1))
 	{
 		clif_displaymessage(fd, msg_txt(sd,1365)); // Usage: @accinfo/@accountinfo <account_id/char name>
 		clif_displaymessage(fd, msg_txt(sd,1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario".
 		return -1;
-	} else if (type != 0) {
-		type = type-'0'; //make it int32
-		if (type != 1) {
-			clif_displaymessage(fd, "accinfo : Unknow type specified\n");
-			return -1;
-		}
- 	}
+	}
 
-	intif_request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query, type);
+	intif_request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query);
 	return 0;
 }
 

+ 4 - 5
src/map/intif.cpp

@@ -3203,21 +3203,20 @@ int32 intif_parse_elemental_saved(int32 fd)
  * @param type : 1 - Only return account id & userid, 0 - Full info
  * @return : 0=error, 1=msg sent
  */
-int32 intif_request_accinfo(int32 u_fd, int32 aid, int32 group_lv, char* query, char type) {
+int32 intif_request_accinfo( int32 u_fd, int32 aid, int32 group_lv, char* query ){
 
 	if( CheckForCharServer() )
 		return 0;
 	
-	WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + 1 + NAME_LENGTH);
+	WFIFOHEAD(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH);
 
 	WFIFOW(inter_fd,0) = 0x3007;
 	WFIFOL(inter_fd,2) = u_fd;
 	WFIFOL(inter_fd,6) = aid;
 	WFIFOL(inter_fd,10) = group_lv;
-	WFIFOB(inter_fd,14) = type;
-	safestrncpy(WFIFOCP(inter_fd,15), query, NAME_LENGTH);
+	safestrncpy(WFIFOCP(inter_fd,14), query, NAME_LENGTH);
 
-	WFIFOSET(inter_fd,2 + 4 + 4 + 4 + 1 + NAME_LENGTH);
+	WFIFOSET(inter_fd,2 + 4 + 4 + 4 + NAME_LENGTH);
 	return 1;
 }
 

+ 1 - 1
src/map/intif.hpp

@@ -124,7 +124,7 @@ void intif_request_achievements(uint32 char_id);
 int32 intif_achievement_save(map_session_data *sd);
 int32 intif_achievement_reward(map_session_data *sd, struct s_achievement_db *adb);
 
-int32 intif_request_accinfo(int32 u_fd, int32 aid, int32 group_lv, char* query, char type);
+int32 intif_request_accinfo( int32 u_fd, int32 aid, int32 group_lv, char* query );
 
 // STORAGE
 bool intif_storage_request(map_session_data *sd, enum storage_type type, uint8 stor_id, uint8 mode);