diff options
Diffstat (limited to 'src/emap')
-rw-r--r-- | src/emap/atcommand.c | 34 | ||||
-rw-r--r-- | src/emap/atcommand.h | 1 | ||||
-rw-r--r-- | src/emap/init.c | 1 |
3 files changed, 36 insertions, 0 deletions
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); |