diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-08 21:04:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-12 01:03:20 +0300 |
commit | b6690d7bb05e75d28891f360f42e0dfe19ea0904 (patch) | |
tree | 0411ca4d1eebaba5cb1f008f7a21f5360d3f3aba /src/map/clif.c | |
parent | 08de021655e1d032db5efa74f3da8f2d8b1efe99 (diff) | |
download | hercules-b6690d7bb05e75d28891f360f42e0dfe19ea0904.tar.gz hercules-b6690d7bb05e75d28891f360f42e0dfe19ea0904.tar.bz2 hercules-b6690d7bb05e75d28891f360f42e0dfe19ea0904.tar.xz hercules-b6690d7bb05e75d28891f360f42e0dfe19ea0904.zip |
Add script command navigateto. Add packet for this command.
Based on rAthena commits:
commit 4f13007fec7f08c265620a71c3bc4806d186c0f1
Author: Lemongrass3110 <lemongrass@kstp.at>
Date: Sun Mar 6 21:48:47 2016 +0100
commit 809f220b9f5ef70ee062ee56ae6e8d5f56cb5d32
Author: aleos89 <aleos89@users.noreply.github.com>
Date: Sun Mar 6 16:15:54 2016 -0500
commit 179f73424934d528ebe494dfb66503c182eacb09
Author: aleos89 <aleos89@users.noreply.github.com>
Date: Sun Mar 6 16:10:15 2016 -0500
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 7e4f6b825..749b3d068 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -18861,6 +18861,47 @@ void clif_selectcart(struct map_session_data *sd) #endif } +/// Starts navigation to the given target on client side +void clif_navigate_to(struct map_session_data *sd, const char* mapname, uint16 x, uint16 y, uint8 flag, bool hideWindow, uint16 mob_id) +{ +#if PACKETVER >= 20111010 + int fd; + + nullpo_retv(sd); + nullpo_retv(mapname); + fd = sd->fd; + WFIFOHEAD(fd, 27); + WFIFOW(fd, 0) = 0x8e2; + + // How detailed will our navigation be? + if (mob_id > 0) { + x = 0; + y = 0; + WFIFOB(fd, 2) = 3; // monster with destination field + } else if (x > 0 && y > 0) { + WFIFOB(fd, 2) = 0; // with coordinates + } else { + x = 0; + y = 0; + WFIFOB(fd, 2) = 1; // without coordinates(will fail if you are already on the map) + } + + // Which services can be used for transportation? + WFIFOB(fd, 3) = flag; + // If this flag is set, the navigation window will not be opened up + WFIFOB(fd, 4) = hideWindow; + // Target map + safestrncpy((char*)WFIFOP(fd, 5), mapname, MAP_NAME_LENGTH_EXT); + // Target x + WFIFOW(fd, 21) = x; + // Target y + WFIFOW(fd, 23) = y; + // Target monster ID + WFIFOW(fd, 25) = mob_id; + WFIFOSET(fd, 27); +#endif +} + /** * Returns the name of the given bl, in a client-friendly format. * @@ -19704,6 +19745,7 @@ void clif_defaults(void) { clif->selectcart = clif_selectcart; /* */ clif->isdisguised = clif_isdisguised; + clif->navigate_to = clif_navigate_to; clif->bl_type = clif_bl_type; /*------------------------ |