Go to the documentation of this file.
31 #define H1(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
32 #define H2(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
33 #define LINE(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
48 GString *line = g_string_new(NULL);
50 H1(
"Client commands:");
53 if (cmd->
cat != category) {
56 snprintf(buf,
sizeof(buf),
"%s commands:",
62 g_string_free(line,
true);
63 line = g_string_new(NULL);
65 g_string_append_printf(line,
"%s ", cmd->
name);
69 g_string_free(line,
true);
74 if (cc->
desc != NULL) {
77 snprintf(buf,
MAX_BUF - 1,
"Help for '%s':", cc->
name);
82 const char *long_help = NULL;
85 if (long_help != NULL) {
88 LINE(
"Extended help for this command is broken.");
91 LINE(
"No extended help is available for this command.");
104 snprintf(buf,
sizeof(buf),
"help %s", cpnext);
126 "Without any arguments, displays a list of client-side "
127 "commands, and fetches the without-arguments help from "
130 "With arguments, first checks if there's a client command "
131 "named <topic>. If there is, display it's help. If there "
132 "isn't, send the topic to the server.";
142 "cwindow command requires a number parameter");
157 "Warning bell when low on food disabled");
161 "Warning bell when low on food enabled");
167 const char * cat_name;
172 cat_name =
"Miscellaneous";
175 cat_name =
"Informational";
178 cat_name =
"Configuration";
181 cat_name =
"Scripting";
184 cat_name =
"Debugging";
187 cat_name =
"PROGRAMMER ERROR";
224 long long scale = strtoll(used, NULL, 0);
229 "mapscale command requires an argument");
262 "set size of command"
263 "window (if val is exceeded"
264 "client won't send new"
265 "commands to server\n\n"
266 "(What does this mean, 'put a lid on it'?) TODO";
271 "Syntax: script <path>\n\n"
272 "Start an executable client script located at <path>. For details on "
273 "client-side scripting, please see the Crossfire Wiki.";
280 " scripttell <yourname> <data>\n"
293 "save window positions - split windows mode only.";
300 " scriptkill <name>\n"
302 "Stop scripts named <name>.\n"
303 "(Not guaranteed to work?)";
312 "Stop all active scripts.\n"
313 "(Not guaranteed to work?)";
349 "toggle audible low on food warning"},
367 "Saves the position and sizes of windows."
375 "Change what items to show in inventory"},
433 cmd_cpy = g_strdup(cmd);
435 for (cp=cmd_cpy; *cp; cp++) {
439 dummy.name = cmd_cpy;
493 snprintf(buf,
MAX_BUF - 1,
"Client command %s has no implementation!", cc->
name);
516 const char *cp = ocommand;
517 char *cpnext, command[
MAX_BUF];
519 if ((cpnext = strchr(cp,
' '))!=NULL) {
520 int len = cpnext - ocommand;
525 strncpy(command, ocommand, len);
528 while (*cpnext ==
' ') {
540 if (
cpl.
title[0] ==
'\0' && strcmp(cp,
"quit") == 0){
560 strncpy(command, ocommand,
MAX_BUF-1);
562 cp = strtok(command,
";");
564 while( *cp ==
' ' ) {
569 cp = strtok(NULL,
";");
585 "accuse",
"afk",
"apply",
"applymode",
"archs",
"beg",
"bleed",
"blush",
586 "body",
"bounce",
"bow",
"bowmode",
"brace",
"build",
"burp",
"cackle",
"cast",
587 "chat",
"chuckle",
"clap",
"cointoss",
"cough",
"cringe",
"cry",
"dance",
588 "disarm",
"dm",
"dmhide",
"drop",
"dropall",
"east",
"examine",
"explore",
589 "fire",
"fire_stop",
"fix_me",
"flip",
"frown",
"gasp",
"get",
"giggle",
590 "glare",
"grin",
"groan",
"growl",
"gsay",
"help",
"hiccup",
"hiscore",
"hug",
591 "inventory",
"invoke",
"killpets",
"kiss",
"laugh",
"lick",
"listen",
"logs",
592 "mapinfo",
"maps",
"mark",
"me",
"motd",
"nod",
"north",
"northeast",
593 "northwest",
"orcknuckle",
"output-count",
"output-sync",
"party",
"peaceful",
594 "petmode",
"pickup",
"players",
"poke",
"pout",
"prepare",
"printlos",
"puke",
595 "quests",
"quit",
"ready_skill",
"rename",
"reply",
"resistances",
596 "rotateshoottype",
"run",
"run_stop",
"save",
"say",
"scream",
"search",
597 "search-items",
"shake",
"shiver",
"shout",
"showpets",
"shrug",
"shutdown",
598 "sigh",
"skills",
"slap",
"smile",
"smirk",
"snap",
"sneeze",
"snicker",
599 "sniff",
"snore",
"sound",
"south",
"southeast",
"southwest",
"spit",
600 "statistics",
"stay",
"strings",
"strut",
"sulk",
"take",
"tell",
"thank",
601 "think",
"throw",
"time",
"title",
"twiddle",
"use_skill",
"usekeys",
602 "version",
"wave",
"weather",
"west",
"whereabouts",
"whereami",
"whistle",
603 "who",
"wimpy",
"wink",
"yawn",
615 int len, display = 0;
617 static char result[64];
620 len = strlen(command);
626 strcpy(list,
"Matching commands:");
642 if (!strncmp(command,
commands[i], len)) {
644 snprintf(list + strlen(list), 499 - strlen(list),
" %s",
commands[i]);
645 }
else if (match != NULL) {
647 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match,
commands[i]);
659 snprintf(list + strlen(list), 499 - strlen(list),
" %s",
CommonCommands[i].name);
660 }
else if (match != NULL) {
662 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match,
CommonCommands[i].name);
672 strncat(list,
"\n", 499 - strlen(list));
677 "No matching command.\n");
686 snprintf(result,
sizeof(result),
"%s ", match);
static const char * help_cwindow(void)
static ConsoleCommand CommonCommands[]
const ConsoleCommand * find_command(const char *cmd)
static const char * help_savewinpos(void)
void unbind_key(const char *params)
static void do_clienthelp_list()
void extended_command(const char *ocommand)
#define HELP_MAGICMAP_LONG
void script_lua_kill(const char *param)
static int get_num_commands(void)
void map_check_resize(void)
static const char * help_help(void)
const char * get_category_name(CommCat cat)
static const char * help_scriptkill(void)
static void do_savedefaults()
static void cmd_raw(const char *cmd)
#define HELP_SAVEDEFAULTS_SHORT
static void do_take(const char *used)
static void set_command_window(const char *cpnext)
void draw_magic_map(void)
void command_take(const char *command, const char *cpnext)
const size_t num_commands
static void do_script_list()
void script_lua_load(const char *name)
void bind_key(const char *params)
static void command_foodbeep()
const char * complete_command(const char *command)
static void command_help(const char *cpnext)
static ConsoleCommand ** name_sorted_commands
int cs_print_string(GSocketConnection *fd, const char *str,...)
void script_kill(const char *params)
gint16 want_config[CONFIG_NUMS]
void draw_ext_info(int orig_color, int type, int subtype, const char *message)
const size_t num_server_commands
static int sort_by_category(const void *a_, const void *b_)
static void do_set_mapscale(const char *used)
void script_lua_list(const char *param)
static void do_clearinfo()
static const char * help_magicmap(void)
int send_command(const char *command, int repeat, int must_send)
static void do_disconnect()
#define MSG_TYPE_CLIENT_CONFIG
int script_lua_command(const char *command, const char *param)
static void show_help(const ConsoleCommand *cc)
#define MSG_TYPE_CLIENT_NOTICE
int handle_local_command(const char *cp, const char *cpnext)
static const char * help_scripttell(void)
gint16 use_config[CONFIG_NUMS]
static void do_magicmap()
#define HELP_MAGICMAP_SHORT
static ConsoleCommand ** cat_sorted_commands
static const char * help_bind(void)
ConsoleCommand ** get_cat_sorted_commands(void)
void script_init(const char *cparams)
void script_tell(const char *params)
void script_killall_wrapper(const char *params)
static int sort_by_name(const void *a_, const void *b_)
static void do_savewinpos()
static const char *const commands[]
static const char * help_scriptkillall(void)
static const char * help_script(void)
static const char * help_unbind(void)
static const char * help_inv(void)
void print_inventory(item *op)
void command_show(const char *params)