From b6690d7bb05e75d28891f360f42e0dfe19ea0904 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Sep 2016 21:04:27 +0300 Subject: Add script command navigateto. Add packet for this command. Based on rAthena commits: commit 4f13007fec7f08c265620a71c3bc4806d186c0f1 Author: Lemongrass3110 Date: Sun Mar 6 21:48:47 2016 +0100 commit 809f220b9f5ef70ee062ee56ae6e8d5f56cb5d32 Author: aleos89 Date: Sun Mar 6 16:15:54 2016 -0500 commit 179f73424934d528ebe494dfb66503c182eacb09 Author: aleos89 Date: Sun Mar 6 16:10:15 2016 -0500 --- src/map/script.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'src/map/script.c') 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 @@ -20506,6 +20506,48 @@ BUILDIN(pcre_match) return true; } +/** + * navigateto(""{,,,,,,}); + */ +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. * @@ -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); -- cgit v1.2.3-70-g09d2