Example #1
0
/** Can someone pay for something (in cash and quota)?
 * Does who have enough pennies to pay for something, and if something
 * is being built, does who have enough quota? Wizards, roys
 * aren't subject to either. This function not only checks that they
 * can afford it, but actually charges them.
 * \param who player attempting to pay.
 * \param pennies cost in pennies.
 * \retval 1 who can pay.
 * \retval 0 who can't pay.
 */
int
can_pay_fees(dbref who, int pennies)
{

  if (Guest(who)) {
    notify(who, T("Sorry, you aren't allowed to build."));
    return 0;
  }

  /* check database size -- EVERYONE is subject to this! */
  if (DBTOP_MAX && (db_top >= DBTOP_MAX + 1) && (first_free == NOTHING)) {
    notify(who, T("Sorry, there is no more room in the database."));
    return 0;
  }
  /* Can they afford it? */
  if (!NoPay(who) && (Pennies(Owner(who)) < pennies)) {
    notify_format(who, T("Sorry, you don't have enough %s."), MONIES);
    return 0;
  }
  /* check building quota */
  if (!pay_quota(who, QUOTA_COST)) {
    notify(who, T("Sorry, your building quota has run out."));
    return 0;
  }

  /* charge */
  payfor(who, pennies);

  return 1;
}
Example #2
0
void
do_gripe(dbref player, const char *message)
{
    dbref loc;
    char buf[BUFFER_LEN];

    if (Guest(player)) {
        anotify_fmt(player, CFAIL "%s", tp_noguest_mesg);
        return;
    }

    if (!message || !*message) {
        if (Wiz(player)) {
            spit_file(player, LOG_GRIPE);
        } else {
            anotify_nolisten2(player, CINFO "What's wrong?");
        }
        return;
    }

    loc = DBFETCH(player)->location;
    log_gripe("%s(%d) in %s(%d): %s\n",
              NAME(player), player, NAME(loc), loc, message);

    anotify_nolisten2(player, CINFO "Your complaint has been filed.");

    sprintf(buf, MARK "Gripe from %s: %s", NAME(player), message);
    wall_wizards(buf);
}
Example #3
0
/* doesn't really belong here, but I couldn't figure out where else */
void 
do_page(dbref player, const char *arg1, const char *arg2)
{
    int     ignored;
    char    buf[BUFFER_LEN], buf2[BUFFER_LEN];
    dbref   target;

    if (!payfor(player, tp_lookup_cost)) {
	anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies);
	return;
    }
    if ( strcmp(arg1, "me") ) {
	if ((target = lookup_player(arg1)) == NOTHING) {
	    anotify(player, CINFO WHO_MESG);
	    return;
	}
    } else target = player;

    if(Guest(player)) {
	if(!Mage(target)) {
	    anotify(player, CINFO "Guests can only page " NAMEWIZ "s, type 'wizzes'.");
	    return;
	}
    }

    if (FLAGS(target) & HAVEN) {
	anotify(player, CFAIL "That player is haven.");
	return;
    }

    ignored = ignoring(target, player);
    if(ignored == 1) {
	anotify(player, CFAIL "That player is ignoring you.");
	return;
    } else if(ignored == 2) {
	anotify(player, CINFO "That player is ignoring you.");
    }

    do_parse_mesg(player, player, arg2, "(page)", buf, MPI_ISPRIVATE);
    tct(buf,buf2);

    if (!*buf2) {
	sprintf(buf, CGREEN "You sense that %s is looking for you in %s.",
			PNAME(player), NAME(DBFETCH(player)->location));
    } else {
	if(buf2[0] == ':' || buf2[0] == ';') {
	    sprintf(buf, CGREEN "%s pages \"" CYELLOW "%s %.3900s" CGREEN "\"",
			PNAME(player), PNAME(player), buf2);
	} else {
	    sprintf(buf, CGREEN "%s pages \"" CYELLOW "%.3900s" CGREEN "\"",
			PNAME(player), buf2);
	}
    }
    if (anotify_from(player, target, buf))
	anotify(player, CSUCC "Your message has been sent.");
    else {
	sprintf(buf, CINFO "%s is not connected.", PNAME(target));
	anotify(player, buf);
    }
}
Example #4
0
/* doesn't really belong here, but I couldn't figure out where else */
void
do_page(int descr, dbref player, const char *arg1, const char *arg2)
{
    char buf[BUFFER_LEN], buf2[BUFFER_LEN];
    dbref target;

    if (!payfor(player, tp_lookup_cost)) {
        anotify_fmt(player, CFAIL "You don't have enough %s.", tp_pennies);
        return;
    }
    if (strcmp(arg1, "me")) {
        if ((target = lookup_player(arg1)) == NOTHING) {
            anotify_nolisten2(player, CINFO "Who?");
            return;
        }
    } else
        target = player;

    if (Guest(player)) {
        if (!Mage(target)) {
            anotify_nolisten2(player,
                              CINFO
                              "Guests can only page wizards, type 'wizzes'.");
            return;
        }
    }

    if (FLAGS(target) & HAVEN) {
        anotify_nolisten2(player, CFAIL "That player is haven.");
        return;
    }
    if (Meeper(OWNER(player))) {
        do_parse_mesg(descr, player, player, arg2, "(page)", buf,
                      MPI_ISPRIVATE);
        tct(buf, buf2);
    } else {
        tct(arg2, buf2);
    }

    if (!*buf2) {
        sprintf(buf, CSUCC "You sense that %s is looking for you in %s.",
                PNAME(player), NAME(DBFETCH(player)->location));
    } else {
        if (buf2[0] == ':' || buf2[0] == ';') {
            sprintf(buf, SYSGREEN "%s pages \"" SYSYELLOW "%s %s" SYSGREEN "\"",
                    PNAME(player), PNAME(player), buf2);
        } else {
            sprintf(buf, SYSGREEN "%s pages \"" SYSYELLOW "%s" SYSGREEN "\"",
                    PNAME(player), buf2);
        }
    }
    if (anotify_from(player, target, buf))
        anotify_nolisten2(player, CSUCC "Your message has been sent.");
    else {
        sprintf(buf, CSUCC "%s is not connected.", PNAME(target));
        anotify_nolisten2(player, buf);
    }
}
	/**
	 * Generates the Person base object and the Guest object
	 * @return   Guest   The randomly generated Guest object
	 */
	Guest GuestGenerator::generateGuest()
	{
		// Use the person generator to make a person
		Person person = personGen.generatePerson();
		int height = (rand() % 40) + 160; // Generate random height
		int weight = (rand() % 40) + 80; // Generate random weight
		// Create a guest using the random person object, height and weight
		return Guest(person, height, weight);
	}
