summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 2633c1e5f..f8754660c 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -20507,6 +20507,48 @@ BUILDIN(pcre_match)
}
/**
+ * navigateto("<map>"{,<x>,<y>,<flag>,<hide_window>,<monster_id>,<char_id>});
+ */
+BUILDIN(navigateto)
+{
+#if PACKETVER >= 20111010
+ struct map_session_data* sd;
+ const char *mapname;
+ uint16 x = 0;
+ uint16 y = 0;
+ uint16 monster_id = 0;
+ uint8 flag = NAV_KAFRA_AND_AIRSHIP;
+ bool hideWindow = true;
+
+ mapname = script_getstr(st, 2);
+
+ if (script_hasdata(st, 3))
+ x = script_getnum(st, 3);
+ if (script_hasdata(st, 4))
+ y = script_getnum(st, 4);
+ if (script_hasdata(st, 5))
+ flag = (uint8)script_getnum(st, 5);
+ if (script_hasdata(st, 6))
+ hideWindow = script_getnum(st, 6) ? true : false;
+ if (script_hasdata(st, 7))
+ monster_id = script_getnum(st, 7);
+
+ if (script_hasdata(st, 8)) {
+ sd = map->charid2sd(script_getnum(st, 8));
+ } else {
+ sd = script->rid2sd(st);
+ }
+
+ clif->navigate_to(sd, mapname, x, y, flag, hideWindow, monster_id);
+
+ return true;
+#else
+ ShowError("Navigation system works only with packet version >= 20111010");
+ return false;
+#endif
+}
+
+/**
* Adds a built-in script function.
*
* @param buildin Script function data
@@ -21175,6 +21217,9 @@ void script_parse_builtin(void) {
BUILDIN_DEF(purchaseok,""),
BUILDIN_DEF(shopcount, "i"),
+ /* Navigation */
+ BUILDIN_DEF(navigateto, "s??????"),
+
BUILDIN_DEF(channelmes, "ss"),
BUILDIN_DEF(showscript, "s?"),
BUILDIN_DEF(mergeitem,""),
@@ -21329,6 +21374,16 @@ void script_hardcoded_constants(void)
script->set_constant("EQP_SHADOW_ACC_R", EQP_SHADOW_ACC_R, false, false);
script->set_constant("EQP_SHADOW_ACC_L", EQP_SHADOW_ACC_L, false, false);
+ script->constdb_comment("Navigation constants, use with *navigateto*");
+ script->set_constant("NAV_NONE", NAV_NONE, false, false);
+ script->set_constant("NAV_AIRSHIP_ONLY", NAV_AIRSHIP_ONLY, false, false);
+ script->set_constant("NAV_SCROLL_ONLY", NAV_SCROLL_ONLY, false, false);
+ script->set_constant("NAV_AIRSHIP_AND_SCROLL", NAV_AIRSHIP_AND_SCROLL, false, false);
+ script->set_constant("NAV_KAFRA_ONLY", NAV_KAFRA_ONLY, false, false);
+ script->set_constant("NAV_KAFRA_AND_AIRSHIP", NAV_KAFRA_AND_AIRSHIP, false, false);
+ script->set_constant("NAV_KAFRA_AND_SCROLL", NAV_KAFRA_AND_SCROLL, false, false);
+ script->set_constant("NAV_ALL", NAV_ALL, false, false);
+
script->constdb_comment("Renewal");
#ifdef RENEWAL
script->set_constant("RENEWAL", 1, false, false);