summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-07 20:15:23 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-07 20:15:23 +0000
commitdd2e4d4fea67858cb39260549de6a2ccb49eb7b9 (patch)
tree2f94180e9494eefcaf6f8a2dd7b0b0c74b5c7da8 /src/map/npc.c
parent5d9d254ef290e9cc8acfdd08af279fdc1a439853 (diff)
downloadhercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.gz
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.bz2
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.tar.xz
hercules-dd2e4d4fea67858cb39260549de6a2ccb49eb7b9.zip
- Added config setting mob_npc_warp, when set to yes, enables mobs to be warped between maps when stepping on a npc-warp.
- Added monster_ai setting &64, when enabled makes a mob run to any nearby npc-warp when their current target has switched maps. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7039 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c
index 6d950399d..e9e472721 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -971,6 +971,35 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
return 0;
}
+int npc_touch_areanpc2(struct block_list *bl)
+{
+ int i,m=bl->m;
+ int xs,ys;
+
+ for(i=0;i<map[m].npc_num;i++) {
+ if (map[m].npc[i]->sc.option&OPTION_INVISIBLE)
+ continue;
+
+ if (map[m].npc[i]->bl.subtype!=WARP)
+ continue;
+
+ xs=map[m].npc[i]->u.warp.xs;
+ ys=map[m].npc[i]->u.warp.ys;
+
+ if (bl->x >= map[m].npc[i]->bl.x-xs/2 && bl->x < map[m].npc[i]->bl.x-xs/2+xs &&
+ bl->y >= map[m].npc[i]->bl.y-ys/2 && bl->y < map[m].npc[i]->bl.y-ys/2+ys)
+ break;
+ }
+ if (i==map[m].npc_num)
+ return 0;
+
+ xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
+ if (xs < 0) // Can't warp object between map servers...
+ return 0;
+ unit_warp(bl, xs, map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,0);
+ return 1;
+}
+
/*==========================================
* 近くかどうかの判定
*------------------------------------------