소스 검색

- the charname request hack message has been downgraded to only include GM-invisible characters.
- corrected clif_charnameack to send negative ID when a disguised player asks for it's own disguised name.
- Cleaned up the disguised target-id checks taking into considering that the only character that sees a negative ID is the same disguised character.


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

skotlex 19 년 전
부모
커밋
0c8a59d012
3개의 변경된 파일37개의 추가작업 그리고 29개의 파일을 삭제
  1. 7 0
      Changelog-Trunk.txt
  2. 27 27
      src/map/clif.c
  3. 3 2
      src/map/npc.c

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ 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.
 
 2006/05/23
+	* the charname request hack message has been downgraded to only include
+	  GM-invisible characters. [Skotlex]
+	* corrected clif_charnameack to send negative ID when a disguised player
+	  asks for it's own disguised name. [Skotlex]
+	* Cleaned up the disguised target-id checks taking into considering that
+	  the only character that sees a negative ID is the same disguised character.
+	  [Skotlex]
 	* Modified battle_calc_weapon_attack to use new flags pdef/pdef (pierce
 	  defense), Investigate and Icepick will now use the final def/vit-def values
 	  rather than the base ones. [Skotlex]

+ 27 - 27
src/map/clif.c

@@ -7822,7 +7822,9 @@ int clif_charnameack (int fd, struct block_list *bl)
 			struct party *p = NULL;
 			struct guild *g = NULL;
 			
-			nullpo_retr(0, ssd);
+			//Requesting your own "shadow" name. [Skotlex]
+			if (ssd->fd == fd && ssd->disguise)
+				WBUFL(buf,2) = -bl->id; 
 
 			if (strlen(ssd->fakename)>1) {
 				memcpy(WBUFP(buf,6), ssd->fakename, NAME_LENGTH);
@@ -8605,28 +8607,28 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) {
 	RFIFOHEAD(fd);
 	
 	account_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
-	if(account_id<0) // for disguises [Valaris]
-		account_id-=account_id*2;
 
+	if(account_id<0 && -account_id == sd->bl.id) // for disguises [Valaris]
+		account_id= sd->bl.id;
+
+	bl = map_id2bl(account_id);
 	//Is this possible? Lagged clients could request names of already gone mobs/players. [Skotlex]
-	if ((bl = map_id2bl(account_id)) != NULL) {	
-		sc = status_get_sc(bl);
-		if (sc && (
-			(sc->option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) && !sd->special_state.intravision) ||
-			(sc->option&OPTION_INVISIBLE && !disguised(bl)))
-		) {
-			//Asked name of invisible player, this shouldn't be possible!
-			//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];
-    			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);
-			    // information is sended to all online GM
-				intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
-			return;
-		}
-		clif_charnameack(fd, bl);
+	if (!bl) return;
+
+	sc = status_get_sc(bl);
+	if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl))
+	{
+		//Asked name of invisible player, this shouldn't be possible!
+		//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];
+		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);
+		 // information is sended to all online GM
+		intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
+		return;
 	}
+	clif_charnameack(fd, bl);
 }
 
 /*==========================================
@@ -8878,8 +8880,8 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) {
 	target_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]);
 	action_type = RFIFOB(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]);
 
-	if(target_id<0) // for disguises [Valaris]
-		target_id-=(target_id*2);
+	if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris]
+		target_id = sd->bl.id;
 		
 	switch(action_type) {
 	case 0x00: // once attack
@@ -9345,9 +9347,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
 
 	if (clif_cant_act(sd))
 		return;
-	//Clicked on a negative ID? Player disguised as NPC! [Skotlex]
-	if (RFIFOL(fd,2) < 0)
-		return;
+
 	npc_click(sd,RFIFOL(fd,2));
 }
 
@@ -9682,8 +9682,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) {
 	if (sd->invincible_timer != -1)
 		pc_delinvincibletimer(sd);
 	
-	if(target_id<0) // for disguises [Valaris]
-		target_id*=-1;
+	if(target_id<0 && -target_id == sd->bl.id) // for disguises [Valaris]
+		target_id = sd->bl.id;
 		
 	if (sd->skillitem >= 0 && sd->skillitem == skillnum) {
 		if (skilllv != sd->skillitemlv)

+ 3 - 2
src/map/npc.c

@@ -985,12 +985,13 @@ int npc_checknear(struct map_session_data *sd,int id)
 		return 0;
 
 	nd=(struct npc_data *)map_id2bl(id);
-	if (nd==NULL || nd->bl.type!=BL_NPC) {
+	if (nd==NULL) {
 		if (battle_config.error_log)
 			ShowWarning("no such npc : %d\n",id);
 		return 1;
 	}
-
+	if (nd->bl.type!=BL_NPC) //Disguised character or something else...
+		return 1;
 
 	if (nd->class_<0)	// ƒCƒxƒ“ƒgŒn‚Í�í‚ÉOK
 		return 0;