 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
64 assert(!existing->second.empty());
65 if (existing->second.back()->type !=
type) {
76 add->
extra = extra ? strdup(extra) :
nullptr;
83 if (strcmp(params,
"1") == 0 || strcmp(params,
"on") == 0) {
86 if (strcmp(params,
"0") == 0 || strcmp(params,
"off") == 0) {
109 #define RN(name, func, time) command_register(name, COMMAND_TYPE_NORMAL, func, time)
110 #define RC(name, func, time) command_register(name, COMMAND_TYPE_COMMUNICATION, func, time)
111 #define RW(name, func, time) command_register(name, COMMAND_TYPE_WIZARD, func, time)
179 #ifdef DEBUG_MALLOC_LEVEL
180 RN(
"verify", command_malloc_verify, 0.0);
348 for (
auto h = cmd->second.begin(); h != cmd->second.end(); h++) {
376 if (cmd.second.back()->type == type) {
377 strcat(line, cmd.first.c_str());
412 "'%s' is not a valid command.",
name);
415 return existing->second.back();
419 size_t len = strlen(
name);
422 bool multiple =
false;
429 candidate =
command.second.back();
436 "'%s' is ambiguous and may be %s.",
name,
matches.c_str());
444 "'%s' is not a valid command.",
name);
466 while ((cp >=
command) && (*cp ==
' ')) {
483 for (low =
command; *low; low++)
488 if (csp ==
nullptr) {
505 LOG(
llevDebug,
"execute_newclient_command: Player issued command that takes more time than he has left.\n");
537 for (
auto h = cmd->second.begin(); h != cmd->second.end(); h++) {
538 if ((*h)->registration ==
command) {
541 cmd->second.erase(h);
542 if (cmd->second.empty()) {
command_registration registration
Identifier for unregistration.
void command_stack_pop(object *op, const char *params)
Pop the stack top.
void command_style_map_info(object *op, const char *params)
Displays information about styles loaded for random maps.
void command_dance(object *op, const char *params)
'dance' command.
void command_shutdown(object *op, const char *params)
Totally shutdowns the server.
void command_cackle(object *op, const char *params)
'cackle' command.
void command_stack_push(object *op, const char *params)
Push specified item on stack.
void command_northeast(object *op, const char *params)
'northeast' command.
void command_sound(object *op, const char *params)
Player wants to change sound status.
void command_bleed(object *op, const char *params)
'bleed' command.
void command_glare(object *op, const char *params)
'glare' command.
void command_delete(object *op, const char *params)
Player wants to totally delete her character.
void command_dumpallmaps(object *op, const char *params)
Various map-related statistics.
void command_players(object *op, const char *params)
Display all known players.
void command_nowiz(object *op, const char *params)
Steps down from wizard mode.
void command_snore(object *op, const char *params)
'snore' command.
void command_remove(object *op, const char *params)
Remove an object from its position.
void command_dumpfriendlyobjects(object *op, const char *params)
Various friendly object-related statistics.
void command_wizcast(object *op, const char *params)
Wizard toggling "cast everywhere" ability.
void command_growl(object *op, const char *params)
'growl' command.
void command_search_items(object *op, const char *params)
'search-items' command.
void command_say(object *op, const char *params)
'say' command.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
void command_sulk(object *op, const char *params)
'sulk' command.
void command_whistle(object *op, const char *params)
'whistle' command.
void command_cringe(object *op, const char *params)
'cringe' command.
void command_unarmed_skill(object *op, const char *params)
Player wants to change prefered unarmed skill.
void command_clap(object *op, const char *params)
'clap' command.
void command_cough(object *op, const char *params)
'cough' command.
static command_registration next_registration
Next identifier for a command registration.
void command_spit(object *op, const char *params)
'spit' command.
void command_poke(object *op, const char *params)
'poke' command.
#define QUERY_FLAG(xyz, p)
void command_shrug(object *op, const char *params)
'shrug' command.
void command_time(object *op, const char *params)
Players asks for the time.
void command_groan(object *op, const char *params)
'groan' command.
same as sound ncom command like but with extra the client want tick commands so it knows animation timing the client wants to be informed of pickup mode changes Mode will be sent when the player successfully logs and afterward any time the value is but over many options have become defaults This documents those now obsolete client can handle the bit exp values that are now used values are sent as bit Setting this flag also means that skill exp will be and it will be sent in revised method as described in the stats command Value is an integer in string format else Deprecated client should presume all servers support this server will return FALSE Deprecated replaced with sound2 setup command
void command_wave(object *op, const char *params)
'wave' command.
void command_beg(object *op, const char *params)
'beg' command.
void command_hiccup(object *op, const char *params)
'hiccup' command.
void command_me(object *op, const char *params)
'me' command.
void command_south(object *op, const char *params)
'south' command.
void command_kiss(object *op, const char *params)
'kiss' command.
void command_shout(object *op, const char *params)
'shout' command.
void command_thank(object *op, const char *params)
'thank' command.
void command_disarm(object *op, const char *params)
'disarm' command.
void command_snap(object *op, const char *params)
'snap' command.
void command_party(object *op, const char *params)
'party' command, subdivided in different sub commands.
void command_wink(object *op, const char *params)
'wink' command.
static command_registration do_register(const char *name, uint8_t type, command_function func_std, command_function_extra func_extra, const char *extra, float time)
Register a player-issued command.
void command_recollect(object *op, const char *params)
void command_run_stop(object *op, const char *params)
Player wants to stop running.
static void show_commands(object *op, uint8_t type, const char *legend)
Helper function to display commands.
void command_printlos(object *op, const char *params)
Various LOS-related statistics.
float speed_left
How much speed is left to spend this round.
void command_usekeys(object *op, const char *params)
Player wants to change how keys are used.
void command_party_rejoin(object *op, const char *params)
Handles the 'party_rejoin' command.
static void command_partial_commands(object *op, const char *params)
void command_lock_item(object *op, const char *params)
Alternate way to lock/unlock items (command line).
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
#define COMMAND_TYPE_COMMUNICATION
Communication commands.
void command_hiscore(object *op, const char *params)
Player is asking for the hiscore.
void command_invoke(object *op, const char *params)
'invoke' command, fires a spell immediately.
void command_twiddle(object *op, const char *params)
'twiddle' command.
void command_statistics(object *pl, const char *params)
Prints out some useful information for the character.
uint32_t partial_commands
If 1, then first letters of a command are enough if no ambiguity in name.
void command_northwest(object *op, const char *params)
'northwest' command.
void command_diff(object *op, const char *params)
Get a diff of specified items.
void command_who(object *op, const char *params)
'who' command.
void command_overlay_reset(object *op, const char *params)
Removes the overlay for op's current map.
void command_throw(object *op, const char *params)
'throw' command.
#define tolower(C)
Simple macro to convert a letter to lowercase.
static std::map< std::string, std::vector< registered_command * > > registered_commands
All registered commands, key is the name, vector is all registered handlers in registration order (la...
void command_puke(object *op, const char *params)
'puke' command.
#define COMMAND_TYPE_NORMAL
Standard commands.
void command_debug(object *op, const char *params)
Player wants to see/change the debug level.
void command_execute(object *pl, char *command)
Handle a player-issued command.
void command_whereami(object *op, const char *params)
'whereami' command.
#define MSG_TYPE_COMMAND_ERROR
Bad syntax/can't use command.
void command_overlay_save(object *op, const char *params)
Saves the op's map as an overlay - objects are persisted.
void command_arrest(object *op, const char *params)
Wizard jails player.
void command_hug(object *op, const char *params)
'hug' command.
void command_face(object *op, const char *params)
Player wants to face a given direction.
void command_rename_item(object *op, const char *params)
Changing the custom name of an item.
void command_petmode(object *op, const char *params)
Player wants to change how her pets behave.
void command_rules(object *op, const char *params)
Display the server rules.
#define HUGE_BUF
Used for messages - some can be quite long.
void command_grin(object *op, const char *params)
'grin' command.
#define MSG_TYPE_COMMAND
Responses to commands, eg, who.
void command_stack_clear(object *op, const char *params)
Empty DM item stack.
void command_nod(object *op, const char *params)
'nod' command.
Plugin animator file specs[Config] name
void command_west(object *op, const char *params)
'west' command.
void command_shoottype(object *op, const char *params)
'shoottype' command, set range attack.
void command_quit(object *op, const char *params)
Tell players to use the 'delete' command.
void command_rskill(object *pl, const char *params)
'ready_skill' command.
void command_unregister(command_registration command)
Unregister a previously registered command.
void command_malloc(object *op, const char *params)
Display memory information.
void command_banish(object *op, const char *params)
Add player's IP to ban_file and kick them off the server.
struct player * contr
Pointer to the player which control this object.
void command_inventory(object *op, const char *params)
Shows the inventory or some item.
void command_kill_pets(object *op, const char *params)
Player wants to get rid of pets.
void command_accountpasswd(object *op, const char *params)
void command_forget_spell(object *op, const char *params)
Command for players to forget a spell.
void command_mark(object *op, const char *params)
'mark' command, to mark an item for some effects (enchant armor, ...).
void command_teleport(object *op, const char *params)
Teleport next to target player.
void command_uskill(object *pl, const char *params)
'use_skill' command.
void command_dump(object *op, const char *params)
Dumps the difference between an object and its archetype.
void command_take(object *op, const char *params)
This takes (picks up) an item.
void command_north(object *op, const char *params)
'north' command.
void command_save(object *op, const char *params)
Player wants to get saved.
void commands_clear()
Clear all registered commands.
void command_mon_aggr(object *op, const char *params)
When DM is possessing a monster, flip aggression on and off, to allow better motion.
void command_dropall(object *op, const char *params)
Command to drop all items that have not been locked.
void command_ssdumptable(object *op, const char *params)
Various string-related statistics.
#define MSG_TYPE_COMMAND_INFO
Generic info: resistances, etc.
void command_listen(object *op, const char *params)
Change the player's listen level.
void command_loadplugin(object *op, const char *params)
Loads the given plugin.
void command_scream(object *op, const char *params)
'scream' command.
void command_follow(object *op, const char *params)
Follow a player, or stop following a player.
void command_strut(object *op, const char *params)
'strut' command.
void command_chuckle(object *op, const char *params)
'chuckle' command.
void command_unloadplugin(object *op, const char *params)
Unloads the given plugin.
void command_think(object *op, const char *params)
'think' command.
void command_help(object *op, const char *params)
Player is asking for some help.
void command_examine(object *op, const char *params)
'examine' command.
float time
How long it takes to execute this command.
void command_free(object *op, const char *params)
Totally free an object.
#define RN(name, func, time)
void command_cry(object *op, const char *params)
'cry' command.
#define RW(name, func, time)
void command_kick(object *op, const char *params)
Kicks a player from the server.
void command_pout(object *op, const char *params)
'pout' command.
void command_orcknuckle(object *op, const char *params)
Plays the "orcknucke" game.
void command_search(object *op, const char *params)
'search' command.
void command_abil(object *op, const char *params)
Changes an object's statistics.
void command_flip(object *op, const char *params)
'flip' command.
void command_language(object *op, const char *params)
This is the 'language' command.
void command_dumpallobjects(object *op, const char *params)
Various object-related statistics.
void command_giggle(object *op, const char *params)
'giggle' command.
void command_hide(object *op, const char *params)
Wizard 'hide' command.
void command_accuse(object *op, const char *params)
'accuse' command.
void command_stay(object *op, const char *params)
'stay' command.
void command_dumpmap(object *op, const char *params)
Various map-related statistics.
void command_settings(object *op, const char *ignored)
Wizard wants to know some server settings, so display.
void command_purge_quest_definitions(object *op, const char *param)
void command_east(object *op, const char *params)
'east' command.
#define COMMAND_TYPE_WIZARD
Wizard-only commands.
void command_dumpbelow(object *op, const char *params)
Player wants to dump object below her.
void command_peaceful(object *op, const char *params)
Player toggles her peaceful status.
void command_list(object *pl, bool is_dm)
Display the list of commands to a player.
void command_wimpy(object *op, const char *params)
Player wants to change how soon she'll flee.
void command_bow(object *op, const char *params)
'bow' command.
void command_drop(object *op, const char *params)
'drop' command.
void command_shake(object *op, const char *params)
'shake' command.
void command_use(object *op, const char *params)
Try to use an item on another.
void command_fire_stop(object *op, const char *params)
Player wants to stop firing.
void command_motd(object *op, const char *params)
Display the message of the day.
void command_loadtest(object *op, const char *params)
This command will stress server.
void command_smile(object *op, const char *params)
'smile' command.
void command_learn_special_prayer(object *op, const char *params)
Wizard wants to learn a god-given spell.
void command_applymode(object *op, const char *params)
Players wants to change the apply mode, ie how to handle applying an item when no body slot available...
#define FLAG_WIZ
Object has special privilegies.
void command_news(object *op, const char *params)
Display the server news.
void command_quest(object *op, const char *params)
Command handler for 'quest'.
void command_whereabouts(object *op, const char *params)
'whereabouts' command.
#define NDI_UNIQUE
Print immediately, don't buffer.
void command_afk(object *op, const char *params)
Toggles the afk status of a player.
void command_summon(object *op, const char *params)
Summons player near DM.
void command_knowledge(object *pl, const char *params)
Handle the 'knowledge' for a player.
void command_reset(object *op, const char *params)
Resets a map.
void command_learn_spell(object *op, const char *params)
Wizard wants to learn a regular spell.
void command_version(object *op, const char *params)
Server version.
void command_frown(object *op, const char *params)
'frown' command.
uint32_t has_hit
If set, weapon_sp instead of speed will count.
void command_toggle_shout(object *op, const char *params)
A simple toggle for the no_shout field.
char * extra
Extra argument, if not NULL then func_extra is used, else func_std.
void command_snicker(object *op, const char *params)
'snicker' command.
void command_reply(object *op, const char *params)
Reply to last person who told you something [mids 01/14/2002].
void command_strings(object *op, const char *params)
Various string-related statistics.
void command_yawn(object *op, const char *params)
'yawn' command.
void command_setgod(object *op, const char *params)
Sets the god for some objects.
void command_pickup(object *op, const char *params)
'pickup' command.
void command_skills(object *op, const char *params)
Player is asking for her skills.
void command_patch(object *op, const char *params)
Wizard wants to altar an object.
void command_dmtell(object *op, const char *params)
Private communication, by a DM (can't be ignored by player).
void command_rotateshoottype(object *op, const char *params)
'rotateshoottype' command, switch range attack.
void command_shiver(object *op, const char *params)
'shiver' command.
void command_stats(object *op, const char *params)
Displays the statistics of a player.
void command_lick(object *op, const char *params)
'lick' command.
void command_chat(object *op, const char *params)
'chat' command.
void command_southwest(object *op, const char *params)
'southwest' command.
void command_bounce(object *op, const char *params)
'bounce' command.
void command_smirk(object *op, const char *params)
'smirk' command.
void command_resistances(object *op, const char *params)
Players wants to know her resistances.
void command_slap(object *op, const char *params)
'slap' command.
void command_stack_list(object *op, const char *params)
Displays stack contents.
void command_fire(object *op, const char *params)
Player wants to start firing.
static registered_command * command_find(const char *name, object *pl)
Find a command by its name.
void command_invisible(object *op, const char *params)
Wizard wants to become invisible.
void command_purge_quest(object *op, const char *param)
void command_run(object *op, const char *params)
Player wants to start running.
void command_freeze(object *op, const char *params)
Freezes a player for a specified tick count, 100 by default.
command_registration command_register_extra(const char *name, const char *extra, uint8_t type, command_function_extra func, float time)
Register a player-issued command with an extra parameter.
void command_maps(object *op, const char *params)
'maps' command.
void command_dumpabove(object *op, const char *params)
Player wants to dump object above her.
void(* command_function_extra)(object *op, const char *params, const char *extra)
One command function, with a custom parameter specified at registration time.
void command_dumpallarchetypes(object *op, const char *params)
Various archetypes-related statistics.
void command_speed(object *op, const char *params)
Changes the server speed.
void command_fix_me(object *op, const char *params)
Wrapper to fix a player.
void command_swap(object *op, const char *params)
Mark a map as ready for swapping.
uint64_t command_registration
Identifier when registering a command.
void command_dm(object *op, const char *params)
Actual command to perhaps become dm.
void command_addexp(object *op, const char *params)
This adds exp to a player.
void command_goto(object *op, const char *params)
Wizard teleports to a map.
void command_empty(object *op, const char *params)
'empty' command.
void command_cointoss(object *op, const char *params)
'cointoss' command.
void command_tell(object *op, const char *params)
Private communication.
void commands_init(void)
Init standard commands.
void command_showpets(object *op, const char *params)
Players wants to know her pets.
void command_gsay(object *op, const char *params)
'gsay' command, talks to party.
void command_mapinfo(object *op, const char *params)
'mapinfo' command.
void command_gasp(object *op, const char *params)
'gasp' command.
void command_brace(object *op, const char *params)
Player toggles her braced status.
void command_body(object *op, const char *params)
This command dumps the body information for object *op.
void command_passwd(object *pl, const char *params)
Player is asking to change password.
void(* command_function)(object *op, const char *params)
One command function.
command_function func_std
Command function.
void command_sniff(object *op, const char *params)
'sniff' command.
void command_insert_into(object *op, const char *params)
Puts an object into another.
#define RC(name, func, time)
void command_apply(object *op, const char *params)
'apply' command.
void command_cast(object *op, const char *params)
'cast' command, prepares a spell for laster casting.
void command_listplugins(object *op, const char *params)
Lists all plugins currently loaded with their IDs and full names.
void command_bowmode(object *op, const char *params)
Player wants to change the bowmode, how arrows are fired.
void command_title(object *op, const char *params)
Player wishes to change her title.
static int matches(const char *exp, const char *text)
Does the text match the expression?
void command_wizpass(object *op, const char *params)
Wizard toggling wall-crossing.
command_function_extra func_extra
Command function if extra argument.
void command_create(object *op, const char *params)
Wizard wants to create an object.
@ llevDebug
Only for debugging purposes.
void command_dmhide(object *op, const char *params)
A players wants to become DM and hide.
void command_blush(object *op, const char *params)
'blush' command.
command_registration command_register(const char *name, uint8_t type, command_function func, float time)
Register a player-issued command.
void command_sneeze(object *op, const char *params)
'sneeze' command.
void command_burp(object *op, const char *params)
'burp' command.
uint8_t type
Command type, one of COMMAND_TYPE_xxx.
void command_southeast(object *op, const char *params)
'southeast' command.
void command_laugh(object *op, const char *params)
'laugh' command.
void command_sigh(object *op, const char *params)
'sigh' command.