44 #undef CLIENTHELP_LONG_LIST
60 #error Oops, need to put them back.
62 #define H1(a) draw_info(a, NDI_BLACK)
63 #define H2(a) draw_info(a, NDI_BLACK)
64 #define LINE(a) draw_info(a, NDI_BLACK)
67 #define assumed_wrap get_info_width()
76 #ifndef CLIENTHELP_LONG_LIST
87 H1(
" === Client Side Commands === ");
90 commands_copy = commands_array[i];
95 if (commands_copy->
cat != current_cat) {
98 #ifndef CLIENTHELP_LONG_LIST
106 #ifdef HELP_USE_COLOR
113 current_cat = commands_copy->
cat;
116 #ifdef CLIENTHELP_LONG_LIST
117 if (commands_copy->
desc != NULL) {
119 snprintf(buf,
MAX_BUF - 1,
"%s - %s", commands_copy->
name, commands_copy->
desc);
128 name_len = strlen(commands_copy->
name);
138 strncpy(line_buf, commands_copy->
name, name_len + 1);
142 strncat(line_buf,
" ", 2);
145 strncat(line_buf, commands_copy->
name, name_len + 1);
146 line_len += name_len;
152 #ifndef CLIENTHELP_LONG_LIST
167 if (cc->
desc != NULL) {
176 const char * long_help = NULL;
180 if (long_help != NULL) {
185 LINE(
"This command's documentation is bugged!");
188 LINE(
"This command has no extended documentation. :(");
195 if (!arg || !strlen(arg)) {
204 snprintf(buf,
MAX_BUF - 1,
"clienthelp: Unknown command %s.", arg);
218 " clienthelp <command>\n"
220 "Without any arguments, displays a list of client-side "
223 "With arguments, displays the help for the client-side "
224 "command <command>.\n"
226 "See also: serverhelp, help.";
233 snprintf(buf,
sizeof(buf),
"help %s", arg);
246 " serverhelp <command>\n"
248 "Fetches help from the server.\n"
250 "Note that currently nothing can be done (without a recompile) if a "
251 "client command masks a server command.\n"
253 "See also: clienthelp, help.";
266 snprintf(buf,
sizeof(buf),
"help %s", cpnext);
288 "Without any arguments, displays a list of client-side "
289 "commands, and fetches the without-arguments help from "
292 "With arguments, first checks if there's a client command "
293 "named <topic>. If there is, display it's help. If there "
294 "isn't, send the topic to the server.\n"
296 "See also: clienthelp, serverhelp.";
336 const char * cat_name;
346 default: cat_name =
"PROGRAMMER ERROR";
break;
378 #ifdef HAVE_DMALLOC_H
379 #ifndef DMALLOC_VERIFY_NOERROR
380 #define DMALLOC_VERIFY_NOERROR 1
382 static void do_dmalloc(
const char * ignored) {
383 if (dmalloc_verify(NULL)==DMALLOC_VERIFY_NOERROR)
417 #include "../help/chelp.h"
433 "set size of command"
434 "window (if val is exceeded"
435 "client won't send new"
436 "commands to server\n\n"
437 "(What does this mean, 'put a lid on it'?) TODO";
444 " script <pathname>\n"
446 "Run the program at path <name>"
447 "as a Crossfire client script."
448 "See Documentation/Script.html";
455 " scripttell <yourname> <data>\n"
467 "save window positions - split windows mode only.";
479 "Get updated list of servers "
480 "from the metaserver and show it."
481 "This is the same information that the client "
482 "uses to show a list of servers when it starts.\n"
484 "Warning: This command may freeze the client until it gets the list.";
491 " scriptkill <name>\n"
493 "Stop scripts named <name>.\n"
494 "(Not guaranteed to work?)";
502 " showweight inventory\n"
505 "(Or any prefix of the arguments.)"
506 "Toggles if you see the weight of"
507 "items in your inventory (also if"
508 "no argument given) or your"
575 "List the running scripts(?)"
593 "clear the info window"
605 "close connection to server"
609 #ifdef HAVE_DMALLOC_H
620 "toggle audible low on food warning"
633 "Client-side command information"
639 "Server-side command information"
657 "Print 'metaserver information'. Warning - your client will pause."
669 "Saves the position and sizes of windows."
675 "toggle scroll/wrap mode in info window"
681 "Toggles if you see the worn, locked, cursed etc state in the inventory pane."
687 "Toggles if you see item weights in inventory look windows."
705 "log the number of free items?"
710 "Change what items to show in inventory"
717 #ifdef TOOLKIT_COMMANDS
720 extern const int ToolkitCommandsSize;
758 #ifdef TOOLKIT_COMMANDS
759 init_toolkit_commands();
762 num_commands = CommonCommandsSize + ToolkitCommandsSize;
773 name_sorted_commands = malloc(
sizeof(
ConsoleCommand *) * num_commands);
776 name_sorted_commands[i] = &CommonCommands[i];
779 #ifdef TOOLKIT_COMMANDS
780 for(i = 0; i < ToolkitCommandsSize; i++) {
781 name_sorted_commands[CommonCommandsSize + i] = &ToolkitCommands[i];
789 cat_sorted_commands = malloc(
sizeof(
ConsoleCommand *) * num_commands);
791 memcpy(cat_sorted_commands, name_sorted_commands,
sizeof(
ConsoleCommand *) * num_commands);
799 #define tolower(C) (((C) >= 'A' && (C) <= 'Z')? (C) - 'A' + 'a': (C))
807 cmd_cpy = strdup(cmd);
809 for (cp=cmd_cpy; *cp; cp++) {
813 dummy.name = cmd_cpy;
817 (
void *)name_sorted_commands,
870 snprintf(buf,
MAX_BUF - 1,
"Client command %s has no implementation!", cc->
name);
891 const char *cp = ocommand;
892 char *cpnext, command[
MAX_BUF];
894 if ((cpnext = strchr(cp,
' '))!=NULL) {
895 int len = cpnext - ocommand;
898 strncpy(command, ocommand, len);
901 while (*cpnext ==
' ')
921 strncpy(command, ocommand,
MAX_BUF-1);
923 cp = strtok(command,
";");
925 while( *cp ==
' ' ) cp++;
928 cp = strtok(NULL,
";");
945 "accuse",
"afk",
"apply",
"applymode",
"archs",
"beg",
"bleed",
"blush",
946 "body",
"bounce",
"bow",
"bowmode",
"brace",
"build",
"burp",
"cackle",
"cast",
947 "chat",
"chuckle",
"clap",
"cointoss",
"cough",
"cringe",
"cry",
"dance",
948 "disarm",
"dm",
"dmhide",
"drop",
"dropall",
"east",
"examine",
"explore",
949 "fire",
"fire_stop",
"fix_me",
"flip",
"frown",
"gasp",
"get",
"giggle",
950 "glare",
"grin",
"groan",
"growl",
"gsay",
"help",
"hiccup",
"hiscore",
"hug",
951 "inventory",
"invoke",
"killpets",
"kiss",
"laugh",
"lick",
"listen",
"logs",
952 "mapinfo",
"maps",
"mark",
"me",
"motd",
"nod",
"north",
"northeast",
953 "northwest",
"orcknuckle",
"output-count",
"output-sync",
"party",
"peaceful",
954 "petmode",
"pickup",
"players",
"poke",
"pout",
"prepare",
"printlos",
"puke",
955 "quests",
"quit",
"ready_skill",
"rename",
"reply",
"resistances",
956 "rotateshoottype",
"run",
"run_stop",
"save",
"say",
"scream",
"search",
957 "search-items",
"shake",
"shiver",
"shout",
"showpets",
"shrug",
"shutdown",
958 "sigh",
"skills",
"slap",
"smile",
"smirk",
"snap",
"sneeze",
"snicker",
959 "sniff",
"snore",
"sound",
"south",
"southeast",
"southwest",
"spit",
960 "statistics",
"stay",
"strings",
"strut",
"sulk",
"take",
"tell",
"thank",
961 "think",
"throw",
"time",
"title",
"twiddle",
"use_skill",
"usekeys",
962 "version",
"wave",
"weather",
"west",
"whereabouts",
"whereami",
"whistle",
963 "who",
"wimpy",
"wink",
"yawn",
965 #define NUM_COMMANDS ((int)(sizeof(commands) / sizeof(char*)))
976 static char result[64];
979 len = strlen(command);
985 strcpy(list,
"Matching commands:");
1001 if (!strncmp(command, commands[i], len)) {
1003 snprintf(list + strlen(list), 499 - strlen(list),
" %s", commands[i]);
1004 }
else if (match != NULL) {
1006 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match, commands[i]);
1009 match = commands[i];
1015 if (!strncmp(command, CommonCommands[i].
name, len)) {
1017 snprintf(list + strlen(list), 499 - strlen(list),
" %s", CommonCommands[i].name);
1018 }
else if (match != NULL) {
1020 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match, CommonCommands[i].name);
1023 match = CommonCommands[i].
name;
1027 if (match == NULL) {
1029 strncat(list,
"\n", 499 - strlen(list));
1042 snprintf(result,
sizeof(result),
"%s ", match);
void set_autorepeat(const char *s)
void script_lua_list(const char *param)
int script_lua_command(const char *command, const char *param)
int handle_local_command(const char *cp, const char *cpnext)
static const char * help_unbind(void)
void command_take(const char *command, const char *cpnext)
void cleanup_connection()
void set_show_icon(const char *s)
void script_lua_kill(const char *param)
#define HELP_MAGICMAP_SHORT
#define HELP_MAGICMAP_LONG
static void command_foodbep(const char *cpnext)
const char * get_category_name(CommCat cat)
static const char *const commands[]
static const char * help_showweight(void)
static void set_command_window(const char *cpnext)
static const char * help_savewinpos(void)
sint16 want_config[CONFIG_NUMS]
static const char * help_clienthelp(void)
static void do_clearinfo(const char *ignored)
void LOG(LogLevel level, const char *origin, const char *format,...)
void script_init(const char *cparams)
static const char * help_scripttell(void)
static const char * help_metaserver(void)
static void do_serverhelp(const char *arg)
static void show_help(const ConsoleCommand *cc)
int send_command(const char *command, int repeat, int must_send)
static void do_magicmap(const char *ignored)
sint16 use_config[CONFIG_NUMS]
#define HELP_SAVEDEFAULTS_SHORT
static void do_clienthelp(const char *arg)
static void do_metaserver(const char *ignored)
static const char * help_scriptkill(void)
static const char * help_magicmap(void)
const int CommonCommandsSize
static void do_clienthelp_list(void)
void extended_command(const char *ocommand)
static void do_take(const char *used)
const char * complete_command(const char *command)
static int sort_by_category(const void *a_, const void *b_)
int get_num_commands(void)
void bind_key(const char *params)
static ConsoleCommand ** name_sorted_commands
static ConsoleCommand CommonCommands[]
static const char * help_help(void)
static void do_num_free_items(const char *ignored)
void print_inventory(item *op)
const ConsoleCommand * find_command(const char *cmd)
void script_tell(const char *params)
static const char * help_bind(void)
void script_kill(const char *params)
void set_show_weight(const char *s)
void command_show(const char *params)
static void do_disconnect(const char *ignored)
static void do_savewinpos(const char *ignored)
void draw_info(const char *str, int color)
void script_lua_load(const char *name)
void draw_magic_map(void)
static int sort_by_name(const void *a_, const void *b_)
static void do_inv(const char *ignored)
static void command_help(const char *cpnext)
static const char * help_script(void)
void unbind_key(const char *params)
static ConsoleCommand ** cat_sorted_commands
static const char * help_serverhelp(void)
static const char * help_inv(void)
static void do_script_list(const char *ignored)
static void do_savedefaults(const char *ignored)
static const char * help_cwindow(void)
ConsoleCommand ** get_cat_sorted_commands(void)
void set_scroll(const char *s)