From 578728adfd125eeac56150705b41e05cd4d970e4 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 27 Apr 2006 14:10:29 +0000 Subject: - Added at command @commands, displays the list of commands available to you. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6313 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 2 ++ conf-tmpl/atcommand_athena.conf | 3 +++ conf-tmpl/msg_athena.conf | 3 +++ src/map/atcommand.c | 35 +++++++++++++++++++++++++++++++++++ src/map/atcommand.h | 2 +- 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 1d1e470f3..89e02d5fc 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,8 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/04/27 + * Added at command @commands, displays the list of commands available to + you. Defaults to level 1. [Skotlex] * Added the missing clif_* calls to make changebase's view-class change update on the client. [Skotlex] * Added battle config hide_woe_damage which hides damage on woe maps diff --git a/conf-tmpl/atcommand_athena.conf b/conf-tmpl/atcommand_athena.conf index d45287c10..6459c2af2 100644 --- a/conf-tmpl/atcommand_athena.conf +++ b/conf-tmpl/atcommand_athena.conf @@ -45,6 +45,9 @@ command_symbol: @ //------------------------- // 1: Super player commands +//Displays a list of @ commands available to the player. +commands: 1 + //Displays the server rates. rates: 1 diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf index a83375b5a..c3840d22f 100644 --- a/conf-tmpl/msg_athena.conf +++ b/conf-tmpl/msg_athena.conf @@ -282,6 +282,9 @@ 270: *%s %s* 271: You can't drop items on this map 272: You can't trade on this map +273: Commands available: +274: %d commands found. +275: No commands found. // Guild Castles Number // -------------------- 299: ?? Castles diff --git a/src/map/atcommand.c b/src/map/atcommand.c index af87efa99..c2d1d0d2f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -293,6 +293,7 @@ ACMD_FUNC(main); // LuzZza ACMD_FUNC(clone); // [Valaris] ACMD_FUNC(tonpc); // LuzZza +ACMD_FUNC(commands); // LuzZza /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 @@ -607,6 +608,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Clone, "@slaveclone", 50, atcommand_clone }, { AtCommand_Clone, "@evilclone", 50, atcommand_clone }, // [Valaris] { AtCommand_ToNPC, "@tonpc", 40, atcommand_tonpc }, // LuzZza + { AtCommand_Commands, "@commands", 1, atcommand_commands }, // [Skotlex] // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } @@ -1157,6 +1159,39 @@ int duel_reject( *------------------------------------------ */ +/*========================================== + * @commands Lists available @ commands to you. + *------------------------------------------ + */ +int atcommand_commands(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + int i,count=0,level; + nullpo_retr(-1, sd); + level = pc_isGM(sd); + + clif_displaymessage(fd, msg_txt(273)); + memset(atcmd_output, 0, sizeof atcmd_output); + for (i = 0; atcommand_info[i].type != AtCommand_None; i++) + if (atcommand_info[i].level <= level) { + count++; + strcat(atcmd_output, atcommand_info[i].command); + strcat(atcmd_output, " "); + if (!(count%10)) { + clif_displaymessage(fd, atcmd_output); + memset(atcmd_output, 0, sizeof atcmd_output); + } + } + + if (count) { + sprintf(atcmd_output, msg_txt(274), count); + clif_displaymessage(fd, atcmd_output); + } else + clif_displaymessage(fd, msg_txt(275)); + + return 0; +} + /*========================================== * @send (used for testing packet sends from the client) *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 08df26523..f67c12844 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -268,7 +268,7 @@ enum AtCommandType { AtCommand_Clone, // [Valaris] AtCommand_ToNPC, // LuzZza - + AtCommand_Commands, // [Skotlex] // end <- Ahem, guys, don't place AtCommands after AtCommand_Unknown! [Skotlex] AtCommand_Unknown, AtCommand_MAX -- cgit v1.2.3-70-g09d2