From 0d5eb7540f191170701a32f8f53d9f24e1b2268f Mon Sep 17 00:00:00 2001 From: skotlex Date: Tue, 23 May 2006 15:43:40 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6715 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 2d6199207..61846b85d 100644 --- a/src/map/clif.c +++ b/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) -- cgit v1.2.3-70-g09d2