Example #6
0
void destroy_guest(dbref guest)
{
	if(!Wizard(mudconf.guest_nuker) || !Good_obj(mudconf.guest_nuker))
		mudconf.guest_nuker = 1;

	if(!Guest(guest))
		return;

	toast_player(guest);
	atr_add_raw(guest, A_DESTROYER, tprintf("%d", mudconf.guest_nuker));
	destroy_player(guest);
	destroy_obj(mudconf.guest_nuker, guest);
}
Example #7
0
/** Can a player control a thing?
 * The control rules are, in order:
 *   Only God controls God.
 *   Wizards control everything else.
 *   Nothing else controls a wizard, and only royalty control royalty.
 *   Mistrusted objects control only themselves.
 *   Objects with the same owner control each other, unless the
 *     target object is TRUST and the would-be controller isn't.
 *   If ZMOs allow control, and you pass the ZMO, you control.
 *   If the owner is a Zone Master, and you pass the ZM, you control.
 *   If you pass the control lock, you control.
 *   Otherwise, no dice.
 * \param who object attempting to control.
 * \param what object to be controlled.
 * \retval 1 who controls what.
 * \retval 0 who doesn't control what.
 */
int
controls(dbref who, dbref what)
{
  boolexp c;

  if (!GoodObject(what))
    return 0;

  if (Guest(who))
    return 0;

  if (what == who)
    return 1;

  if (God(what))
    return 0;

  if (Wizard(who))
    return 1;

  if (Wizard(what) || (Hasprivs(what) && !Hasprivs(who)))
    return 0;

  if (Mistrust(who))
    return 0;

  if (Owns(who, what) && (!Inheritable(what) || Inheritable(who)))
    return 1;

  if (Inheritable(what) || IsPlayer(what))
    return 0;

  if (!ZONE_CONTROL_ZMP && (Zone(what) != NOTHING) &&
      eval_lock(who, Zone(what), Zone_Lock))
    return 1;

  if (ZMaster(Owner(what)) && !IsPlayer(what) &&
      eval_lock(who, Owner(what), Zone_Lock))
    return 1;

  c = getlock_noparent(what, Control_Lock);
  if (c != TRUE_BOOLEXP) {
    if (eval_boolexp(who, c, what, NULL))
      return 1;
  }
  return 0;
}
Example #8
0
void do_give(dbref player, dbref cause, int key, char *who, char *amnt)
{
  dbref	recipient;

	/* check recipient */

	init_match(player, who, TYPE_PLAYER);
	match_neighbor();
	match_possession();
	match_me();
	if (Privilaged(player) || HasPriv(player,NOTHING,POWER_LONG_FINGERS,POWER3,NOTHING)) {
		match_player();
		match_absolute();
	}

	recipient = match_result();
	switch (recipient) {
	case NOTHING:
		notify(player, "Give to whom?");
		return;
	case AMBIGUOUS:
		notify(player, "I don't know who you mean!");
		return;
	}

	if (DePriv(player,recipient,DP_GIVE,POWER7,POWER_LEVEL_SPC)) {
		notify(player, "Permission denied.");
		return;
	}
	if (DePriv(recipient,player,DP_RECEIVE,POWER7,POWER_LEVEL_SPC)) {
		notify(player, "Permission denied.");
		return;
	}
	if (is_number(amnt)) {
		give_money(player, recipient, key, atoi(amnt));
	} else if(Guest(recipient)) {
		notify(player, "Guest really doesn't need money or anything.");
		return;
	} else {
            if ( Typeof(player) != TYPE_ROOM )
		give_thing(player, recipient, key, amnt);
            else
                notify(player, "Command incompatible with invoker type.");
	}
}
Example #9
0
void
do_password(dbref player, const char *old, const char *newobj)
{

    if (Guest(player)) {
        anotify_fmt(player, CFAIL "%s", tp_noguest_mesg);
        return;
    }

    if (!check_password(player, old)) {
        anotify_nolisten2(player,
                          CFAIL "Syntax: @password <oldpass>=<newpass>");
    } else if (!ok_password(newobj)) {
        anotify_nolisten2(player, CFAIL "Bad new password.");
    } else {
        set_password(player, newobj);
        anotify_nolisten2(player, CFAIL "Password changed.");
    }
}
Example #10
0
/** Processing related to players' last connections.
 * Here we check to see if a player gets a paycheck, tell them their
 * last connection site, and update all their LAST* attributes.
 * \param player dbref of player.
 * \param host hostname of player's current connection.
 * \param ip ip address of player's current connection.
 */
