summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-25 14:32:56 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-05 14:28:30 +0300
commit81d0eb8441fa7d1bcfde8a1ca9bf09666d5139d8 (patch)
tree12d608e3dd6fd989ca6c46bb988fe91f54630976
parentac9dc43ac589e0c70f1f4f27d04dad0a302805bc (diff)
downloadhercules-81d0eb8441fa7d1bcfde8a1ca9bf09666d5139d8.tar.gz
hercules-81d0eb8441fa7d1bcfde8a1ca9bf09666d5139d8.tar.bz2
hercules-81d0eb8441fa7d1bcfde8a1ca9bf09666d5139d8.tar.xz
hercules-81d0eb8441fa7d1bcfde8a1ca9bf09666d5139d8.zip
Add optional parameter to warp script command for prevent stoping npc scripts after warp.
-rw-r--r--doc/script_commands.txt6
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/pc.c1
-rw-r--r--src/map/pc.h1
-rw-r--r--src/map/script.c8
5 files changed, 24 insertions, 10 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index af8dffef0..e190c5cff 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4116,7 +4116,7 @@ will be seen to everyone around but not in chat window.
---------------------------------------
-*warp "<map name>",<x>,<y>;
+*warp "<map name>",<x>,<y>{,<flag>};
This command will take the invoking character to the specified map, and if
wanted, specified coordinates too, but these can be random.
@@ -4139,6 +4139,10 @@ There are also three special 'map names' you can use:
"Random" will warp the player randomly on the current map.
"Save" and "SavePoint" will warp the player back to their save point.
+If flag parameter is set to 0, after player warped will be not stopped
+currend running npc script. Running script after warp can be issue for
+Gravity client if warp to other maps.
+
---------------------------------------
*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
diff --git a/src/map/clif.c b/src/map/clif.c
index cbe22dbb0..d00cac0ee 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9215,14 +9215,16 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) {
clif->updatestatus(sd,SP_DEX);
clif->updatestatus(sd,SP_LUK);
- // abort currently running script
- sd->state.using_fake_npc = 0;
- sd->state.menu_or_input = 0;
- sd->npc_menu = 0;
-
- if(sd->npc_id)
- npc->event_dequeue(sd);
-
+ if (sd->state.warp_clean) {
+ // abort currently running script
+ sd->state.using_fake_npc = 0;
+ sd->state.menu_or_input = 0;
+ sd->npc_menu = 0;
+ if(sd->npc_id)
+ npc->event_dequeue(sd);
+ } else {
+ sd->state.warp_clean = 1;
+ }
if( sd->guild && ( battle_config.guild_notice_changemap == 2 || ( battle_config.guild_notice_changemap == 1 && sd->state.changemap ) ) )
clif->guild_notice(sd,sd->guild);
}
diff --git a/src/map/pc.c b/src/map/pc.c
index 8b52f615d..107d656f0 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -651,6 +651,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->canlog_tick = timer->gettick();
//Required to prevent homunculus copuing a base speed of 0.
sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
+ sd->state.warp_clean = 1;
return 0;
}
diff --git a/src/map/pc.h b/src/map/pc.h
index c370f9956..f546d4910 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -206,6 +206,7 @@ struct map_session_data {
unsigned int itemcheck : 1;
unsigned int standalone : 1;/* [Ind/Hercules <3] */
unsigned int loggingout : 1;
+ unsigned int warp_clean : 1;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
diff --git a/src/map/script.c b/src/map/script.c
index 30af4d0f7..e7a0175c7 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5763,6 +5763,7 @@ BUILDIN(warp)
{
int ret;
int x,y;
+ int warp_clean = 1;
const char* str;
TBL_PC* sd;
@@ -5774,6 +5775,11 @@ BUILDIN(warp)
x = script_getnum(st,3);
y = script_getnum(st,4);
+ if (script_hasdata(st, 5)) {
+ warp_clean = script_getnum(st, 5);
+ }
+
+ sd->state.warp_clean = warp_clean;
if(strcmp(str,"Random")==0)
ret = pc->randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
@@ -19855,7 +19861,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(jobchange,"i?"),
BUILDIN_DEF(jobname,"i"),
BUILDIN_DEF(input,"r??"),
- BUILDIN_DEF(warp,"sii"),
+ BUILDIN_DEF(warp,"sii?"),
BUILDIN_DEF(areawarp,"siiiisii??"),
BUILDIN_DEF(warpchar,"siii"), // [LuzZza]
BUILDIN_DEF(warpparty,"siii?"), // [Fredzilla] [Paradox924X]