summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-24 05:25:01 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-11-24 05:25:01 +0000
commitead84f994eb5440f2406e9fee7a93800c0e7e78e (patch)
treef45306a3c0bd86d123fa15d1065465ac8e46be4a /src/map/script.c
parentb413c736331227ce3198831dda21b5e484182359 (diff)
downloadhercules-ead84f994eb5440f2406e9fee7a93800c0e7e78e.tar.gz
hercules-ead84f994eb5440f2406e9fee7a93800c0e7e78e.tar.bz2
hercules-ead84f994eb5440f2406e9fee7a93800c0e7e78e.tar.xz
hercules-ead84f994eb5440f2406e9fee7a93800c0e7e78e.zip
* Completed Reddozen's hanging mapwarp code to support party and old syntax.
modified Changelog-Trunk.txt modified src/map/script.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9305 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 233648a4d..914931ebf 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3802,7 +3802,7 @@ struct script_function buildin_func[] = {
{buildin_specialeffect,"specialeffect","i*"}, // npc skill effect [Valaris]
{buildin_specialeffect2,"specialeffect2","i*"}, // skill effect on players[Valaris]
{buildin_nude,"nude",""}, // nude command [Valaris]
- {buildin_mapwarp,"mapwarp","ssiiii"}, // Added by RoVeRT
+ {buildin_mapwarp,"mapwarp","ssii*"}, // Added by RoVeRT
{buildin_inittimer,"inittimer",""},
{buildin_stoptimer,"stoptimer",""},
{buildin_cmdothernpc,"cmdothernpc","ss"},
@@ -9114,12 +9114,15 @@ int buildin_failedremovecards(struct script_state *st)
/* ================================================================
* mapwarp "<from map>","<to map>",<x>,<y>,<type>,<ID for Type>;
- * type: 0=everyone, 1=guild, 2=party(uncoded); [Reddozen]
+ * type: 0=everyone, 1=guild, 2=party; [Reddozen]
+ * improved by [Lance]
* ================================================================
*/
int buildin_mapwarp(struct script_state *st) // Added by RoVeRT
{
int x,y,m,check_val=0,check_ID=0,i=0;
+ struct guild *g = NULL;
+ struct party_data *p = NULL;
char *str;
char *mapname;
unsigned int index;
@@ -9127,8 +9130,10 @@ int buildin_mapwarp(struct script_state *st) // Added by RoVeRT
str=conv_str(st,& (st->stack->stack_data[st->start+3]));
x=conv_num(st,& (st->stack->stack_data[st->start+4]));
y=conv_num(st,& (st->stack->stack_data[st->start+5]));
- check_val=conv_num(st,& (st->stack->stack_data[st->start+6]));
- check_ID=conv_num(st,& (st->stack->stack_data[st->start+7]));
+ if(st->end > st->start+7){
+ check_val=conv_num(st,& (st->stack->stack_data[st->start+6]));
+ check_ID=conv_num(st,& (st->stack->stack_data[st->start+7]));
+ }
if( (m=map_mapname2mapid(mapname))< 0)
return 0;
@@ -9136,21 +9141,31 @@ int buildin_mapwarp(struct script_state *st) // Added by RoVeRT
if(!(index=mapindex_name2id(str)))
return 0;
- if(!(check_val))
- map_foreachinmap(buildin_areawarp_sub,
- m,BL_PC,index,x,y);
-
- if(check_val==1){
- struct guild *g = guild_search(check_ID);
-
- if (g){
- for( i=0; i < g->max_member; i++)
- {
- if(g->member[i].sd && g->member[i].sd->bl.m==m){
- pc_setpos(g->member[i].sd,index,x,y,3);
+ switch(check_val){
+ case 1:
+ g = guild_search(check_ID);
+ if (g){
+ for( i=0; i < g->max_member; i++)
+ {
+ if(g->member[i].sd && g->member[i].sd->bl.m==m){
+ pc_setpos(g->member[i].sd,index,x,y,3);
+ }
}
}
- }
+ break;
+ case 2:
+ p = party_search(check_ID);
+ if(p){
+ for(i=0;i<MAX_PARTY; i++){
+ if(p->data[i].sd && p->data[i].sd->bl.m == m){
+ pc_setpos(p->data[i].sd,index,x,y,3);
+ }
+ }
+ }
+ break;
+ default:
+ map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y);
+ break;
}
return 0;