void
check_last(dbref player, const char *host, const char *ip)
{
  char *s;
  ATTR *a;
  ATTR *h;
  char last_time[MAX_COMMAND_LEN / 8];
  char last_place[MAX_COMMAND_LEN];

  /* compare to last connect see if player gets salary */
  s = show_time(mudtime, 0);
  a = atr_get_noparent(player, "LAST");
  if (a && (strncmp(atr_value(a), s, 10) != 0))
    giveto(player, Paycheck(player));
  /* tell the player where he last connected from */
  if (!Guest(player)) {
    h = atr_get_noparent(player, "LASTSITE");
    if (h && a) {
      strcpy(last_place, atr_value(h));
      strcpy(last_time, atr_value(a));
      notify_format(player, T("Last connect was from %s on %s."), last_place,
                    last_time);
    }
    /* How about last failed connection */
    h = atr_get_noparent(player, "LASTFAILED");
    if (h && a) {
      strcpy(last_place, atr_value(h));
      if (strlen(last_place) > 2)
        notify_format(player, T("Last FAILED connect was from %s."),
                      last_place);
    }
  }
  /* if there is no Lastsite, then the player is newly created.
   * the extra variables are a kludge to work around some weird
   * behavior involving uncompress.
   */

  /* set the new attributes */
  (void) atr_add(player, "LAST", s, GOD, 0);
  (void) atr_add(player, "LASTSITE", host, GOD, 0);
  (void) atr_add(player, "LASTIP", ip, GOD, 0);
  (void) atr_add(player, "LASTFAILED", " ", GOD, 0);
}
Example #11
0
void
do_password(dbref player, const char *old, const char *newobj)
{
    if(Guest(player)) {
        anotify(player, CFAIL NOGUEST_MESG);
        return;
    }

    if ((!DBFETCH(player)->sp.player.password) ||
            (!*DBFETCH(player)->sp.player.password) ||
            strcmp(old, DBFETCH(player)->sp.player.password)
       ) {
        anotify(player, CFAIL "Sorry.");
    } else if (!ok_password(newobj)) {
        anotify(player, CFAIL "Bad new password.");
    } else {
        free((void *) DBFETCH(player)->sp.player.password);
        DBSTORE(player, sp.player.password, alloc_string(newobj));
        ts_modifyobject(player);
        remove_property(player, PROP_PW);
        anotify(player, CSUCC "Password changed.");
    }
}
Example #12
0
void
do_whisper(int descr, dbref player, const char *arg1, const char *arg2)
{
    dbref who;
    char buf[BUFFER_LEN], buf2[BUFFER_LEN];
    struct match_data md;

    if (Guest(player)) {
        anotify_fmt(player, CFAIL "%s", tp_noguest_mesg);
        return;
    }

    init_match(descr, player, arg1, TYPE_PLAYER, &md);
    match_neighbor(&md);
    match_me(&md);
    if (Mage(player) && Typeof(player) == TYPE_PLAYER) {
        match_absolute(&md);
        match_player(&md);
    }
    switch (who = match_result(&md)) {
        case NOTHING:
            anotify_nolisten2(player, CINFO "Who?");
            break;
        case AMBIGUOUS:
            anotify_nolisten2(player, CINFO "I don't know who you mean!");
            break;
        default:
            if (Meeper(OWNER(player))) {
                do_parse_mesg(descr, player, player, arg2, "(whisper)", buf,
                              MPI_ISPRIVATE);
                tct(buf, buf2);
            } else {
                tct(arg2, buf2);
            }

            if (buf2[0] == ':' || buf2[0] == ';') {
                sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s %s"
                        SYSBLUE "\"", PNAME(player), PNAME(player), buf2 + 1);
                if (!anotify_from(player, who, buf)) {
                    sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who));
                    anotify_nolisten2(player, buf);
                    break;
                }
                sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s %s"
                        SYSBLUE "\" to %s.", PNAME(player), buf2 + 1,
                        PNAME(who));
                anotify(player, buf);
                break;
            } else {
                sprintf(buf, SYSBLUE "%s whispers, \"" SYSPURPLE "%s" SYSBLUE
                        "\"", PNAME(player), buf2);
                if (!anotify_from(player, who, buf)) {
                    sprintf(buf, SYSBLUE "%s is not connected.", PNAME(who));
                    anotify_nolisten2(player, buf);
                    break;
                }
                sprintf(buf, SYSBLUE "You whisper, \"" SYSPURPLE "%s" SYSBLUE
                        "\" to %s.", buf2, PNAME(who));
                anotify(player, buf);
                break;
            }
    }
}
Example #13
0
Game::Game(const vector<string>& names)
{
	for(int i=0; i<names.size(); i++)
		guestPlayer.push_back(Guest(names[i]));	
}
Example #14
0
/** Check to see if someone can connect to a player.
 * \param d DESC the connect attempt is being made for
 * \param name name of player to connect to.
 * \param password password of player to connect to.
 * \param host host from which connection is being attempted.
 * \param ip ip address from which connection is being attempted.
 * \param errbuf buffer to return connection errors.
 * \return dbref of connected player object or NOTHING for failure
 * (with reason for failure returned in errbuf).
 */
