mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-06 01:18:49 +01:00
Wizhelp (#39)
* Added %log%, and made %send%, %echo%, etc. not force capitalization. * Fixed Previous Commit * Really fixed this time. * Fixed look 2.mail Also reverted CMMAND_TERMS, was increased in previous commit when it didn't need to be due to the removed of marena. * Fixed add_to_lookup_table Fixed as per Welcor https://www.tbamud.com/forum/2-general/4307-crash-bug-need-assistance-with-gdb?start=20#7390 * Fixed two crash bugs Fixed tw crash bugs Welcor found here https://www.tbamud.com/forum/4-development/4300-simple-list-forced-to-reset-itself * wizhelp changes Cleared buf in columns_list that was getting garbage data in it. Removed wizhelp subcommand from do_commands, and removed buf and sprintf line that were never sent to anyone and replaced it with a send_to_char. Removed arg capability from do_commands as it's no longer useful without the wizhelp subcommand. Replaced wizhelp subcommand with separate do_wizhelp command that sorts commands by their level and shows all imms all imm commands regardless of their level.
This commit is contained in:
parent
fe8f93a6b2
commit
2a62eb3f4d
5 changed files with 35 additions and 27 deletions
|
|
@ -64,7 +64,6 @@ void free_recent_players(void);
|
|||
ACMD(do_commands);
|
||||
#define SCMD_COMMANDS 0
|
||||
#define SCMD_SOCIALS 1
|
||||
#define SCMD_WIZHELP 2
|
||||
/* do_gen_ps */
|
||||
ACMD(do_gen_ps);
|
||||
#define SCMD_INFO 0
|
||||
|
|
@ -340,6 +339,7 @@ ACMD(do_teleport);
|
|||
ACMD(do_trans);
|
||||
ACMD(do_vnum);
|
||||
ACMD(do_vstat);
|
||||
ACMD(do_wizhelp);
|
||||
ACMD(do_wizlock);
|
||||
ACMD(do_wiznet);
|
||||
ACMD(do_wizupdate);
|
||||
|
|
|
|||
|
|
@ -2210,35 +2210,17 @@ ACMD(do_toggle)
|
|||
ACMD(do_commands)
|
||||
{
|
||||
int no, i, cmd_num;
|
||||
int wizhelp = 0, socials = 0;
|
||||
struct char_data *vict;
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
int socials = 0;
|
||||
const char *commands[1000];
|
||||
int overflow = sizeof(commands) / sizeof(commands[0]);
|
||||
|
||||
if (!ch->desc)
|
||||
return;
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (*arg) {
|
||||
if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD)) || IS_NPC(vict)) {
|
||||
send_to_char(ch, "Who is that?\r\n");
|
||||
return;
|
||||
}
|
||||
} else
|
||||
vict = ch;
|
||||
|
||||
if (subcmd == SCMD_SOCIALS)
|
||||
socials = 1;
|
||||
else if (subcmd == SCMD_WIZHELP)
|
||||
wizhelp = 1;
|
||||
|
||||
sprintf(buf, "The following %s%s are available to %s:\r\n",
|
||||
wizhelp ? "privileged " : "",
|
||||
socials ? "socials" : "commands",
|
||||
vict == ch ? "you" : GET_NAME(vict));
|
||||
send_to_char(ch, "The following %s are available to you:\r\n", socials ? "socials" : "commands");
|
||||
|
||||
/* cmd_num starts at 1, not 0, to remove 'RESERVED' */
|
||||
for (no = 0, cmd_num = 1;
|
||||
|
|
@ -2250,13 +2232,10 @@ ACMD(do_commands)
|
|||
if (complete_cmd_info[i].minimum_level < 0 || GET_LEVEL(vict) < complete_cmd_info[i].minimum_level)
|
||||
continue;
|
||||
|
||||
if ((complete_cmd_info[i].minimum_level >= LVL_IMMORT) != wizhelp)
|
||||
if (complete_cmd_info[i].minimum_level >= LVL_IMMORT)
|
||||
continue;
|
||||
|
||||
if (!wizhelp && socials != (complete_cmd_info[i].command_pointer == do_action))
|
||||
continue;
|
||||
|
||||
if (wizhelp && complete_cmd_info[i].command_pointer == do_action)
|
||||
if (socials != (complete_cmd_info[i].command_pointer == do_action))
|
||||
continue;
|
||||
|
||||
if (--overflow < 0)
|
||||
|
|
|
|||
|
|
@ -89,6 +89,34 @@ static int purge_room(room_rnum room)
|
|||
return 1;
|
||||
}
|
||||
|
||||
ACMD(do_wizhelp)
|
||||
{
|
||||
extern int *cmd_sort_info;
|
||||
int no = 1, i, cmd_num;
|
||||
int level;
|
||||
|
||||
if (!ch->desc)
|
||||
return;
|
||||
|
||||
send_to_char(ch, "The following privileged commands are available:\r\n");
|
||||
|
||||
for (level = LVL_IMPL; level >= LVL_IMMORT; level--) {
|
||||
send_to_char(ch, "%sLevel %d%s:\r\n", CCCYN(ch, C_NRM), level, CCNRM(ch, C_NRM));
|
||||
for (no = 1, cmd_num = 1; complete_cmd_info[cmd_sort_info[cmd_num]].command[0] != '\n'; cmd_num++) {
|
||||
i = cmd_sort_info[cmd_num];
|
||||
|
||||
if (complete_cmd_info[i].minimum_level != level)
|
||||
continue;
|
||||
|
||||
send_to_char(ch, "%-14s%s", complete_cmd_info[i].command, no++ % 7 == 0 ? "\r\n" : "");
|
||||
}
|
||||
if (no % 7 != 1)
|
||||
send_to_char(ch, "\r\n");
|
||||
if (level != LVL_IMMORT)
|
||||
send_to_char(ch, "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
ACMD(do_echo)
|
||||
{
|
||||
skip_spaces(&argument);
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "withdraw" , "withdraw", POS_STANDING, do_not_here , 1, 0 },
|
||||
{ "wiznet" , "wiz" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 },
|
||||
{ ";" , ";" , POS_DEAD , do_wiznet , LVL_IMMORT, 0 },
|
||||
{ "wizhelp" , "wizhelp" , POS_SLEEPING, do_commands , LVL_IMMORT, SCMD_WIZHELP },
|
||||
{ "wizhelp" , "wizhelp" , POS_DEAD , do_wizhelp , LVL_IMMORT, 0 },
|
||||
{ "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST },
|
||||
{ "wizupdate", "wizupde" , POS_DEAD , do_wizupdate, LVL_GRGOD, 0 },
|
||||
{ "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 },
|
||||
|
|
|
|||
|
|
@ -961,6 +961,7 @@ void column_list(struct char_data *ch, int num_cols, const char **list, int list
|
|||
int num_per_col, col_width, r, c, i, offset = 0;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
*buf='\0';
|
||||
/* Work out the longest list item */
|
||||
for (i=0; i<list_length; i++)
|
||||
if (max_len < strlen(list[i]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue