Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

interp.c

Go to the documentation of this file.
00001 /***************************************************************************
00002  *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
00003  *  Michael Seifert, Hans Henrik Strfeldt, Tom Madsen, and Katja Nyboe.    *
00004  *                                                                         *
00005  *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
00006  *  Chastain, Michael Quan, and Mitchell Tse.                              *
00007  *                                                                         *
00008  *  In order to use any part of this Merc Diku Mud, you must comply with   *
00009  *  both the original Diku license in 'license.doc' as well the Merc       *
00010  *  license in 'license.txt'.  In particular, you may not remove either of *
00011  *  these copyright notices.                                               *
00012  *                                                                         *
00013  *  Much time and thought has gone into this software and you are          *
00014  *  benefitting.  We hope that you share your changes too.  What goes      *
00015  *  around, comes around.                                                  *
00016  ***************************************************************************/
00017 
00018 /***************************************************************************
00019 *    ROM 2.4 is copyright 1993-1998 Russ Taylor                             *
00020 *    ROM has been brought to you by the ROM consortium                      *
00021 *        Russ Taylor (rtaylor@hypercube.org)                                *
00022 *        Gabrielle Taylor (gtaylor@hypercube.org)                           *
00023 *        Brian Moore (zump@rom.org)                                         *
00024 *    By using this code, you have agreed to follow the terms of the         *
00025 *    ROM license, in the file Rom24/doc/rom.license                         *
00026 ****************************************************************************/
00027 
00028 #if defined(macintosh)
00029 #include <types.h>
00030 #else
00031 #include <sys/types.h>
00032 #endif
00033 #include <ctype.h>
00034 #include <stdio.h>
00035 #include <stdlib.h>
00036 #include <string.h>
00037 #include <time.h>
00038 #include "merc.h"
00039 #include "interp.h"
00040 #include "tables.h"
00041 #include <unistd.h> /* unlink()*/
00042 
00043 bool check_social args ((CHAR_DATA * ch, char *command, char *argument));
00044 bool    check_disabled (const struct cmd_type *command);
00045 DISABLED_DATA *disabled_first;
00046 //CHAN_DISABLED *dChan_first;
00047 #define END_MARKER  "END" /* for load_disabled() and save_disabled() */
00048 
00049 
00050 /*
00051  * Command logging types.
00052  */
00053 #define LOG_NORMAL  0
00054 #define LOG_ALWAYS  1
00055 #define LOG_NEVER   2
00056 
00057 
00058 
00059 /*
00060  * Log-all switch.
00061  */
00062 bool fLogAll = FALSE;
00063 
00064 
00065 
00066 /*
00067  * Command table.
00068  */
00069 const struct cmd_type cmd_table[] = {
00070     
00071     /*
00072      * commands for clan stuff
00073      */
00074 
00075 
00076   
00077     
00078     /*
00079      * Common movement commands.
00080      */
00081     //{"second", do_second, POS_RESTING, 0, LOG_NEVER, 0},
00082     {"gstat",   do_gstat, POS_DEAD, 58, LOG_NORMAL, 1},
00083     {"board",   do_board,   POS_DEAD,  0, LOG_NORMAL, 1},
00084     {"btell",   do_btell,   POS_DEAD,   0,  LOG_NEVER, 1},  
00085     {"affects", do_affects, POS_DEAD, 0, LOG_NEVER, 1},
00086     {"north", do_north, POS_STANDING, 0, LOG_NEVER, 0},
00087     {"east",  do_east,  POS_STANDING, 0, LOG_NEVER, 0},
00088     {"south", do_south, POS_STANDING, 0, LOG_NEVER, 0},
00089     {"west",  do_west,  POS_STANDING, 0, LOG_NEVER, 0},
00090     {"up",    do_up,    POS_STANDING, 0, LOG_NEVER, 0},
00091     {"down",  do_down,  POS_STANDING, 0, LOG_NEVER, 0},
00092     {"northeast", do_northeast, POS_STANDING, 0, LOG_NEVER,0},
00093     {"northwest", do_northwest, POS_STANDING, 0, LOG_NEVER,0},
00094     {"southeast", do_southeast, POS_STANDING, 0, LOG_NEVER,0},
00095     {"southwest", do_southwest, POS_STANDING, 0, LOG_NEVER,0},
00096     {"ne",        do_northeast, POS_STANDING, 0, LOG_NEVER,0},
00097     {"nw",        do_northwest, POS_STANDING, 0, LOG_NEVER,0},
00098     {"se",        do_southeast, POS_STANDING, 0, LOG_NEVER,0},
00099     {"sw",        do_southwest, POS_STANDING, 0, LOG_NEVER,0},
00100     //{"ttt",       do_southeast, POS_STANDING, 0, LOG_NEVER,0},
00101     {"second", do_second, POS_RESTING, 0, LOG_NEVER, 1},
00102     {"odelete", OEDIT, POS_DEAD, ML , LOG_ALWAYS, 1},
00103    //{"medit", MEDIT, POS_DEAD, ML, LOG_ALWAYS, 1},
00104     /*
00105      * Common other commands.
00106      * Placed here so one and two letter abbreviations work.
00107      */
00108     {">",         do_dsay,      POS_RESTING,        0,LOG_NORMAL,1},
00109     {"whisper",   do_whisper,   POS_RESTING,       0, LOG_NORMAL,1},
00110     {"ooc",   do_ooc,       POS_DEAD,        0, LOG_NORMAL,1},
00111     {"broadcast",  do_broadcast, POS_DEAD,      52,  LOG_NORMAL,1},
00112  //  {"pray",     do_pray,  POS_DEAD,      0,  LOG_NORMAL, 1},
00113 //   {"testco",    do_testco,    POS_DEAD,     ML, LOG_NORMAL, 1},
00115     {"at",        do_at,        POS_DEAD,     L6, LOG_NORMAL, 1},
00116     {"cast",      do_cast,      POS_FIGHTING, 0,  LOG_NORMAL, 1},
00117     {"cgos",      do_clan_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1},
00118     {"auction",   do_auction,   POS_SLEEPING, 0,  LOG_NORMAL, 1},
00119     {"buy",       do_buy,       POS_RESTING,  0,  LOG_NORMAL, 1},
00120     {"channels",  do_channels,  POS_DEAD,     0,  LOG_NORMAL, 1},
00121     {"exits",     do_exits,     POS_RESTING,  0,  LOG_NORMAL, 1},
00122     {"get",       do_get,       POS_RESTING,  0,  LOG_NORMAL, 1},
00123     {"goto",      do_goto,      POS_DEAD,     IM, LOG_NORMAL, 1},
00124     {"group",     do_group,     POS_SLEEPING, 0,  LOG_NORMAL, 1},
00125     {"glance",    do_glance,    POS_RESTING,  0,  LOG_NEVER,  1},
00126     {"guild",     do_guild,     POS_DEAD,     L8, LOG_ALWAYS, 1},
00127     {"hit",       do_kill,      POS_FIGHTING, 0,  LOG_NORMAL, 1},
00128     {"inventory", do_inventory, POS_DEAD,     0,  LOG_NORMAL, 1},
00129     {"kill",      do_kill,      POS_FIGHTING, 0,  LOG_NORMAL, 1},
00130     {"kguild",          do_kingdom_guild, POS_DEAD, 0, LOG_NORMAL, 1},
00131     {"look",      do_look,      POS_RESTING,  0,  LOG_NORMAL, 1},
00132 //   {"whok",     do_who_kingdom, POS_DEAD,   0,  LOG_NEVER,  1},
00133     {"clan",      do_clantalk,  POS_SLEEPING, 0,  LOG_NORMAL, 1},
00134     {"oclan",     do_oocclan_talk, POS_DEAD,  0,  LOG_NORMAL, 1},
00135     {"kingdom",   do_kingdomtalk, POS_DEAD,   0,  LOG_NORMAL, 1},
00136     {"music",     do_music,     POS_SLEEPING, 0,  LOG_NORMAL, 1},
00137     {"order",     do_order,     POS_RESTING,  0,  LOG_NORMAL, 1},
00138     {"practice",  do_practice,  POS_SLEEPING, 0,  LOG_NORMAL, 1},
00139     {"pray",      do_pray,      POS_DEAD,     0,  LOG_NORMAL, 1},
00140     {"rest",      do_rest,      POS_SLEEPING, 0,  LOG_NORMAL, 1},
00141     {"sit",       do_sit,       POS_SLEEPING, 0,  LOG_NORMAL, 1},
00142     {"sockets",   do_sockets,   POS_DEAD,     57, LOG_NORMAL, 1},
00143     {"stand",     do_stand,     POS_SLEEPING, 0,  LOG_NORMAL, 1},
00144     {"tell",      do_tell,      POS_RESTING,  0,  LOG_NORMAL, 1},
00145     {"unlock",    do_unlock,    POS_RESTING,  0,  LOG_NORMAL, 1},
00146     {"wield",     do_wear,      POS_RESTING,  0,  LOG_NORMAL, 1},
00147     {"wizhelp",   do_wizhelp,   POS_DEAD,     IM, LOG_NORMAL, 1},
00148  //  {"nogoto",   do_nogoto,    POS_DEAD,     IM, LOG_NORMAL, 1},
00149 //   {"cgos",     do_clan_gossip, POS_SLEEING, 0, LOG_NORMAL, 0},
00150     /*
00151      * Informational commands.
00152      */
00153    // {"affects",   do_affects,   POS_DEAD,     0, LOG_NORMAL, 1},
00154     {"areas",     do_areas,     POS_DEAD,     0, LOG_NORMAL, 1},
00155   {"bug",       do_bug,       POS_DEAD,     0, LOG_NORMAL, 1}, 
00156 //   {"board",     do_board,     POS_SLEEPING, 0, LOG_NORMAL, 1},
00157     {"commands",  do_commands,  POS_DEAD,     0, LOG_NORMAL, 1},
00158     {"compare",   do_compare,   POS_RESTING,  0, LOG_NORMAL, 1},
00159     {"consider",  do_consider,  POS_RESTING,  0, LOG_NORMAL, 1},
00160     {"count",     do_count,     POS_SLEEPING, 0, LOG_NORMAL, 1},
00161     {"credits",   do_credits,   POS_DEAD,     0, LOG_NORMAL, 1},
00162     {"equipment", do_equipment, POS_DEAD,     0, LOG_NORMAL, 1},
00163     {"examine",   do_examine,   POS_RESTING,  0, LOG_NORMAL, 1},
00164 /*  {"groups",    do_groups,    POS_SLEEPING, 0, LOG_NORMAL, 1}, */
00165     {"help",      do_help,      POS_DEAD,     0, LOG_NORMAL, 1},
00166     {"info",      do_groups,    POS_SLEEPING, 0, LOG_NORMAL, 1},
00167     {"motd",      do_motd,      POS_DEAD,     0, LOG_NORMAL, 1},
00168     {"direct",    do_dsay,  POS_RESTING,  0, LOG_NORMAL, 1},
00169     {"read",      do_read,      POS_RESTING,  0, LOG_NORMAL, 1},
00170     {"report",    do_report,    POS_RESTING,  0, LOG_NORMAL, 1},
00171     {"rules",     do_rules,     POS_DEAD,     0, LOG_NORMAL, 1},
00172     {"score",     do_score2,     POS_DEAD,     0, LOG_NORMAL, 1},
00173     {"oldscore",  do_score,    POS_DEAD,     0, LOG_NEVER,  1},
00174     {"skills",    do_skills,    POS_DEAD,     0, LOG_NORMAL, 1},
00175     {"socials",   do_socials,   POS_DEAD,     0, LOG_NORMAL, 1},
00176     {"show",      do_show,      POS_DEAD,     0, LOG_NORMAL, 1},
00177     {"spells",    do_spells,    POS_DEAD,     0, LOG_NORMAL, 1},
00178     {"story",     do_story,     POS_DEAD,     0, LOG_NORMAL, 1},
00179     {"time",      do_time,      POS_DEAD,     0, LOG_NORMAL, 1},
00180     {"typo",      do_typo,      POS_DEAD,     0, LOG_NORMAL, 1},
00181     {"weather",   do_weather,   POS_RESTING,  0, LOG_NORMAL, 1},
00182     {"who",       do_who,       POS_DEAD,     0, LOG_NORMAL, 1},
00183     {"whois",     do_whois,     POS_DEAD,     0, LOG_NORMAL, 1},
00184     {"wizlist",   do_wizlist,   POS_DEAD,     0, LOG_NORMAL, 1},
00185     {"worth",     do_worth,     POS_SLEEPING, 0, LOG_NORMAL, 1},
00186 
00187     /*
00188      * Configuration commands.
00189      */
00190     {"alia", do_alia, POS_DEAD, 0, LOG_NORMAL, 0},
00191     {"alias", do_alias, POS_DEAD, 0, LOG_NORMAL, 1},
00192     {"autolist", do_autolist, POS_DEAD, 0, LOG_NORMAL, 1},
00193     {"autoall", do_autoall, POS_DEAD, 0, LOG_NORMAL, 1},
00194     {"autoassist", do_autoassist, POS_DEAD, 0, LOG_NORMAL, 1},
00195     {"autoexit", do_autoexit, POS_DEAD, 0, LOG_NORMAL, 1},
00196     {"autogold", do_autogold, POS_DEAD, 0, LOG_NORMAL, 1},
00197     {"autoloot", do_autoloot, POS_DEAD, 0, LOG_NORMAL, 1},
00198     {"autosac", do_autosac, POS_DEAD, 0, LOG_NORMAL, 1},
00199     {"autosplit", do_autosplit, POS_DEAD, 0, LOG_NORMAL, 1},
00200     {"brief", do_brief, POS_DEAD, 0, LOG_NORMAL, 1},
00201 /*  { "channels",    do_channels,    POS_DEAD,     0,  LOG_NORMAL, 1 }, */
00202     {"tick",            do_tick,        POS_DEAD,       0, LOG_NORMAL, 1},
00203     {"colour",      do_colour,  POS_DEAD,   0, LOG_NORMAL, 1},
00204     {"color",       do_colour,  POS_DEAD,   0, LOG_NORMAL, 1},
00205     {"combine",     do_combine, POS_DEAD,   0, LOG_NORMAL, 1},
00206     {"compact",     do_compact, POS_DEAD,   0, LOG_NORMAL, 1},
00207     {"description", do_description, POS_DEAD,   0, LOG_NORMAL, 1},
00208     {"delet",       do_delet,   POS_DEAD,   0, LOG_ALWAYS, 0},
00209     {"delete",      do_delete,  POS_STANDING,   0, LOG_ALWAYS, 1},
00210     {"nofollow",    do_nofollow,    POS_DEAD,   0, LOG_NORMAL, 1},
00211     {"noloot",      do_noloot,  POS_DEAD,   0, LOG_NORMAL, 1},
00212     {"nosummon",    do_nosummon,    POS_DEAD,   0, LOG_NORMAL, 1},
00213     {"outfit",      do_outfit,  POS_RESTING,    0, LOG_NORMAL, 1},
00214     {"password",    do_password,    POS_DEAD,   0, LOG_NEVER,  1},
00215     {"prompt",      do_prompt,  POS_DEAD,   0, LOG_NORMAL, 1},
00216     {"scroll",      do_scroll,  POS_DEAD,   0, LOG_NORMAL, 1},
00217     {"telnetga",    do_telnetga,    POS_DEAD,   0, LOG_NORMAL, 1},
00218     {"title",       do_title,   POS_DEAD,   0, LOG_NORMAL, 1},
00219     {"unalias",     do_unalias, POS_DEAD,   0, LOG_NORMAL, 1},
00220     {"wimpy",       do_wimpy,   POS_DEAD,   0, LOG_NORMAL, 1},
00221     
00222     /*
00223      * Communication commands.
00224      */
00225     {"afk", do_afk, POS_SLEEPING, 0, LOG_NORMAL, 1},
00226     {"answer", do_answer, POS_SLEEPING, 0, LOG_NORMAL, 1},
00227 /*  { "auction",    do_auction,    POS_SLEEPING,     0,  LOG_NORMAL, 1 }, */
00228     {"deaf", do_deaf, POS_DEAD, 0, LOG_NORMAL, 1},
00229     {"emote", do_emote, POS_RESTING, 0, LOG_NORMAL, 1},
00230     {"pmote", do_pmote, POS_RESTING, 0, LOG_NORMAL, 1},
00231     {".", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1},
00232     {"gossip", do_gossip, POS_SLEEPING, 0, LOG_NORMAL, 1},
00233     {",", do_emote, POS_RESTING, 0, LOG_NORMAL, 1},
00234     {"grats", do_grats, POS_SLEEPING, 0, LOG_NORMAL, 1},
00235     {"gtell", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1},
00236     {";", do_gtell, POS_DEAD, 0, LOG_NORMAL, 1},
00237 /*  { "music",        do_music,    POS_SLEEPING,     0,  LOG_NORMAL, 1 }, */
00238     {"note", do_note, POS_DEAD, 0, LOG_NORMAL, 1},
00239     {"unread", do_unread, POS_DEAD, 0, LOG_NEVER,1},
00240     {"idea", do_idea, POS_DEAD, 0, LOG_NEVER,1},
00241     {"penalty", do_penalty, POS_DEAD, 0, LOG_NEVER,1},
00242     {"news", do_news, POS_DEAD, 0, LOG_NEVER,1},
00243     {"changes", do_changes, POS_DEAD, 0, LOG_NEVER,1},
00244     {"bnote", builder_note, POS_DEAD, L7, LOG_NORMAL, 1},
00245     {"cnote", code_note, POS_DEAD, L7, LOG_NORMAL, 1},
00246     {"pose", do_pose, POS_RESTING, 0, LOG_NORMAL, 1},
00247     {"ask", do_question, POS_SLEEPING, 0, LOG_NORMAL, 1},
00248     {"quest", do_quote, POS_SLEEPING, 0, LOG_NORMAL, 1},
00249     {"quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1},
00250     {"reply", do_reply, POS_SLEEPING, 0, LOG_NORMAL, 1},
00251     {"replay", do_replay, POS_SLEEPING, 0, LOG_NORMAL, 1},
00252     {"say", do_say, POS_RESTING, 0, LOG_NORMAL, 1},
00253     {"'", do_say, POS_RESTING, 0, LOG_NORMAL, 0},
00254     {"shout", do_shout, POS_RESTING, 3, LOG_NORMAL, 1},
00255     {"yell", do_yell, POS_RESTING, 0, LOG_NORMAL, 1},
00256 
00257     /*
00258      * Object manipulation commands.
00259      */
00260     {"brandish", do_brandish, POS_RESTING, 0, LOG_NORMAL, 1},
00261     {"close", do_close, POS_RESTING, 0, LOG_NORMAL, 1},
00262     {"drink", do_drink, POS_RESTING, 0, LOG_NORMAL, 1},
00263     {"drop", do_drop, POS_RESTING, 0, LOG_NORMAL, 1},
00264     {"eat", do_eat, POS_RESTING, 0, LOG_NORMAL, 1},
00265     {"envenom", do_envenom, POS_RESTING, 0, LOG_NORMAL, 1},
00266     {"fill", do_fill, POS_RESTING, 0, LOG_NORMAL, 1},
00267     {"give", do_give, POS_RESTING, 0, LOG_NORMAL, 1},
00268     {"heal", do_heal, POS_RESTING, 0, LOG_NORMAL, 1},
00269     {"hold", do_wear, POS_RESTING, 0, LOG_NORMAL, 1},
00270     {"list", do_list, POS_RESTING, 0, LOG_NORMAL, 1},
00271     {"lock", do_lock, POS_RESTING, 0, LOG_NORMAL, 1},
00272     {"open", do_open, POS_RESTING, 0, LOG_NORMAL, 1},
00273     {"pick", do_pick, POS_RESTING, 0, LOG_NORMAL, 1},
00274     {"pour", do_pour, POS_RESTING, 0, LOG_NORMAL, 1},
00275     {"put", do_put, POS_RESTING, 0, LOG_NORMAL, 1},
00276     {"quaff", do_quaff, POS_RESTING, 0, LOG_NORMAL, 1},
00277     {"recite", do_recite, POS_RESTING, 0, LOG_NORMAL, 1},
00278     {"remove", do_remove, POS_RESTING, 0, LOG_NORMAL, 1},
00279     {"sell", do_sell, POS_RESTING, 0, LOG_NORMAL, 1},
00280     {"take", do_get, POS_RESTING, 0, LOG_NORMAL, 1},
00281     {"sacrifice", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1},
00282     {"junk", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1},
00283     {"tap", do_sacrifice, POS_RESTING, 0, LOG_NORMAL, 1},
00284 /*  { "unlock",        do_unlock,    POS_RESTING,     0,  LOG_NORMAL, 1 }, */
00285     {"value", do_value, POS_RESTING, 0, LOG_NORMAL, 1},
00286     {"wear", do_wear, POS_RESTING, 0, LOG_NORMAL, 1},
00287     {"zap", do_zap, POS_RESTING, 0, LOG_NORMAL, 1},
00288     {"gamestatus", do_game_status, POS_DEAD, 0, LOG_NEVER, 1},
00289 
00290     /*
00291      * Combat commands.
00292      */
00293     {"backstab", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 1},
00294     {"bash", do_bash, POS_FIGHTING, 0, LOG_NORMAL, 1},
00295     {"bs", do_backstab, POS_FIGHTING, 0, LOG_NORMAL, 0},
00296     {"berserk", do_berserk, POS_FIGHTING, 0, LOG_NORMAL, 1},
00297     {"dirt", do_dirt, POS_FIGHTING, 0, LOG_NORMAL, 1},
00298     {"disarm", do_disarm, POS_FIGHTING, 0, LOG_NORMAL, 1},
00299     {"flee", do_flee, POS_FIGHTING, 0, LOG_NORMAL, 1},
00300     {"kick", do_kick, POS_FIGHTING, 0, LOG_NORMAL, 1},
00301    //{"gbash", do_dragon_bash, POS_FIGHTING, 0, LOG_NORMAL, 1},
00302     {"murde", do_murde, POS_FIGHTING, 0, LOG_NORMAL, 0},
00303     {"murder", do_murder, POS_FIGHTING, 5, LOG_ALWAYS, 1},
00304     {"rescue", do_rescue, POS_FIGHTING, 0, LOG_NORMAL, 1},
00305     {"surrender", do_surrender, POS_FIGHTING, 0, LOG_NORMAL, 1},
00306     {"trip", do_trip, POS_FIGHTING, 0, LOG_NORMAL, 1},
00307 
00308     /*
00309      * Mob command interpreter (placed here for faster scan...)
00310      */
00311     {"mob", do_mob, POS_DEAD, 0, LOG_NEVER, 0},
00312 
00313     /*
00314      * Miscellaneous commands.
00315      */
00316    {"ssssssaveclass", do_save_class, POS_DEAD,  ML, LOG_ALWAYS, 0},
00317     {"enter", do_enter, POS_STANDING, 0, LOG_NORMAL, 1},
00318     {"follow", do_follow, POS_RESTING, 0, LOG_NORMAL, 1},
00319     {"gain", do_gain, POS_STANDING, 0, LOG_NORMAL, 1},
00320     /*  { "group",        do_group,    POS_SLEEPING,     0,  LOG_NORMAL, 1 }, */
00321     {"groups", do_groups, POS_SLEEPING, 0, LOG_NORMAL, 1},
00322     {"hide", do_hide, POS_RESTING, 0, LOG_NORMAL, 1},
00323     {"play", do_play, POS_RESTING, 0, LOG_NORMAL, 1},
00324 /*  { "practice",    do_practice,    POS_SLEEPING,     0,  LOG_NORMAL, 1 }, */
00325     {"qui", do_qui, POS_DEAD, 0, LOG_NORMAL, 0},
00326     {"quit", do_quit, POS_DEAD, 0, LOG_NORMAL, 1},
00327     {"recall", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 1},
00328     {"/", do_recall, POS_FIGHTING, 0, LOG_NORMAL, 0},
00329     {"rent", do_rent, POS_DEAD, 0, LOG_NORMAL, 1},
00330     {"save", do_save, POS_DEAD, 0, LOG_NORMAL, 1},
00331     {"sleep", do_sleep, POS_SLEEPING, 0, LOG_NORMAL, 1},
00332     {"sneak", do_sneak, POS_STANDING, 0, LOG_NORMAL, 1},
00333     {"split", do_split, POS_RESTING, 0, LOG_NORMAL, 1},
00334     {"steal", do_steal, POS_STANDING, 0, LOG_NORMAL, 1},
00335     {"train", do_train, POS_RESTING, 0, LOG_NORMAL, 1},
00336     {"visible", do_visible, POS_SLEEPING, 0, LOG_NORMAL, 1},
00337     {"wake", do_wake, POS_SLEEPING, 0, LOG_NORMAL, 1},
00338     {"where", do_where, POS_RESTING, 0, LOG_NORMAL, 1},
00339     {"objectsdump", do_dump_objects, POS_DEAD, ML, LOG_ALWAYS, 1},
00340 
00341 
00342 
00343     /*
00344      * Immortal commands.
00345      */
00346     {"advance",     do_advance, POS_DEAD, L2, LOG_ALWAYS, 1},
00347     {"copyover",    do_tco, POS_DEAD, 59, LOG_ALWAYS, 1},
00348     {"dump",        do_dump,    POS_DEAD, ML, LOG_ALWAYS, 1},
00349     {"trust",       do_trust,   POS_DEAD, ML, LOG_ALWAYS, 1},
00350     {"violate",     do_violate, POS_DEAD, L2, LOG_ALWAYS, 1},
00351     {"notrans",         do_notrans,     POS_DEAD, L8, LOG_ALWAYS, 1},
00352     {"allow",       do_allow,   POS_DEAD, L2, LOG_ALWAYS, 1},
00353     {"ban",     do_ban,     POS_DEAD, L3, LOG_ALWAYS, 1},
00354     {"deny",        do_deny,    POS_DEAD, L2, LOG_ALWAYS, 1},
00355     {"disconnect",  do_disconnect,  POS_DEAD, L6, LOG_ALWAYS, 1},
00356     {"flag",        do_flag,    POS_DEAD, L2, LOG_ALWAYS, 1},
00357     {"freeze",      do_freeze,  POS_DEAD, L3, LOG_ALWAYS, 1},
00358     {"permban",     do_permban, POS_DEAD, L2, LOG_ALWAYS, 1},
00359     {"protect",     do_protect, POS_DEAD, L2, LOG_ALWAYS, 1},
00360     {"reboo",       do_reboo,   POS_DEAD, L1, LOG_NORMAL, 0},
00361     {"reboot",      do_reboot,  POS_DEAD, L1, LOG_ALWAYS, 1},
00362     {"set",     do_set,     POS_DEAD, L4, LOG_ALWAYS, 1},
00363     {"showvehicles",    do_show_vehicles,POS_DEAD, 52, LOG_NORMAL, 1},
00364     {"shutdow",     do_shutdow, POS_DEAD, L1, LOG_NORMAL, 0},
00365     {"shutdown",    do_shutdown,    POS_DEAD, L1, LOG_ALWAYS, 1},
00366 /*  { "sockets",    do_sockets,    POS_DEAD,    L4,  LOG_NORMAL, 1 }, */
00367     {"wizlock",     do_wizlock, POS_DEAD, L3, LOG_ALWAYS, 1},
00368 
00369     {"force",       do_force,   POS_DEAD, L7, LOG_ALWAYS, 1},
00370     {"load",        do_load,    POS_DEAD, L6, LOG_ALWAYS, 1},
00371     {"newlock",     do_newlock, POS_DEAD, L8, LOG_ALWAYS, 1},
00372     {"nochannels",  do_nochannels,  POS_DEAD, L8, LOG_ALWAYS, 1},
00373     {"noemote",     do_noemote, POS_DEAD, L8, LOG_ALWAYS, 1},
00374     {"noshout",     do_noshout, POS_DEAD, L8, LOG_ALWAYS, 1},
00375     {"notell",      do_notell,  POS_DEAD, L8, LOG_ALWAYS, 1},
00376     {"pecho",       do_pecho,   POS_DEAD, L6, LOG_ALWAYS, 1},
00377     {"pardon",      do_pardon,  POS_DEAD, L7, LOG_ALWAYS, 1},
00378     {"purge",       do_purge,   POS_DEAD, L6, LOG_ALWAYS, 1},
00379     {"qmconfig",    do_qmconfig,    POS_DEAD, ML, LOG_ALWAYS, 1},
00380     {"restore",     do_restore, POS_DEAD, IM, LOG_ALWAYS, 1},
00381     {"sla",     do_sla,     POS_DEAD, L6, LOG_NORMAL, 0},
00382     {"slay",        do_slay,    POS_DEAD, L6, LOG_NORMAL, 1},
00383     {"teleport",    do_transfer,    POS_DEAD, L5, LOG_ALWAYS, 1},
00384     {"transfer",    do_transfer,    POS_DEAD, L5, LOG_ALWAYS, 1},
00385     {"reclass",     do_reclass, POS_DEAD, ML, LOG_ALWAYS, 1},
00386 
00387 /*  { "at",        do_at,        POS_DEAD,    L6,  LOG_NORMAL, 1 }, */
00388     {"poofin",      do_bamfin,  POS_DEAD, IM, LOG_NORMAL, 1},
00389     {"poofout",     do_bamfout, POS_DEAD, IM, LOG_NORMAL, 1},
00390     {"gecho",       do_echo,    POS_DEAD, L6, LOG_ALWAYS, 1},
00391 /*  { "goto",        do_goto,    POS_DEAD,    L8,  LOG_NORMAL, 1 }, */
00392     {"holylight",   do_holylight,   POS_DEAD, IM, LOG_NORMAL, 1},
00393     {"incognito",   do_incognito,   POS_DEAD, L8, LOG_NORMAL, 1},
00394     {"invis",       do_invis,   POS_DEAD, IM, LOG_NORMAL, 1},
00395     {"log",     do_log,     POS_DEAD, L2, LOG_ALWAYS, 1},
00396     {"memory",      do_memory,  POS_DEAD, L8, LOG_NORMAL, 1},
00397     {"mwhere",      do_mwhere,  POS_DEAD, L6, LOG_NORMAL, 1},
00398     {"owhere",      do_owhere,  POS_DEAD, L6, LOG_NORMAL, 1},
00399     {"peace",       do_peace,   POS_DEAD, L7, LOG_NORMAL, 1},
00400     {"echo",        do_recho,   POS_DEAD, L6, LOG_ALWAYS, 1},
00401     {"return",      do_return,  POS_DEAD, 52, LOG_NORMAL, 1},
00402     {"snoop",       do_snoop,   POS_DEAD, L2, LOG_ALWAYS, 1},
00403     {"stat",        do_stat,    POS_DEAD, IM, LOG_NEVER , 1},
00404     {"string",      do_string,  POS_DEAD, IM, LOG_ALWAYS, 1},
00405     {"switch",      do_switch,  POS_DEAD, 52, LOG_ALWAYS, 1},
00406     {"wizinvis",    do_invis,   POS_DEAD, L6, LOG_NORMAL, 1},
00407     {"vnum",        do_vnum,    POS_DEAD, L8, LOG_NORMAL, 1},
00408     {"zecho",       do_zecho,   POS_DEAD, L6, LOG_ALWAYS, 1},
00409 
00410     {"clone",       do_clone,   POS_DEAD, L6, LOG_ALWAYS, 1},
00411 
00412     {"wiznet",      do_wiznet,  POS_DEAD, L8, LOG_NORMAL, 1},
00413     {"immtalk",     do_immtalk, POS_DEAD, IM, LOG_NORMAL, 1},
00414     {"imotd",       do_imotd,   POS_DEAD, IM, LOG_NORMAL, 1},
00415     {":",       do_immtalk, POS_DEAD, IM, LOG_NORMAL, 1},
00416     {"smote",       do_smote,   POS_DEAD, L8, LOG_NORMAL, 1},
00417     {"prefi",       do_prefi,   POS_DEAD, IM, LOG_NORMAL, 0},
00418     {"prefix",      do_prefix,  POS_DEAD, L8, LOG_NORMAL, 1},
00419     {"mpdump",      do_mpdump,  POS_DEAD, L6, LOG_NEVER, 1},
00420     {"mpstat",      do_mpstat,  POS_DEAD, L6, LOG_NEVER, 1},
00421     {"banish",      do_banish,  POS_DEAD, 0, LOG_ALWAYS, 1},
00422     /*
00423      * OLC
00424      */
00425     {"edit", do_olc, POS_DEAD, L5, LOG_NORMAL, 1},
00426     {"asave", do_asave, POS_DEAD, L5, LOG_NORMAL, 1},
00427     {"alist", do_alist, POS_DEAD, IM, LOG_NORMAL, 1},
00428     {"resets", do_resets, POS_DEAD, L5, LOG_NORMAL, 1},
00429     {"redit", do_redit, POS_DEAD, 57, LOG_NORMAL, 1},
00430     {"medit", do_medit, POS_DEAD, 57, LOG_NORMAL, 1},
00431     {"aedit", do_aedit, POS_DEAD, L2, LOG_NORMAL, 1},
00432     {"oedit", do_oedit, POS_DEAD, L5, LOG_NORMAL, 1},
00433     {"mpedit", do_mpedit, POS_DEAD, L2, LOG_NORMAL, 1},
00434     {"hedit", do_hedit, POS_DEAD, 58, LOG_NORMAL, 1},
00435     {"cedit", do_cedit, POS_DEAD, L5, LOG_ALWAYS, 1},
00436     {"scan",  do_scan,  POS_STANDING, 0, LOG_NEVER, 1},
00437     {"sedit", do_sedit, POS_DEAD, 61, LOG_ALWAYS, 1},
00438 //    {"asleep", do_asleep, POS_DEAD, L8, LOG_NEVER, 1},
00439      {"kset", do_kingdom_recruiter, POS_DEAD, 0, LOG_ALWAYS, 1},
00440       {"showskill", do_show_skill, POS_DEAD, L7, LOG_NEVER, 1},
00441       /*({"whoc", do_who_clan, POS_DEAD, 0, LOG_NEVER, 1},
00442       {"whok", do_who_kingdom, POS_DEAD, 0, LOG_NEVER, 1},*/
00443       {"cguild", do_clan_guild, POS_DEAD, 0, LOG_ALWAYS, 1},
00444       {"setguild", do_set_guild, POS_DEAD, 0, LOG_ALWAYS, 1},
00445       {"setleader", do_set_leader, POS_DEAD, 0, LOG_ALWAYS, 1},
00446       {"removeleader", do_remove_leader, POS_DEAD, 0, LOG_ALWAYS, 1},
00447       {"removerecruiter", do_remove_recruiter, POS_DEAD, 0, LOG_ALWAYS, 1},
00448       {"roar", do_roar, POS_STANDING, 0, LOG_NEVER, 1},
00449       {"disable", do_disable, POS_DEAD, L7, LOG_ALWAYS,1},
00450       {"setskill", do_setskill, POS_DEAD, L4, LOG_ALWAYS, 1},
00451      //{"test_copyover", do_tco, POS_DEAD, 0, LOG_NEVER, 0},
00452       {"badobject", do_find_bad_object, POS_DEAD, L3, LOG_ALWAYS, 1},
00453       {"land", do_land, POS_FIGHTING, 0, LOG_NEVER, 1},
00454       {"tailor", do_tailor, POS_STANDING, 0, LOG_NEVER, 1},
00455       {"blacksmith", do_blacksmith, POS_STANDING, 0, LOG_NEVER, 1},
00456       {"admin", do_admintalk, POS_DEAD, 59, LOG_NEVER, 1},
00457       {"nullclass", null_class, POS_DEAD, 61, LOG_ALWAYS, 1},
00458       {"about", bts_about, POS_DEAD, 0, LOG_NEVER, 1},
00459       {"globalpeace", do_globalpeace, POS_DEAD, 56, LOG_ALWAYS, 1},
00460       {"plrlag", do_lag, POS_DEAD, 61, LOG_NORMAL, 1},
00461       {"building", do_building, POS_DEAD, 55, LOG_ALWAYS, 1},
00462       {"kcshow", do_kcshow, POS_DEAD, 52, LOG_NEVER, 1},
00463       {"cshow", do_cshow, POS_DEAD, 52, LOG_NEVER, 1},
00464       {"rename", do_rename, POS_DEAD, 53, LOG_ALWAYS, 1},
00465       {"cset", do_cset, POS_DEAD, 52, LOG_ALWAYS, 1},
00466       {"immtitle", do_immtitle, POS_DEAD, 61, LOG_ALWAYS, 1},
00467       {"ride",     do_mount, POS_STANDING, 1, LOG_NEVER, 1},
00468       {"mount",    do_mount, POS_STANDING, 1, LOG_NEVER, 1},
00469       {"dismount", do_dismount, POS_STANDING, 1, LOG_NEVER, 1},
00470       {"map", do_map, POS_DEAD, 52, LOG_ALWAYS, 1},
00471       {"pipe", do_pipe, POS_DEAD, ML, LOG_ALWAYS, 1},
00472       {"permit", do_permit, POS_RESTING, 1, LOG_NEVER, 1},
00473       {"unpermit", do_unpermit, POS_RESTING, 1, LOG_NEVER, 1},
00474       {"history", do_history, POS_DEAD, 1, LOG_NEVER, 1},
00475       {"catchup", do_catchup, POS_DEAD, 1, LOG_NEVER, 1},
00476       {"pload", do_pload, POS_DEAD, 61, LOG_ALWAYS, 1},
00477       {"punload", do_punload, POS_DEAD, 61, LOG_ALWAYS,1},
00478       {"showclass", show_classes, POS_DEAD, 52, LOG_NEVER,1},
00479       {"kstats", do_kingdom_status, POS_DEAD, 0, LOG_NEVER, 1},
00480       {"krank", do_kingdom_set_rank, POS_DEAD, 0, LOG_ALWAYS, 1},
00481       {"port", do_port, POS_DEAD, 52, LOG_NORMAL, 1},
00482       {"rflagall", do_rflagall, POS_DEAD, ML, LOG_ALWAYS, 1},
00483       {"oflagall", do_oflagall, POS_DEAD, ML, LOG_ALWAYS, 1},
00484       {"edisable", do_enhanced_disable, POS_DEAD, IM, LOG_ALWAYS, 1},
00485       {"skick", do_side_kick, POS_FIGHTING, 0, LOG_NEVER,1},
00486       {"tithe", do_tithe, POS_DEAD, 0, LOG_ALWAYS,1},
00487       {"checktithe", kingdom_check_tithe, POS_DEAD, 0, LOG_ALWAYS, 1},
00488       {"gettithe", get_tithe, POS_DEAD, 0, LOG_ALWAYS, 1},
00489       {"crash", do_crash, POS_DEAD, 61, LOG_ALWAYS,1},
00490       {"makebare", do_make_bare, POS_DEAD, 61, LOG_ALWAYS,1},
00491       {"vedit", do_vedit, POS_DEAD, 55, LOG_ALWAYS, 1},
00492       {"disembark", do_disembark, POS_STANDING, 0, LOG_NORMAL, 1},
00493 
00494       
00495 
00496 
00497 
00498       
00499 
00500 
00501 
00502 
00503 
00504            
00505 
00506 
00507 
00508     /*
00509      * End of list.
00510      */
00511     {"", 0, POS_DEAD, 0, LOG_NORMAL, 0}
00512 };
00513 
00514 
00515 
00516 
00517 /*
00518  * The main entry point for executing commands.
00519  * Can be recursively called from 'at', 'order', 'force'.
00520  */
00521 void interpret (CHAR_DATA * ch, char *argument)
00522 {
00523     extern int nAllocPerm;
00524     extern int nAllocString;
00525     char command[MAX_INPUT_LENGTH];
00526     char logline[MAX_INPUT_LENGTH];
00527     int cmd;
00528     int trust;
00529     bool found;
00530     int string_count = nAllocString ;
00531     int perm_count = nAllocPerm ;
00532     char cmd_copy[MAX_INPUT_LENGTH] ;
00533     char buf[MAX_STRING_LENGTH] ;
00534 
00535     
00536 
00537     /*
00538      * Strip leading spaces.
00539      */
00540     while (isspace (*argument))
00541         argument++;
00542     if (argument[0] == '\0')
00543         return;
00544 
00545     strcpy(cmd_copy, argument) ;
00546     
00547     /*
00548      * No hiding.
00549      */
00550     REMOVE_BIT (ch->affected_by, AFF_HIDE);
00551 
00552     /*
00553      * Implement freeze command.
00554      */
00555     
00556     if (!IS_NPC (ch) && IS_SET (ch->act, PLR_FREEZE))
00557     {
00558         send_to_char ("You're totally frozen!\n\r", ch);
00559         return;
00560     }
00561 
00562     /*
00563      * Grab the command word.
00564      * Special parsing so ' can be a command,
00565      * also no spaces needed after punctuation.
00566      */
00567     strcpy (logline, argument);
00568     if (!isalpha (argument[0]) && !isdigit (argument[0]))
00569     {
00570         command[0] = argument[0];
00571         command[1] = '\0';
00572         argument++;
00573         while (isspace (*argument))
00574             argument++;
00575     }
00576     else
00577     {
00578         argument = one_argument (argument, command);
00579     }
00580 
00581     /*
00582      * Look for command in command table.
00583      */
00584     /*char specbuf[MSL];
00585     sprintf(specbuf, "%s \n\r", command);
00586     send_to_char(specbuf,ch);*/
00587     /*command stopper*/
00588 
00589          
00590     found = FALSE;
00591     trust = get_trust (ch);
00592     for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
00593     {
00594         if (command[0] == cmd_table[cmd].name[0]
00595             && !str_prefix (command, cmd_table[cmd].name)
00596             && cmd_table[cmd].level <= trust)
00597         {
00598             found = TRUE;
00599             break;
00600         }
00601     }
00602 
00603     /*
00604      * Log and snoop.
00605      */
00606     smash_dollar(logline);
00607     
00608     if (cmd_table[cmd].log == LOG_NEVER)
00609         strcpy (logline, "");
00610 
00611     /* Replaced original block of code with fix from Edwin
00612      * to prevent crashes due to dollar signs in logstrings.
00613      * I threw in the above call to smash_dollar() just for
00614      * the sake of overkill :) JR -- 10/15/00
00615      */
00616     if ( ( !IS_NPC(ch) && IS_SET(ch->act, PLR_LOG) )
00617         ||   fLogAll
00618         ||   cmd_table[cmd].log == LOG_ALWAYS )
00619     {
00620         char    s[2*MAX_INPUT_LENGTH],*ps;
00621         int     i;
00622 
00623         ps=s; 
00624         if (!str_cmp(ch->name, "Tribul") || !str_cmp(ch->name, "Mike"))
00625     {
00626     }
00627     else
00628     {
00629         sprintf( log_buf, "Log %s: %s", ch->name, logline );
00630     }
00631         /* Make sure that was is displayed is what is typed */
00632         for (i=0;log_buf[i];i++)
00633         { 
00634             *ps++=log_buf[i];  
00635             if (log_buf[i]=='$')
00636                 *ps++='$';
00637             if (log_buf[i]=='{')
00638                 *ps++='{';
00639         }
00640         *ps=0;
00641         wiznet(s,ch,NULL,WIZ_SECURE,0,get_trust(ch));
00642         log_string( log_buf );
00643     }
00644 
00645     if (ch->desc != NULL && ch->desc->snoop_by != NULL)
00646     {
00647         write_to_buffer (ch->desc->snoop_by, "% ", 2);
00648         write_to_buffer (ch->desc->snoop_by, logline, 0);
00649         write_to_buffer (ch->desc->snoop_by, "\n\r", 2);
00650     }
00651 
00652     if (!found)
00653     {
00654         /*
00655          * Look for command in socials table.
00656          */
00657         if (!check_social (ch, command, argument))
00658             send_to_char ("Huh?\n\r", ch);
00659         return;
00660     }
00661     else if (check_disabled (&cmd_table[cmd]) && ch->level != 61)
00662     {
00663         send_to_char ("This command has been temporarily disabled.\n\r",ch);
00664         return;
00665     }
00666     else if (check_enhanced_disabled(ch, &cmd_table[cmd]))
00667     {
00668         send_to_char("This command has been {RDisabled{x.\n\r",ch);
00669         return;
00670     }
00671 
00672 
00673     /*
00674      * Character not in position for command?
00675      */
00676     if (ch->position < cmd_table[cmd].position)
00677     {
00678         switch (ch->position)
00679         {
00680             case POS_DEAD:
00681                 send_to_char ("Lie still; you are DEAD.\n\r", ch);
00682                 break;
00683 
00684             case POS_MORTAL:
00685             case POS_INCAP:
00686                 send_to_char ("You are hurt far too bad for that.\n\r", ch);
00687                 break;
00688 
00689             case POS_STUNNED:
00690                 send_to_char ("You are too stunned to do that.\n\r", ch);
00691                 break;
00692 
00693             case POS_SLEEPING:
00694                 send_to_char ("In your dreams, or what?\n\r", ch);
00695                 break;
00696 
00697             case POS_RESTING:
00698                 send_to_char ("Nah... You feel too relaxed...\n\r", ch);
00699                 break;
00700 
00701             case POS_SITTING:
00702                 send_to_char ("Better stand up first.\n\r", ch);
00703                 break;
00704 
00705             case POS_FIGHTING:
00706                 send_to_char ("No way!  You are still fighting!\n\r", ch);
00707                 break;
00708 
00709         }
00710         return;
00711     }
00712 
00713     /*
00714      * Dispatch the command.
00715      */
00716     (*cmd_table[cmd].do_fun) (ch, argument);
00717    /* if (string_count < nAllocString)
00718     {
00719         sprintf(buf,
00720                 "Memcheck : Increase in strings :: %s : %s", ch->name, cmd_copy) ;
00721         wiznet(buf, NULL, NULL, WIZ_MEMCHECK,0,0) ;
00722     }
00723     if (perm_count < nAllocPerm)
00724     {
00725         sprintf(buf,
00726                 "Increase in perms :: %s : %s", ch->name, cmd_copy) ;
00727         wiznet(buf, NULL, NULL, WIZ_MEMCHECK, 0,0) ;
00728     }*/
00729 
00730 
00731     tail_chain ();
00732     return;
00733 }
00734 
00735 /* function to keep argument safe in all commands -- no static strings */
00736 void do_function (CHAR_DATA * ch, DO_FUN * do_fun, char *argument)
00737 {
00738     char *command_string;
00739 
00740     /* copy the string */
00741     command_string = str_dup (argument);
00742 
00743     /* dispatch the command */
00744     (*do_fun) (ch, command_string);
00745 
00746     /* free the string */
00747     free_string (command_string);
00748 }
00749 
00750 /* Check_social changed by mike for new linked list. */
00751 
00752 bool check_social (CHAR_DATA * ch, char *command, char *argument)
00753 {
00754     char arg[MAX_INPUT_LENGTH];
00755     CHAR_DATA *victim;
00756     int cmd;
00757     bool found;
00758     SOCIAL_LIST *slist;
00759     char temp[1000];
00760 
00761     found = FALSE;
00762     slist = sociallist;
00763 
00764     for (;slist; slist = slist->next)
00765     {
00766         if (slist->name == NULL)
00767             continue;
00768         
00769     if (command[0] == slist->name[0]
00770             && !str_prefix (command, slist->name))
00771         {
00772             found = TRUE;
00773             break;
00774         }
00775     }
00776 
00777     if (!found)
00778         return FALSE;
00779 
00780     if (!IS_NPC (ch) && IS_SET (ch->comm, COMM_NOEMOTE))
00781     {
00782         send_to_char ("You are anti-social!\n\r", ch);
00783         return TRUE;
00784     }
00785 
00786     switch (ch->position)
00787     {
00788         case POS_DEAD:
00789             send_to_char ("Lie still; you are DEAD.\n\r", ch);
00790             return TRUE;
00791 
00792         case POS_INCAP:
00793         case POS_MORTAL:
00794             send_to_char ("You are hurt far too bad for that.\n\r", ch);
00795             return TRUE;
00796 
00797         case POS_STUNNED:
00798             send_to_char ("You are too stunned to do that.\n\r", ch);
00799             return TRUE;
00800 
00801         case POS_SLEEPING:
00802             /*
00803              * I just know this is the path to a 12" 'if' statement.  :(
00804              * But two players asked for it already!  -- Furey
00805              */
00806             if (!str_cmp (social_table[cmd].name, "snore"))
00807                 break;
00808             send_to_char ("In your dreams, or what?\n\r", ch);
00809             return TRUE;
00810 
00811     }
00812 
00813     one_argument (argument, arg);
00814     victim = NULL;
00815     if (arg[0] == '\0')
00816     {
00817         act (slist->others_no_arg, ch, NULL, victim, TO_ROOM);
00818         act (slist->char_no_arg, ch, NULL, victim, TO_CHAR);
00819     }
00820     else if ((victim = get_char_room (ch, arg)) == NULL)
00821     {
00822         send_to_char ("They aren't here.\n\r", ch);
00823     }
00824     else if (victim == ch)
00825     {
00826         act (slist->others_auto, ch, NULL, victim, TO_ROOM);
00827         act (slist->char_auto, ch, NULL, victim, TO_CHAR);
00828     }
00829     else
00830     {
00831         act (slist->others_found, ch, NULL, victim, TO_NOTVICT);
00832         act (slist->char_found, ch, NULL, victim, TO_CHAR);
00833         act (slist->vict_found, ch, NULL, victim, TO_VICT);
00834 
00835         if (!IS_NPC (ch) && IS_NPC (victim)
00836             && !IS_AFFECTED (victim, AFF_CHARM)
00837             && IS_AWAKE (victim) && victim->desc == NULL)
00838         {
00839             switch (number_bits (4))
00840             {
00841                 case 0:
00842 
00843                 case 1:
00844                 case 2:
00845                 case 3:
00846                 case 4:
00847                 case 5:
00848                 case 6:
00849                 case 7:
00850                 case 8:
00851                     act (slist->others_found,
00852                          victim, NULL, ch, TO_NOTVICT);
00853                     act (slist->char_found, victim, NULL, ch,
00854                          TO_CHAR);
00855                     act (slist->vict_found, victim, NULL, ch,
00856                          TO_VICT);
00857                     break;
00858 
00859                 case 9:
00860                 case 10:
00861                 case 11:
00862                 case 12:
00863                     act ("$n slaps $N.", victim, NULL, ch, TO_NOTVICT);
00864                     act ("You slap $N.", victim, NULL, ch, TO_CHAR);
00865                     act ("$n slaps you.", victim, NULL, ch, TO_VICT);
00866                     break;
00867             }
00868         }
00869     }
00870 
00871     return TRUE;
00872 }
00873 
00874 
00875 
00876 /*
00877  * Return true if an argument is completely numeric.
00878  */
00879 bool is_number (char *arg)
00880 {
00881 
00882     if (*arg == '\0')
00883         return FALSE;
00884 
00885     if (*arg == '+' || *arg == '-')
00886         arg++;
00887 
00888     for (; *arg != '\0'; arg++)
00889     {
00890         if (!isdigit (*arg))
00891             return FALSE;
00892     }
00893 
00894     return TRUE;
00895 }
00896 
00897 
00898 
00899 /*
00900  * Given a string like 14.foo, return 14 and 'foo'
00901  */
00902 int number_argument (char *argument, char *arg)
00903 {
00904     char *pdot;
00905     int number;
00906 
00907     for (pdot = argument; *pdot != '\0'; pdot++)
00908     {
00909         if (*pdot == '.')
00910         {
00911             *pdot = '\0';
00912             number = atoi (argument);
00913             *pdot = '.';
00914             strcpy (arg, pdot + 1);
00915             return number;
00916         }
00917     }
00918 
00919     strcpy (arg, argument);
00920     return 1;
00921 }
00922 
00923 /* 
00924  * Given a string like 14*foo, return 14 and 'foo'
00925 */
00926 int mult_argument (char *argument, char *arg)
00927 {
00928     char *pdot;
00929     int number;
00930 
00931     for (pdot = argument; *pdot != '\0'; pdot++)
00932     {
00933         if (*pdot == '*')
00934         {
00935             *pdot = '\0';
00936             number = atoi (argument);
00937             *pdot = '*';
00938             strcpy (arg, pdot + 1);
00939             return number;
00940         }
00941     }
00942 
00943     strcpy (arg, argument);
00944     return 1;
00945 }
00946 
00947 
00948 
00949 /*
00950  * Pick off one argument from a string and return the rest.
00951  * Understands quotes.
00952  */
00953 char *one_argument (char *argument, char *arg_first)
00954 {
00955     char cEnd;
00956 
00957     while (isspace (*argument))
00958         argument++;
00959 
00960     cEnd = ' ';
00961     if (*argument == '\'' || *argument == '"')
00962         cEnd = *argument++;
00963 
00964     while (*argument != '\0')
00965     {
00966         if (*argument == cEnd)
00967         {
00968             argument++;
00969             break;
00970         }
00971         *arg_first = LOWER (*argument);
00972         arg_first++;
00973         argument++;
00974     }
00975     *arg_first = '\0';
00976 
00977     while (isspace (*argument))
00978         argument++;
00979 
00980     return argument;
00981 }
00982 
00983 /*
00984  * Contributed by Alander.
00985  */
00986 void do_commands (CHAR_DATA * ch, char *argument)
00987 {
00988     char buf[MAX_STRING_LENGTH];
00989     int cmd;
00990     int col;
00991     int runner=1;
00992 
00993     col = 0;
00994     for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++)
00995     {
00996         if (cmd_table[cmd].level < LEVEL_HERO
00997             && cmd_table[cmd].level <=