diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/npc.c | 11 | ||||
-rw-r--r-- | src/map/npc.h | 1 | ||||
-rw-r--r-- | src/map/status.c | 8 | ||||
-rw-r--r-- | src/map/unit.c | 6 |
5 files changed, 22 insertions, 6 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 173175260..3515bb806 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9597,7 +9597,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); else - sd->areanpc_id = 0; + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); /* it broke at some point (e.g. during a crash), so we make it visibly dead again. */ if( !sd->status.hp && !pc_isdead(sd) && status->isdead(&sd->bl) ) diff --git a/src/map/npc.c b/src/map/npc.c index 63514710f..77e99ecc5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -975,6 +975,16 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) return 0; } +/*========================================== + * Exec OnUnTouch for player if out range of area event + *------------------------------------------*/ +int npc_untouch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y) +{ + nullpo_retr(1, sd); + sd->areanpc_id = 0; + return 0; +} + // OnTouch NPC or Warp for Mobs // Return 1 if Warped int npc_touch_areanpc2(struct mob_data *md) @@ -4650,6 +4660,7 @@ void npc_defaults(void) { npc->touch_areanpc_sub = npc_touch_areanpc_sub; npc->touchnext_areanpc = npc_touchnext_areanpc; npc->touch_areanpc = npc_touch_areanpc; + npc->untouch_areanpc = npc_untouch_areanpc; npc->touch_areanpc2 = npc_touch_areanpc2; npc->check_areanpc = npc_check_areanpc; npc->checknear = npc_checknear; diff --git a/src/map/npc.h b/src/map/npc.h index cb8f09644..a5a2b4676 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -207,6 +207,7 @@ struct npc_interface { int (*touch_areanpc_sub) (struct block_list *bl, va_list ap); int (*touchnext_areanpc) (struct map_session_data *sd, bool leavemap); int (*touch_areanpc) (struct map_session_data *sd, int16 m, int16 x, int16 y); + int (*untouch_areanpc) (struct map_session_data *sd, int16 m, int16 x, int16 y); int (*touch_areanpc2) (struct mob_data *md); int (*check_areanpc) (int flag, int16 m, int16 x, int16 y, int16 range); struct npc_data* (*checknear) (struct map_session_data *sd, struct block_list *bl); diff --git a/src/map/status.c b/src/map/status.c index 54b4a4358..e0d8d4f9b 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -10466,8 +10466,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if(opt_flag&4) //Out of hiding, invoke on place. skill->unit_move(bl,timer->gettick(),1); - if(opt_flag&2 && sd && map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) - npc->touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event. + if (opt_flag & 2 && sd) { + if (map->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) + npc->touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event. + else + npc->untouch_areanpc(sd, bl->m, bl->x, bl->y); + } ers_free(status->data_ers, sce); return 1; diff --git a/src/map/unit.c b/src/map/unit.c index 64885541f..0924e6cf2 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -309,7 +309,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. return 0; } else - sd->areanpc_id=0; + npc->untouch_areanpc(sd, bl->m, x, y); if( sd->md ) { // mercenary should be warped after being 3 seconds too far from the master [greenbox] if( !check_distance_bl(&sd->bl, &sd->md->bl, MAX_MER_DISTANCE) ) { @@ -767,7 +767,7 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool if (bl->prev == NULL) //Script could have warped char, abort remaining of the function. return 0; } else - sd->areanpc_id=0; + npc->untouch_areanpc(sd, bl->m, bl->x, bl->y); if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 ) { // Check if pet needs to be teleported. [Skotlex] @@ -867,7 +867,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag) if(map->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) { npc->touch_areanpc(sd, bl->m, bl->x, bl->y); } else { - sd->areanpc_id = 0; + npc->untouch_areanpc(sd, bl->m, bl->x, bl->y);; } } } |