From a76908de39c38dcb65afb6d1ab628bc414abd483 Mon Sep 17 00:00:00 2001 From: Lance Date: Mon, 1 May 2006 05:48:06 +0000 Subject: * Optimized fake npc system. Added npc_checknear back to npc_buysellsel. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6426 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/map/clif.c') diff --git a/src/map/clif.c b/src/map/clif.c index 0efd160b4..8321368c0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1809,10 +1809,16 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) { int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) { int fd; int slen = strlen(mes) + 8; + struct block_list *bl = map_id2bl(npcid); WFIFOHEAD(fd, slen); nullpo_retr(0, sd); + if (bl->type == BL_PC || bl->m!=sd->bl.m || + bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || + bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1) + clif_sendfakenpc(sd, npcid); + fd=sd->fd; WFIFOW(fd,0)=0xb7; WFIFOW(fd,2)=slen; @@ -1829,8 +1835,14 @@ int clif_scriptmenu(struct map_session_data *sd, int npcid, char *mes) { */ int clif_scriptinput(struct map_session_data *sd, int npcid) { int fd; + struct block_list *bl = map_id2bl(npcid); nullpo_retr(0, sd); + + if (bl->type == BL_PC || bl->m!=sd->bl.m || + bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || + bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1) + clif_sendfakenpc(sd, npcid); fd=sd->fd; WFIFOHEAD(fd, packet_len_table[0x142]); @@ -1847,9 +1859,15 @@ int clif_scriptinput(struct map_session_data *sd, int npcid) { */ int clif_scriptinputstr(struct map_session_data *sd, int npcid) { int fd; + struct block_list *bl = map_id2bl(npcid); nullpo_retr(0, sd); + if (bl->type == BL_PC || bl->m!=sd->bl.m || + bl->xbl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || + bl->ybl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1) + clif_sendfakenpc(sd, npcid); + fd=sd->fd; WFIFOHEAD(fd, packet_len_table[0x1d4]); WFIFOW(fd,0)=0x1d4; -- cgit v1.2.3-70-g09d2