From bc7213b9b4650dd26029be375e7a6727bd60afb2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 16 Nov 2015 17:21:46 +0300 Subject: Add gm command slide for fast move player on same map. --- src/emap/atcommand.c | 34 ++++++++++++++++++++++++++++++++++ src/emap/atcommand.h | 1 + src/emap/init.c | 1 + 3 files changed, 36 insertions(+) diff --git a/src/emap/atcommand.c b/src/emap/atcommand.c index 7978758..5818dc4 100644 --- a/src/emap/atcommand.c +++ b/src/emap/atcommand.c @@ -89,3 +89,37 @@ ACMD2(setSkill) return true; } + +ACMD2(slide) +{ + int x = 0; + int y = 0; + if (!*message || sscanf(message, "%4d %4d", &x, &y) < 2) + { + const char* text = info->help; + if (text) + clif->messageln (fd, text); + return false; + } + + if (!sd) + { + clif->message(fd, msg_fd(fd, 3)); // Character not found. + return false; + } + + const int m = sd->bl.m; + if (x < 0 || x >= map->list[m].xs || y < 0 || y >= map->list[m].ys) + { + ShowError("slide: attempt to place player %s (%d:%d) on invalid coordinates (%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, x, y); + return false; + } + if (map->getcell(m, &sd->bl, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle->bc->gm_ignore_warpable_area) + { + clif->message(fd, msg_fd(fd, 2)); + return false; + } + clif->slide(&sd->bl, x, y); + unit->movepos(&sd->bl, x, y, 1, 0); + return true; +} diff --git a/src/emap/atcommand.h b/src/emap/atcommand.h index 8375983..b3166ab 100644 --- a/src/emap/atcommand.h +++ b/src/emap/atcommand.h @@ -10,5 +10,6 @@ const char* eatcommand_msgfd(int *fdPtr, int *msgPtr); #define ACMD2(x) bool atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command __attribute__ ((unused)), const char* message, struct AtCommandInfo *info) ACMD2(setSkill); +ACMD2(slide); #endif // EVOL_MAP_ATCOMMAND diff --git a/src/emap/init.c b/src/emap/init.c index 5b3352e..27cd1ac 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -80,6 +80,7 @@ HPExport void plugin_init (void) status_init(); addAtcommand("setskill", setSkill); + addAtcommand("slide", slide); addScriptCommand("chatjoin", "i*", chatJoin); addScriptCommand("setcamnpc", "*", setCamNpc); -- cgit v1.2.3-60-g2f50