diff options
author | Haru <haru@dotalux.com> | 2017-03-16 14:21:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 14:21:14 +0100 |
commit | 07639c861a7326c4ae022a6fedc161941f69e651 (patch) | |
tree | 6d0c37835e9542377e80eeca30f0dde21de7fb70 /src | |
parent | 1e3f61685c9f5a21be1e7ed29a300baf09dd7bd6 (diff) | |
parent | 68feea9f091f368b5e661314eb7a9a3cd93d6dad (diff) | |
download | hercules-07639c861a7326c4ae022a6fedc161941f69e651.tar.gz hercules-07639c861a7326c4ae022a6fedc161941f69e651.tar.bz2 hercules-07639c861a7326c4ae022a6fedc161941f69e651.tar.xz hercules-07639c861a7326c4ae022a6fedc161941f69e651.zip |
Merge pull request #1612 from Emistry/atcommand_commands
Enable display of custom commands in @commands.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2beb6c634..881e50497 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8366,6 +8366,36 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand dbi_destroy(iter); clif->message(fd,line_buff); + if (atcommand->binding_count > 0) { + int i, count_bind = 0; + int gm_lvl = pc_get_group_level(sd); + + for (i = 0; i < atcommand->binding_count; i++) { + if (gm_lvl >= ((type == COMMAND_ATCOMMAND) ? atcommand->binding[i]->group_lv : atcommand->binding[i]->group_lv_char)) { + size_t slen = strlen(atcommand->binding[i]->command); + if (count_bind == 0) { + cur = line_buff; + memset(line_buff, ' ', CHATBOX_SIZE); + line_buff[CHATBOX_SIZE - 1] = 0; + clif->message(fd, "------------------"); + clif->message(fd, "Custom commands:"); + } + if (slen + cur - line_buff >= CHATBOX_SIZE) { + clif->message(fd, line_buff); + cur = line_buff; + memset(line_buff, ' ', CHATBOX_SIZE); + line_buff[CHATBOX_SIZE - 1] = 0; + } + memcpy(cur, atcommand->binding[i]->command, slen); + cur += slen + (10 - slen % 10); + count_bind++; + } + } + if (count_bind > 0) + clif->message(fd, line_buff); // Last Line + count += count_bind; + } + safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,274), count); // "%d commands found." clif->message(fd, atcmd_output); |