Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated sds and fixed a few issues #11

Merged
merged 3 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 0 additions & 243 deletions src/amnuts.c
Original file line number Diff line number Diff line change
Expand Up @@ -6172,249 +6172,6 @@ login_who(UR_OBJECT user)
sdsfree(lineText);
}

/*
* Show the command available listed by level
*/
void
help_commands_level(UR_OBJECT user)
{
int cnt, total, highlight;
enum lvl_value lvl;
sds temp, temp1;
CMD_OBJECT cmd;

start_pager(user);
write_user(user,
"\n+----------------------------------------------------------------------------+\n");
write_user(user,
"| All commands start with a \".\" (when in ~FYspeech~RS mode) and can be abbreviated |\n");
write_user(user,
"| Remember, a \".\" by itself will repeat your last command or speech |\n");
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
align_string(1, 78, 1, "|",
" Commands available to you (level ~OL%s~RS) ",
user_level[user->level].name));
write_user(user,
"+----------------------------------------------------------------------------+\n");
total = 0;
for (lvl = JAILED; lvl < NUM_LEVELS; lvl = (enum lvl_value) (lvl + 1)) {
if (user->level < lvl) {
break;
}
cnt = 0;
*text = '\0';
sprintf(text, " ~FG~OL%-1.1s)~RS ~FC", user_level[lvl].name);
highlight = 1;
/* scroll through all commands, format and print */
for (cmd = first_command; cmd; cmd = cmd->next) {
temp1 = sdsempty();
if (cmd->level != lvl) {
continue;
}
if (has_xcom(user, cmd->id)) {
temp1 = sdscatfmt(sdsempty(), "~FR%s~RS%s %s", cmd->name, highlight ? "~FC" : "",
cmd->alias);
} else {
temp1 = sdscatfmt(sdsempty(), "%s %s", cmd->name, cmd->alias);
}
if (++cnt == 5) {
strcat(text, temp1);
strcat(text, "~RS");
write_user(user, align_string(0, 78, 1, "|", "%s", text));
cnt = 0;
highlight = 0;
*text = '\0';
} else {
temp = sdscatprintf(sdsempty(), "%-*s ", 11 + (int) teslen(temp1, 0), temp1);
strcat(text, temp);
}
if (!cnt) {
strcat(text, " ");
}
sdsfree(temp);
sdsfree(temp1);
}
if (cnt > 0 && cnt < 5)
write_user(user, align_string(0, 78, 1, "|", "%s", text));
}
/* count up total number of commands for user level */
for (cmd = first_command; cmd; cmd = cmd->next) {
if (cmd->level > user->level) {
continue;
}
++total;
}
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
align_string(0, 78, 1, "|",
" There is a total of ~OL%d~RS command%s that you can use ",
total, PLTEXT_S(total)));
write_user(user,
"+----------------------------------------------------------------------------+\n");
stop_pager(user);
}

/*
* Show the command available listed by function
*/
void
help_commands_function(UR_OBJECT user)
{
sds temp, temp1;
CMD_OBJECT cmd;
int cnt, total, function, found;

start_pager(user);
write_user(user,
"\n+----------------------------------------------------------------------------+\n");
write_user(user,
"| All commands start with a \".\" (when in ~FYspeech~RS mode) and can be abbreviated |\n");
write_user(user,
"| Remember, a \".\" by itself will repeat your last command or speech |\n");
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
align_string(1, 78, 1, "|",
" Commands available to you (level ~OL%s~RS) ",
user_level[user->level].name));
write_user(user,
"+----------------------------------------------------------------------------+\n");
/* scroll through all the commands listing by function */
total = 0;
for (function = 0; command_types[function]; ++function) {
cnt = 0;
found = 0;
*text = '\0';
/* scroll through all commands, format and print */
for (cmd = first_command; cmd; cmd = cmd->next) {
temp1 = sdsempty();
if (cmd->level > user->level || cmd->function != function) {
continue;
}
if (!found++) {
write_user(user,
align_string(0, 78, 1, "|", " ~OL~FG%s~RS ",
command_types[function]));
strcpy(text, " ");
}
if (has_xcom(user, cmd->id)) {
temp1 = sdscatfmt(sdsempty(), "~FR%s~RS %s", cmd->name, cmd->alias);
} else {
temp1 = sdscatfmt(sdsempty(), "%s %s", cmd->name, cmd->alias);
}
if (++cnt == 5) {
strcat(text, temp1);
strcat(text, "~RS");
write_user(user, align_string(0, 78, 1, "|", "%s", text));
cnt = 0;
*text = '\0';
} else {
temp = sdscatprintf(sdsempty(), "%-*s ", 11 + (int) teslen(temp1, 0), temp1);
strcat(text, temp);
}
if (!cnt) {
strcat(text, " ");
}
sdsfree(temp);
sdsfree(temp1);
}
if (cnt > 0 && cnt < 5)
write_user(user, align_string(0, 78, 1, "|", "%s", text));
}
/* count up total number of commands for user level */
for (cmd = first_command; cmd; cmd = cmd->next) {
if (cmd->level > user->level) {
continue;
}
++total;
}
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
align_string(0, 78, 1, "|",
" There is a total of ~OL%d~RS command%s that you can use ",
total, PLTEXT_S(total)));
write_user(user,
"+----------------------------------------------------------------------------+\n");
stop_pager(user);
}