dbref
connect_player(DESC *d, const char *name, const char *password,
               const char *host, const char *ip, char *errbuf)
{
  dbref player;
  int count;

  /* Default error */
  strcpy(errbuf,
         T("Either that player does not exist, or has a different password."));

  if (!name || !*name)
    return NOTHING;

  /* validate name */
  if ((player = lookup_player(name)) == NOTHING) {
    /* Invalid player names are failures, too. */
    count = mark_failed(ip);
    strcpy(errbuf, T("There is no player with that name."));
    queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d,%s",
                d->descriptor, ip, count, "invalid player", -1, name);
    return NOTHING;
  }

  /* See if player is allowed to connect like this */
  if (Going(player) || Going_Twice(player)) {
    do_log(LT_CONN, 0, 0,
           "Connection to GOING player %s not allowed from %s (%s)",
           Name(player), host, ip);
    queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d", d->descriptor,
                ip, count_failed(ip), "player is going", player);
    strcpy(errbuf, T("You cannot connect to that player at this time."));
    return NOTHING;
  }
  /* Check sitelock patterns */
  if (Guest(player) &&
      (!Site_Can_Guest(host, player) || !Site_Can_Guest(ip, player))) {
    if (!Deny_Silent_Site(host, AMBIGUOUS) &&
        !Deny_Silent_Site(ip, AMBIGUOUS)) {
      do_log(LT_CONN, 0, 0, "Connection to %s (GUEST) not allowed from %s (%s)",
             name, host, ip);
      strcpy(errbuf, T("Guest connections not allowed."));
      count = mark_failed(ip);
      queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d",
                  d->descriptor, ip, count, "failed sitelock", player);
    }
    return NOTHING;
  } else if (!Guest(player) && (!Site_Can_Connect(host, player) ||
                                !Site_Can_Connect(ip, player))) {
    if (!Deny_Silent_Site(host, player) && !Deny_Silent_Site(ip, player)) {
      do_log(LT_CONN, 0, 0,
             "Connection to %s (Non-GUEST) not allowed from %s (%s)", name,
             host, ip);
      strcpy(errbuf, T("Player connections not allowed."));
      count = mark_failed(ip);
      queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d",
                  d->descriptor, ip, count, "failed sitelock", player);
    }
    return NOTHING;
  }
  /* validate password */
  if (!Guest(player))
    if (!password_check(player, password)) {
      /* Increment count of login failures */
      ModTime(player)++;
      check_lastfailed(player, host);
      count = mark_failed(ip);
      queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d",
                  d->descriptor, ip, count, "invalid password", player);
      strcpy(errbuf, T("That is not the correct password."));
      return NOTHING;
    }

  /* If it's a Guest player, and already connected, search the
   * db for another Guest player to connect them to. */
  if (Guest(player)) {
    /* Enforce guest limit */
    player = guest_to_connect(player);
    if (!GoodObject(player)) {
      do_log(LT_CONN, 0, 0, "Can't connect to a guest (too many connected)");
      strcpy(errbuf, T("Too many guests are connected now."));
      queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d",
                  d->descriptor, ip, count_failed(ip), "too many guests",
                  player);
      return NOTHING;
    }
  }
  if (Suspect_Site(host, player) || Suspect_Site(ip, player)) {
    do_log(LT_CONN, 0, 0,
           "Connection from Suspect site. Setting %s(#%d) suspect.",
           Name(player), player);
    set_flag_internal(player, "SUSPECT");
  }
  return player;
}
Example #15
0
void 
do_whisper(dbref player, const char *arg1, const char *arg2)
{
    int     ignored;
    dbref   who;
    char    buf[BUFFER_LEN], buf2[BUFFER_LEN];
    struct match_data md;

    if(Guest(player)) {
	anotify(player, CFAIL NOGUEST_MESG);
	return;
    }

    init_match(player, arg1, TYPE_PLAYER, &md);
    match_neighbor(&md);
    match_me(&md);
    if (Mage(player) && Typeof(player) == TYPE_PLAYER) {
	match_absolute(&md);
	match_player(&md);
    }
    switch (who = match_result(&md)) {
	case NOTHING:
	case AMBIGUOUS:
	    anotify(player, CINFO WHO_MESG);
	    break;
	default:

	    ignored = ignoring(who, player);
	    if(ignored == 1) {
		anotify(player, CFAIL "That player is ignoring you.");
		return;
	    } else if(ignored == 2) {
		anotify(player, CINFO "That player is ignoring you.");
	    }

	    do_parse_mesg(player, player, arg2, "(whisper)", buf, MPI_ISPRIVATE);
	    tct(buf,buf2);

	    if (buf2[0] == ':' || buf2[0] == ';') {
		sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%s %.3900s" CBLUE "\"",
					PNAME(player), PNAME(player), buf2+1);
		if (!anotify_from(player, who, buf)) {
		    sprintf(buf, CBLUE "%s is not connected.", PNAME(who));
		    anotify(player, buf);
		    break;
		}
		sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%s %.3900s" CBLUE "\" to %s.",
					 PNAME(player), buf2+1, PNAME(who));
		anotify(player, buf);
		break;
	    } else { 
		sprintf(buf, CBLUE "%s whispers, \"" CPURPLE "%.3900s" CBLUE "\"", PNAME(player), buf2);
		if (!anotify_from(player, who, buf)) {
		    sprintf(buf, CBLUE "%s is not connected.", PNAME(who));
		    anotify(player, buf);
		    break;
		}
		sprintf(buf, CBLUE "You whisper, \"" CPURPLE "%.3900s" CBLUE "\" to %s.", buf2, PNAME(who));
		anotify(player, buf);
		break;
	    }
    }
}
Example #16
0
bool
could_doit(int descr, dbref player, dbref thing)
{
    dbref source, dest, owner;

    if (Typeof(thing) == TYPE_EXIT) {
        if (DBFETCH(thing)->sp.exit.ndest == 0) {
            return 0;
        }

        owner = OWNER(thing);
        source = DBFETCH(player)->location;
        dest = *(DBFETCH(thing)->sp.exit.dest);

        if (dest == NIL)        /* unless its locked, anyone can use #-4 */
            return (eval_boolexp(descr, player, GETLOCK(thing), thing));

        if (Typeof(dest) == TYPE_PLAYER) {
            dbref destplayer = dest;

            dest = DBFETCH(dest)->location;
            if (!(FLAGS(destplayer) & JUMP_OK) || (FLAGS(dest) & BUILDER)) {
                return 0;
            }
        }
/*
    if (OkObj(thing)) if
       ( ((FLAG2(player) & F2IMMOBILE) && !(FLAG2(thing) & F2IMMOBILE)) && 
         (!(Typeof(dest) == TYPE_PROGRAM) && !(dest == NIL))
       ) {
          envpropqueue(descr, player, OkObj(player) ? getloc(player) : -1,
	              thing, thing, NOTHING, "@immobile", "Immobile", 1, 1);
    	  return 0;
         }

*/
/*        if( (dest != HOME) &&
            (Typeof(dest)==TYPE_ROOM) &&
            (FLAGS(player) & ZOMBIE) && (Typeof(player) == TYPE_THING) &&
            (FLAGS(dest) & ZOMBIE) ) 
            return 0;
 Saving this part for a revision of trigger() and this function. */
        if ((dest != HOME) && (Typeof(dest) == TYPE_ROOM) && Guest(player)
            && (tp_guest_needflag ? !(FLAG2(dest) & F2GUEST)
                : (FLAG2(dest) & F2GUEST))) {
/*	    anotify_nolisten(player, CFAIL "Guests aren't allowed there.", 1); */
            return 0;
        }

        /* for actions */
        if ((DBFETCH(thing)->location != NOTHING) &&
            (Typeof(DBFETCH(thing)->location) != TYPE_ROOM)) {

            if ((Typeof(dest) == TYPE_ROOM || Typeof(dest) == TYPE_PLAYER) &&
                (FLAGS(source) & BUILDER))
                return 0;

            if (tp_secure_teleport && Typeof(dest) == TYPE_ROOM) {
                if ((dest != HOME) && (!controls(owner, dest))
                    && ((FLAGS(dest) & JUMP_OK) == 0)) {
                    return 0;
                }
            }
        }
    }


    return (eval_boolexp(descr, player, GETLOCK(thing), thing));
}
Example #17
0
/* do_link
 *
 * Use this to link to a room that you own.  It also sets home for
 * objects and things, and drop-to's for rooms.
 * It seizes ownership of an unlinked exit, and costs 1 penny
 * plus a penny transferred to the exit owner if they aren't you
 *
 * All destinations must either be owned by you, or be LINK_OK.
 */
