 |
Crossfire Client, Trunk
|
Go to the documentation of this file.
32 #define H1(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
33 #define H2(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
34 #define LINE(a) draw_ext_info(NDI_BLACK, MSG_TYPE_CLIENT, MSG_TYPE_CLIENT_NOTICE, a)
51 GString *line = g_string_new(NULL);
53 H1(
"Client commands:");
56 if (cmd->
cat != category) {
59 snprintf(buf,
sizeof(buf),
"%s commands:",
65 g_string_free(line,
true);
66 line = g_string_new(NULL);
68 g_string_append_printf(line,
"%s ", cmd->
name);
72 g_string_free(line,
true);
77 if (cc->
desc != NULL) {
80 snprintf(buf,
MAX_BUF - 1,
"Help for '%s':", cc->
name);
85 const char *long_help = NULL;
88 if (long_help != NULL) {
91 LINE(
"Extended help for this command is broken.");
94 LINE(
"No extended help is available for this command.");
107 snprintf(buf,
sizeof(buf),
"help %s", cpnext);
129 "Without any arguments, displays a list of client-side "
130 "commands, and fetches the without-arguments help from "
133 "With arguments, first checks if there's a client command "
134 "named <topic>. If there is, display it's help. If there "
135 "isn't, send the topic to the server.";
145 "cwindow command requires a number parameter");
160 "Warning bell when low on food disabled");
164 "Warning bell when low on food enabled");
170 const char * cat_name;
175 cat_name =
"Miscellaneous";
178 cat_name =
"Informational";
181 cat_name =
"Configuration";
184 cat_name =
"Scripting";
187 cat_name =
"Debugging";
190 cat_name =
"PROGRAMMER ERROR";
227 long long scale = strtoll(used, NULL, 0);
232 "mapscale command requires an argument");
265 "set size of command"
266 "window (if val is exceeded"
267 "client won't send new"
268 "commands to server\n\n"
269 "(What does this mean, 'put a lid on it'?) TODO";
274 "Syntax: script <path>\n\n"
275 "Start an executable client script located at <path>. For details on "
276 "client-side scripting, please see the Crossfire Wiki.";
283 " scripttell <yourname> <data>\n"
296 "save window positions - split windows mode only.";
303 " scriptkill <name>\n"
305 "Stop scripts named <name>.\n"
306 "(Not guaranteed to work?)";
315 "Stop all active scripts.\n"
316 "(Not guaranteed to work?)";
365 "toggle audible low on food warning"},
383 "Saves the position and sizes of windows."
391 "Change what items to show in inventory"},
449 cmd_cpy = g_strdup(cmd);
451 for (cp=cmd_cpy; *cp; cp++) {
455 dummy.name = cmd_cpy;
509 snprintf(buf,
MAX_BUF - 1,
"Client command %s has no implementation!", cc->
name);
532 const char *cp = ocommand;
533 char *cpnext, command[
MAX_BUF];
535 if ((cpnext = strchr(cp,
' '))!=NULL) {
536 int len = cpnext - ocommand;
541 strncpy(command, ocommand, len);
544 while (*cpnext ==
' ') {
556 if (
cpl.
title[0] ==
'\0' && strcmp(cp,
"quit") == 0){
576 strncpy(command, ocommand,
MAX_BUF-1);
578 cp = strtok(command,
";");
580 while( *cp ==
' ' ) {
585 cp = strtok(NULL,
";");
601 "accuse",
"afk",
"apply",
"applymode",
"archs",
"beg",
"bleed",
"blush",
602 "body",
"bounce",
"bow",
"bowmode",
"brace",
"build",
"burp",
"cackle",
"cast",
603 "chat",
"chuckle",
"clap",
"cointoss",
"cough",
"cringe",
"cry",
"dance",
604 "disarm",
"dm",
"dmhide",
"drop",
"dropall",
"east",
"examine",
"explore",
605 "fire",
"fire_stop",
"fix_me",
"flip",
"frown",
"gasp",
"get",
"giggle",
606 "glare",
"grin",
"groan",
"growl",
"gsay",
"help",
"hiccup",
"hiscore",
"hug",
607 "inventory",
"invoke",
"killpets",
"kiss",
"laugh",
"lick",
"listen",
"logs",
608 "mapinfo",
"maps",
"mark",
"me",
"motd",
"nod",
"north",
"northeast",
609 "northwest",
"orcknuckle",
"output-count",
"output-sync",
"party",
"peaceful",
610 "petmode",
"pickup",
"players",
"poke",
"pout",
"prepare",
"printlos",
"puke",
611 "quests",
"quit",
"ready_skill",
"rename",
"reply",
"resistances",
612 "rotateshoottype",
"run",
"run_stop",
"save",
"say",
"scream",
"search",
613 "search-items",
"shake",
"shiver",
"shout",
"showpets",
"shrug",
"shutdown",
614 "sigh",
"skills",
"slap",
"smile",
"smirk",
"snap",
"sneeze",
"snicker",
615 "sniff",
"snore",
"sound",
"south",
"southeast",
"southwest",
"spit",
616 "statistics",
"stay",
"strings",
"strut",
"sulk",
"take",
"tell",
"thank",
617 "think",
"throw",
"time",
"title",
"twiddle",
"use_skill",
"usekeys",
618 "version",
"wave",
"weather",
"west",
"whereabouts",
"whereami",
"whistle",
619 "who",
"wimpy",
"wink",
"yawn",
631 int len, display = 0;
633 static char result[64];
636 len = strlen(command);
642 strcpy(list,
"Matching commands:");
658 if (!strncmp(command,
commands[i], len)) {
660 snprintf(list + strlen(list), 499 - strlen(list),
" %s",
commands[i]);
661 }
else if (match != NULL) {
663 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match,
commands[i]);
675 snprintf(list + strlen(list), 499 - strlen(list),
" %s",
CommonCommands[i].name);
676 }
else if (match != NULL) {
678 snprintf(list + strlen(list), 499 - strlen(list),
" %s %s", match,
CommonCommands[i].name);
688 strncat(list,
"\n", 499 - strlen(list));
693 "No matching command.\n");
702 snprintf(result,
sizeof(result),
"%s ", match);
static const char * help_cwindow(void)
#define MSG_TYPE_CLIENT
Client originated Messages.
static ConsoleCommand CommonCommands[]
const ConsoleCommand * find_command(const char *cmd)
char title[MAX_BUF]
Title of character.
static const char * help_savewinpos(void)
void client_disconnect()
Closes the connection to the server.
void extended_command(const char *ocommand)
This is an extended command (ie, 'who, 'whatever, etc).
void init_commands()
Fills some internal arrays.
#define HELP_MAGICMAP_LONG
void script_lua_kill(const char *param)
const char * get_category_name(CommCat cat)
void save_defaults(void)
This function saves user settings chosen using the configuration popup dialog.
void map_check_resize(void)
Calculate and set desired map size based on map window size.
void menu_clear(void)
Clears all the message panels.
static const char * help_scriptkill(void)
int render_debug_layers
Current number of layers to render for renderer debugging purposes.
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)
static void command_help(const char *cpnext)
static void do_clienthelp_list()
void command_take(const char *command, const char *cpnext)
static const char * help_help(void)
const size_t num_commands
static void do_script_list()
static void show_help(const ConsoleCommand *cc)
void script_lua_load(const char *name)
void bind_key(const char *params)
static void command_foodbeep()
const char * complete_command(const char *command)
Player has entered 'command' and hit tab to complete it.
static ConsoleCommand ** name_sorted_commands
int cs_print_string(GSocketConnection *fd, const char *str,...)
Send a printf-formatted packet to the socket.
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)
A message processor that accepts messages along with meta information color and type.
const size_t num_server_commands
bool arm_mapedit
If true, the next drawextinfo is expected to contain a map path.
#define MSG_TYPE_CLIENT_DEBUG
General debug messages.
static int sort_by_category(const void *a_, const void *b_)
void save_winpos(void)
Save client window positions to a file unique to each layout.
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()
Client_Player cpl
Player object.
#define MSG_TYPE_CLIENT_CONFIG
Local configuration issues.
int script_lua_command(const char *command, const char *param)
#define COMMAND_WINDOW
Do not send more than this many outstanding commands to the server this is only a default value.
void unbind_key(const char *params)
#define MSG_TYPE_CLIENT_NOTICE
Non-critical note to player.
int handle_local_command(const char *cp, const char *cpnext)
Tries to handle command cp (with optional params in cpnext, which may be null) as a local command.
static const char * help_scripttell(void)
guint32 count
Repeat count on command.
gint16 use_config[CONFIG_NUMS]
static int get_num_commands(void)
#define MAXLAYERS
The protocol supports 10 layers, so set MAXLAYERS accordingly.
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)
Returns a pointer to the head of an array of ConsoleCommands sorted by category, then by name.
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)
void cmd_debugrender(const char *cmd)
static const char * help_inv(void)
void print_inventory(item *op)
void command_show(const char *params)
void config_check(void)
Check that want_config is valid, copy the new configuration to use_config, and apply the new configur...