summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorEmistry Haoyan <Equinox1991@gmail.com>2017-03-07 22:25:21 +0800
committerEmistry Haoyan <Equinox1991@gmail.com>2017-03-13 23:15:02 +0800
commit68feea9f091f368b5e661314eb7a9a3cd93d6dad (patch)
tree13dea65db97b704b76cc6cab664da21de827a526 /src/map
parentce74d8c119facb51a0da92ef965c3dd78994b68f (diff)
downloadhercules-68feea9f091f368b5e661314eb7a9a3cd93d6dad.tar.gz
hercules-68feea9f091f368b5e661314eb7a9a3cd93d6dad.tar.bz2
hercules-68feea9f091f368b5e661314eb7a9a3cd93d6dad.tar.xz
hercules-68feea9f091f368b5e661314eb7a9a3cd93d6dad.zip
Enable display of custom commands in @commands.
- Based on @Dastgir's commit. https://github.com/RagEmu/Renewal/commit/9409e435cab3c7ee24172f09b865b2803411f0ff - only GM with the minimum group id able to view it.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c30
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);