Browse Source

- Fixed a few functions sending a negative ID for disguised characters (such as clif_specialeffect) which very likely produced client crashes.
- A small cleanup on npc-whispering which could fix a reported crash on it.
- Removed the gm-whispering of the charnameack hack notice since it isn't perfected yet.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5850 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 years ago
parent
commit
b11e202bc2
2 changed files with 20 additions and 22 deletions
  1. 8 0
      Changelog-Trunk.txt
  2. 12 22
      src/map/clif.c

+ 8 - 0
Changelog-Trunk.txt

@@ -4,6 +4,14 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2006/04/01
 2006/04/01
+	* Fixed a few functions sending a negative ID for disguised characters
+	  (such as clif_specialeffect) which very likely produced client crashes.
+	  [Skotlex]
+	* A small cleanup on npc-whispering which could fix a reported crash on it.
+	  [Skotlex]
+	* Removed the gm-whispering of the charnameack hack notice since it isn't
+	  perfected yet. It is still reported on the console for debugging
+	  purposes. [Skotlex]
 	* Fixes to the mob_ai routines. Prevent casting rude-attacked skills in
 	* Fixes to the mob_ai routines. Prevent casting rude-attacked skills in
 	  situations that shouldn't be considered as so. Fixed mobs failing to chase
 	  situations that shouldn't be considered as so. Fixed mobs failing to chase
 	  after enemies when attacked from out of their view_range. [Skotlex]
 	  after enemies when attacked from out of their view_range. [Skotlex]

+ 12 - 22
src/map/clif.c

@@ -7439,10 +7439,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
 	memset(buf, 0, packet_len_table[0x1f3]);
 	memset(buf, 0, packet_len_table[0x1f3]);
 
 
 	WBUFW(buf,0) = 0x1f3;
 	WBUFW(buf,0) = 0x1f3;
-	if(bl->type==BL_PC && ((struct map_session_data *)bl)->disguise)
-		WBUFL(buf,2) = -bl->id;
-	else
-		WBUFL(buf,2) = bl->id;
+	WBUFL(buf,2) = bl->id;
 	WBUFL(buf,6) = type;
 	WBUFL(buf,6) = type;
 
 
 	switch (flag) {
 	switch (flag) {
@@ -7461,7 +7458,10 @@ int clif_specialeffect(struct block_list *bl, int type, int flag)
 	default:
 	default:
 		clif_send(buf, packet_len_table[0x1f3], bl, AREA);
 		clif_send(buf, packet_len_table[0x1f3], bl, AREA);
 	}
 	}
-
+	if (disguised(bl)) {
+		WBUFL(buf,2) = -bl->id;
+		clif_send(buf, packet_len_table[0x1f3], bl, SELF);
+	}
 	return 0;
 	return 0;
 }
 }
 
 
@@ -7482,11 +7482,7 @@ int clif_charnameack (int fd, struct block_list *bl)
 	nullpo_retr(0, bl);
 	nullpo_retr(0, bl);
 
 
 	WBUFW(buf,0) = cmd;
 	WBUFW(buf,0) = cmd;
-
-	if(bl->type==BL_PC && ((struct map_session_data *)bl)->disguise)
-		WBUFL(buf,2) = -bl->id;
-	else
-		WBUFL(buf,2) = bl->id;
+	WBUFL(buf,2) = bl->id;
 
 
 	switch(bl->type) {
 	switch(bl->type) {
 	case BL_PC:
 	case BL_PC:
@@ -7609,11 +7605,7 @@ int clif_charnameupdate (struct map_session_data *ssd)
 		return 0; //No need to update as the party/guild was not displayed anyway.
 		return 0; //No need to update as the party/guild was not displayed anyway.
 
 
 	WBUFW(buf,0) = cmd;
 	WBUFW(buf,0) = cmd;
-
-	if(ssd->disguise)
-		WBUFL(buf,2) = -(ssd->bl.id);
-	else
-		WBUFL(buf,2) = ssd->bl.id;
+	WBUFL(buf,2) = ssd->bl.id;
 
 
 	memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH);
 	memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH);
 			
 			
@@ -8231,11 +8223,12 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
 		) {
 		) {
 			//Asked name of invisible player, this shouldn't be possible!
 			//Asked name of invisible player, this shouldn't be possible!
 			//Possible bot? Thanks to veider and qspirit
 			//Possible bot? Thanks to veider and qspirit
+			//FIXME: Still isn't perfected as clients keep asking for this on legitimate situations.
     			unsigned char gm_msg[256];
     			unsigned char gm_msg[256];
     			sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requests name of invisible chars.", sd->status.name, sd->status.account_id);
     			sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requests name of invisible chars.", sd->status.name, sd->status.account_id);
 				ShowWarning(gm_msg);
 				ShowWarning(gm_msg);
 			    // information is sended to all online GM
 			    // information is sended to all online GM
-			    intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
+			  //  intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
 			return;
 			return;
 		}
 		}
 		clif_charnameack(fd, bl);
 		clif_charnameack(fd, bl);
@@ -8538,10 +8531,6 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
 		WBUFL(buf, 2) = sd->bl.id;
 		WBUFL(buf, 2) = sd->bl.id;
 		WBUFB(buf,26) = 3;
 		WBUFB(buf,26) = 3;
 		clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
 		clif_send(buf, packet_len_table[0x8a], &sd->bl, AREA);
-		if(sd->disguise) {
-			WBUFL(buf, 2) = -sd->bl.id;
-			clif_send(buf, packet_len_table[0x8a], &sd->bl, SELF);
-		}
 		break;
 		break;
 	}
 	}
 }
 }
@@ -8621,8 +8610,9 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
 	//-------------------------------------------------------//
 	//-------------------------------------------------------//
 	//   Lordalfa - Paperboy - To whisper NPC commands       //
 	//   Lordalfa - Paperboy - To whisper NPC commands       //
 	//-------------------------------------------------------//
 	//-------------------------------------------------------//
-	if ((strncasecmp((const char*)RFIFOP(fd,4),"NPC:",4) == 0) && (strlen((const char*)RFIFOP(fd,4)) >4))   {
-		whisper_tmp = (char*) RFIFOP(fd,4) + 4;
+	whisper_tmp = (char*) RFIFOP(fd,4);
+	if (whisper_tmp[0] && (strncasecmp(whisper_tmp,"NPC:",4) == 0) && (strlen(whisper_tmp) >4))   {
+		whisper_tmp += 4; //Skip the NPC: string part.
 		if ((npc = npc_name2id(whisper_tmp)))	
 		if ((npc = npc_name2id(whisper_tmp)))	
 		{
 		{
 			whisper_tmp=(char *)aCallocA(strlen((char *)(RFIFOP(fd,28)))+1,sizeof(char));
 			whisper_tmp=(char *)aCallocA(strlen((char *)(RFIFOP(fd,28)))+1,sizeof(char));