/*
* Show NUTS credits
*/
void
help_nuts_credits(UR_OBJECT user)
{
write_user(user,
"\n~BB*** NUTS Credits :) (for Amnuts credits, see \".help credits\") ***\n\n");
vwrite_user(user,
"~BRNUTS version %s, Copyright (C) Neil Robertson 1996.\n\n",
NUTSVER);
write_user(user,
"~BM ~BB ~BC ~BG ~BY ~BR \n");
write_user(user,
"NUTS stands for Neil's Unix Talk Server, a program which started out as a\n");
write_user(user,
"university project in autumn 1992 and has progressed from thereon. In no\n");
write_user(user,
"particular order thanks go to the following people who helped me develop or\n");
write_user(user, "debug this code in one way or another over the years:\n");
write_user(user,
" ~FCDarren Seryck, Steve Guest, Dave Temple, Satish Bedi, Tim Bernhardt,\n");
write_user(user,
" ~FCKien Tran, Jesse Walton, Pak Chan, Scott MacKenzie and Bryan McPhail.\n");
write_user(user,
"Also thanks must go to anyone else who has emailed me with ideas and/or bug\n");
write_user(user,
"reports and all the people who have used NUTS over the intervening years.\n");
write_user(user,
"I know I have said this before but this time I really mean it--this is the final\n");
write_user(user,
"version of NUTS 3. In a few years NUTS 4 may spring forth but in the meantime\n");
write_user(user, "that, as they say, is that. :)\n\n");
write_user(user,
"If you wish to email me my address is \"~FGneil@ogham.demon.co.uk~RS\" and should\n");
write_user(user,
"remain so for the forseeable future.\n\nNeil Robertson - November 1996.\n");
write_user(user,
"~BM ~BB ~BC ~BG ~BY ~BR \n\n");
}

/*
* Show the credits. Add your own credits here if you wish but PLEASE leave
* my credits intact. Thanks.
*/
void
help_amnuts_credits(UR_OBJECT user)
{
write_user(user,
"~BM ~BB ~BC ~BG ~BY ~BR \n\n");
vwrite_user(user,
"~OL~FCAmnuts version %s~RS, Copyright (C) Andrew Collington, 2003\n",
AMNUTSVER);
write_user(user,
"Brought to you by the Amnuts Development Group (Andy, Ardant and Uzume)\n\n");
write_user(user,
"Amnuts stands for ~OLA~RSndy's ~OLM~RSodified ~OLNUTS~RS, a Unix talker server written in C.\n\n");
write_user(user,
"Many thanks to everyone who has helped out with Amnuts. Special thanks go to\n");
write_user(user,
"Ardant, Uzume, Arny (of Paris fame), Silver (of PG+ fame), and anyone else who\n");
write_user(user,
"has contributed at all to the development of Amnuts.\n\n");
write_user(user,
"If you are interested, you can purchase Amnuts t-shirts, mugs, mousemats, and\n");
write_user(user,
"more, from http://www.cafepress.com/amnuts/\n\nWe hope you enjoy the talker!\n\n");
write_user(user,
" -- The Amnuts Development Group\n\n(for NUTS credits, see \".help nuts\")\n");
write_user(user,
"\n~BM ~BB ~BC ~BG ~BY ~BR \n\n");
}

void
show_attributes(UR_OBJECT user)
{
Expand Down
Loading