/* * The unique portions of SunderMud code as well as the integration efforts * for code from other sources is based on the efforts of: * * Lotherius (elfren@aros.net) * * This code can only be used under the terms of the DikuMud, Merc, * and ROM licenses. The same requirements apply to the changes that * have been made. * * All other copyrights remain in place and in force. */ /*************************************************************************** * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. * * * * Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * * * In order to use any part of this Merc Diku Mud, you must comply with * * both the original Diku license in 'license.doc' as well the Merc * * license in 'license.txt'. In particular, you may not remove either of * * these copyright notices. * * * * Much time and thought has gone into this software and you are * * benefitting. We hope that you share your changes too. What goes * * around, comes around. * ***************************************************************************/ #include "everything.h" #include "interp.h" bool check_social args( ( CHAR_DATA *ch, char *command, char *argument ) ); bool expand_aliases args(( CHAR_DATA *ch, char *orig_command, char *final_command)); void check_multi_cmd (CHAR_DATA *ch, char *orig_cmd, char *final_cmd); struct wizcommand_type *wizcommand_table[10]; struct disable_cmd_type *disable_cmd_list; void gen_wiz_table (void); /* * Command logging types. */ #define LOG_NORMAL 0 #define LOG_ALWAYS 1 #define LOG_NEVER 2 /* * Log-all switch. */ bool fLogAll = FALSE; /* * Command table. */ const struct cmd_type cmd_table [] = { /* * Common movement commands. */ { "north", do_north, POS_STANDING, 0, LOG_NEVER, 0 }, { "east", do_east, POS_STANDING, 0, LOG_NEVER, 0 }, { "south", do_south, POS_STANDING, 0, LOG_NEVER, 0 }, { "west", do_west, POS_STANDING, 0, LOG_NEVER, 0 }, { "up", do_up, POS_STANDING, 0, LOG_NEVER, 0 }, { "down", do_down, POS_STANDING, 0, LOG_NEVER, 0 }, /* * Common other commands. * Placed here so one and two letter abbreviations work. */ { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "buy", do_buy, POS_RESTING, 0, LOG_NORMAL, 1 }, { "cast", do_cast, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "channels", do_channels, POS_DEAD, 0, LOG_NORMAL, 1 }, { "enter", do_enter, POS_STANDING, 0, LOG_NORMAL,1 }, { "exits", do_exits, POS_RESTING, 0, LOG_NORMAL, 1 }, { "get", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, { "hit", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 0 }, { "inventory", do_inventory, POS_DEAD, 0, LOG_NORMAL, 1 }, { "kill", do_kill, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "look", do_look, POS_RESTING, 0, LOG_NORMAL, 1 }, { "last", do_last, POS_DEAD, 0, LOG_NORMAL, 1 }, { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "order", do_order, POS_RESTING, 0, LOG_ALWAYS, 1 }, { "practice", do_practice, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "rest", do_rest, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "sit", do_sit, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "sc", do_score, POS_DEAD, 0, LOG_NORMAL, 1 }, { "scan", do_scan, POS_RESTING, 0, LOG_NORMAL, 1 }, { "sca", do_scan, POS_RESTING, 0, LOG_NORMAL, 1 }, { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, { "stand", do_stand, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "tell", do_tell, POS_RESTING, 0, LOG_NORMAL, 1 }, { "wield", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, { "wizhelp", do_wizhelp, POS_DEAD, HE, LOG_NORMAL, 1 }, /* * Informational commands. */ { "areas", do_areas, POS_DEAD, 0, LOG_NORMAL, 1 }, { "affect", do_affect, POS_DEAD, 0, LOG_NORMAL, 1}, { "affects", do_affect, POS_DEAD, 0, LOG_NORMAL, 1}, { "bug", do_bug, POS_DEAD, 0, LOG_NORMAL, 1 }, { "clan", do_clan, POS_DEAD, 0, LOG_NORMAL, 1}, { "commands", do_commands, POS_DEAD, 0, LOG_NORMAL, 1 }, { "compare", do_compare, POS_RESTING, 0, LOG_NORMAL, 1 }, { "consider", do_consider, POS_RESTING, 0, LOG_NORMAL, 1 }, { "count", do_count, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "credits", do_credits, POS_DEAD, 0, LOG_NORMAL, 1 }, { "equipment", do_equipment, POS_DEAD, 0, LOG_NORMAL, 1 }, { "examine", do_examine, POS_RESTING, 0, LOG_NORMAL, 1 }, { "help", do_help, POS_DEAD, 0, LOG_NORMAL, 1 }, { "hlist", do_hlist, POS_DEAD, 0, LOG_NORMAL, 1 }, { "motd", do_motd, POS_DEAD, 0, LOG_NORMAL, 1 }, { "notify", do_notify, POS_DEAD, 0, LOG_NORMAL, 1 }, { "read", do_read, POS_RESTING, 0, LOG_NORMAL, 1 }, { "report", do_report, POS_RESTING, 0, LOG_NORMAL, 1 }, { "rules", do_rules, POS_DEAD, 0, LOG_NORMAL, 1 }, { "score", do_score, POS_DEAD, 0, LOG_NORMAL, 1 }, { "oldscore", do_oldscore, POS_DEAD, 0, LOG_NORMAL, 1 }, { "skills", do_skills, POS_DEAD, 0, LOG_NORMAL, 1 }, { "socials", do_socials, POS_DEAD, 0, LOG_NORMAL, 1 }, { "spells", do_spells, POS_DEAD, 0, LOG_NORMAL, 1 }, { "story", do_story, POS_DEAD, 0, LOG_NORMAL, 1 }, { "time", do_time, POS_DEAD, 0, LOG_NORMAL, 1 }, { "typo", do_typo, POS_DEAD, 0, LOG_NORMAL, 1 }, { "weather", do_weather, POS_RESTING, 0, LOG_NORMAL, 1 }, { "who", do_who, POS_DEAD, 0, LOG_NORMAL, 1 }, { "whois", do_whois, POS_DEAD, 0, LOG_NORMAL, 1 }, { "wizlist", do_wizlist, POS_DEAD, 0, LOG_NORMAL, 1 }, { "worth", do_worth, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "lore", do_lore, POS_STANDING, 0, LOG_NORMAL, 1 }, /* * Configuration commands. */ { "autolist", do_autolist, POS_DEAD, 0, LOG_NORMAL, 1 }, { "alias", do_alias, POS_DEAD, 0, LOG_NORMAL, 1 }, { "unalias", do_unalias, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autoassist", do_autoassist, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autoexit", do_autoexit, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autogold", do_autogold, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autoloot", do_autoloot, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autosac", do_autosac, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autosave", do_autosave, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autosplit", do_autosplit, POS_DEAD, 0, LOG_NORMAL, 1 }, { "autotitle", do_autotitle, POS_DEAD, 0, LOG_NORMAL, 1}, { "brief", do_brief, POS_DEAD, 0, LOG_NORMAL, 1 }, { "colour", do_colour, POS_DEAD, 0, LOG_NORMAL, 1 }, { "color", do_colour, POS_DEAD, 0, LOG_NORMAL, 1 }, { "combine", do_combine, POS_DEAD, 0, LOG_NORMAL, 1 }, { "compact", do_compact, POS_DEAD, 0, LOG_NORMAL, 1 }, { "cursor", do_cursor, POS_DEAD, 0, LOG_NORMAL, 1 }, { "description", do_description, POS_DEAD, 0, LOG_NORMAL, 1 }, { "delet", do_delet, POS_DEAD, 0, LOG_ALWAYS, 0 }, { "delete", do_delete, POS_DEAD, 0, LOG_ALWAYS, 1 }, { "email", do_email, POS_DEAD, 0, LOG_NORMAL, 1 }, { "fullfight", do_fullfight, POS_DEAD, 0, LOG_NORMAL, 1 }, { "nofollow", do_nofollow, POS_DEAD, 0, LOG_NORMAL, 1 }, { "noloot", do_noloot, POS_DEAD, 0, LOG_NORMAL, 1 }, { "nosummon", do_nosummon, POS_DEAD, 0, LOG_NORMAL, 1 }, { "outfit", do_outfit, POS_RESTING, 0, LOG_ALWAYS, 1 }, { "password", do_password, POS_DEAD, 0, LOG_NEVER, 1 }, { "prompt", do_prompt, POS_DEAD, 0, LOG_NORMAL, 1 }, { "scroll", do_scroll, POS_DEAD, 0, LOG_NORMAL, 1 }, { "title", do_title, POS_DEAD, 0, LOG_NORMAL, 1 }, { "wimpy", do_wimpy, POS_DEAD, 0, LOG_NORMAL, 1 }, { "xinfo", do_xinfo, POS_DEAD, IM, LOG_NORMAL, 1 }, /* * Communication commands. */ { "answer", do_answer, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "afk", do_afk, POS_SLEEPING, 0, LOG_NORMAL, 1}, /* { "auction", do_auction, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ { "deaf", do_deaf, POS_DEAD, 0, LOG_NORMAL, 1 }, { "emote", do_emote, POS_RESTING, 0, LOG_NORMAL, 1 }, { ".", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 0 }, { "gossip", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { ",", do_emote, POS_RESTING, 0, LOG_NORMAL, 0 }, { "gtell", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1 }, { ";", do_gtell, POS_DEAD, 0, LOG_NORMAL, 0 }, /* { "music", do_music, POS_SLEEPING, 0, LOG_NORMAL, 1 }, */ { "note", do_note, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "notes", do_note, POS_SLEEPING, 0, LOG_NORMAL, 0 }, { "pose", do_pose, POS_RESTING, 0, LOG_NORMAL, 1 }, { "question", do_question, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "reply", do_reply, POS_RESTING, 0, LOG_NORMAL, 1 }, { "say", do_say, POS_RESTING, 0, LOG_NORMAL, 1 }, { "'", do_say, POS_RESTING, 0, LOG_NORMAL, 0 }, { "shout", do_shout, POS_RESTING, 3, LOG_NORMAL, 1 }, { "yell", do_yell, POS_RESTING, 0, LOG_NORMAL, 1 }, /* elfren added beep */ { "beep", do_beep, POS_DEAD, 0, LOG_NORMAL, 1 }, { "ct", do_clan_tell, POS_DEAD, 0, LOG_NORMAL, 1}, { "?", do_clan_tell, POS_DEAD, 0, LOG_NORMAL, 1}, { "boards", do_board, POS_SLEEPING, 0, LOG_NORMAL, 1}, /* * Object manipulation commands. */ { "brandish", do_brandish, POS_RESTING, 0, LOG_NORMAL, 1 }, { "brew", do_brew, POS_STANDING, 0, LOG_NORMAL, 1 }, { "scribe", do_scribe, POS_STANDING, 0, LOG_NORMAL, 1 }, { "close", do_close, POS_RESTING, 0, LOG_NORMAL, 1 }, { "drink", do_drink, POS_RESTING, 0, LOG_NORMAL, 1 }, { "drop", do_drop, POS_RESTING, 0, LOG_NORMAL, 1 }, { "eat", do_eat, POS_RESTING, 0, LOG_NORMAL, 1 }, { "envenom", do_envenom, POS_RESTING, 0, LOG_NORMAL, 1 }, { "fill", do_fill, POS_RESTING, 0, LOG_NORMAL, 1 }, { "give", do_give, POS_RESTING, 0, LOG_NORMAL, 1 }, { "heal", do_heal, POS_RESTING, 0, LOG_NORMAL, 1 }, { "hold", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, { "list", do_list, POS_RESTING, 0, LOG_NORMAL, 1 }, { "lock", do_lock, POS_RESTING, 0, LOG_NORMAL, 1 }, { "open", do_open, POS_RESTING, 0, LOG_NORMAL, 1 }, { "pick", do_pick, POS_RESTING, 0, LOG_NORMAL, 1 }, { "put", do_put, POS_RESTING, 0, LOG_NORMAL, 1 }, { "quaff", do_quaff, POS_RESTING, 0, LOG_NORMAL, 1 }, { "recite", do_recite, POS_RESTING, 0, LOG_NORMAL, 1 }, { "remove", do_remove, POS_RESTING, 0, LOG_NORMAL, 1 }, { "resize", do_resize, POS_RESTING, 0, LOG_NORMAL, 1 }, { "repair", do_repair, POS_RESTING, 0, LOG_NORMAL, 1 }, { "search", do_search, POS_STANDING, 0, LOG_NORMAL, 1 }, { "sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1 }, { "take", do_get, POS_RESTING, 0, LOG_NORMAL, 1 }, { "sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1 }, { "junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, { "tap", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 0 }, { "unlock", do_unlock, POS_RESTING, 0, LOG_NORMAL, 1 }, { "value", do_value, POS_RESTING, 0, LOG_NORMAL, 1 }, { "wear", do_wear, POS_RESTING, 0, LOG_NORMAL, 1 }, { "zap", do_zap, POS_RESTING, 0, LOG_NORMAL, 1 }, { "sharpen", do_sharpen, POS_STANDING, 0, LOG_NORMAL, 1}, /* * Combat commands. */ { "backstab", do_backstab, POS_STANDING, 0, LOG_NORMAL, 1 }, { "circle", do_circle, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "bash", do_bash, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "bs", do_backstab, POS_STANDING, 0, LOG_NORMAL, 0 }, { "berserk", do_berserk, POS_FIGHTING, 0, LOG_NORMAL, 1 }, /* { "copy", do_copy, POS_STANDING, 0, LOG_NORMAL, 1 }, */ { "dual", do_dual, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "dirt", do_dirt, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "disarm", do_disarm, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "flee", do_flee, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "kick", do_kick, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "murde", do_murde, POS_FIGHTING, 6, LOG_NORMAL, 0 }, { "murder", do_murder, POS_FIGHTING, 6, LOG_ALWAYS, 1 }, { "rescue", do_rescue, POS_FIGHTING, 0, LOG_NORMAL, 0 }, { "rotate", do_rotate, POS_FIGHTING, 0, LOG_NORMAL, 0 }, { "trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1 }, /* * Miscellaneous commands. */ { "follow", do_follow, POS_RESTING, 0, LOG_NORMAL, 1 }, { "group", do_group, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "hide", do_hide, POS_RESTING, 0, LOG_NORMAL, 1 }, { "qui", do_qui, POS_DEAD, 0, LOG_NORMAL, 0 }, { "quit", do_quit, POS_DEAD, 0, LOG_NORMAL, 1 }, { "recall", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 1 }, { "/", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 0 }, { "rent", do_rent, POS_DEAD, 0, LOG_NORMAL, 0 }, { "lease", do_lease, POS_STANDING, 0, LOG_ALWAYS, 1 }, { "save", do_save, POS_DEAD, 0, LOG_NORMAL, 1 }, { "sleep", do_sleep, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "sneak", do_sneak, POS_STANDING, 0, LOG_NORMAL, 1 }, { "split", do_split, POS_RESTING, 0, LOG_NORMAL, 1 }, { "steal", do_steal, POS_STANDING, 0, LOG_NORMAL, 1 }, { "visible", do_visible, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "wake", do_wake, POS_SLEEPING, 0, LOG_NORMAL, 1 }, { "where", do_where, POS_RESTING, 0, LOG_NORMAL, 1 }, /* * Immortal commands. */ { "advance", do_advance, POS_DEAD, ML, LOG_ALWAYS, 1 }, { "award", do_award, POS_DEAD, L1, LOG_ALWAYS, 1 }, { "trust", do_trust, POS_DEAD, ML, LOG_ALWAYS, 1 }, { "allow", do_allow, POS_DEAD, L2, LOG_ALWAYS, 1 }, { "ban", do_ban, POS_DEAD, L2, LOG_ALWAYS, 1 }, { "enable", do_enable, POS_DEAD, L4, LOG_ALWAYS, 1 }, { "disable", do_disable, POS_DEAD, L4, LOG_ALWAYS, 1 }, { "deny", do_deny, POS_DEAD, L1, LOG_ALWAYS, 1 }, { "disconnect", do_disconnect, POS_DEAD, L3, LOG_ALWAYS, 1 }, { "freeze", do_freeze, POS_DEAD, L3, LOG_ALWAYS, 1 }, { "reboo", do_reboo, POS_DEAD, L1, LOG_NORMAL, 0 }, { "reboot", do_reboot, POS_DEAD, L1, LOG_ALWAYS, 1 }, { "set", do_set, POS_DEAD, L2, LOG_ALWAYS, 1 }, { "shutdow", do_shutdow, POS_DEAD, L1, LOG_NORMAL, 0 }, { "shutdown", do_shutdown, POS_DEAD, L1, LOG_ALWAYS, 1 }, /* { "sockets", do_sockets, POS_DEAD, L4, LOG_NORMAL, 1 }, */ { "wizlock", do_wizlock, POS_DEAD, L2, LOG_ALWAYS, 1 }, { "wiznet", do_wiznet, POS_DEAD, IM, LOG_ALWAYS, 1 }, { "force", do_force, POS_DEAD, L7, LOG_ALWAYS, 1 }, { "load", do_load, POS_DEAD, L6, LOG_ALWAYS, 1 }, { "newlock", do_newlock, POS_DEAD, L4, LOG_ALWAYS, 1 }, { "nochannels", do_nochannels, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "noemote", do_noemote, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "noshout", do_noshout, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "notell", do_notell, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "pecho", do_pecho, POS_DEAD, L4, LOG_ALWAYS, 1 }, { "pardon", do_pardon, POS_DEAD, L3, LOG_ALWAYS, 1 }, { "purge", do_purge, POS_DEAD, L7, LOG_ALWAYS, 1 }, { "restore", do_restore, POS_DEAD, L4, LOG_ALWAYS, 1 }, { "sla", do_sla, POS_DEAD, L3, LOG_NORMAL, 0 }, { "slay", do_slay, POS_DEAD, L3, LOG_ALWAYS, 1 }, { "teleport", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "transfer", do_transfer, POS_DEAD, L5, LOG_ALWAYS, 1 }, /* { "at", do_at, POS_DEAD, L6, LOG_NORMAL, 1 }, */ { "poofin", do_bamfin, POS_DEAD, L8, LOG_NORMAL, 1 }, { "poofout", do_bamfout, POS_DEAD, L8, LOG_NORMAL, 1 }, { "gecho", do_echo, POS_DEAD, L4, LOG_ALWAYS, 1 }, /* { "goto", do_goto, POS_DEAD, L8, LOG_NORMAL, 1 }, */ { "holylight", do_holylight, POS_DEAD, IM, LOG_NORMAL, 1 }, { "home", do_home, POS_DEAD, IM, LOG_NORMAL, 1 }, { "invis", do_invis, POS_DEAD, IM, LOG_NORMAL, 0 }, { "cloak", do_cloak, POS_DEAD, IM, LOG_NORMAL, 1 }, { "log", do_log, POS_DEAD, L1, LOG_ALWAYS, 1 }, { "memory", do_memory, POS_DEAD, IM, LOG_NORMAL, 1 }, { "mwhere", do_mwhere, POS_DEAD, IM, LOG_NORMAL, 1 }, { "owhere", do_owhere, POS_DEAD, IM, LOG_NORMAL, 1 }, { "pwhere", do_pwhere, POS_DEAD, IM, LOG_NORMAL, 1 }, { "peace", do_peace, POS_DEAD, L8, LOG_NORMAL, 1 }, { "echo", do_recho, POS_DEAD, L6, LOG_ALWAYS, 1 }, { "return", do_return, POS_DEAD, L6, LOG_NORMAL, 1 }, { "snoop", do_snoop, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "stat", do_stat, POS_DEAD, IM, LOG_NORMAL, 1 }, { "string", do_string, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "switch", do_switch, POS_DEAD, L6, LOG_ALWAYS, 1 }, { "wizinvis", do_invis, POS_DEAD, IM, LOG_NORMAL, 1 }, { "vnum", do_vnum, POS_DEAD, L4, LOG_NORMAL, 1 }, { "clone", do_clone, POS_DEAD, L5, LOG_ALWAYS, 1 }, { "immtalk", do_immtalk, POS_DEAD, HE, LOG_NORMAL, 1 }, { "imotd", do_imotd, POS_DEAD, HE, LOG_NORMAL, 1 }, { "world", do_world, POS_DEAD, L7, LOG_NORMAL, 1 }, { ":", do_immtalk, POS_DEAD, HE, LOG_NORMAL, 0 }, { "setskill", do_setskill, POS_DEAD, ML, LOG_ALWAYS, 1 }, { "listskills", do_listskills, POS_DEAD, HE, LOG_NORMAL, 1 }, { "dump", do_dump, POS_DEAD, ML, LOG_NORMAL, 0 }, { "checklease", do_checklease, POS_DEAD, IM, LOG_NORMAL, 1 }, { "immtitle", do_immtitle, POS_DEAD, IM, LOG_NORMAL, 1 }, /* * OLC */ { "edit", do_olc, POS_DEAD, L8, LOG_NORMAL, 1 }, { "asave", do_asave, POS_DEAD, L8, LOG_NORMAL, 1 }, { "alist", do_alist, POS_DEAD, L8, LOG_NORMAL, 1 }, { "resets", do_resets, POS_DEAD, L8, LOG_NORMAL, 1 }, { "end", do_end, POS_DEAD, 0, LOG_NORMAL, 1 }, /* * MOBprogram commands. */ { "mpstat", do_mpstat, POS_DEAD, 38, LOG_NORMAL }, { "mpasound", do_mpasound, POS_DEAD, 0, LOG_NORMAL }, { "mpjunk", do_mpjunk, POS_DEAD, 0, LOG_NORMAL }, { "mpecho", do_mpecho, POS_DEAD, 0, LOG_NORMAL }, { "mpechoat", do_mpechoat, POS_DEAD, 0, LOG_NORMAL }, { "mpechoaround", do_mpechoaround,POS_DEAD, 0, LOG_NORMAL }, { "mpkill", do_mpkill ,POS_DEAD, 0, LOG_NORMAL }, { "mpmload", do_mpmload ,POS_DEAD, 0, LOG_NORMAL }, { "mpoload", do_mpoload ,POS_DEAD, 0, LOG_NORMAL }, { "mppurge", do_mppurge ,POS_DEAD, 0, LOG_NORMAL }, { "mpgoto", do_mpgoto ,POS_DEAD, 0, LOG_NORMAL }, { "mpat", do_mpat ,POS_DEAD, 0, LOG_NORMAL }, { "mptransfer", do_mptransfer ,POS_DEAD, 0, LOG_NORMAL }, { "mpforce", do_mpforce ,POS_DEAD, 0, LOG_NORMAL }, /* * End of list. */ { "", 0, POS_DEAD, 0, LOG_NORMAL, 0 } }; /* * The main entry point for executing commands. * Can be recursively called from 'at', 'order', 'force'. */ void interpret( CHAR_DATA *ch, char *argument ) { char command[MAX_INPUT_LENGTH]; char logline[MAX_INPUT_LENGTH]; char new_argument[MAX_STRING_LENGTH]; char new2_argument[MAX_STRING_LENGTH]; int depth = 0; bool expand = TRUE; int cmd; int trust; bool found; bool alias_cmd=FALSE; /* * Strip leading spaces. */ while ( isspace(*argument) ) argument++; if ( argument[0] == '\0' ) return; /* check for alias command, if so, bypass multi command and alias expansion functions -- allows embedded multi command aliasing */ one_argument (argument, command); if (!str_cmp (command, "alias")) alias_cmd = TRUE; /* if (!IS_NPC(ch)) { send_to_char ("Argument to interpret is: ",ch); send_to_char (argument,ch); send_to_char ("\n\rch->desc->incomm is: ",ch); send_to_char (ch->desc->incomm,ch); send_to_char ("\n\r",ch); } */ /* * Implement freeze command. */ if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_FREEZE) ) { send_to_char( "You're totally frozen!\n\r", ch ); return; } /* Zeran - call check_multi_cmd and expand_aliases for any PC who is not switched and argument is ch->desc->incomm. Prevents flooding of commands with the force or order command against other PCs. Continue expansion until a max depth of 2 is reached, or no more alias expansions have occured. */ if (!IS_NPC(ch) && !alias_cmd && ch->desc && argument == ch->desc->incomm ) while ( depth < 3 && expand ) { new_argument[0]='\0'; check_multi_cmd (ch, argument, new_argument); argument = new_argument; /* send_to_char ("Command after multi: ",ch); send_to_char (argument, ch); send_to_char ("\n\r",ch); send_to_char ("Incomm after multi: ",ch); send_to_char (ch->desc->incomm,ch); send_to_char ("\n\r\n\r",ch);*/ if (ch->pcdata->has_alias) { new2_argument[0]='\0'; expand = expand_aliases (ch, argument, new2_argument); if (expand) ch->wait+=2; argument = new2_argument; } else break; depth++; } /* * Grab the command word. * Special parsing so ' can be a command, * also no spaces needed after punctuation. */ strcpy( logline, argument ); if ( !isalpha(argument[0]) && !isdigit(argument[0]) ) { command[0] = argument[0]; command[1] = '\0'; argument++; while ( isspace(*argument) ) argument++; } else { argument = one_argument( argument, command ); } /* * Look for command in command table. */ found = FALSE; trust = get_trust( ch ); for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) { if ( command[0] == cmd_table[cmd].name[0] && !str_prefix( command, cmd_table[cmd].name ) && cmd_table[cmd].level <= trust ) { found = TRUE; break; } } /* * Log and snoop. */ if ( cmd_table[cmd].log == LOG_NEVER ) strcpy( logline, "" ); if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) || fLogAll || cmd_table[cmd].log == LOG_ALWAYS ) { sprintf( log_buf, "Log %s: %s", ch->name, logline ); log_string( log_buf ); } if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) ) { sprintf( log_buf, "Log %s: %s", ch->name, logline ); notify_message (ch, WIZNET_SECURE, TO_IMM_ADMIN, log_buf); } if ( ch->desc != NULL && ch->desc->snoop_by != NULL ) { write_to_buffer( ch->desc->snoop_by, "% ", 2 ); write_to_buffer( ch->desc->snoop_by, logline, 0 ); write_to_buffer( ch->desc->snoop_by, "\n\r", 2 ); } /* Zeran - Now, check against disabled commands. This should be done after logging so that disabled commands still register for tracking repeat hackers/offenders. */ { struct disable_cmd_type *tmp; for (tmp = disable_cmd_list; tmp != NULL ; tmp=tmp->next) { if ( (!str_prefix(command, tmp->name) || cmd_table[cmd].do_fun == tmp->disable_fcn) && trust < tmp->level) { send_to_char ("This command has been disabled by the staff, sorry for the inconvenience.\n\r",ch); return; } } } /* end checking for disabled command */ if ( !found ) { /* * Look for command in socials table. */ if ( !check_social( ch, command, argument ) ) send_to_char( "Type {YCOMMANDS{x for a list of valid commands.\n\r", ch ); return; } /* * Character not in position for command? */ if ( ch->position < cmd_table[cmd].position ) { switch( ch->position ) { case POS_DEAD: send_to_char( "Lie still; you are DEAD.\n\r", ch ); break; case POS_MORTAL: case POS_INCAP: send_to_char( "You are hurt far too bad for that.\n\r", ch ); break; case POS_STUNNED: send_to_char( "You are too stunned to do that.\n\r", ch ); break; case POS_SLEEPING: send_to_char( "In your dreams, or what?\n\r", ch ); break; case POS_RESTING: send_to_char( "Nah... You feel too relaxed...\n\r", ch); break; case POS_SITTING: send_to_char( "Better stand up first.\n\r",ch); break; case POS_FIGHTING: send_to_char( "No way! You are still fighting!\n\r", ch); break; } return; } /* * No hiding. */ if (cmd_table[cmd].position > POS_SLEEPING) REMOVE_BIT( ch->affected_by, AFF_HIDE ); /* * Dispatch the command. */ (*cmd_table[cmd].do_fun) ( ch, argument ); tail_chain( ); return; } bool check_social( CHAR_DATA *ch, char *command, char *argument ) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; int cmd; bool found; found = FALSE; for ( cmd = 0; social_table[cmd].name[0] != '\0'; cmd++ ) { if ( command[0] == social_table[cmd].name[0] && !str_prefix( command, social_table[cmd].name ) ) { found = TRUE; break; } } if ( !found ) return FALSE; if ( !IS_NPC(ch) && IS_SET(ch->comm, COMM_NOEMOTE) ) { send_to_char( "You are anti-social!\n\r", ch ); return TRUE; } switch ( ch->position ) { case POS_DEAD: send_to_char( "Lie still; you are DEAD.\n\r", ch ); return TRUE; case POS_INCAP: case POS_MORTAL: send_to_char( "You are hurt far too bad for that.\n\r", ch ); return TRUE; case POS_STUNNED: send_to_char( "You are too stunned to do that.\n\r", ch ); return TRUE; case POS_SLEEPING: /* * I just know this is the path to a 12" 'if' statement. :( * But two players asked for it already! -- Furey */ if ( !str_cmp( social_table[cmd].name, "snore" ) ) break; send_to_char( "In your dreams, or what?\n\r", ch ); return TRUE; } one_argument( argument, arg ); victim = NULL; if ( arg[0] == '\0' ) { act( social_table[cmd].others_no_arg, ch, NULL, victim, TO_ROOM ); act( social_table[cmd].char_no_arg, ch, NULL, victim, TO_CHAR ); } else if ( ( victim = get_char_room( ch, arg ) ) == NULL ) { send_to_char( "They aren't here.\n\r", ch ); } else if ( victim == ch ) { act( social_table[cmd].others_auto, ch, NULL, victim, TO_ROOM ); act( social_table[cmd].char_auto, ch, NULL, victim, TO_CHAR ); } else { act( social_table[cmd].others_found, ch, NULL, victim, TO_NOTVICT ); act( social_table[cmd].char_found, ch, NULL, victim, TO_CHAR ); act( social_table[cmd].vict_found, ch, NULL, victim, TO_VICT ); if ( !IS_NPC(ch) && IS_NPC(victim) && !IS_AFFECTED(victim, AFF_CHARM) && IS_AWAKE(victim) && victim->desc == NULL) { switch ( number_bits( 4 ) ) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: act( social_table[cmd].others_found, victim, NULL, ch, TO_NOTVICT ); act( social_table[cmd].char_found, victim, NULL, ch, TO_CHAR ); act( social_table[cmd].vict_found, victim, NULL, ch, TO_VICT ); break; case 9: case 10: case 11: case 12: act( "$n slaps $N.", victim, NULL, ch, TO_NOTVICT ); act( "You slap $N.", victim, NULL, ch, TO_CHAR ); act( "$n slaps you.", victim, NULL, ch, TO_VICT ); break; } } } return TRUE; } /* * Return true if an argument is completely numeric. */ bool is_number ( char *arg ) { if ( *arg == '\0' ) return FALSE; if ( *arg == '+' || *arg == '-' ) arg++; for ( ; *arg != '\0'; arg++ ) { if ( !isdigit( *arg ) ) return FALSE; } return TRUE; } /* * Given a string like 14.foo, return 14 and 'foo' * Zeran - modify to return -1 for all.foo number */ int number_argument( char *argument, char *arg ) { char *pdot; int number; for ( pdot = argument; *pdot != '\0'; pdot++ ) { if ( *pdot == '.' ) { *pdot = '\0'; if (!str_cmp(argument, "all")) number = -1; else number = atoi( argument ); *pdot = '.'; strcpy( arg, pdot+1 ); return number; } } strcpy( arg, argument ); return 1; } /* elfren added for buying multiple items * * Given a string like 14*foo, return 14 and 'foo' * argument is original string, arg will get name of the object */ int mult_argument(char *argument, char *arg) { char *pdot; int number; for ( pdot = argument; *pdot != '\0'; pdot++ ) { if ( *pdot == '*' ) { *pdot = '\0'; number = atoi( argument ); *pdot = '*'; strcpy( argument, pdot+1 ); return number; } } return 1; } /* * Pick off one argument from a string and return the rest. * Understands quotes. */ char *one_argument( char *argument, char *arg_first ) { char cEnd; while ( isspace(*argument) ) argument++; cEnd = ' '; if ( *argument == '\'' || *argument == '"' ) cEnd = *argument++; while ( *argument != '\0' ) { if ( *argument == cEnd ) { argument++; break; } *arg_first = LOWER(*argument); arg_first++; argument++; } *arg_first = '\0'; while ( isspace(*argument) ) argument++; return argument; } /* * Contributed by Alander. */ void do_commands( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; int cmd; int col; col = 0; for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) { if ( cmd_table[cmd].level < LEVEL_HERO && cmd_table[cmd].level <= get_trust( ch ) && cmd_table[cmd].show) { sprintf( buf, "%-12s", cmd_table[cmd].name ); send_to_char( buf, ch ); if ( ++col % 6 == 0 ) send_to_char( "\n\r", ch ); } } if ( col % 6 != 0 ) send_to_char( "\n\r", ch ); return; } void do_wizhelp( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; int col; int counter; int level; int v_level; struct wizcommand_type *tmp; v_level = UMAX (ch->level, get_trust(ch)); for (counter = MAX_LEVEL-v_level; counter < 10; counter++) { level = MAX_LEVEL-counter; col = 0; if (level % 2 == 0) sprintf (buf, "{BLevel %3d:{x ", level); else sprintf (buf, "{CLevel %3d:{x ", level); send_to_char(buf, ch); for (tmp = wizcommand_table[counter]; tmp != NULL ; tmp = tmp->next) { sprintf( buf, "%-12s", tmp->name ); send_to_char( buf, ch ); if ( ++col % 5 == 0 ) send_to_char( "\n\r ", ch ); } if (col % 5 != 0) send_to_char ("\n\r",ch); } return; } void gen_wiz_table (void) { int cmd; int level; struct wizcommand_type *tmp; bool show; for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) { level = cmd_table[cmd].level; show = cmd_table[cmd].show; if (level >= HE && show) { if (wizcommand_table[MAX_LEVEL-level] == NULL) { tmp = (struct wizcommand_type *) malloc (sizeof (struct wizcommand_type)); tmp->name = strdup (cmd_table[cmd].name); tmp->next = NULL; wizcommand_table[MAX_LEVEL-level] = tmp; } else { for (tmp = wizcommand_table[MAX_LEVEL-level] ; tmp->next != NULL ; tmp = tmp->next); tmp->next = (struct wizcommand_type *) malloc (sizeof (struct wizcommand_type)); tmp->next->name = strdup (cmd_table[cmd].name); tmp->next->next = NULL; } } } } /* Zeran - these functions should go in act_wiz.c, but putting them here so don't have to declare the cmd_table globally. */ void do_disable (CHAR_DATA *ch, char *argument) { struct disable_cmd_type *tmp, *last_disabled=NULL; char command[MAX_INPUT_LENGTH]; char *level_string; char outbuf[MAX_STRING_LENGTH]; int level; int trust; int cmd; bool found=FALSE; if (argument == NULL || argument[0] == '\0') { send_to_char ("Disabled commands\n\r",ch); send_to_char ("-------- --------\n\r",ch); for (tmp = disable_cmd_list ; tmp != NULL ; tmp=tmp->next) { sprintf (outbuf, "[ {B%-12s{x ] at level [ {B%3d{x ]\n\r", tmp->name, tmp->level); send_to_char (outbuf,ch); found=TRUE; } if (!found) send_to_char ("No commands are disabled at this time.\n\r",ch); return; } else { trust = get_trust (ch); level_string = one_argument (argument, command); if (level_string == NULL || level_string[0] == '\0' || atoi(level_string) == 0 ) level = trust; else level = UMIN (trust , atoi (level_string)); for ( cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ ) { if ( command[0] == cmd_table[cmd].name[0] && !str_prefix( command, cmd_table[cmd].name ) && cmd_table[cmd].level <= trust ) { found = TRUE; break; } } if (!found) { send_to_char ("No such command found, or command restricted to higher level.\n\r",ch); return; } /*check if command already disabled*/ for (tmp = disable_cmd_list; tmp != NULL ; tmp=tmp->next) { if (!str_prefix(command, tmp->name)) { sprintf (outbuf, "[ {B%s{x ] is already disabled for all characters below level [ {B%d{x ].\n\r", tmp->name, tmp->level); send_to_char (outbuf,ch); return; } last_disabled = tmp; } /* disable the command */ tmp = (struct disable_cmd_type *) malloc (sizeof (struct disable_cmd_type)); tmp->next = NULL; tmp->name = strdup (cmd_table[cmd].name); tmp->level = level; tmp->disable_fcn=cmd_table[cmd].do_fun; if (disable_cmd_list == NULL) disable_cmd_list = tmp; else last_disabled->next = tmp; sprintf (outbuf, "You have disabled [ {B%s{x ] for characters below level [ {B%d{x ].\n\r", tmp->name, tmp->level); send_to_char (outbuf, ch); } fwrite_disable(); return; } void do_enable (CHAR_DATA *ch, char *argument) { struct disable_cmd_type *tmp, *last_disabled=NULL; char command[MAX_INPUT_LENGTH]; char outbuf[MAX_STRING_LENGTH]; bool found = FALSE; if (argument == NULL || argument[0] == '\0') { send_to_char ("Syntax: enable <command>\n\r",ch); return; } one_argument (argument, command); /* find command in disable list */ for (tmp = disable_cmd_list; tmp != NULL ; tmp=tmp->next) { if (!str_prefix(command, tmp->name)) { found = TRUE; break; } last_disabled = tmp; } if (!found) { send_to_char ("That command is not currently disabled...\n\r",ch); return; } /* remove command from disabled list */ sprintf (outbuf, "[ {B%s{x ] disabling removed.\n\r", tmp->name); send_to_char (outbuf, ch); free_string (tmp->name); if (tmp == disable_cmd_list ) disable_cmd_list = tmp->next; else last_disabled->next = tmp->next; free (tmp); fwrite_disable(); return; } /* Zeran - This function has a horribly inelegant method of watching for quoted arguments, but at least it works. *sigh* */ bool expand_aliases (CHAR_DATA *ch, char *orig_command, char *final_command) { char arg[MAX_INPUT_LENGTH]; char *remainder; char *tmp_remainder; struct alias_data *tmp; int counter; bool match = FALSE; char allargs[6][MAX_INPUT_LENGTH]; int total_args; int tmp_count; int tmp_len; int value; char single[3]; single[0]='\0'; final_command[0]='\0'; /* smash out tildes..sheesh */ smash_tilde (orig_command); /* check null command */ if (orig_command == NULL || orig_command[0] == '\0' || orig_command[0] == '\'') { strcpy (final_command , orig_command); return FALSE; } /* parse orig_command first word, match against alias names, expand if found and tack onto final_command, then return) */ remainder = one_argument (orig_command, arg); /* match arg against alias names */ for (counter = 0 ; counter < MAX_ALIAS ; counter++) { tmp = ch->pcdata->aliases[counter]; if (tmp == NULL) continue; if (!strcmp (tmp->name, arg)) { /* check for parameters required for alias */ total_args=1; tmp_remainder = remainder; while (tmp_remainder != NULL && tmp_remainder[0] != '\0' && total_args < 6) { tmp_remainder = one_argument (tmp_remainder, allargs[total_args]); total_args++; } tmp_remainder = tmp->command_string; tmp_len = strlen(tmp->command_string); for (tmp_count = 0; tmp_count < (tmp_len) ; tmp_count++) { if ( tmp_remainder[tmp_count] == '%' && tmp_remainder[tmp_count+1] != '\0' && (tmp_remainder[tmp_count+2] == ' ' || tmp_remainder[tmp_count+2] == '\0') ) { value = (tmp_remainder[tmp_count+1] - '0'); if (value < 1 || value > MAX_ALIAS_PARMS) value=-1; if ( value != -1) { if ( value < total_args) strcat (final_command, allargs[value]); else strcat (final_command, " "); tmp_count++; } else { sprintf (single, "%c", tmp_remainder[tmp_count+1]); strcat (final_command, "%"); strcat (final_command, single); tmp_count++; } } else { sprintf (single, "%c", tmp_remainder[tmp_count]); strcat (final_command, single); } } /* end for loop through tmp->command_string */ strcat (final_command, " "); match = TRUE; } } if (!match) { strcpy (final_command , orig_command); return FALSE; } return TRUE; } /* Zeran - procedure to scan for multiple commands */ void check_multi_cmd (CHAR_DATA *ch, char *orig_cmd, char *final_cmd) { int count; int len; char *tmp_ptr=NULL; bool first_s_quote=FALSE; bool first_d_quote=FALSE; char *tmp_incomm=NULL; bool need_tmp_incomm=FALSE; len = strlen (orig_cmd) ; /* are we parsing an alias, or just parsing incomm? */ if (orig_cmd != ch->desc->incomm) need_tmp_incomm = TRUE; for (count = 0; count < len ; count++) { switch (orig_cmd[count]) { case '"': if (!first_s_quote) if (!first_d_quote) first_d_quote = TRUE; else first_d_quote = FALSE; break; case '\'': /* skip if count is 0...its the short say command */ if (count == 0) break; if (!first_d_quote) if (!first_s_quote) first_s_quote = TRUE; else first_s_quote = FALSE; break; case '|': if (!tmp_ptr && !first_d_quote && !first_s_quote) tmp_ptr = &(orig_cmd[count]); break; default: break; } /* end switch */ /* if got a separator pointer, break */ if (tmp_ptr) break; } /* end for loop */ if (tmp_ptr != NULL && !first_s_quote && !first_d_quote) { ch->desc->multi_comm=TRUE; /* copy ch->desc->incomm if needed*/ if (need_tmp_incomm) tmp_incomm = str_dup (ch->desc->incomm); *tmp_ptr = '\0'; tmp_ptr++; while (isspace(*tmp_ptr)) tmp_ptr++; strcpy (final_cmd, orig_cmd); strcpy (ch->desc->incomm,tmp_ptr); if (need_tmp_incomm) { if ( ( strlen(ch->desc->incomm) + strlen((tmp_ptr+1)) ) >= (MAX_INPUT_LENGTH-10) ) { send_to_char ("Command expansion too large, ignoring last command.\n\r",ch); ch->desc->incomm[0]='\0'; final_cmd[0]='\0'; return; } strcat (ch->desc->incomm, "|"); strcat (ch->desc->incomm, tmp_incomm); } free_string (tmp_incomm); return; } else { strcpy (final_cmd, orig_cmd); if (orig_cmd == ch->desc->incomm) ch->desc->incomm[0]='\0'; } return; }