void
do_link(int descr, dbref player, const char *thing_name, const char *dest_name)
{
    dbref good_dest[MAX_LINKS];
    int ndest, i;
    struct match_data md;
    char buf[BUFFER_LEN];
    dbref thing, dest;

    if (tp_db_readonly) {
        anotify_nolisten2(player, CFAIL DBRO_MESG);
        return;
    }

    if (Guest(player)) {
        anotify_fmt(player, CFAIL "%s", tp_noguest_mesg);
        return;
    }

    init_match(descr, player, thing_name, TYPE_EXIT, &md);
    match_all_exits(&md);
    match_neighbor(&md);
    match_possession(&md);
    match_me(&md);
    match_here(&md);
    match_absolute(&md);
    match_registered(&md);

    if (Mage(OWNER(player)))
        match_player(&md);

    if ((thing = noisy_match_result(&md)) == NOTHING)
        return;

    switch (Typeof(thing)) {
        case TYPE_EXIT:
            /* we're ok, check the usual stuff */
            if (DBFETCH(thing)->sp.exit.ndest != 0) {
                if (controls(player, thing)) {
                    if ((DBFETCH(thing)->sp.exit.dest)[0] != NIL) {
                        anotify_nolisten2(player,
                                          CINFO "That exit is already linked.");
                        return;
                    }
                } else {
                    anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);
                    return;
                }
            }

            /* handle costs */
            if (OWNER(thing) == OWNER(player)) {
                if (!payfor(player, tp_link_cost)) {
                    anotify_fmt(player,
                                CFAIL "It costs %d %s to link this exit.",
                                tp_link_cost,
                                (tp_link_cost == 1) ? tp_penny : tp_pennies);
                    return;
                }
            } else {
                if (!payfor(player, tp_link_cost + tp_exit_cost)) {
                    anotify_fmt(player,
                                CFAIL "It costs %d %s to link this exit.",
                                (tp_link_cost + tp_exit_cost),
                                (tp_link_cost + tp_exit_cost ==
                                 1) ? tp_penny : tp_pennies);
                    return;
                } else if (!Builder(player)) {
                    anotify_nolisten2(player, CFAIL NOBBIT_MESG);
                    return;
                } else {
                    /* pay the owner for his loss */
                    dbref owner = OWNER(thing);

                    DBFETCH(owner)->sp.player.pennies += tp_exit_cost;
                    DBDIRTY(owner);
                }
            }

            /* link has been validated and paid for; do it */
            OWNER(thing) = OWNER(player);

            if (!
                (ndest =
                 link_exit(descr, player, thing, (char *) dest_name,
                           good_dest))) {
                anotify_nolisten2(player, CFAIL "No destinations linked.");
                DBFETCH(player)->sp.player.pennies += tp_link_cost; /* Refund! */
                DBDIRTY(player);
                break;
            }

            DBFETCH(thing)->sp.exit.ndest = ndest;
            if (DBFETCH(thing)->sp.exit.dest)
                free(DBFETCH(thing)->sp.exit.dest);

            DBFETCH(thing)->sp.exit.dest =
                (dbref *) malloc(sizeof(dbref) * ndest);
            for (i = 0; i < ndest; i++)
                (DBFETCH(thing)->sp.exit.dest)[i] = good_dest[i];
            break;
        case TYPE_THING:
        case TYPE_PLAYER:
            init_match(descr, player, dest_name, TYPE_ROOM, &md);
            match_neighbor(&md);
            match_absolute(&md);
            match_registered(&md);
            match_me(&md);
            match_here(&md);
            match_null(&md);

            if (Typeof(thing) == TYPE_THING)
                match_possession(&md);
            if ((dest = noisy_match_result(&md)) == NOTHING)
                return;
	    if (Typeof(thing) == TYPE_THING && dest == NIL) {
                anotify_fmt(player, CFAIL "%s", "You cannot HOME a THING to NIL.");
                return;		
	    }
            if (!controls(player, thing)
                || !can_link_to(player, Typeof(thing), dest)) {
                anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);
                return;
            }
            if (parent_loop_check(thing, dest)) {
                anotify_nolisten2(player,
                                  CFAIL "That would cause a parent paradox.");
                return;
            }
            /* do the link */
            if (Typeof(thing) == TYPE_THING) {
                DBFETCH(thing)->sp.thing.home = dest;
            } else
                DBFETCH(thing)->sp.player.home = dest;
            sprintf(buf, CSUCC "%s's home set to %s.",
                    NAME(thing), unparse_object(player, dest));
            anotify_nolisten2(player, buf);
            break;
        case TYPE_ROOM:        /* room dropto's */
            init_match(descr, player, dest_name, TYPE_ROOM, &md);
            match_neighbor(&md);
            match_possession(&md);
            match_registered(&md);
            match_absolute(&md);
            match_home(&md);
            match_null(&md);

            if ((dest = noisy_match_result(&md)) == NOTHING)
                break;

            if (!controls(player, thing)
                || !can_link_to(player, Typeof(thing), dest)
                || (thing == dest)) {
                anotify_fmt(player, CFAIL "%s", tp_noperm_mesg);
            } else {
                DBFETCH(thing)->sp.room.dropto = dest; /* dropto */
                sprintf(buf, CSUCC "%s's dropto set to %s.",
                        NAME(thing), unparse_object(player, dest));
                anotify_nolisten2(player, buf);
            }

            break;
        case TYPE_PROGRAM:
            anotify_nolisten2(player,
                              CFAIL "You can't link programs to things!");
            break;
        default:
            anotify_nolisten2(player, CFAIL "Weird object type.");
            log_status("*BUG: weird object: Typeof(%d) = %d\n",
                       thing, Typeof(thing));
            break;
    }
    DBDIRTY(thing);
    return;
}
Example #18
0
void 
process_command(int descr, dbref player, char *command)
{
    char   *arg1;
    char   *arg2;
    char   *full_command, *commandline=command, *commandstuff;
    char   *p;                  /* utility */
    char    pbuf[BUFFER_LEN];
    char    xbuf[BUFFER_LEN];
    char    ybuf[BUFFER_LEN];
    const char *path;
    struct frame *tmpfr;

    if (command == 0)
	abort();

    /* robustify player */
    if (player < 0 || player >= db_top ||
	    (Typeof(player) != TYPE_PLAYER && Typeof(player) != TYPE_THING)) {
	log_status("process_command: bad player %d\n", player);
	return;
    }

    if ((tp_log_commands || (tp_log_guests && Guest(OWNER(player)))) &&
	    (!(FLAGS(player)&(INTERACTIVE | READMODE)))) {
	log_command("%s%s%s%s(%d) in %s(%d):%s %s\n",
		    Mage(OWNER(player)) ? "WIZ: " : "",
		    (Typeof(player) != TYPE_PLAYER) ? NAME(player) : "",
		    (Typeof(player) != TYPE_PLAYER) ? " by " : "",
		    NAME(OWNER(player)), (int) player,
		    NAME(DBFETCH(player)->location),
		    (int) DBFETCH(player)->location,
		    (FLAGS(player) & INTERACTIVE) ?
		    " [interactive]" : " ", command);
    }

    if (FLAGS(player) & INTERACTIVE) {
	interactive(descr, player, command);
	return;
    }
    /* eat leading whitespace */
    while (*command && isspace(*command))
	command++;

    commandstuff = command;
    /* check for single-character commands */
    if (*command == SAY_TOKEN || *command == '\'') {
	sprintf(pbuf, "say %s", command + 1);
	command = &pbuf[0];
    } else if (*command == POSE_TOKEN || *command == ';') {
	sprintf(pbuf, "pose %s", command + 1);
	command = &pbuf[0];
    } else if ((*command == '|' || (*commandstuff++ == '\\' && *commandstuff == '\\') ) && can_move(descr, player, "spoof", 0)) {
      if(*command = '\\')
         sprintf(pbuf, "spoof %s", command + 2);
      else
         sprintf(pbuf, "spoof %s", command + 1);
      command = &pbuf[0];
    }

    /* if player is a wizard, and uses overide token to start line...*/
    /* ... then do NOT run actions, but run the command they specify. */
    if (!strcmp(command, WHO_COMMAND)) {
       char xxbuf[BUFFER_LEN];

       strcpy(xxbuf, "@");
       strcat(xxbuf, WHO_COMMAND);
       strcat(xxbuf, " ");
       strcat(xxbuf, command + sizeof(WHO_COMMAND) - 1);
       if (can_move(descr, player, xxbuf, 5)) {
          do_move(descr, player, xxbuf, 5);
       } else {
          pdump_who_users(descr, command + sizeof(WHO_COMMAND) - 1);
       }
       return;
    }

    if (!( *command == OVERIDE_TOKEN && TMage(player) )) {
	if( can_move(descr, player, command, 0) ) {
	    do_move(descr, player, command, 0); /* command is exact match for exit */
	    *match_args = 0;
	    *match_cmdname = 0; 
	    return;
	}
    }

	if (*command == OVERIDE_TOKEN && TMage(player))
	    command++;

	full_command = strcpy(xbuf, command);
	for (; *full_command && !isspace(*full_command); full_command++);
	if (*full_command)
	    full_command++;

	/* find arg1 -- move over command word */
	command = strcpy(ybuf, command);
	for (arg1 = command; *arg1 && !isspace(*arg1); arg1++);
	/* truncate command */
	if (*arg1)
	    *arg1++ = '\0';

	/* remember command for programs */
	strcpy(match_cmdname, command);

	/* move over spaces */
	while (*arg1 && isspace(*arg1))
	    arg1++;

	/* find end of arg1, start of arg2 */
	for (arg2 = arg1; *arg2 && *arg2 != ARG_DELIMITER; arg2++);

	/* truncate arg1 */
	for (p = arg2 - 1; p >= arg1 && isspace(*p); p--)
	    *p = '\0';

	/* go past delimiter if present */
	if (*arg2)
	    *arg2++ = '\0';
	while (*arg2 && isspace(*arg2))
	    arg2++;

	strcpy(match_cmdname, command);
	strcpy(match_args, full_command);

	switch (command[0]) {
	    case '@':
		switch (command[1]) {
		    case 'a':
		    case 'A':
			/* @action, @attach */
			switch (command[2]) {
			    case 'c':
			    case 'C':
				Matched("@action");
				do_action(descr, player, arg1, arg2);
				break;
			    case 'r':
			    case 'R':
				if (string_compare(command, "@armageddon"))
				    goto bad;
				do_armageddon(player, full_command);
				break;
			    case 't':
			    case 'T':
				Matched("@attach");
				do_attach(descr, player, arg1, arg2);
				break;
                      case 'n':
                      case 'N':
                        Matched("@ansidescribe");
                        do_ansidescribe(descr, player, arg1, arg2);
                        break;
			    default:
				goto bad;
			}
			break;
		    case 'b':
		    case 'B':
			Matched("@boot");
			do_boot(player, arg1);
			break;
		    case 'c':
		    case 'C':
			/* chown, contents, create */
			switch (command[2]) {
			    case 'h':
			    case 'H':
				switch (command[3]) {
				    case 'l':
				    case 'L':
					Matched("@chlock");
					do_chlock(descr, player, arg1, arg2);
					break;
				    case 'o':
				    case 'O':
					Matched("@chown");
					do_chown(descr, player, arg1, arg2);
					break;
				    default:
					goto bad;
				}
				break;
			    case 'o':
			    case 'O':
				switch (command[4]) {
				    case 'l':
				    case 'L':
					Matched("@conlock");
					do_conlock(descr, player, arg1, arg2);
					break;
				    case 't':
				    case 'T':
					Matched("@contents");
					do_contents(descr, player, arg1, arg2);
					break;
				    default:
					goto bad;
				}
				break;
			    case 'r':
			    case 'R':
				if (string_compare(command, "@credits")) {
				    Matched("@create");
				    do_create(player, arg1, arg2);
				} else {
				    do_credits(player);
				}
				break;
			    default:
				goto bad;
			}
			break;
		    case 'd':
		    case 'D':
			/* describe, dequeue, dig, or dump */
			switch (command[2]) {
			    case 'b':
			    case 'B':
				Matched("@dbginfo");
				do_serverdebug(descr, player, arg1, arg2);
				break;
			    case 'e':
			    case 'E':
#ifdef DELTADUMPS
				if(command[3] == 'l' || command[3] == 'L') {
				    Matched("@delta");
				    do_delta(player);
				} else
#endif
				{
                          if( (command[3] == 's' || command[3] == 'S') &&
                              (command[4] == 't' || command[4] == 'T') ) {
                            Matched("@destroy");
 				    do_recycle(descr, player, arg1);
                          } else {
				    Matched("@describe");
				    do_describe(descr, player, arg1, arg2);
                          }
				}
				break;
			    case 'i':
			    case 'I':
				Matched("@dig");
				do_dig(descr, player, arg1, arg2);
				break;
#ifdef DELTADUMPS
			    case 'l':
			    case 'L':
				Matched("@dlt");
				do_delta(player);
				break;
#endif
			    case 'o':
			    case 'O':
				Matched("@doing");
				if (!tp_who_doing) goto bad;
				do_doing(descr, player, arg1, arg2);
				break;
			    case 'r':
			    case 'R':
				Matched("@drop");
				do_drop_message(descr, player, arg1, arg2);
				break;
			    case 'u':
			    case 'U':
				Matched("@dump");
				do_dump(player, full_command);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'e':
		    case 'E':
			switch (command[2]) {
			    case 'd':
			    case 'D':
				Matched("@edit");
				do_edit(descr, player, arg1);
				break;
			    case 'n':
			    case 'N':
				Matched("@entrances");
				do_entrances(descr, player, arg1, arg2);
				break;
			    case 'x':
			    case 'X':
				Matched("@examine");
				sane_dump_object(player, arg1);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'f':
		    case 'F':
			/* fail, find, force, or frob */
			switch (command[2]) {
			    case 'a':
			    case 'A':
				Matched("@fail");
				do_fail(descr, player, arg1, arg2);
				break;
			    case 'i':
			    case 'I':
				if(command[3] == 'x' || command[3] == 'X') {
				    Matched("@fixwizbits");
				    do_fixw(player, full_command);
				} else {
				    Matched("@find");
				    do_find(player, arg1, arg2);
				}
				break;
			    case 'l':
			    case 'L':
				Matched("@flock");
				do_flock(descr, player, arg1, arg2);
				break;
			    case 'o':
			    case 'O':
				Matched("@force");
				do_force(descr, player, arg1, arg2);
				break;
			    case 'r':
			    case 'R':
				if (string_compare(command, "@frob"))
				    goto bad;
				do_frob(descr, player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'h':
		    case 'H':
                  switch (command[2]) {
                     case 'T':
                     case 't':
                        Matched("@htmldescribe");
                        do_htmldescribe(descr, player, arg1, arg2);
                        break;
                     default:
 			      Matched("@hopper");
			      do_hopper(player, arg1);
                        break;
                  }
			break;
		    case 'i':
		    case 'I':
                  switch(command[2]) {
                     case 'h':
                     case 'H':
   	   		      Matched("@ihtmldescribe");
			      do_ihtmldescribe(descr, player, arg1, arg2);
			      break;
                     case 'a':
                     case 'A':
                        Matched("@iansidescribe");
                        do_iansidescribe(descr, player, arg1, arg2);
                        break;
                     default:
   			      Matched("@idescribe");
			      do_idescribe(descr, player, arg1, arg2);
			      break;
                  }
                  break;
		    case 'k':
		    case 'K':
			Matched("@kill");
			do_dequeue(descr, player, arg1);
			break;
		    case 'l':
		    case 'L':
			/* lock or link */
			switch (command[2]) {
			    case 'i':
			    case 'I':
				switch (command[3]) {
				    case 'n':
				    case 'N':
					Matched("@link");
					do_link(descr, player, arg1, arg2);
					break;
				    case 's':
				    case 'S':
					Matched("@list");
					match_and_list(descr, player, arg1, arg2, 1);
					break;
				    default:
					goto bad;
				}
				break;
			    case 'o':
			    case 'O':
				Matched("@lock");
				do_lock(descr, player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'm':
		    case 'M':
			switch (command[2]) {
			    case 'e':
			    case 'E':
				Matched("@memory");
				do_memory(player);
				break;
			    case 'c':
			    case 'C':
				switch (command[4]) {
				   case '2':
				     Matched("@mcp2muf");
				     match_and_list(descr, player, arg1, arg2, 0);
				     break;
				   default:
				     Matched("@mcp");
				     do_prog(descr, player, arg1, 1);
				     break;
				}
                     default:
                        goto bad;
			}
			break;
		    case 'n':
		    case 'N':
			/* @name or @newpassword */
			switch (command[2]) {
			    case 'a':
			    case 'A':
				Matched("@name");
				do_name(descr, player, arg1, arg2);
				break;
			    case 'e':
			    case 'E':
				if (string_compare(command, "@newpassword"))
				    goto bad;
				do_newpassword(player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'o':
		    case 'O':
			switch (command[2]) {
			    case 'd':
			    case 'D':
				Matched("@odrop");
				do_odrop(descr, player, arg1, arg2);
				break;
			    case 'e':
			    case 'E':
				Matched("@oecho");
				do_oecho(descr, player, arg1, arg2);
				break;
			    case 'f':
			    case 'F':
				Matched("@ofail");
				do_ofail(descr, player, arg1, arg2);
				break;
			    case 'p':
			    case 'P':
				Matched("@open");
				do_open(descr, player, arg1, arg2);
				break;
			    case 's':
			    case 'S':
				Matched("@osuccess");
				do_osuccess(descr, player, arg1, arg2);
				break;
			    case 'w':
			    case 'W':
				Matched("@owned");
				do_owned(player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'p':
		    case 'P':
			switch (command[2]) {
			    case 'a':
			    case 'A':
				Matched("@password");
				do_password(player, arg1, arg2);
				break;
			    case 'c':
			    case 'C':
				Matched("@pcreate");
				do_pcreate(player, arg1, arg2);
				break;
			    case 'e':
			    case 'E':
				Matched("@pecho");
				do_pecho(descr, player, arg1, arg2);
				break;
			    case 'r':
			    case 'R':
				if (string_prefix("@program", command)) {
				    do_prog(descr, player, arg1, 0);
				    break;
				} else if (string_prefix("@proginfo", command)) {
				    do_proginfo(player, arg1);
				    break;
				} else {
				    Matched("@propset");
				    do_propset(descr, player, arg1, arg2);
				    break;
				}
			    case 's':
			    case 'S':
				Matched("@ps");
				list_events(player);
				break;
			    case 'u':
			    case 'U':
				Matched("@purge");
				do_purge(descr, player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'r':
		    case 'R':
			switch (command[3]) {
			    case 'c':
			    case 'C':
				Matched("@recycle");
				do_recycle(descr, player, arg1);
				break;
			    case 's':
			    case 'S':
				if (!string_compare(command, "@restart")) {
				    do_restart(player, full_command);
				} else if (!string_compare(command, "@restrict")) {
				    do_restrict(player, arg1);
				} else {
				    goto bad;
				}
				break;
			    default:
				goto bad;
			}
			break;
		    case 's':
		    case 'S':
			/* set, shutdown, success */
			switch (command[2]) {
			    case 'a':
			    case 'A':
				if (!string_compare(command, "@sanity")) {
				    sanity(player);
				} else if (!string_compare(command, "@sanchange")) {
				    sanechange(player, full_command);
				} else if (!string_compare(command, "@sanfix")) {
				    sanfix(player);
				} else {
				    goto bad;
				}
				break;
			    case 'e':
			    case 'E':
				Matched("@set");
				do_set(descr, player, arg1, arg2);
				break;
			    case 'h':
			    case 'H':
				if (!string_compare(command, "@shout")) {
				    do_wall(player, full_command);
				    break;
				}
				if (string_compare(command, "@shutdown"))
				    goto bad;
				do_shutdown(player, arg1);
				break;
			    case 't':
			    case 'T':
				Matched("@stats");
				do_stats(player, arg1);
				break;
			    case 'u':
			    case 'U':
				Matched("@success");
				do_success(descr, player, arg1, arg2);
				break;
			    case 'w':
			    case 'W':
				Matched("@sweep");
				do_sweep(descr, player, arg1);
				break;
			    default:
				goto bad;
			}
			break;
		    case 't':
		    case 'T':
			switch (command[2]) {
			    case 'e':
			    case 'E':
				Matched("@teleport");
				do_teleport(descr, player, arg1, arg2);
				break;
                      case 'o':
                      case 'O':
				if (string_compare(command, "@toad"))
				    goto bad;
				do_frob(descr, player, arg1, arg2);
				break;
			    case 'r':
			    case 'R':
				Matched("@trace");
				do_trace(descr, player, arg1, atoi(arg2));
				break;
			    case 'u':
			    case 'U':
				Matched("@tune");
				do_tune(player, arg1, arg2);
				break;
			    default:
				goto bad;
			}
			break;
		    case 'u':
		    case 'U':
			switch (command[2]) {
			    case 'N':
			    case 'n':
				if (string_prefix(command, "@unlink")) {
				    do_unlink(descr, player, arg1);
				} else if (string_prefix(command, "@unlock")) {
				    do_unlock(descr, player, arg1);
				} else if (string_prefix(command, "@uncompile")) {
				    do_uncompile(player);
				} else {
				    goto bad;
				}
				break;

#ifndef NO_USAGE_COMMAND
			    case 'S':
			    case 's':
				Matched("@usage");
				do_usage(player);
				break;
#endif

			    default:
				goto bad;
				break;
			}
			break;
		    case 'v':
		    case 'V':
			Matched("@version");
			anotify_nolisten2(player, CRIMSON "ProtoMUCK " PROTOBASE PURPLE " (" RED VERSION WHITE " -- " AQUA NEONVER PURPLE ")" );
			break;
		    case 'w':
		    case 'W':
			if (string_compare(command, "@wall"))
			    goto bad;
			do_wall(player, full_command);
			break;
		    default:
			goto bad;
		}
		break;
          case '&':
            do_mush_set(descr, player, arg1, arg2, command);
            break;
	    case 'd':
	    case 'D':
		switch (command[1]) {
		    case 'b':
		    case 'B':
			Matched("dboot");
			do_dboot(player, arg1);
			break;
		    case 'i':
		    case 'I':
			Matched("dinfo");
			do_dinfo(player, arg1);
			break;
		    case 'r':
		    case 'R':
			Matched("drop");
			do_drop(descr, player, arg1, arg2);
			break;
		    case 'w':
		    case 'W':
			Matched("dwall");
			do_dwall(player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    case 'e':
	    case 'E':
		switch (command[1]) {
		    case 'm':
		    case 'M':
			Matched("emote");
			do_pose(descr, player, full_command);
			break;
		    case 'x':
		    case 'X':
		    case '\0':
			Matched("examine");
			do_examine(descr, player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    case 'g':
	    case 'G':
		/* get, give, go, or gripe */
		switch (command[1]) {
		    case 'e':
		    case 'E':
			Matched("get");
			do_get(descr, player, arg1, arg2);
			break;
		    case 'i':
		    case 'I':
			Matched("give");
			do_give(descr, player, arg1, atoi(arg2));
			break;
		    case 'o':
		    case 'O':
			Matched("goto");
			do_move(descr, player, arg1, 0);
			break;
		    case 'r':
		    case 'R':
			if(command[2]=='i' || command[2]=='I') {
				if (string_compare(command, "gripe"))
				    goto bad;
				do_gripe(player, full_command);
				break;
			}
		    default:
			goto bad;
		}
		break;
	    case 'h':
	    case 'H':
		switch (command[1]) {
		    case 'a':
		    case 'A':
			Matched("hand");
			do_drop(descr, player, arg1, arg2);
			break;
		    case 'e':
		    case 'E':
			Matched("help");
			do_help(player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    case 'i':
	    case 'I':
		if (string_compare(command, "info")) {
		    Matched("inventory");
		    do_inventory(player);
		} else {
		    do_info(player, arg1, arg2);
		}
		break;
	    case 'l':
	    case 'L':
		if (string_prefix("look", command)) {
		    do_look_at(descr, player, arg1, arg2);
		    break;
		} else {
		    Matched("leave");
		    do_leave(descr, player);
		    break;
		}
	    case 'm':
	    case 'M':
		if (string_prefix(command, "move")) {
		    do_move(descr, player, arg1, 0);
		    break;
		} else if (!string_compare(command, "motd")) {
		    do_motd(player, full_command);
		    break;
		} else if (!string_compare(command, "mpi")) {
		    do_mpihelp(player, arg1, arg2);
		    break;
		} else {
		    if (string_compare(command, "man"))
			goto bad;
		    do_man(player, arg1, arg2);
		}
		break;
	    case 'n':
	    case 'N':
		/* news */
		Matched("news");
		do_news(player, arg1, arg2);
		break;
	    case 'p':
	    case 'P':
		switch (command[1]) {
		    case 'a':
		    case 'A':
		    case '\0':
			Matched("page");
			do_page(descr, player, arg1, arg2);
			break;
		    case 'o':
		    case 'O':
			Matched("pose");
			do_pose(descr, player, full_command);
			break;
		    case 'u':
		    case 'U':
			Matched("put");
			do_drop(descr, player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    case 'r':
	    case 'R':
		switch (command[1]) {
		    case 'e':
		    case 'E':
			if(command[2] == 'q' || command[2] == 'Q'){
			    Matched("request");
			    request(player, NULL, commandline);
			} else {
			    Matched("read");    /* undocumented alias for look */
			    do_look_at(descr, player, arg1, arg2);
			}
			break;
		    default:
			goto bad;
		}
		break;
	    case 's':
	    case 'S':
		/* say, "score" */
		switch (command[1]) {
		    case 'a':
		    case 'A':
			Matched("say");
			do_say(descr, player, full_command);
			break;
		    case 'c':
		    case 'C':
		    case '\0':
			if( command[1] &&
			    (command[2] == 'a' || command[2] == 'A' )) {
			    Matched("scan");
			    do_sweep(descr, player, arg1);
			} else {
			    Matched("score");
			    do_score(player, 1);
			}
			break;
		    default:
			goto bad;
		}
		break;
	    case 't':
	    case 'T':
		switch (command[1]) {
		    case 'a':
		    case 'A':
			Matched("take");
			do_get(descr, player, arg1, arg2);
			break;
		    case 'h':
		    case 'H':
			Matched("throw");
			do_drop(descr, player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    case 'w':
	    case 'W':
		switch (command[1]){
		    case 'c':
		    case 'C':
			Matched("wc");
			do_wizchat(player, full_command);
			break;
		    case 'i':
		    case 'I':
			Matched("wizchat");
			do_wizchat(player, arg1);
			break;
		    case 'h':
		    case 'H':
		    case '\0':
			Matched("whisper");
			do_whisper(descr, player, arg1, arg2);
			break;
		    default:
			goto bad;
		}
		break;
	    default:
	bad:
 		if ( Typeof(tp_huh_command) == TYPE_PROGRAM && !(player == -1)) {
			tmpfr = interp(descr, player, DBFETCH(player)->location, tp_huh_command, (dbref)-4, FOREGROUND, STD_REGUID);
			if (!tmpfr)
				goto bad2;
			(void) interp_loop(player, tp_huh_command, tmpfr, 0);
            } else {
   		   bad2:
                  anotify_fmt(player, CINFO "%s",tp_huh_mesg);
			if (tp_log_failed_commands && !controls(player, DBFETCH(player)->location)) {
		    		log_status("HUH from %s(%d) in %s(%d)[%s]: %s %s\n", NAME(player), player,
                        NAME(DBFETCH(player)->location),
			      DBFETCH(player)->location,
			      NAME(OWNER(DBFETCH(player)->location)), command,
			      full_command);
			}
		}
		break;
	}

}