summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-16 17:21:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-16 17:21:46 +0300
commitbc7213b9b4650dd26029be375e7a6727bd60afb2 (patch)
treee325f8172b50681487b024456dfb4da9a7a7853f
parentb7afcb67f381f5087f2cf1e388b7acf79fa95a03 (diff)
downloadevol-hercules-bc7213b9b4650dd26029be375e7a6727bd60afb2.tar.gz
evol-hercules-bc7213b9b4650dd26029be375e7a6727bd60afb2.tar.bz2
evol-hercules-bc7213b9b4650dd26029be375e7a6727bd60afb2.tar.xz
evol-hercules-bc7213b9b4650dd26029be375e7a6727bd60afb2.zip
Add gm command slide for fast move player on same map.
-rw-r--r--src/emap/atcommand.c34
-rw-r--r--src/emap/atcommand.h1
-rw-r--r--src/emap/init.c1
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);