summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c54
-rw-r--r--src/map/npc.c5
2 files changed, 30 insertions, 29 deletions
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)
diff --git a/src/map/npc.c b/src/map/npc.c
index 953eccc27..5bded2f3c 100644
--- a/src/map/npc.c
+++ b/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) // イベント系は常にOK
return 0;