From 1e844abc3fa269a504ba6610ac83224d9660ce22 Mon Sep 17 00:00:00 2001 From: blackhole89 Date: Tue, 11 Jul 2006 15:58:40 +0000 Subject: warpportal(x,y,"tmap",tx,ty) - Creates a skill warp portal on the map. battle_check_target modified to allow NPC-owned skill units to proceed. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7612 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 3 +++ src/map/battle.c | 2 ++ src/map/script.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 98c7a1a4e..770276218 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,9 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/07/11 + * Added script function warpportal(x,y,targetmap$,targetx,targety). + This creates warp portals as in the skill unit as a volatile alternative + to static warp portals. [blackhole89] * Modified the login-sql server to do the ip-ban check only on the auth-packets instead of on every packet. [Skotlex] 2006/07/10 diff --git a/src/map/battle.c b/src/map/battle.c index bbe1e8279..25bacc337 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3176,6 +3176,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f } case BL_SKILL: //Skill with no owner? Fishy, but let it through. break; + case BL_NPC: // allows NPC-set skill units to proceed [blackhole89] + break; default: //Invalid source of attack? return 0; } diff --git a/src/map/script.c b/src/map/script.c index 26ae86ee1..fdcc98c6e 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -438,6 +438,9 @@ int buildin_sleep(struct script_state *st); int buildin_sleep2(struct script_state *st); int buildin_awake(struct script_state *st); int buildin_getvariableofnpc(struct script_state *st); +// [blackhole89] --> +int buildin_warpportal(struct script_state *st); +// <-- [blackhole89] void push_val(struct script_stack *stack,int type,int val); int run_func(struct script_state *st); @@ -779,6 +782,9 @@ struct { {buildin_sleep2,"sleep2","i"}, {buildin_awake,"awake","s"}, {buildin_getvariableofnpc,"getvariableofnpc","is"}, + // [blackhole89] --> + {buildin_warpportal,"warpportal","iisii"}, + // <--- [blackhole89] {NULL,NULL,NULL}, }; @@ -11011,6 +11017,39 @@ int buildin_getvariableofnpc(struct script_state *st) } return 0; } + +// [blackhole89] ---> + +// Set a warp portal. +int buildin_warpportal(struct script_state *st){ + struct skill_unit_group *group; + unsigned short mapindex; + long spx,spy,tpx,tpy; + struct block_list *bl=map_id2bl(st->oid); + + nullpo_retr(0,bl); + + spx=conv_num(st, & (st->stack->stack_data[st->start+2])); + spy=conv_num(st, & (st->stack->stack_data[st->start+3])); + mapindex = mapindex_name2id((char*)conv_str(st,& (st->stack->stack_data[st->start+4]))); + printf("mapindex: %d\n",mapindex); + tpx=conv_num(st, & (st->stack->stack_data[st->start+5])); + tpy=conv_num(st, & (st->stack->stack_data[st->start+6])); + + if(!mapindex) return 0; + + if((group=skill_unitsetting(bl,AL_WARP,4,spx,spy,1))==NULL) { + return 0; + } + + group->val2=(tpx<<16)|tpy; + group->val3 = mapindex; + + return 0; +} + +// <-- [blackhole89] + // // ŽÀs•”main // -- cgit v1.2.3-70-g09d2